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

# Which Line Rings a Test Call

> Requires calls:create. Says which number a test call to this agent would come from, without placing anything: the workspace's own number when it has one (a number the agent calls from, 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 active number in the workspace; at each step a Yappr-hosted number before one on your own Telnyx account), otherwise a Yappr test line. A key limited to agents only ever calls from a number one of its agents answers or calls from, and is never told about any other: with none, the Yappr test line calls. available is false when neither exists.


See which number a [test call](https://docs.goyappr.com/api-reference/agents/test-call.md) to this agent would come from,
without placing one. Requires `calls:create`.

```bash theme={null}
curl "$YAPPR_API_URL/agents/$AGENT_ID/test-call" \
  --header "Authorization: Bearer $YAPPR_API_KEY"
```

```json theme={null}
{
  "agent_id": "a1b2c3d4-0000-4000-8000-000000000001",
  "available": true,
  "caller_line": "yappr",
  "from": "+972555000111"
}
```

| Field | Meaning |
| - | - |
| `caller_line` | `workspace` when one of your numbers would call (a number the agent calls from, then a campaign's from-number, then one it answers on, then any other; a Yappr-hosted number before one on your own Telnyx account at each step), `yappr` when there is no such number and a Yappr test line would call. A key limited to agents only sees, and only calls from, numbers its agents answer or call from. `null` when `available` is `false`. |
| `from` | The number that would call. |
| `available` | `false` when there is no number to call from: add a phone number, or test in the browser. |


## OpenAPI

````yaml GET /agents/{id}/test-call
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:
  /agents/{id}/test-call:
    parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - Agents
      summary: Which line rings a test call
      description: >
        Requires calls:create. Says which number a test call to this agent would
        come from, without placing anything: the workspace's own number when it
        has one (a number the agent calls from, 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 active number in the workspace; at each
        step a Yappr-hosted number before one on your own Telnyx account),
        otherwise a Yappr test line. A key limited to agents only ever calls
        from a number one of its agents answers or calls from, and is never told
        about any other: with none, the Yappr test line calls. available is
        false when neither exists.
      operationId: getAgentTestCallCaller
      responses:
        '200':
          description: The line a test call would ring from.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentTestCallCaller'
        '400':
          description: AGENTS_QUERY_INVALID — this read takes no query parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            AGENT_NOT_FOUND — no agent with this id in this workspace, or it is
            archived.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            TEST_CALL_UNAVAILABLE — the workspace's numbers could not be read
            just now. Retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AgentTestCallCaller:
      type: object
      required:
        - agent_id
        - available
        - caller_line
        - from
      properties:
        agent_id:
          type: string
          format: uuid
        available:
          type: boolean
          description: >-
            false when the workspace has no number and no Yappr test line is
            available.
        caller_line:
          type: string
          nullable: true
          enum:
            - workspace
            - yappr
          description: >-
            workspace — one of the workspace's own numbers calls. yappr — a
            Yappr test line calls (it places calls only). null when available is
            false.
        from:
          type: string
          nullable: true
          description: The number that would call, E.164.
    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.