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

# Cancel AI task

> Stopping a previously launched AI-task without waiting for it to be fully completed.

The task will be moved to "REVOKED" status.



## OpenAPI

````yaml /api-reference/services_documented/streaming_api.yaml post /streaming/ai/tasks/{task_id}/cancel
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Streaming API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-15T06:37:28.230198+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: AI
    x-displayName: AI
  - name: Broadcasts
    x-displayName: Broadcasts
  - name: Directories
    x-displayName: Directories
  - name: Overlays
    x-displayName: Overlays
  - name: Players
    x-displayName: Players
  - name: Playlists
    x-displayName: Playlists
  - name: QualitySets
    x-displayName: QualitySets
  - name: Restreams
    x-displayName: Restreams
  - name: Streaming Statistics
    x-displayName: Statistics
  - name: Streams
    x-displayName: Streams
  - name: Subtitles
    x-displayName: Subtitles
  - name: Videos
    x-displayName: Videos
paths:
  /streaming/ai/tasks/{task_id}/cancel:
    post:
      tags:
        - AI
      summary: Cancel AI task
      description: >-
        Stopping a previously launched AI-task without waiting for it to be
        fully completed.


        The task will be moved to "REVOKED" status.
      operationId: post_ai_tasks_cancel
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
          description: ID of the task to be cancelled
      responses:
        '202':
          description: Accepted. AI-task has been cancelled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ai_post_response_result'
        '400':
          description: |-
            Bad request:
            - "task_id" is not specified,
            - Queue limit reached (100), try later,
            - etc
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/streaming_error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ai_post_response_error404'
        '412':
          description: >-
            Precondition Failed. AI-task can't be cancelled, because it is
            already cancelled or completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ai_post_response_error'
        '422':
          description: >-
            This is advanced functionality; to enable it, contact your manager
            or the Support Team.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/upgraderequired'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            response = client.streaming.ai_tasks.cancel(
                "task_id",
            )
            print(response.result)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Streaming.AITasks.Cancel(context.TODO(), \"task_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Result)\n}\n"
components:
  schemas:
    ai_post_response_result:
      type: object
      properties:
        result:
          type: string
          description: A textual explicit description of the result of the operation
      example:
        result: Task has been cancelled successfully.
    streaming_error:
      type: object
      properties:
        error:
          type: string
          description: Text message with description of error.
      example:
        error: Queue limit reached (100), try later.
    ai_post_response_error404:
      allOf:
        - $ref: '#/components/schemas/ai_post_response_error'
      example:
        error: Task not found
    ai_post_response_error:
      type: object
      properties:
        error:
          type: string
          description: >-
            A textual explicit description of the operation execution error, if
            something went wrong
      example:
        error: Cannot cancel task because it is already in status REVOKED.
    upgraderequired:
      type: object
      properties:
        error:
          type: string
          description: >-
            This is advanced functionality; to enable it, contact your manager
            or support service.
      example:
        error: Feature is disabled. Contact support to enable.
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````