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

# List workflow versions

> Page through immutable publication summaries.

Requires `agents:read`. This is publication history, not call execution history.

**id** `string` *required*

Local agent UUID.

**limit** `integer` (default: 50)

Page size, 1–100.

**cursor** `integer`

Exclusive version cursor returned as `next_cursor`.

```bash theme={null}
curl 'https://api.goyappr.com/agents/AGENT_ID/workflow/versions?limit=20' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'x-company-id: COMPANY_ID'
```

A `limit` outside 1–100 is refused, not clamped, and so is a `cursor` that is
not a version number: `400 WORKFLOW_REQUEST_INVALID`, with the parameter in
`issues[0].path` and what it takes in `error`.

The response has `data` and nullable `next_cursor`. Summaries are newest first
and contain `id`, `version`, `draft_version`, `content_hash`, `compiler_version`,
`environment`, `published_at` and three fields that say how the version came to
be: `source`, `source_run_id` and `restored_from_version`. This read does not
restore a draft, republish a version or grant access to a run journal.

## Where a version came from

| `source` | Meaning |
| - | - |
| `teach` | [Teach](https://docs.goyappr.com/api-reference/workflows/train.md) published it from a web test call; `source_run_id` is the run. |
| `restore` | [A restore](https://docs.goyappr.com/api-reference/workflows/restore.md) published it; `restored_from_version` is the version number it copies. An undo of a Teach run is a restore. |
| `null` | A person published it from the editor or the API. |

Read one version with its document through
[Get workflow version](https://docs.goyappr.com/api-reference/workflows/version.md).

## What `environment` says, and what it does not

`environment` is the **deployment plane** that compiled and stored the revision:
`production`, `testing` or `local`. It is not a rehearsal flag, not a sandbox
switch and not something you send — there is no field for it on
[Publish workflow](https://docs.goyappr.com/api-reference/workflows/publish.md), and no query parameter
selects one.

It is decided by the deployment you are talking to. Every Yappr deployment is
configured with exactly one plane, and everything published through it is stored
on that plane. **The hosted API you are reading about publishes as `testing`.**
That is the deployment's own configuration, not a property of your agent and not
something gone wrong: `testing` here names the plane, not a lesser copy of your
workflow. A self-hosted or on-premise deployment configured as `production`
stores its versions as `production`, and nothing else about publishing differs.

### What the dashboard calls it

The dashboard labels a plane by what it means for your callers, and keeps the
API value off the screen:

| `environment` | Dashboard label |
| - | - |
| `testing` | Live |
| `production` | Live |
| `local` | Local |

So *Version 3 is live.* in the dashboard and `"version": 3, "environment": "testing"`
here describe the same published version. In the dashboard's version list only
the version callers reach now is marked *live now*; an older row shows its number
and when it was published.

### How a call finds the version to run

A call runs on the plane of the deployment that admitted it, and it loads the
agent's published version **only if that version was stored on the same plane**.

That is why you do not have to think about this. Publish through this API and
place the call through this API — [`POST /calls`](https://docs.goyappr.com/api-reference/calls/create),
[`POST /call-requests`](https://docs.goyappr.com/api-reference/calls/request-create), a phone number, a
[shared link](https://docs.goyappr.com/api-reference/shared-links/create.md) — and both are the same
deployment, so both are the same plane. The version you publish is the version
your next call runs.

The two can only come apart if a version was published through a *different*
deployment than the one placing the call — moving a workspace between
deployments, or an on-premise stack pointed at a hosted one. Publishing is not
plane-scoped, so such a version still becomes the agent's published version, and
a call then finds nothing to run however active the agent is: the request ends
`failed` with `error_code: "artifact_unavailable"` (see
[Read a call request](https://docs.goyappr.com/api-reference/calls/request-get.md)). The fix is one call —
publish the draft again through the deployment that will place the call, and the
new version is stored on its plane.

The same code also answers a call whose channel the published version does not
list in its `channels` — see [Which ways in the agent allows](https://docs.goyappr.com/api-reference/workflows/save.md#which-ways-in-the-agent-allows-channels).

The other conditions on being callable are unchanged: the agent must be active
and have a published version. See
[Place a call](https://docs.goyappr.com/api-reference/calls/create.md).

### Reading it

[Publish workflow](https://docs.goyappr.com/api-reference/workflows/publish.md) returns `environment` on
the revision it creates, so you can record the plane at publish time without a
second request. It is also on every row here.

Every version of the agent is listed whatever plane published it, so this is
also the only field on which two of one agent's versions can differ without the
document differing. Tell versions apart by `version`, `content_hash` and
`published_at`.


## OpenAPI

````yaml GET /agents/{id}/workflow/versions
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}/workflow/versions:
    parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
          format: uuid
      - in: header
        name: x-company-id
        schema:
          type: string
          format: uuid
        description: >-
          Explicit active workspace. Optional; when sent it must be the API
          key's own workspace — any other value is refused with 403
          WORKSPACE_MISMATCH.
    get:
      tags:
        - Workflows
      summary: List published workflow versions
      description: >-
        Requires agents:read. Newest first; this lists publication summaries,
        not runtime receipts or call history.
      operationId: listWorkflowVersions
      parameters:
        - in: query
          name: cursor
          schema:
            type: integer
            minimum: 1
          description: Exclusive version cursor from next_cursor.
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
      responses:
        '200':
          description: Published versions.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - next_cursor
                properties:
                  next_cursor:
                    type:
                      - integer
                      - 'null'
                  data:
                    type: array
                    items:
                      allOf:
                        - $ref: '#/components/schemas/WorkflowRevisionSummary'
                        - type: object
                          properties:
                            draft_version:
                              type: integer
                              minimum: 1
                            compiler_version:
                              type: string
                            environment:
                              type: string
                        - $ref: '#/components/schemas/WorkflowVersionProvenance'
        '400':
          description: >-
            WORKFLOW_REQUEST_INVALID: a limit outside 1-100 (refused, not
            clamped), a cursor that is not a version number from next_cursor, or
            a query parameter this route does not read (it reads limit and
            cursor), refused by name rather than ignored; issues[0].path names
            the parameter.
          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'
        '403':
          description: >
            WORKSPACE_MISMATCH — `x-company-id` named a workspace other than the
            one this API key belongs to.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Agent unavailable in this company.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    WorkflowRevisionSummary:
      type: object
      required:
        - id
        - version
        - content_hash
        - published_at
      properties:
        id:
          type: string
          format: uuid
        version:
          type: integer
          minimum: 1
        content_hash:
          type: string
          pattern: ^[a-f0-9]{64}$
        published_at:
          type: string
          format: date-time
        environment:
          type: string
          enum:
            - local
            - testing
            - production
          readOnly: true
          description: >
            The deployment plane that compiled and stored this revision. Decided
            by the deployment, never sent by the caller; the hosted API stores
            as testing. A call loads only a version stored on the plane it runs
            on, and publishing and calling through the same API are the same
            plane. See the List workflow versions page.
    WorkflowVersionProvenance:
      type: object
      properties:
        source:
          type:
            - string
            - 'null'
          enum:
            - teach
            - restore
            - null
          description: >-
            How the version came to be. `teach` - published by Teach from a test
            call; `restore` - published by a restore (including an undo of a
            Teach run); null - published by a person from the editor or the API.
        source_run_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            The Teach run that published this version. Null unless source is
            teach.
        restored_from_version:
          type:
            - integer
            - 'null'
          minimum: 1
          description: >-
            The version number this one is a copy of. Null unless source is
            restore.
    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.