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

# Cancel an eligible execution

> Cancel an eligible image execution or a Video execution that is still queued. Video returns 409 once submission has started. Sprite executions do not support customer cancellation.



## OpenAPI

````yaml /openapi/managed.yaml post /v1/executions/{execution_id}/cancel
openapi: 3.1.0
info:
  title: DreamLayer Agent API
  version: '1'
  description: >-
    Generate images, sprite sheets, and quoted videos; follow executions and
    retrieve owned outputs. Start with https://docs.dreamlayer.io/agent-api for
    authentication, limits, runnable examples, event recovery, and billing.
    Sprite sheets require account capability support and an approved credit
    ceiling. Video requires a quote before acceptance. Video schemas document
    the customer integration fields; response objects may contain additional
    fields. See https://docs.dreamlayer.io/agent-api/video.
servers:
  - url: https://api.dreamlayer.io
security:
  - bearerAuth: []
paths:
  /v1/executions/{execution_id}/cancel:
    post:
      summary: Cancel an eligible execution
      description: >-
        Cancel an eligible image execution or a Video execution that is still
        queued. Video returns 409 once submission has started. Sprite executions
        do not support customer cancellation.
      operationId: cancelExecution
      parameters:
        - $ref: '#/components/parameters/Version'
        - $ref: '#/components/parameters/ExecutionId'
      responses:
        '202':
          description: >-
            Eligible image or queued Video execution cancelled and any
            reservation restored once. Sprite requests cannot be cancelled.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ExecutionAccepted'
                  - $ref: '#/components/schemas/VideoExecution'
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '409':
          $ref: '#/components/responses/VideoOrSharedFailure'
        '422':
          $ref: '#/components/responses/InvalidRequest'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    Version:
      name: DreamLayer-Version
      in: header
      required: true
      schema:
        type: string
        const: '1'
    ExecutionId:
      name: execution_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    ExecutionAccepted:
      type: object
      additionalProperties: false
      required:
        - execution_id
        - conversation_id
        - status
      properties:
        execution_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - needs_input
            - queued
            - running
            - completed
            - failed
            - cancelled
    VideoExecution:
      type: object
      additionalProperties: false
      required:
        - execution_id
        - conversation_id
        - status
        - image_job
        - video_job
      properties:
        execution_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/VideoState'
        image_job:
          type: 'null'
        video_job:
          type: object
          additionalProperties: true
          description: >-
            Documented integration fields. Additional response fields can
            include original request data; do not log full responses.
          required:
            - stage
            - requested_settings
            - metadata
            - credits
            - credits_restored
            - settled_credits
            - reserved_credits
            - billing_note
            - error_code
            - retention_expires_at
            - download_url
          properties:
            stage:
              $ref: '#/components/schemas/VideoState'
            requested_settings:
              $ref: '#/components/schemas/VideoSettings'
            metadata:
              type:
                - object
                - 'null'
              description: >-
                Actual delivered metadata, available after validation.
                Dimensions and duration can differ slightly from nominal
                settings.
              properties:
                width:
                  type: integer
                height:
                  type: integer
                duration_seconds:
                  type: number
                fps:
                  type: number
                audio_streams:
                  type: integer
                codec:
                  type: string
                content_type:
                  type: string
                  const: video/mp4
                bytes:
                  type: integer
                  maximum: 268435456
                sha256:
                  type: string
            credits:
              type: string
            credits_restored:
              type: boolean
            settled_credits:
              type: string
            reserved_credits:
              type: string
            billing_note:
              type: string
            error_code:
              type:
                - string
                - 'null'
            retention_expires_at:
              type:
                - string
                - 'null'
              format: date-time
            download_url:
              type:
                - string
                - 'null'
              description: >-
                Owned relative asset path on completion; authenticate only at
                the API origin.
            created_at:
              type:
                - string
                - 'null'
              format: date-time
            completed_at:
              type:
                - string
                - 'null'
              format: date-time
    VideoState:
      type: string
      enum:
        - queued
        - submitting
        - uncertain
        - generating
        - delivering
        - completed
        - failed
        - cancelled
        - expired
    VideoSettings:
      type: object
      additionalProperties: false
      required:
        - duration_seconds
        - resolution
        - aspect_ratio
        - generate_audio
      properties:
        duration_seconds:
          type: integer
        resolution:
          type: string
          const: 720p
        aspect_ratio:
          type: string
          description: >-
            Resolved text aspect or the source-driven profile marker for image
            video. Read delivered metadata for actual width and height.
        generate_audio:
          type: boolean
    ErrorEnvelope:
      type: object
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - code
            - reason
            - message
            - category
            - retryable
            - request_id
          properties:
            code:
              type: string
              description: Legacy uppercase code retained for existing clients.
            reason:
              $ref: '#/components/schemas/PublicErrorReason'
            message:
              type: string
            category:
              type: string
            retryable:
              type: boolean
            request_id:
              type: string
              format: uuid
            details:
              type: object
              description: >-
                Optional sanitized validation detail. Submitted values are never
                echoed.
              additionalProperties: true
    VideoErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - reason
            - message
            - retryable
          properties:
            code:
              type: string
            reason:
              type: string
            message:
              type: string
            retryable:
              type: boolean
    PublicErrorReason:
      type: string
      enum:
        - invalid_request
        - authentication_failed
        - access_denied
        - resource_not_found
        - insufficient_credits
        - conflict
        - too_many_active_jobs
        - rate_limited
        - quota_exceeded
        - content_refused
        - temporarily_unavailable
        - generation_failed
        - insufficient_frames
        - prompt_policy_blocked
        - feature_unavailable
  responses:
    InvalidRequest:
      description: Invalid request, including a missing required Authorization header
      headers:
        Cache-Control:
          schema:
            type: string
            const: no-store
        Pragma:
          schema:
            type: string
            const: no-cache
        X-Request-ID:
          schema:
            type: string
            format: uuid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthenticated:
      description: >-
        Invalid or revoked API key. A missing Authorization header returns 422
        invalid_request.
      headers:
        Cache-Control:
          schema:
            type: string
            const: no-store
        Pragma:
          schema:
            type: string
            const: no-cache
        X-Request-ID:
          schema:
            type: string
            format: uuid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    VideoOrSharedFailure:
      description: >-
        Video business error or shared validation, authentication, or
        request-limit error. See the operation-specific recovery guide.
      content:
        application/json:
          schema:
            anyOf:
              - $ref: '#/components/schemas/VideoErrorEnvelope'
              - $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: >-
        Synchronous request or open-stream limit reached. See
        https://docs.dreamlayer.io/agent-api/limits for scopes and backoff.
        Retry-After and remaining-request headers are not guaranteed.
      headers:
        Cache-Control:
          schema:
            type: string
            const: no-store
        Pragma:
          schema:
            type: string
            const: no-cache
        X-Request-ID:
          schema:
            type: string
            format: uuid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            error:
              code: RATE_LIMITED
              reason: rate_limited
              message: Too many requests. Please try again shortly.
              category: RATE_LIMITED
              retryable: true
              request_id: d34db33f-0000-4000-8000-000000000001
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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