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

# Publish call flow

> Publishes the working draft, making it the live call flow for the phone number. This changes live inbound routing immediately. Runs full validation, which is stricter than the lenient validation a draft save runs, so a draft that saved successfully can still fail to publish; the whole publish rolls back if validation fails. Publishing consumes the draft, so the line is left with no draft afterwards.

<Note>
  **Required scope:** `PHONE_NUMBERS_WRITE`
</Note>

## Behavior

Publishes the working draft, making it the **live** call flow for the phone number. The `{number}` path parameter is the Allo phone number in E.164 format.

Pass the `lock_version` of the draft you are publishing — fetch it with [Get call flow draft](/en/v2/api-reference/phone-numbers/get-call-flow-draft).

<Warning>
  This changes live inbound routing immediately. If you would rather have a person confirm the change, don't call this endpoint: [Save call flow draft](/en/v2/api-reference/phone-numbers/save-call-flow-draft) returns a `confirmation_url` where a signed-in user reviews the draft and publishes it themselves.
</Warning>

Publishing runs **full** validation, which is stricter than the lenient validation a draft save runs — a draft that saved successfully can still fail to publish. If any rule fails, the whole publish is rolled back and the previously live flow keeps routing calls.

Publishing **consumes** the draft: the draft version becomes the published version, so the line is left with no draft and the response carries no `confirmation_url`. Start the next edit cycle with a fresh `PUT …/call_flow/draft`.

## Errors

* `400 CALL_FLOW_INVALID` — the draft failed full validation.
* `400 CALL_FLOW_ROOT_MENU_TOO_SMALL` — the line runs an IVR and this flow would leave its menu with fewer than 2 options.
* `400 CALL_FLOW_CONTACT_PROPERTY_KEY_REQUIRED` — a `CONTACT_PROPERTY` node has no `propertyKey`.
* `400 CALL_FLOW_CONTACT_PROPERTY_VALUE_REQUIRED` — a `CONTACT_PROPERTY` node has no `expectedValue`.
* `400 CALL_FLOW_CONTACT_PROPERTY_UNKNOWN` — a `CONTACT_PROPERTY` node's `propertyKey` does not name a custom person property of your team. Renaming or deleting a property in the CRM invalidates a flow that branches on it.
* `404 CALL_FLOW_DRAFT_NOT_FOUND` — there is no draft to publish. Save one first with `PUT /v2/api/numbers/{number}/call_flow/draft`.
* `404 PHONE_NUMBER_NOT_FOUND` — the number is not one of your account's numbers.
* `409 CALL_FLOW_STALE_LOCK` — the `lock_version` is stale; refetch the draft and retry.


## OpenAPI

````yaml POST /v2/api/numbers/{number}/call_flow/publish
openapi: 3.0.3
info:
  title: Allo API
  description: >-
    Allo API provides programmatic access to your Allo account, allowing you to
    manage webhooks, retrieve calls and contacts, and send SMS messages.


    All requests to `/v1/api/**` endpoints automatically go through quota
    checking and scope validation.
  version: 1.0.0
  contact:
    name: Allo Support
servers:
  - url: https://api.withallo.com
    description: Production server
security: []
tags:
  - name: Summary Templates
    description: >-
      Manage call summary templates that control how AI-generated call summaries
      are structured for your team.
  - name: Webhooks
    description: >-
      Manage webhook endpoints to receive real-time notifications about events
      in your Allo account. Each endpoint subscribes to one or more event topics
      and is verified with a signing secret.
  - name: Calls
    description: >-
      Retrieve and search call records with filtering and pagination. Filter
      calls by your Allo phone number.
  - name: Contacts
    description: >-
      Search and retrieve contact information with sorting and pagination.
      Includes engagement level tracking.
  - name: SMS
    description: Send SMS messages to phone numbers using your Allo numbers.
  - name: Phone Numbers
    description: Retrieve information about your Allo phone numbers.
  - name: Analytics
    description: Pre-computed call metrics, team performance, and outbound dial funnel
  - name: CRM
    description: Manage people, companies, and deals in your CRM.
  - name: Notes
    description: >-
      Internal team notes on conversations and CRM people, with @mention
      support. Notes are never visible to the contact.
  - name: Threads
    description: >-
      Team discussion threads attached to a conversation item (call, SMS, or
      conversation note). One thread per item.
paths:
  /v2/api/numbers/{number}/call_flow/publish:
    post:
      tags:
        - Phone Numbers
      summary: Publish call flow
      description: >-
        Publishes the working draft, making it the live call flow for the phone
        number. This changes live inbound routing immediately. Runs full
        validation, which is stricter than the lenient validation a draft save
        runs, so a draft that saved successfully can still fail to publish; the
        whole publish rolls back if validation fails. Publishing consumes the
        draft, so the line is left with no draft afterwards.
      operationId: publishCallFlow
      parameters:
        - name: number
          in: path
          required: true
          description: Allo phone number in E.164 format
          schema:
            type: string
            example: '+14155551234'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - lock_version
              properties:
                lock_version:
                  type: integer
                  description: The `lock_version` of the draft you are publishing.
                  example: 0
      responses:
        '200':
          description: The published call flow
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CallFlow'
        '400':
          $ref: '#/components/responses/ApiValidationError'
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '404':
          $ref: '#/components/responses/ApiNotFound'
        '409':
          $ref: '#/components/responses/ApiConflict'
        '429':
          $ref: '#/components/responses/ApiRateLimited'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CallFlow:
      type: object
      description: A version of a phone number's call flow.
      properties:
        id:
          type: string
          nullable: true
          description: >-
            The call flow version ID. Null for a synthesized (never-persisted)
            flow.
          example: cflv-abc123
        flow_id:
          type: string
          nullable: true
          description: The parent call flow ID. Null for a synthesized flow.
          example: cflw-abc123
        version:
          type: integer
          description: Monotonic version number within the flow.
          example: 3
        status:
          type: string
          enum:
            - DRAFT
            - PUBLISHED
            - SYNTHESIZED
          description: >-
            DRAFT (working copy), PUBLISHED (live), or SYNTHESIZED (in-memory
            representation of a legacy IVR-only line).
          example: PUBLISHED
        lock_version:
          type: integer
          description: Optimistic-concurrency token; pass it back on the next draft save.
          example: 0
        schema_version:
          type: integer
          description: The call flow schema version this definition conforms to.
          example: 1
        engine_subset:
          type: string
          enum:
            - NESTED_IVR
            - FULL_FLOW
          example: FULL_FLOW
        number:
          type: string
          nullable: true
          description: >-
            E.164 of the line this flow routes. Null for a never-persisted
            SYNTHESIZED flow.
          example: '+14155551234'
        confirmation_url:
          type: string
          nullable: true
          description: >-
            A link where a signed-in user reviews this draft and publishes it.
            Present only on a `DRAFT` (a `PUBLISHED` or `SYNTHESIZED` version
            has nothing to confirm). Because the public API cannot publish, this
            is how a draft you compose reaches a human to go live. Treat it as
            opaque — pass it through verbatim; never construct or parse it.
          example: https://app.withallo.com/call-flow-draft/cflv-abc123
        entry_node_id:
          type: string
          description: The id of the entry node in `definition.nodes`.
          example: node-22
        definition:
          type: object
          description: The call flow tree document (opaque; camelCase keys).
          additionalProperties: true
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            request_id:
              type: string
            retry_after_seconds:
              type: integer
              nullable: true
  responses:
    ApiValidationError:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ApiUnauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ApiNotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ApiConflict:
      description: Conflict with existing resource
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ApiRateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````