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

# Cancel a run



## OpenAPI

````yaml /openapi.yaml post /runs/{runId}/cancel
openapi: 3.0.0
info:
  title: superglue AI API
  version: 1.0.0
  description: API for running superglue AI tools
  contact:
    name: superglue AI Support
    email: stefan@superglue.ai
servers:
  - url: https://api.superglue.ai/v1
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /runs/{runId}/cancel:
    post:
      tags:
        - Runs
      summary: Cancel a run
      operationId: cancelRun
      parameters:
        - name: runId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Run cancelled
          headers:
            X-Trace-Id:
              schema:
                type: string
              description: Request trace ID for debugging and log correlation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Run'
        '400':
          description: Cannot cancel run
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Run:
      type: object
      required:
        - runId
        - toolId
        - status
        - metadata
      properties:
        runId:
          type: string
          description: Unique identifier for this run
          example: 7f3e9c1a-2b4d-4e8f-9a3b-1c5d7e9f2a4b
        toolId:
          type: string
          description: ID of the tool that was executed
          example: 550e8400-e29b-41d4-a716-446655440000
        tool:
          $ref: '#/components/schemas/Tool'
          description: Full tool configuration that was executed
        status:
          type: string
          enum:
            - running
            - success
            - failed
            - aborted
          description: |
            Execution status:
            - running: Execution in progress
            - success: Completed successfully
            - failed: Failed due to error
            - aborted: Cancelled by user or system
          example: success
        toolPayload:
          type: object
          description: The inputs provided when running the tool
          additionalProperties: true
        data:
          type: object
          description: >
            Tool execution result data. Only present in the sync response from
            POST /tools/{toolId}/run (200).

            Not stored in the run record — for async runs, use GET
            /runs/{runId}/results to fetch results from storage.
          additionalProperties: true
        error:
          type: string
          description: Error message (only present when status is failed or aborted)
          example: Connection timeout after 30000 milliseconds
        stepResults:
          type: array
          description: >
            Per-step execution results for multi-step tools. Only present in the
            sync response

            from POST /tools/{toolId}/run (200). For async runs, use GET
            /runs/{runId}/results.
          items:
            $ref: '#/components/schemas/StepResult'
        options:
          type: object
          description: Execution options that were used for this run
          additionalProperties: true
        requestSource:
          type: string
          description: Source identifier for where the run was initiated
          enum:
            - api
            - frontend
            - scheduler
            - mcp
            - tool-chain
            - webhook
            - cli
          example: api
        traceId:
          type: string
          description: Trace ID for this run (for debugging and log correlation)
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        resultStorageUri:
          type: string
          description: |
            Storage URI where full results are stored (enterprise feature).
            Present when the result was too large for the run record.
            Use GET /runs/{runId}/results to fetch the full data.
          example: s3://superglue-results/org123/runs/7f3e9c1a.json
        userId:
          type: string
          description: User who triggered this run
        executionMode:
          type: string
          enum:
            - prod
            - dev
          description: >-
            The execution mode used for this run (which system credentials were
            used)
          example: prod
        metadata:
          type: object
          properties:
            startedAt:
              type: string
              format: date-time
            completedAt:
              type: string
              format: date-time
              description: Only present when run has finished (success, failed, or aborted)
            durationMs:
              type: integer
              example: 5234
        fileArtifacts:
          type: array
          description: >
            File artifacts produced by the tool run.

            Only present when the tool produced file output.

            In list responses, includes metadata only (no downloadUrl).

            In single-run responses (GET /runs/{runId}), includes presigned
            download URLs (1 hour TTL).

            Use GET /runs/{runId}/files to get fresh download URLs.
          items:
            $ref: '#/components/schemas/FileArtifact'
        important_notice:
          type: string
          description: Upgrade notice shown to free-tier organizations
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            message:
              type: string
              example: Invalid input parameters
    Tool:
      type: object
      description: >-
        A multi-step workflow tool that executes one or more protocol-specific
        operations
      required:
        - id
        - steps
      properties:
        id:
          type: string
          example: 550e8400-e29b-41d4-a716-446655440000
        name:
          type: string
          example: Web Search
        version:
          type: string
          description: Semantic version string (major.minor.patch)
          example: 2.1.0
          pattern: ^\d+\.\d+\.\d+$
        instruction:
          type: string
          description: Human-readable instruction describing what the tool does
          example: Search the web for the given query and return relevant results
        inputSchema:
          type: object
          description: JSON Schema for tool inputs
          example:
            type: object
            properties:
              query:
                type: string
              maxResults:
                type: integer
                default: 10
            required:
              - query
        outputSchema:
          type: object
          description: JSON Schema for tool outputs (after transformations applied)
        steps:
          type: array
          description: Ordered execution steps that make up this tool
          minItems: 1
          items:
            $ref: '#/components/schemas/ToolStep'
        outputTransform:
          type: string
          description: |
            JavaScript function for final output transformation.
            Format: (sourceData) => expression
          example: >-
            (sourceData) => sourceData.map(item => ({ id: item.id, title:
            item.name }))
        folder:
          type: string
          description: Folder path for organizing tools
          example: integrations/payments
        archived:
          type: boolean
          description: >-
            Whether this tool is archived (if so, it will not be listed in the
            UI and cannot be run)
          default: false
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    StepResult:
      type: object
      description: Execution result for a single tool step
      required:
        - stepId
        - success
      properties:
        stepId:
          type: string
          description: ID of the step that was executed
        success:
          type: boolean
          description: Whether the step completed successfully
        data:
          type: object
          description: Step result data
          additionalProperties: true
        error:
          type: string
          description: Error message if the step failed
    FileArtifact:
      type: object
      description: A downloadable file artifact produced by a tool
      required:
        - fileKey
        - filename
        - contentType
        - size
      properties:
        fileKey:
          type: string
          description: Unique key identifying this file within the run
          example: report
        filename:
          type: string
          description: Original filename
          example: monthly_report.csv
        contentType:
          type: string
          description: MIME type of the file
          example: text/csv
        size:
          type: integer
          description: File size in bytes
          example: 52480
        downloadUrl:
          type: string
          format: uri
          description: >-
            Pre-signed download URL, valid for 1 hour. Included in single-run
            and file-specific endpoints, omitted in list responses.
          example: >-
            https://s3.amazonaws.com/bucket/org/run-files/runId/report.csv?X-Amz-Expires=3600
    ToolStep:
      type: object
      description: >
        A single execution step containing either a request configuration (API
        call)

        or a transform configuration (data transformation).
      required:
        - id
        - config
      properties:
        id:
          type: string
          description: Unique identifier for this step
          example: 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
        config:
          $ref: '#/components/schemas/StepConfig'
        instruction:
          type: string
          description: Human-readable instruction describing what this step does
          example: Fetch user details from the API
        modify:
          type: boolean
          description: Whether this step modifies data on the system it operates on
          default: false
        dataSelector:
          type: string
          description: |
            JavaScript function to select data for loop execution.
            Format: (sourceData) => expression
          example: (sourceData) => sourceData.data.items
        failureBehavior:
          type: string
          enum:
            - fail
            - continue
          description: >-
            How to handle step failures (fail stops execution, continue proceeds
            to next step)
          default: fail
    StepConfig:
      oneOf:
        - $ref: '#/components/schemas/RequestStepConfig'
        - $ref: '#/components/schemas/TransformStepConfig'
      discriminator:
        propertyName: type
        mapping:
          request:
            $ref: '#/components/schemas/RequestStepConfig'
          transform:
            $ref: '#/components/schemas/TransformStepConfig'
    RequestStepConfig:
      type: object
      description: >
        Configuration for a request step. Protocol is detected from URL scheme:

        - HTTP/HTTPS: Standard REST API calls with query params, headers, body

        - Postgres: postgres:// or postgresql:// URLs, body contains SQL query

        - FTP/SFTP: ftp://, ftps://, or sftp:// URLs, body contains operation
        details
      required:
        - url
        - method
      properties:
        type:
          type: string
          enum:
            - request
          description: Optional type discriminator (defaults to request)
        url:
          type: string
          description: |
            Full URL including protocol. Examples:
            - HTTP: https://api.example.com/search
            - Postgres: postgres://user:pass@host:5432/database
            - FTP: ftp://user:pass@host:21/path
            - SFTP: sftp://user:pass@host:22/path
          example: https://api.example.com/search
        method:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - DELETE
            - PATCH
            - HEAD
            - OPTIONS
          description: HTTP method. For non-HTTP protocols, use POST.
          example: GET
        queryParams:
          type: object
          description: >-
            URL query parameters (HTTP only). Supports template expressions with
            <<(sourceData) => ...>> syntax.
          additionalProperties: true
          example:
            q: <<(sourceData) => sourceData.query>>
            limit: 10
        headers:
          type: object
          description: >-
            HTTP headers (HTTP only). Supports template expressions with
            <<(sourceData) => ...>> syntax.
          additionalProperties: true
          example:
            Content-Type: application/json
            Authorization: Bearer <<(sourceData) => sourceData.credentials.apiKey>>
        body:
          type: string
          description: >
            Request body (protocol-specific). Supports template expressions with
            <<(sourceData) => ...>> syntax.


            HTTP: Any content (JSON, XML, form data, etc.)

            Example: '{"query": "<<(sourceData) => sourceData.query>>"}'


            Postgres: JSON with query and optional params

            Example: '{"query": "SELECT * FROM users WHERE id = $1", "params":
            ["<<(sourceData) => sourceData.userId>>"]}'


            FTP/SFTP: JSON with operation, path, and optional content

            Example: '{"operation": "get", "path": "/data/file.csv"}'

            Example: '{"operation": "list", "path": "/data"}'

            Example: '{"operation": "put", "path": "/data/file.txt", "content":
            "<<(sourceData) => sourceData.fileContent>>"}'
          example: '{"query": "<<(sourceData) => sourceData.query>>"}'
        pagination:
          $ref: '#/components/schemas/Pagination'
        systemId:
          type: string
          description: System to use for stored credentials and documentation
          example: 3f7c8d9e-1a2b-4c5d-8e9f-0a1b2c3d4e5f
    TransformStepConfig:
      type: object
      description: >
        Configuration for a transform step. Transform steps execute JavaScript
        code

        to reshape data between request steps without making external API calls.
      required:
        - type
        - transformCode
      properties:
        type:
          type: string
          enum:
            - transform
          description: Type discriminator for transform steps
        transformCode:
          type: string
          description: |
            JavaScript function that transforms sourceData.
            Format: (sourceData) => transformedData
            The function receives all previous step results and payload data.
          example: >-
            (sourceData) => sourceData.getUsers.data.map(u => ({ id: u.id, name:
            u.fullName }))
    Pagination:
      type: object
      description: >-
        Pagination configuration (HTTP/HTTPS only, not applicable to
        Postgres/FTP)
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - offsetBased
            - pageBased
            - cursorBased
            - disabled
          example: cursorBased
        pageSize:
          type: string
          description: >-
            Number of items per page. Becomes available as <<(sourceData) =>
            sourceData.limit>> in request templates.
          example: '50'
        cursorPath:
          type: string
          description: >-
            JSONPath to extract next page cursor from response body (e.g.
            "meta.next_cursor" for {meta:{next_cursor:"abc"}})
          example: meta.next_cursor
        stopCondition:
          type: string
          description: >
            JavaScript function to determine when to stop pagination. Format:
            (response, pageInfo) => boolean

            - response: Object with {data: ..., headers: ...} - access response
            body via response.data

            - pageInfo: Object with {page: number, offset: number, cursor: any,
            totalFetched: number}

            - Return true to STOP pagination, false to continue
          example: (response, pageInfo) => !response.data.pagination.has_more
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: Static API Key
      description: >
        Static API key authentication using Bearer token scheme.

        Include your API key in the Authorization header: `Authorization: Bearer
        YOUR_API_KEY`


        Alternatively, you can use the `token` query parameter to authenticate.


        API keys can be generated in your superglue dashboard.

````