Authentication and conventions
API keys, read/write scopes, request and response formats, pagination, errors and retries.
#API keys
Send your key on every request as a bearer token:
Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxCreate and revoke keys under Settings > API Keys in the app. A key is shown once, when you create it; only its first characters (the prefix) are shown afterwards. Treat it like a password: use it from your servers, never from a browser or mobile app, and revoke it if it leaks. Only organization admins can create keys.
Keys cannot create other keys.
#Scopes
Each key is limited to the areas, and the access level within each area, chosen when it was
created. A scope is <area>:read or <area>:write. Write includes read.
| Area | Scope prefix |
|---|---|
whatsapp | |
| Voice calls | voice |
| Agents and knowledge | agents |
| Analytics | analytics |
| Contact memory | memory |
| Billing | billing |
A bare scope with no suffix (for example whatsapp) grants both read and write for that
area. Keys created before read and write existed carry the bare scope and keep working.
Which level a call needs depends on its name:
- Calls whose name starts with
Get,List,Search,Count,ExportorDownloadonly read, and need:read(or:write). - Every other call needs
:write. This includes calls that read but spend credits or AI quota, such as sending a message or chatting with an agent.
A call outside the key's scopes is rejected with 403. Each endpoint in the
reference shows the level it needs.
#Requests and responses
- REST + JSON. Paths look like
/voice/v1/calls/{callId}. Bodies are JSON; sendContent-Type: application/json. - Field names are camelCase in JSON (
pageSize,agentId). - 64-bit integers are strings in JSON responses (
"millicredits": "125000"), so they never lose precision. - Times are RFC 3339 in UTC (
2026-11-19T09:30:00Z). - Phone numbers are E.164 (
+919876543210). Separators such as spaces, dashes and parentheses are accepted and stripped. - Unset fields are omitted or empty; send only what you want to set.
- Also callable as Connect/gRPC. Every service is available at
https://api.pingx.ai/pingx.<area>.v1.<Service>/<Method>over Connect, gRPC and gRPC-Web, with the same key. - Request bodies are limited to 32 MiB.
#Pagination
List calls take pageSize (usually default 50, maximum 200) and pageToken, and return
nextPageToken. Pass the returned token unchanged to get the next page; an empty
nextPageToken means you have the last page.
curl "https://api.pingx.ai/voice/v1/calls?pageSize=100" \
-H "Authorization: Bearer $PINGX_API_KEY"
curl "https://api.pingx.ai/voice/v1/calls?pageSize=100&pageToken=TOKEN_FROM_PREVIOUS" \
-H "Authorization: Bearer $PINGX_API_KEY"Tokens are opaque and tied to the query that produced them. A few lists return everything in
one response; their reference entry has no pageToken.
#Errors
Errors return a non-2xx HTTP status and a JSON body:
{ "code": 5, "message": "agent not found", "details": [] }| HTTP | Meaning | Typical cause |
|---|---|---|
| 400 | Invalid argument, or the resource is in the wrong state | Missing or malformed field; an action that is not allowed right now |
| 401 | Unauthenticated | Missing, malformed, revoked or unknown key |
| 403 | Permission denied | The key does not carry the scope the call needs |
| 404 | Not found | Unknown id, or an id that belongs to another organization |
| 409 | Conflict or aborted | A concurrent edit; reload and retry |
| 503 | Unavailable | A backend is briefly unavailable; safe to retry |
| 500 | Internal error | Retry; contact support if it persists |
Calls that move money or messages (sending, campaigns, placing calls) are charged to your organization's balance exactly as they are in the app. A refused charge (for example insufficient credits) is reported on the call or message itself; see the area's guide.
#Retrying safely
Reads are always safe to retry. For writes, prefer the idempotent forms the guides point out (adding a label that is already there, or removing one that is not, does nothing). Creating a resource twice creates two resources.