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

# Set the live deployment

> Roll back or forward by serving an earlier successful deployment again. Its stored bundle goes through the same candidate deploy, probes and activation as createAppDeployment, as a new deployment to poll at Location. Only code changes: migrations are never reversed. When the database has migrations the chosen deployment lacks, this is refused with 409 migrations_ahead unless `allowMigrationsAhead` is true. After a lost response, repeat with the same Idempotency-Key.

Alpha: this operation may change or be removed without notice.



## OpenAPI

````yaml /openapi.json post /apps/apps/{appId}/live
openapi: 3.0.3
info:
  title: Effective API
  version: 2.0.0
  description: The public Effective REST API. Authenticate using an Effective API key.
servers:
  - url: https://api.canary.effectiveai.app/api/v2
    description: Canary
security:
  - bearerAuth: []
paths:
  /apps/apps/{appId}/live:
    post:
      tags:
        - Apps
      summary: Set the live deployment
      description: >-
        Roll back or forward by serving an earlier successful deployment again.
        Its stored bundle goes through the same candidate deploy, probes and
        activation as createAppDeployment, as a new deployment to poll at
        Location. Only code changes: migrations are never reversed. When the
        database has migrations the chosen deployment lacks, this is refused
        with 409 migrations_ahead unless `allowMigrationsAhead` is true. After a
        lost response, repeat with the same Idempotency-Key.


        Alpha: this operation may change or be removed without notice.
      operationId: setAppLiveDeployment
      parameters:
        - schema:
            type: string
            maxLength: 63
            pattern: ^app-[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$
            description: >-
              App ID: `app-` followed by lowercase letters, digits and hyphens,
              ending in a letter or digit. It is part of the app’s hostname, so
              your organization’s subdomain and the ID together must fit 63
              characters.
          required: true
          description: >-
            App ID: `app-` followed by lowercase letters, digits and hyphens,
            ending in a letter or digit. It is part of the app’s hostname, so
            your organization’s subdomain and the ID together must fit 63
            characters.
          name: appId
          in: path
        - schema:
            type: string
            minLength: 1
            maxLength: 128
            pattern: ^[A-Za-z0-9\-_.:]+$
            description: >-
              Client-chosen key for safe retries: 1-128 letters, digits, -, _, .
              or :. Use a new random UUID for each intended operation and the
              same key when retrying it. Do not put customer data or credentials
              in the key.
          required: true
          description: >-
            Client-chosen key for safe retries: 1-128 letters, digits, -, _, .
            or :. Use a new random UUID for each intended operation and the same
            key when retrying it. Do not put customer data or credentials in the
            key.
          name: Idempotency-Key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                deploymentId:
                  type: string
                  format: uuid
                  description: An earlier successful deployment of this app.
                expectedLiveDeploymentId:
                  type: string
                  nullable: true
                  format: uuid
                  description: >-
                    The live deployment you expect, from getApp; null before the
                    first deployment.
                allowMigrationsAhead:
                  type: boolean
                  default: false
                  description: >-
                    Set true to serve a deployment that lacks migrations the
                    database already has. Migrations are never reversed.
              required:
                - deploymentId
                - expectedLiveDeploymentId
              additionalProperties: false
      responses:
        '200':
          description: The same Idempotency-Key replayed a finished attempt.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2AppDeploymentAttempt'
        '202':
          description: 'Accepted; poll Location with getAppDeployment. Retry-After: 2.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2AppDeploymentAttempt'
        '400':
          description: Invalid request or idempotency key, or invalid_release.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '403':
          description: Publish permission required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '404':
          description: >-
            app_not_found, or deployment_not_found: not a successful deployment
            of this app.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '409':
          description: >-
            migrations_ahead: the database has migrations the deployment lacks.
            release_not_retained: its bundle is no longer stored. conflict: the
            live deployment changed or another deployment is running.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '413':
          description: JSON request body exceeds 64 KiB.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '415':
          description: Content-Type must be application/json.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '503':
          description: Execution unavailable; retry with the same Idempotency-Key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
      security:
        - bearerAuth: []
components:
  schemas:
    V2AppDeploymentAttempt:
      type: object
      properties:
        id:
          type: string
          format: uuid
        appId:
          type: string
          maxLength: 63
          pattern: ^app-[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$
          description: >-
            App ID: `app-` followed by lowercase letters, digits and hyphens,
            ending in a letter or digit. It is part of the app’s hostname, so
            your organization’s subdomain and the ID together must fit 63
            characters.
        sourceSha:
          type: string
        shape:
          type: string
          nullable: true
          enum:
            - full
            - service
            - instructions
            - null
        bundleSha256:
          type: string
          nullable: true
          pattern: ^[0-9a-f]{64}$
        runtimeUrl:
          type: string
          nullable: true
          format: uri
        mcpUrl:
          type: string
          nullable: true
          format: uri
        target:
          type: object
          properties:
            environment:
              type: string
              enum:
                - preview
            branch:
              type: string
              minLength: 1
              maxLength: 255
              description: Exact pushed development branch, excluding main and HEAD.
          required:
            - environment
            - branch
          additionalProperties: false
        previewUrl:
          type: string
          format: uri
          description: >-
            Private URL for the latest activated build of this branch. Returned
            after success.
        buildId:
          type: string
          format: uuid
          description: >-
            Build activated by this preview attempt. Identical content can reuse
            an existing build.
        createdByEmail:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        completedAt:
          type: string
          nullable: true
          format: date-time
        idempotencyExpiresAt:
          type: string
          nullable: true
          format: date-time
        status:
          type: string
          enum:
            - queued
            - running
            - succeeded
            - failed
        stage:
          type: string
        checks:
          type: object
          nullable: true
          properties:
            passed:
              type: boolean
            checkedAt:
              type: string
              format: date-time
            checks:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  passed:
                    type: boolean
                  detail:
                    type: string
                required:
                  - name
                  - passed
                  - detail
                additionalProperties: false
          required:
            - passed
            - checkedAt
            - checks
          additionalProperties: false
        effects:
          type: object
          properties:
            runtimeChanged:
              type: boolean
            migrationsApplied:
              type: array
              items:
                type: string
            migrationsStatus:
              type: string
              enum:
                - not_started
                - running
                - succeeded
                - unknown
                - failed
            previousRuntimeRestored:
              type: boolean
              nullable: true
          required:
            - runtimeChanged
            - migrationsApplied
            - migrationsStatus
            - previousRuntimeRestored
          additionalProperties: false
        interface:
          type: object
          nullable: true
          properties:
            capabilities:
              type: array
              items:
                type: string
            tools:
              type: array
              items:
                type: object
                additionalProperties:
                  nullable: true
            openapiUrl:
              type: string
              nullable: true
              format: uri
          required:
            - capabilities
            - tools
            - openapiUrl
          additionalProperties: false
        error:
          type: object
          nullable: true
          properties:
            code:
              type: string
            error:
              type: string
            retryable:
              type: boolean
            recovery:
              type: string
          required:
            - code
            - error
            - retryable
            - recovery
          additionalProperties: false
        live:
          type: boolean
          description: >-
            True when production serves this deployment. Branch previews report
            false.
      required:
        - id
        - appId
        - sourceSha
        - shape
        - bundleSha256
        - runtimeUrl
        - mcpUrl
        - createdByEmail
        - createdAt
        - completedAt
        - idempotencyExpiresAt
        - status
        - stage
        - checks
        - effects
        - interface
        - error
        - live
      additionalProperties: false
    V2CodedError:
      allOf:
        - $ref: '#/components/schemas/V2Error'
        - type: object
          properties:
            code:
              type: string
              minLength: 1
              description: Stable error code. Clients must tolerate unknown future codes.
            details:
              type: array
              items:
                type: object
                properties:
                  location:
                    type: string
                    enum:
                      - path
                      - query
                      - header
                      - body
                  path:
                    type: array
                    items:
                      type: string
                      maxLength: 64
                    maxItems: 12
                  code:
                    type: string
                    enum:
                      - required
                      - invalid_type
                      - invalid_value
                      - unknown_field
                  message:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - location
                  - path
                  - code
                  - message
              minItems: 1
              maxItems: 20
              description: Bounded safe validation issues; may omit some invalid fields.
            requestId:
              type: string
              minLength: 1
              maxLength: 128
              description: >-
                Existing server correlation for this HTTP attempt, when
                available.
            dataset:
              type: string
              enum:
                - naic
                - osha
              description: Dataset needed for dataset_not_enabled.
            businessCode:
              type: string
              description: The rater’s own refusal code, for business_rejection.
            violations:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    description: Authored or built-in constraint code
                  message:
                    type: string
                    description: Authored message for the failed constraint
                  path:
                    type: string
                    description: Input path of the offending value; empty for the request
                  value:
                    nullable: true
                    description: Offending input value, size-bounded by the runtime
                  constraint:
                    type: string
                    description: The constraint the value failed, as text
                  cite:
                    type: string
                    nullable: true
                    description: >-
                      Filing citation of the constraint, when the source cites
                      one
                required:
                  - code
                  - message
                  - path
                  - value
                  - constraint
                  - cite
                additionalProperties: false
              maxItems: 256
              description: >-
                Each input constraint the submission failed, for invalid_inputs
                and business_rejection.
            violationsTruncated:
              type: boolean
              description: >-
                True when the rater reported more violations than violations
                holds.
            executionId:
              type: string
              description: >-
                The recorded execution of a failed rating, for rater rating
                failures.
            accessUrl:
              type: string
              nullable: true
              format: uri
              description: Not currently returned.
          required:
            - code
    V2Error:
      type: object
      properties:
        error:
          type: string
          minLength: 1
          description: Human-readable explanation of the failure.
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Effective API key. Send Authorization: Bearer sk-eai-...'

````

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