> ## 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.

# End an Unopened Browser Session

> Requires calls:create. Ends a browser session minted with POST /calls {"type":"web"} that no browser has opened yet (status pending_connection): the call settles at once as status no_answer, ended_by operator, disconnect_reason "Ended by operator", cost 0 and no failure member (you ended it; it did not fail), and a browser that later tries the session's token is turned away. It takes no body. It is not a hang-up: a call a browser has already opened, or one that has settled, is refused with 409 CALL_NOT_PENDING and left as it is.


Requires `calls:create`, the permission that minted the session.

A browser session minted with [`POST /calls`](https://docs.goyappr.com/api-reference/calls/create)
`{"type":"web"}` is a call from the moment the mint answers, waiting as
`status: "pending_connection"` until a browser opens it. If you know nobody
will (the visitor closed the page, your test is over), end it here instead of
waiting for its token to expire:

```bash theme={null}
curl -X POST https://api.goyappr.com/calls/CALL_ID/end \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{ "id": "75a8e137-…", "status": "no_answer", "ended_at": "2026-09-24T13:38:05.112Z", "ended_by": "operator" }
```

The call is final at once: [`GET /calls/{id}`](https://docs.goyappr.com/api-reference/calls/get) reads
`status: "no_answer"`, `ended_by: "operator"`, `disconnect_reason: "Ended by operator"`
and `cost_cents: 0`, and a browser that later tries the session's token is turned
away. It takes no body.

**It is your end, not a failure.** The call has no `failure` member and its
timeline no failed phase: `ended_by` and `disconnect_reason` already say why it
stopped. `ended_at` is when you ended it.

A `call_request` session has no call to end until its request starts
(`call_id: null`). Discard its token with the `cancel_url` the mint returned
instead — see [Discarding a session nobody will use](https://docs.goyappr.com/api-reference/calls/create.md#discarding-a-session-nobody-will-use).
That URL takes the token rather than your key, so the page you handed the
token to can call it too.

**It is not a hang-up.** Only a session no browser has opened can be ended. A
call a browser has opened, a phone call, or a call that has already settled is
refused with `409 CALL_NOT_PENDING`, whose `status` names the state the call is
in, and nothing changes.

## Errors

| HTTP | Code | When |
| - | - | - |
| `400` | `CALL_END_INVALID` | The body had something in it. Ending takes no body; send none, or `{}`. Nothing was changed. |
| `404` | `NOT_FOUND` | No such call in this workspace. A key limited to other agents gets the same answer. |
| `404` | `RESOURCE_ID_INVALID` | The call id in the path is not an id at all. Use an `id` exactly as a list or a create returned it. |
| `409` | `CALL_NOT_PENDING` | The call is not a browser session waiting to be opened. Nothing was changed. |
| `503` | `CALL_END_UNAVAILABLE` | The call could not be read or written just then. Nothing was changed; send the same request again. |


## OpenAPI

````yaml POST /calls/{id}/end
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:
  /calls/{id}/end:
    post:
      tags:
        - Calls
      summary: End a browser session nobody has opened
      description: >
        Requires calls:create. Ends a browser session minted with POST /calls
        {"type":"web"} that no browser has opened yet (status
        pending_connection): the call settles at once as status no_answer,
        ended_by operator, disconnect_reason "Ended by operator", cost 0 and no
        failure member (you ended it; it did not fail), and a browser that later
        tries the session's token is turned away. It takes no body. It is not a
        hang-up: a call a browser has already opened, or one that has settled,
        is refused with 409 CALL_NOT_PENDING and left as it is.
      operationId: endPendingWebCall
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: The session was ended.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - status
                  - ended_at
                  - ended_by
                properties:
                  id:
                    type: string
                    format: uuid
                  status:
                    type: string
                    enum:
                      - no_answer
                  ended_at:
                    type: string
                    format: date-time
                  ended_by:
                    type: string
                    enum:
                      - operator
        '400':
          description: >-
            CALL_END_INVALID - the body had something in it. Ending takes no
            body (send none, or {}); the message names what to remove. Nothing
            was changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '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.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            NOT_FOUND - no such call in this workspace (or one a key limited to
            other agents cannot see). An id that is not an id at all is
            RESOURCE_ID_INVALID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            CALL_NOT_PENDING - the call is not a browser session waiting to be
            opened (a browser opened it, it is a phone call, or it has settled).
            `status` in the body names the state it is in. Nothing was changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            CALL_END_UNAVAILABLE - the call could not be read or written just
            then. Nothing was changed; send the same request again.
          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.