Endpoint
The External Events API is exposed as a single POST webhook endpoint:POST https://api.{region}.platform.polyai.app/v1/external-events/webhook
Region can be:
us-1uk-1euw-1
Identifying the event
To bind an incoming payload to the correct conversation, PolyAI needs to know where in the request the external event identifier lives. You configure this per request using two query parameters:-
event_id_locationWhere the external event ID is found. One of:headersquerystringpayload
-
event_id_pathThe name or dotted path to the external event ID within that location.
Examples:cidpath.to.object.property
account_id: your PolyAI account IDproject_id: your PolyAI project ID
Payload formats
The webhook accepts multiple content types:application/jsonArbitrary JSON with the event ID somewhere in the structure.application/x-www-form-urlencodedStandard form-encoded key–value pairs.application/xmlXML payload containing the event ID and other fields.text/plainRaw text payloads (for example, simple key=value strings).
Authentication
The External Events API uses a dedicated API key:- sent in the
X-Api-Keyheader - scoped specifically for external events
X-Api-Key: YOUR_EXTERNAL_EVENTS_API_KEY
Typical flow
- The PolyAI agent initiates an external workflow (for example, payment, booking, or verification) and generates an external event ID.
- Your system or third-party provider completes its task and sends a POST request to the webhook:
- targeting the correct regional base URL
- including
event_id_location,event_id_path,account_id, andproject_idas query parameters - including the external event ID somewhere in the request, at the agreed location and path
- passing the full result payload in the body
- PolyAI:
- authenticates the request using X-Api-Key
- extracts the external event ID
- binds the payload to the right conversation
- updates the agent’s state so the conversation can continue or complete
Responses and error handling
On success:- 201 Accepted
The event has been received and queued for processing.
- 400 Malformed request
For example, the external event ID cannot be found or is invalid. - 401 Unauthorized
Missing or invalid API key. - 500 Internal Server Error
A transient error occurred while processing the event.
error_message field explaining the reason, which you can log or surface in your monitoring.
