Skip to main content
POST
Create web call request
Requires calls:create. Creates a browser call on a workflow agent (with or without steps before it answers or follow-ups after the call), and hands back the one capability the browser needs to follow it and start it. Nothing is dialled here. No call record is created, no line is held and no minutes are charged: the caller’s browser starts the call itself, once the steps are done. That is the whole reason this endpoint exists — a browser call used to be one request that took a line and created a peer in the same breath, which left before-call steps nowhere to run.

Which agents need this

Ask the mint. POST /calls with type: "web" answers with protocol: @goyappr/client does this for you — pass session.protocol through to startSession. An older client that sends a one-shot offer to an agent the mint answered call_request for is refused with 409 workflow_preparation_required, and the refusal costs nothing: the token is not spent and no line is taken, so the same token can create the request instead.

The capability

start_capability is returned once and stored only as a hash. It authorises this one request’s read, cancel and start, and nothing else — not another request, not a phone request, not anything about the workspace — so it is safe to hand to a browser. Send it as x-yappr-call-request-key. It dies with the request at expires_at. That is why the three URLs are browser routes on the API host (/web-call/call-requests/…) that take the capability instead of your key: your secret key never has to reach a browser.

Asking again with the same key

Send an Idempotency-Key and a retry is safe: the same key with the same body does not create a second request. It answers 200 with the request as it is now — a request whose steps already failed reads failed with its error_code, not preparing — with replayed: true, the three URLs, and no start_capability. The capability that works was returned once, by the first create, and is stored only as a hash, so keep it from that answer. The same key with a different body is 409 WORKFLOW_IDEMPOTENCY_CONFLICT. A browser that presents a Web SDK session token again gets the same answer: the token is the create’s key. That holds until the token runs out — even in its last five minutes, when a token that has not created a request yet is refused with 409 SESSION_TOKEN_EXPIRES_TOO_SOON.

Following it

Poll status_url until status is ready, then start it. The read carries preparation_steps — one entry per authored before-call step, in document order, each with the author’s own label — so a waiting caller can be shown what is running rather than a silent spinner, and your server’s GET /call-requests/{id} carries the same array, with the failed step’s error_code and http_status. Step results are never included: a before-call result is data the agent is given, not something a browser may read.
cancel_url stops a request that has not been started. A browser call holds no line while it prepares, but the steps are work this workspace paid for, so cancelling when the caller changes their mind is worth doing rather than letting it expire.

Statuses

The same states a phone request has, and they mean the same things. See Get Call Request. The one difference is what dispatching means here: a browser request reaches it when the caller claims their start and the peer is being negotiated, rather than when a number is being dialled. It reads dispatched as soon as the voice server has answered the browser, and stays dispatched after the call ends; how the call went is on GET /calls/{id} under call_id. The call’s end reaches its workflow like a phone call’s, so follow-ups on any_end or call.ended run on a browser call too.

Refusals

Being switched off is reported before being unpublished, because switching it on is the step you are missing: publishing an agent nobody can call would not make the call happen.

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

Visible ASCII, space excluded. The same key with the same body answers 200 with the request as it is now and no start_capability (see the 200 response); with a different body it is a conflict.

Maximum string length: 200

Body

application/json
type
enum<string>
required

A phone call is created with POST /calls.

Available options:
web
agent_id
string<uuid>
required
variables
object

Values the workflow's request schema declares. Rendered into the prompt and readable by before-call steps.

metadata
object

Stored on the call record and echoed to tools. Reserved platform key names are refused.

workflow_revision_id
string<uuid>

Pin a published version of this agent's workflow instead of following the current one.

Response

This Idempotency-Key already created a request (with the same body). The request as it is now - the CallRequest fields, request_id, type, agent_id, accepted_at, the three URLs and replayed: true - and no start_capability: the one that works was returned once, by the first create, and is stored only as a hash. A request that already failed reads failed with its error_code here, not preparing.

Lifecycle record for one accepted call on a workflow agent. An outbound phone call returns its identity as request_id from POST /calls; a browser call is created directly with POST /call-requests. Either way this object is what you poll and what you cancel, and the two follow the same states.

id
string<uuid>
required
run_id
string<uuid>
required

Shared lifecycle identity. It does not grant access to call history.

channel
enum<string>
required

phone is dialled by the platform once it is ready. web is started by the caller's own browser with POST /call-requests/{id}/start, because the microphone is there and not here.

Available options:
phone,
web
status
enum<string>
required

scheduled waits for the workspace's next calling window; preparing and ready cover pre-call work; dispatching and dispatched mean the call is being placed or has been placed; dispatch_unknown means placement is still being confirmed and must not be retried blindly; failed, expired and cancelled are final.

Available options:
preparing,
scheduled,
ready,
dispatching,
dispatched,
failed,
expired,
cancelled,
dispatch_unknown
preparation_status
enum<string>
required

Progress of the pre-call step only. A preparation that fails or runs out of time does not always fail the request - an agent configured to continue with whatever is available still calls, with whatever the preparation produced. declined is a decision rather than a failure - a before-call step refused the call, so nothing is dialled, no call record is created, and the failure policy does not apply.

Available options:
pending,
running,
ready,
failed,
expired,
cancelled,
declined
expires_at
string<date-time>
required

After this moment a request that has not finished is abandoned and no call is placed. A request that already failed keeps status failed and its error_code.

request_id
string<uuid>
required
replayed
enum<boolean>
required
Available options:
true
status_url
string<uri>
required
cancel_url
string<uri>
required
start_url
string<uri>
required
agent_id
string<uuid>

The agent the request was made for. On GET /call-requests/{id}, the browser's poll and a replayed create.

preparation_steps
object[]

On GET /call-requests/{id} (either channel) and the browser's poll. One entry per before-call step the workflow declares, in document order, whatever ran - so a waiting caller can be shown what is running, and a server can see which step failed and what its tool answered. Empty only between accepting the request and freezing the workflow version it runs. Step results are never included.

workflow_revision_id
string<uuid> | null

The published version of the agent frozen for this request.

call_id
string<uuid> | null

Set once a call record exists. Pass it to the call-by-id endpoint.

error_code
string | null

Present only when status is failed or expired. An expired request is always request_expired. On a failed one the preparation's own code wins wherever it recorded one - step_failed when a before-call step failed and its failure setting stops the call (preparation_steps names the step and what its tool answered), before_declined for a refusal, preparation_interrupted when the platform could not finish running the steps (a fault on its side, never a tool's answer; no step is sent twice - create a new request), preparation_unavailable when the steps could not be run at all, promotion_stalled when the agent's latest settings were still not ready 30 s after the request was due (retry shortly) - and where it recorded nothing the value is before_declined for a refusal and request_failed for anything else.

execution
object

Execution history — how the platform carried the call out, beside the conversation itself. Returned on GET /calls/{id} and GET /call-requests/{id} when execution history is enabled for the workspace; absent otherwise. Ask for a page of it with the execution_limit and execution_cursor query parameters.

This is an investigation view, not an authority: it is read-only, it is retained for a limited window, and it never carries the platform's own plumbing.

The members below are the whole of this block. They are written down because the API projects onto exactly this list before the response is written: anything else the platform knows about a call — delivery row ids, internal job and journal counts, storage-retention flags, internal hostnames, its own diagnostic notes — is dropped rather than published, and every URL here is rewritten onto the public API base whatever the platform recorded. A field you do not see below will not appear, and a field you do see will not change shape.

type
enum<string>
Available options:
web
accepted_at
string<date-time> | null