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

# Get publish status

> Follow a publish until its new version is live or the publish fails

Use the `poll_url` that [Publish an agent](https://docs.squawkvoice.ai/api-reference/agents/publish-agent.md) returned, as it is. Call it every few seconds and decide on `status`:

| `status` | What it means |
| - | - |
| `publishing` | Still running. Wait for `published` before you rely on the new version. |
| `published` | The new version is live for new phone calls, website chats and emails. |
| `failed` | The publish stopped. What was live stays live, and the new version was never created. |

When a publish fails, `error` gives a short reason. Decide on `status`, not on its wording, but read it before you try again:

* **A knowledge base linked to the agent is being deleted or no longer exists.** The message doesn't say which one, so check the agent's knowledge base in Studio and remove it from the agent before you publish again.
* **The live version changed while the publish was running.** Someone made another version live in Studio. Check [Get live version](https://docs.squawkvoice.ai/api-reference/agents/get-live-version.md) and the draft before you publish again, because a publish puts the whole draft live over their choice.
* **Anything else.** Publish again.

A publish that makes no progress for about 15 minutes is ended and reads `failed`, so you can stop polling then.


## OpenAPI

````yaml api-reference/openapi.yaml GET /api/v1/assistants/{assistantId}/publish-jobs/{jobId}
openapi: 3.1.0
info:
  title: SquawkVoice API
  version: '1.0'
  description: >-
    Place on-demand campaign calls, and manage and publish an agent's
    guidelines, from your own systems. Every request is authenticated with an
    API key sent in the `X-API-Key` header.
servers:
  - url: https://api.squawkvoice.ai
security:
  - apiKey: []
tags:
  - name: on-demand-calls
    x-group: On-Demand Calls
    description: Place a campaign call for one contact, and cancel it before it is dialed.
  - name: agents
    x-group: Agents
    description: >-
      Read and replace an agent's guidelines, publish the agent, and see which
      version is live.
paths:
  /api/v1/assistants/{assistantId}/publish-jobs/{jobId}:
    get:
      tags:
        - agents
      summary: Get publish status
      description: >-
        Follows a publish started with [Publish an
        agent](/api-reference/agents/publish-agent). Call it every few seconds
        until `status` is `published` or `failed`.
      operationId: getPublishStatus
      parameters:
        - $ref: '#/components/parameters/assistantId'
        - name: jobId
          in: path
          required: true
          description: The `job_id` returned when you started the publish.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Where the publish is.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    type: object
                    required:
                      - job_id
                      - stage
                      - status
                      - version
                    properties:
                      job_id:
                        type: string
                        format: uuid
                      status:
                        type: string
                        enum:
                          - publishing
                          - published
                          - failed
                        description: >-
                          `publishing`: still running, so wait for `published`
                          before you rely on the new version. `published`: the
                          new version is live. `failed`: the version was never
                          created and what was live stays live.
                      stage:
                        type: string
                        description: >-
                          The step the publish is on, such as `queued`,
                          `replicating_kb` or `persisting_publish`, then
                          `completed` or `failed`. For display only: decide on
                          `status`.
                      version:
                        description: >-
                          The version the publish creates. Once it is
                          `published`, the version as it is now, so a rename in
                          Studio shows. `null` when the publish failed, or when
                          the version has since been deleted.
                        oneOf:
                          - $ref: '#/components/schemas/PublishVersion'
                          - type: 'null'
                      error:
                        type: string
                        description: >-
                          Only when the publish failed: a short reason, written
                          for a person. Don't match on its wording; decide on
                          `status`.
              examples:
                publishing:
                  summary: Still running
                  value:
                    success: true
                    data:
                      job_id: 0c4f8e2a-6b1d-4a39-9e57-2f8d1c3b6a90
                      stage: replicating_kb
                      status: publishing
                      version:
                        version_id: a71d3e95-2c8b-4f04-8d6a-9b1e5c7f2d38
                        version_number: 4
                        name: November pricing update
                published:
                  summary: Published
                  value:
                    success: true
                    data:
                      job_id: 0c4f8e2a-6b1d-4a39-9e57-2f8d1c3b6a90
                      stage: completed
                      status: published
                      version:
                        version_id: a71d3e95-2c8b-4f04-8d6a-9b1e5c7f2d38
                        version_number: 4
                        name: November pricing update
                failed:
                  summary: Failed
                  value:
                    success: true
                    data:
                      job_id: 0c4f8e2a-6b1d-4a39-9e57-2f8d1c3b6a90
                      stage: failed
                      status: failed
                      version: null
                      error: Publish failed. Please try again.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/AgentForbidden'
        '404':
          description: The agent was not found, or this agent has no publish with that ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                agentNotFound:
                  summary: Agent not found
                  value:
                    message: Assistant not found.
                publishNotFound:
                  summary: Publish not found
                  value:
                    success: false
                    error: Publish job not found
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    assistantId:
      name: assistantId
      in: path
      required: true
      description: >-
        The agent's ID. Open the agent in Studio and select **Copy ID** in its
        header.
      schema:
        type: string
        format: uuid
  schemas:
    PublishVersion:
      type: object
      description: The version a publish creates.
      required:
        - version_id
        - version_number
        - name
      properties:
        version_id:
          type: string
          format: uuid
          description: >-
            The new version's ID, known from the start. Wait for the publish's
            `status` to be `published` before you rely on it: a failed publish
            never creates it.
        version_number:
          type: integer
          description: >-
            The new version's number. A failed publish leaves its number unused,
            so numbers can skip.
        name:
          type:
            - string
            - 'null'
          description: The `version_name` you sent, or `null`.
    Error:
      type: object
      description: >-
        Most errors have `success: false` and a readable `error`. Some agent
        errors and rate-limit errors carry `message` instead.
      properties:
        success:
          type: boolean
          const: false
        error:
          type: string
          description: What went wrong.
        details:
          description: More detail, when there is any.
        message:
          type: string
          description: What went wrong, on errors that don't use `error`.
        data:
          type: object
          description: >-
            Extra detail on a few errors, such as the live version when there is
            nothing to publish, or the running publish on a `409`.
  responses:
    Unauthorized:
      description: >-
        The API key is missing, unknown, revoked or expired. The reply is the
        same in every case.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: 'Unauthorized: Invalid credentials'
    AgentForbidden:
      description: The agent isn't in your account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: 'Forbidden: Workspace does not belong to your account.'
    TooManyRequests:
      description: >-
        Too many requests. Wait for the number of seconds in the `Retry-After`
        header, then retry.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                const: error
              message:
                type: string
          example:
            status: error
            message: Too many requests, please try again later.
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        An API key from **Manage → API Keys** in Studio. See
        [Authentication](/api-reference/authentication).

````

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