What you’ll build
By the end of this guide you’ll have:- Authenticated against the PolyAI API
- Listed conversations from the last 24 hours
- Fetched a single conversation with its full turn-by-turn transcript
- Downloaded the audio recording for that call
- Registered a webhook endpoint so PolyAI pushes new conversations to you in real time
Prerequisites
Get an API key
PolyAI provisions API keys — they aren’t self-serve yet for runtime APIs.
- Ask your PolyAI representative for a v3 Conversations API key scoped to the project and region you want to query.
- The same key works for the Data API, Handoff, Chat, and other runtime APIs on the
platform.polyai.apphost. - For the Agents API, Alerts, and Webhooks, email developers@poly.ai for a separate workspace-scoped key.
Find your account ID and project ID
Open Agent Studio. Your IDs are the first two segments of the URL after the host:For example,
https://studio.uk.poly.ai/acme-uk/acme-team-4/agent gives account_id=acme-uk and project_id=acme-team-4. Both the slug form and the prefixed form (ws-xxxxxxxx, PROJECT-xxxxxxxx) are valid in API paths. The account_id workspace prefix is ws-, not ACCOUNT-.Pick the right base URL
Runtime and data APIs live on regional hosts under
platform.polyai.app. Match the region your project is provisioned in:| Region | Base URL |
|---|---|
| US | https://api.us-1.platform.polyai.app |
| UK | https://api.uk-1.platform.polyai.app |
| EUW | https://api.euw-1.platform.polyai.app |
Step 1: Make your first call
A quick smoke test confirms the key, IDs, region, and network path all line up. List a single conversation from the last 24 hours:conversations array and a cursor field. If you get 401, the key is wrong or missing. If you get 404, the region host or IDs are wrong. See troubleshooting below.
Step 2: Page through a full day of calls
The smoke test usedlimit=1. For real workloads, use a larger limit and walk pages with the opaque cursor field. Cursors stay stable as new conversations arrive, so the iteration is safe to run during business hours.
Step 3: Fetch one conversation with its transcript
The list response includes per-conversation summaries plus theturns array — but if you want a single conversation in detail, hit the by-ID endpoint:
Step 4: Download the audio recording
Voice calls have an audio recording, fetched via a separate endpoint. The response is a binary stream — write it to disk or pipe it to your storage.VOICE-SIP). Chat conversations (WEBCHAT, CHAT) return 404 on this endpoint — filter on channel before calling.
Step 5: Stop polling, subscribe to webhooks
Polling the list endpoint every few minutes works, but it wastes requests and adds lag. PolyAI can push a JSON payload to a URL of yours every time a call ends, an alert fires, or a handoff happens. Set it up once and your pipeline becomes event-driven. The Webhooks API lives on thepoly.ai host family — base URL changes:
Register an endpoint
signing_secret securely — you’ll need it to verify every incoming request.
Verify the signature
PolyAI signs each delivery with HMAC-SHA256 in theX-PolyAI-Signature header. Reject any request whose signature doesn’t match.
Python
Step 6: Promote from sandbox to live
You probably built and tested against your sandbox environment. To run against production traffic, change one parameter:data.environment == "live" in your handler, or register separate endpoints per environment.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
401 Unauthorized | Missing or wrong x-api-key header, or key revoked. | Check the env var is set; ask PolyAI to confirm the key is active. |
403 Forbidden | Key is valid but lacks permission for this project or scope. | Confirm the key was provisioned for the project ID in the URL. |
404 Not Found on conversations endpoint | Wrong base URL (most often api.us.poly.ai instead of api.us-1.platform.polyai.app). | Use the platform.polyai.app host with the regional -1 suffix for runtime/data APIs. |
404 Not Found on webhooks endpoint | You hit the runtime host. Webhooks live on api.{region}.poly.ai. | Use api.us.poly.ai (no -1) for Agents, Alerts, Webhooks. |
Empty conversations array | Time window has no calls, or wrong client_env (live vs. sandbox). | Place a test call, widen the time window, or set client_env=sandbox. |
turns is empty but num_turns > 0 | Transcript visibility is off at the project level. | Enable Conversation transcript under API Keys > Configuration in Agent Studio. |
429 Too Many Requests | You hit the rate limit. | Back off using the Retry-After header; switch from offset to cursor pagination for large pulls. |
| Webhook handler never fires | Endpoint not yet active, or signature verification rejecting valid requests. | Hit your handler URL directly; log the request body and computed signature; confirm the secret matches what you saved. |
Where to go next
API overview
The three API families, base URLs, and version policy.
Conversations API reference
Full schema, retrieval modes, pagination, and streaming.
Agents API
Build and deploy agents programmatically.
Webhooks API
Event types, retries, and signature verification in depth.

