What you will accomplish

Create a scoped API key, call the supported public API, and handle errors without exposing secrets.

Before you begin

  • You need an AyuChat workspace.
  • Your role must allow API key management.
  • Use server-side code. Never place an AyuChat API key in browser JavaScript, mobile app bundles, or public repositories.

Step 1 - Create an API key

AyuChat Developer Hub showing API key and webhook management areas without exposing any secret value.
Create scoped API keys from Developer Hub and store secrets server-side only.
  1. Open Developer Hub.
  2. Open Project API Keys.
  3. Generate a key with only the scopes your integration needs.
  4. Copy it immediately and store it in a server-side secret manager or environment variable.

Step 2 - Use the base URL

https://api.ayuchat.in/api

Step 3 - Make your first request

curl -s https://api.ayuchat.in/api/public/contacts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Step 4 - Create a contact

curl -s -X POST https://api.ayuchat.in/api/public/contacts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"name":"Demo Contact","phone":"+919999999999","email":"demo@example.com","source":"crm"}'

Step 5 - Understand responses

Successful list endpoints return a JSON envelope with success and paginated data. Create contact returns HTTP 201. Send-template returns HTTP 202 with a queued message id.

Error handling

StatusMeaningFix
401Invalid, revoked, expired, or missing API key.Check the key and environment.
403API key lacks the required scope.Create or update a key with the required scope.
404Workspace resource not found or not accessible.Verify the id belongs to the API key workspace.
422Validation failed or contact opted out.Fix request fields or respect opt-out state.

Next step

Read the API reference and outbound webhook guide before moving from a local integration to production traffic.