Skip to main content
POST
Test an agent by phone
Ring your own phone with an agent, with calls:create, to hear it the way a caller will. You send only the number to ring; Yappr picks the number that calls:
  • Your workspace’s own number, when it has one: a number the agent calls from first (including as the other half of an outbound split), then the from-number of a campaign it runs, then a number it answers on, then any other active number in the workspace. At each step a Yappr-hosted number comes before one on your own Telnyx account.
  • A Yappr test line, when the workspace has no number yet. It places calls only and never answers one, so nobody can call your agent through it.
A key limited to agents calls only from a number one of its agents answers or calls from, as on POST /calls: any other number is another client’s caller ID. With none, the Yappr test line calls. GET /agents/{id}/test-call tells you which one it will be, without placing anything.

What it costs

A test call is an ordinary outbound phone call for your workspace. It is billed per minute at the phone rate of the agent’s model, from your credit, whichever line it comes from. It appears in your call logs and on GET /calls with source: "test".

What is checked

The same things every outbound call is checked for: a number that can be dialled, your Do-Not-Call list, your outbound call window, your monthly spending limit and the $1.00 credit floor, and capacity. There is no limit on how many test calls you place. Two answers differ from POST /calls, because someone is waiting on the phone: outside your call window the test is refused (422 OUTSIDE_CALL_WINDOW) instead of being scheduled for the next opening, and when every line is busy it is refused (503 AT_CAPACITY) instead of being queued.

The answer

For an agent that does not run a workflow the call is placed at once:
A workflow agent’s call is a phone call request, answered 202 with request_id set and call_id null. The workflow prepares and dials it within seconds: poll GET /call-requests/{id} until call_id is set, then read the call with GET /calls/{id}. Send an Idempotency-Key header to make a retry return the same request instead of ringing again. caller_line is workspace when one of your numbers called and yappr when a Yappr test line did.

Errors

Authorizations

Authorization
string
header
required

Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).

Headers

Idempotency-Key
string

Workflow agents only. Replaying the same key returns the same call request instead of ringing again.

Path Parameters

id
string<uuid>
required

Body

application/json
to
string
required

The phone to ring, in E.164 format (e.g. +972501234567). The number that calls is chosen for you; there is no from.

variables
object

Values for the agent's template variables, as on POST /calls.

Response

The call was placed (an agent that does not run a workflow).

status
string
required

ringing, queued or scheduled.

agent_id
string<uuid>
required
to
string
required
from
string
required

The number that calls.

caller_line
enum<string>
required
Available options:
workspace,
yappr
id
string<uuid>

The call's id (agents that do not run a workflow).

call_id
string<uuid> | null

The call's id; null on a workflow agent's request until the call is placed.

request_id
string<uuid> | null

A workflow agent's call request; follow it with GET /call-requests/{id}.