All pages

API reference

Make a test call to an agent

POST /v1/test/inbound-calls

View as Markdown

With a test key only: somebody calls one of your inbound agents from a test number. The agent's test lookup address is asked — or its sample answer used, with no request — and the answer says what the lookup made of it and the greeting it produced. The conversation then plays out like any test call: events to your test receivers, nothing real rung, nothing charged.

Body

Sent as JSON. A field this operation does not take is refused, so a typo fails loudly.

Field Type Required Description
agent_id string (uuid) or null No The inbound agent the call reaches. Or send phone_number_id.
from_number string Yes The test number the call comes from, like +12025550100.
phone_number_id string (uuid) or null No One of your numbers; the call reaches the agent it rings.

Answer

201 with TestInboundCall.

Errors

Every error is a problem document with a stable code.

Status When
401 The key is missing, mistyped, unknown, revoked or expired.
403 Only a test key makes test calls.
404 This key reaches no such agent or number.
409 The agent answers no calls, or its project is frozen.
422 from_number is not a test number, or the request does not fit.
429 Too many requests for this key or its organization; see Retry-After.
500 Something went wrong on our side. Quote the request_id to support.

Examples

Make a test call to an agent
#!/bin/sh
# Make a test call to an agent. Test keys only. It asks the agent's test lookup and plays a scripted call.
curl -sS --fail-with-body -X POST "https://api.aigently.ai/v1/test/inbound-calls" \
  -H "Authorization: Bearer $AIGENTLY_API_KEY" \
  --json '{
  "agent_id": "3c7d9e1f-5a2b-4c6d-8e0f-1a3b5c7d9e2f",
  "from_number": "+12025550100"
}'

Try it

Sends this request to the API from your browser, with a test key. Nothing it does rings a phone.