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

# Cancel generation

> Cancels a generation that is still queued.



## OpenAPI

````yaml /hub/openapi/hub.json post /api/v1/hub/generations/{id}/cancel
openapi: 3.0.1
info:
  title: Fanify Hub API
  description: Generate media and text with Fanify credits. All prices use EUR.
  version: v1
servers:
  - url: https://fanifyai.com
security: []
paths:
  /api/v1/hub/generations/{id}/cancel:
    post:
      tags:
        - Generations
      summary: Cancel generation
      description: Cancels a generation that is still queued.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Canceled generation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubGenerationDto'
              example:
                id: 0192f3a4-8c1e-7b2a-9f10-2b6d4e0c9a11
                model: nano-banana-2
                is_llm: false
                status: canceled
                input:
                  prompt: a cat
                  aspect_ratio: '16:9'
                  resolution: 2K
                estimated_cost: 0.04
                billed_cost: null
                currency: EUR
                outputs: []
                error: null
                missing: []
                created_at: '2026-09-07T10:00:00Z'
                started_at: null
                completed_at: '2026-09-07T10:00:10Z'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - unauthorized
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#unauthorized
                title: Unauthorized
                status: 401
                code: unauthorized
        '404':
          description: Generation not found
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - generation_not_found
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#generation_not_found
                title: Generation not found
                status: 404
                code: generation_not_found
        '409':
          description: Generation cannot be canceled
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - not_cancelable
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#not_cancelable
                title: Generation cannot be canceled
                status: 409
                code: not_cancelable
        '429':
          description: Rate limit reached
          headers:
            Retry-After:
              description: Seconds before retrying.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - rate_limited
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#rate_limited
                title: Rate limit reached
                status: 429
                code: rate_limited
      security:
        - Bearer: []
components:
  schemas:
    HubGenerationDto:
      required:
        - billed_cost
        - completed_at
        - created_at
        - currency
        - error
        - estimated_cost
        - id
        - input
        - is_llm
        - missing
        - model
        - outputs
        - started_at
        - status
      type: object
      properties:
        id:
          type: string
          format: uuid
        model:
          type: string
        is_llm:
          type: boolean
        status:
          enum:
            - queued
            - running
            - succeeded
            - failed
            - canceled
            - awaiting_supply
          type: string
        input:
          type: object
          nullable: true
        estimated_cost:
          type: number
          format: double
        billed_cost:
          type: number
          format: double
          nullable: true
        currency:
          enum:
            - EUR
          type: string
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/HubOutputDto'
        error:
          allOf:
            - $ref: '#/components/schemas/HubErrorDto'
          nullable: true
        missing:
          type: array
          items:
            type: string
        created_at:
          type: string
          format: date-time
        started_at:
          type: string
          format: date-time
          nullable: true
        completed_at:
          type: string
          format: date-time
          nullable: true
      additionalProperties: false
    HubOutputDto:
      required:
        - index
      type: object
      properties:
        index:
          type: integer
          format: int32
        media_type:
          type: string
          nullable: true
        url:
          type: string
          nullable: true
        size:
          type: integer
          format: int64
          nullable: true
        expires_at:
          type: string
          format: date-time
          nullable: true
        data:
          type: object
          nullable: true
      additionalProperties: false
    HubErrorDto:
      required:
        - code
        - message
      type: object
      properties:
        code:
          type: string
        message:
          type: string
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: http
      description: Fanify API key.
      scheme: bearer
      bearerFormat: fanify_sk_...

````

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