> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goyappr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Start Web Call Request

> Requires calls:create, plus the request's own `start_capability` in the x-yappr-call-request-key header. Sends a fresh SDP offer for a request that has reached `ready`, takes a line, and returns the answer the browser completes the connection with.

A start is one offer. Sending the same offer again returns the same peer, so a lost response is recovered rather than turned into a second call; sending a different one is refused, because the request has already spent its start. A `503` here is refused before anything is claimed, so the preparation is still worth starting - poll and try again.


Requires `calls:create` **and** the request's own `start_capability` in the
`x-yappr-call-request-key` header. Sends a fresh SDP offer for a request that has
reached `ready`, takes a line, and returns the answer the browser completes the
connection with.

```bash theme={null}
curl -X POST "https://api.goyappr.com/web-call/call-requests/REQUEST_ID/start" \
  -H "x-yappr-call-request-key: START_CAPABILITY" \
  -H "Content-Type: application/json" \
  -d '{ "sdp": "v=0…", "type": "offer" }'
```

```json theme={null}
{
  "sdp": "v=0…",
  "type": "answer",
  "pc_id": "…",
  "ice_candidate_url": "https://voice.goyappr.com/api/web-call/offer",
  "call_id": "7c4d…",
  "request_id": "9f1c…",
  "replayed": false
}
```

## Send a fresh offer

Build the peer connection **now**, not before the steps ran. Preparation can take
seconds, and candidates gathered before someone else's calendar lookup are stale
by the time it finishes.

## A start is one offer

Sending the **same** offer again returns the same peer, with `replayed: true` —
so a lost response is recovered rather than turned into a second call. Sending a
**different** one is `409 WORKFLOW_START_ALREADY_CLAIMED`: this request has spent
its start, and a second call means creating a second request.

## What each refusal means

| Status | Code | What to do |
| - | - | - |
| `401` | `CALL_REQUEST_KEY_REQUIRED` | No capability was sent. Send the `start_capability` the create answered with as `x-yappr-call-request-key`. |
| `403` | `WORKFLOW_START_DENIED` | The capability does not belong to that request. The same answer covers a wrong capability, an unknown request and a phone request, on purpose. |
| `409` | `WORKFLOW_START_NOT_READY` | The steps have not finished. Poll until the request reports `ready`. |
| `409` | `WORKFLOW_START_ALREADY_CLAIMED` | Already started with a different offer. Create a new request. |
| `409` | `WORKFLOW_REQUEST_CANCELLED` | Cancelled. Create a new request. |
| `410` | `WORKFLOW_START_EXPIRED` | The request outlived `expires_at`. Create a new one. |
| `402` | `WORKFLOW_BILLING_UNAVAILABLE` | The workspace is out of credit. |
| `503` | `AT_CAPACITY` | Every line is busy and **nothing was claimed** — the preparation is still good. Wait and start again. |
| `502` | `WEB_START_REFUSED` | The voice runtime refused the offer. The line was given back and the request is finished; create a new one. |
| `503` | `WEB_START_UNAVAILABLE` | The voice runtime never answered. Same as above: the line was given back and the request is finished. |

The distinction that matters is `AT_CAPACITY` against the other two. It is
refused **before** anything is claimed, so the request is still startable; the
others happen after the claim, which is why they end the request instead of
inviting a retry onto a second peer.

## After it connects

Trickle ICE candidates to `ice_candidate_url` with `pc_id`, and `DELETE` the same
URL with `pc_id` to hang up. `call_id` is the call record —
[Get Call](https://docs.goyappr.com/api-reference/calls/get.md) reads it once the call ends.


## OpenAPI

````yaml POST /call-requests/{id}/start
openapi: 3.1.0
info:
  title: Yappr API
  description: >
    Create and manage AI voice agents, purchase phone numbers, configure tools,
    and initiate calls — all via REST.
  version: 1.0.0
  contact:
    url: https://goyappr.com
servers:
  - url: https://api.goyappr.com
    description: Production
security:
  - apiKey: []
paths:
  /call-requests/{id}/start:
    post:
      tags:
        - Calls
      summary: Start web call request
      description: >
        Requires calls:create, plus the request's own `start_capability` in the
        x-yappr-call-request-key header. Sends a fresh SDP offer for a request
        that has reached `ready`, takes a line, and returns the answer the
        browser completes the connection with.


        A start is one offer. Sending the same offer again returns the same
        peer, so a lost response is recovered rather than turned into a second
        call; sending a different one is refused, because the request has
        already spent its start. A `503` here is refused before anything is
        claimed, so the preparation is still worth starting - poll and try
        again.
      operationId: startWebCallRequest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
            format: uuid
        - in: header
          name: x-yappr-call-request-key
          required: true
          schema:
            type: string
          description: The `start_capability` this request was created with.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - sdp
                - type
              properties:
                sdp:
                  type: string
                  description: >-
                    A fresh SDP offer from a peer connection created now, not
                    before the steps ran.
                type:
                  type: string
                  enum:
                    - offer
      responses:
        '201':
          description: The call is live. Complete the WebRTC connection with this answer.
          content:
            application/json:
              schema:
                type: object
                required:
                  - sdp
                  - type
                  - pc_id
                  - call_id
                  - request_id
                properties:
                  sdp:
                    type: string
                  type:
                    type: string
                    enum:
                      - answer
                  pc_id:
                    type: string
                    description: >-
                      Peer id. Trickle ICE candidates and hang up against
                      ice_candidate_url with it.
                  ice_candidate_url:
                    type: string
                    format: uri
                  call_id:
                    type: string
                    format: uuid
                    description: Read it with GET /calls/{id} once the call ends.
                  request_id:
                    type: string
                    format: uuid
                  run_id:
                    type: string
                    format: uuid
                  replayed:
                    type: boolean
                    description: >-
                      True when this is the receipt of a start that already
                      happened.
        '401':
          description: >-
            MISSING_KEY, INVALID_KEY or EXPIRED_KEY - the key was not accepted.
            A valid key without the scope this operation needs is 403
            INSUFFICIENT_SCOPE, naming the scope. CALL_REQUEST_KEY_REQUIRED - no
            x-yappr-call-request-key header (and no start_capability in the
            body) was sent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: WORKFLOW_BILLING_UNAVAILABLE — this workspace is out of credit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            WORKFLOW_START_DENIED — the capability does not belong to that
            request. The same answer covers a wrong capability, a missing
            request and a phone request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: WORKFLOW_REQUEST_NOT_FOUND — no such request in this workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >
            WORKFLOW_START_NOT_READY - the before-call steps have not finished;
            poll until the request reports ready. WORKFLOW_START_ALREADY_CLAIMED
            - this request has already been started with a different offer.
            WORKFLOW_REQUEST_CANCELLED - it was cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: >-
            WORKFLOW_START_EXPIRED — the request outlived its expiry. Create a
            new one.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: >-
            WEB_START_REFUSED — the voice runtime refused the offer. The line
            was given back and the request is finished; create a new one.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >
            AT_CAPACITY - every line is busy and nothing was claimed, so poll
            and start again. WEB_START_UNAVAILABLE - the voice runtime never
            answered; the line was given back and the request is finished.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      required:
        - error
        - code
      description: >
        Every error response - the secret-key API and the browser data plane
        alike - carries a

        human-readable `error` and a stable machine `code`, and a refusal that
        names what is

        wrong with the request carries `issues[]` too. Branch on `code`, never
        on the `error`

        text. A refusal that names nothing more specific carries the code its
        status means:

        `BAD_REQUEST` (400), `UNAUTHORIZED` (401, the browser data plane; the
        secret-key API

        answers `MISSING_KEY`, `INVALID_KEY` or `EXPIRED_KEY`), `BILLING_ERROR`
        (402),

        `FORBIDDEN` (403), `NOT_FOUND` (404), `METHOD_NOT_ALLOWED` (405),
        `CONFLICT` (409),

        `GONE` (410), `PAYLOAD_TOO_LARGE` (413), `UNSUPPORTED_MEDIA_TYPE` (415),

        `UNPROCESSABLE_REQUEST` (422), `RATE_LIMIT` (429), `INTERNAL_ERROR`
        (500),

        `UPSTREAM_ERROR` (502), `SERVICE_UNAVAILABLE` (503), `UPSTREAM_TIMEOUT`
        (504). Some

        refusals add members of their own beside these (a call request's
        `status`, a workflow's

        `current_version`); the operation says which.
      properties:
        error:
          type: string
          description: The refusal, in one sentence for a person. Its wording may change.
        code:
          type: string
          description: The stable code to branch on.
        issues:
          type: array
          description: >
            Each thing at fault, on a 400 or 422 that names them: every query
            parameter or body field, not just the first. `path` is the
            parameter's name or the field's location.
          items:
            type: object
            required:
              - code
              - message
            properties:
              code:
                type: string
                description: >-
                  query_param_unknown, query_param_repeated, query_param_blank,
                  query_param_invalid, field_unknown, field_required,
                  field_invalid, or the route's own word.
              path:
                type: string
              message:
                type: string
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        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`).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.