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

# Cancel run

> Stop a run. A `queued` run is cancelled at once. A `running` run is asked to stop: it finishes as
`cancelled` at its next check-in, about 15 seconds by default, keeping what had already finished. Answers
`409 wrong_state` when the run has already ended, and when it is `waiting_approval`: a run waiting for a
decision is ended by rejecting it in the Vortex IQ app, not here.

Needs the `automations:write` scope.



## OpenAPI

````yaml automations/api/openapi.json POST /v1/automations/runs/{runId}/cancel
openapi: 3.1.0
info:
  title: Vortex IQ Automations API
  version: 1.0.0
  description: >
    REST API for Vortex IQ Automations. List the templates your organisation can
    use, set automations up on your

    stores, schedule them, run them, and follow every run, from your own tools
    instead of the Automations screens.


    The API is served from `https://automations-api.vortexiq.ai`; the login that
    gives you a token is on

    `https://app.vortexiq.ai`. Every call acts as the person who logged in,
    within their organisation, and every

    answer is JSON. See [Authentication](/automations/api/authentication).
  contact:
    name: Vortex IQ Support
    url: https://www.vortexiq.ai/contact-us
servers:
  - url: https://automations-api.vortexiq.ai
    description: Vortex IQ Automations (production)
security:
  - bearerAuth: []
  - apiCredential: []
tags:
  - name: Authentication
    description: >-
      Exchange your identity and your organisation's API credential for a bearer
      token.
  - name: Templates & stores
    description: What you can set up, and what it can run on.
  - name: Automations
    description: Set automations up, read them and change them.
  - name: Automation controls
    description: Pause, resume, archive and restore.
  - name: Runs
    description: Run an automation now, follow a run, read the history.
  - name: Schedules & calendar
    description: Preview a schedule, list the coming runs, move or skip one.
  - name: Approvals
    description: >-
      The runs waiting for a decision. Deciding happens in the Vortex IQ app
      only.
  - name: Imported workflows
    description: >-
      Bring an n8n or Shopify Flow workflow in, see how it would run, and run it
      as your own automation.
  - name: Status
    description: >-
      Whether Automations are on for your organisation, and how the service is
      doing.
paths:
  /v1/automations/runs/{runId}/cancel:
    post:
      tags:
        - Runs
      summary: Cancel run
      description: >-
        Stop a run. A `queued` run is cancelled at once. A `running` run is
        asked to stop: it finishes as

        `cancelled` at its next check-in, about 15 seconds by default, keeping
        what had already finished. Answers

        `409 wrong_state` when the run has already ended, and when it is
        `waiting_approval`: a run waiting for a

        decision is ended by rejecting it in the Vortex IQ app, not here.


        Needs the `automations:write` scope.
      operationId: cancelRun
      parameters:
        - name: runId
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/Id'
          description: The run's id.
      responses:
        '200':
          description: The run, `cancelled` or with `cancel_requested_at` set.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunResponse'
              example:
                success: true
                contract_version: 1
                data:
                  run:
                    id: 01M520GWV3SDB6DP4E29Q79C2S
                    automation_id: 01M520GSDQH5TQ3CAAQ584TTKH
                    template_id: shopify-catalogue-quality
                    template_version: 4
                    trigger: manual
                    lane: interactive
                    mode: normal
                    status: cancelled
                    reason_code: cancelled_by_merchant
                    message: null
                    platform_fault: false
                    attempt: 1
                    store_label: Example Shopify store
                    queued_at: '2026-10-16T09:26:06.948Z'
                    started_at: null
                    finished_at: '2026-10-16T09:26:06.967Z'
                    duration_ms: null
                    queue_wait_ms: null
                    cancel_requested_at: '2026-10-16T09:26:06.967Z'
                    summary: null
                    result: null
                    result_truncated: false
                    usage: null
                    receipt: null
                    event_ref: null
                    created_by: 7
                    created_via: api-token
                    api_client_id: viq_auto_Ab12Cd34Ef56Gh78Ij90Kl12
        '401':
          $ref: '#/components/responses/Unauthorised'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/WrongState'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - bearerAuth:
            - automations:write
        - apiCredential:
            - automations:write
components:
  schemas:
    Id:
      type: string
      description: A public id (a ULID).
      pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
    RunResponse:
      type: object
      required:
        - success
        - data
        - contract_version
      properties:
        success:
          type: boolean
          const: true
        contract_version:
          $ref: '#/components/schemas/ContractVersion'
        data:
          type: object
          required:
            - run
          properties:
            run:
              $ref: '#/components/schemas/Run'
    ContractVersion:
      type: integer
      minimum: 1
      description: >-
        The version of the API this answer follows. It changes only for a
        breaking change.
    Run:
      type: object
      required:
        - id
        - automation_id
        - template_id
        - template_version
        - trigger
        - lane
        - mode
        - status
        - reason_code
        - message
        - platform_fault
        - attempt
        - store_label
        - queued_at
        - started_at
        - finished_at
        - duration_ms
        - queue_wait_ms
        - cancel_requested_at
        - summary
        - result
        - result_truncated
        - usage
        - receipt
      properties:
        id:
          $ref: '#/components/schemas/Id'
        automation_id:
          $ref: '#/components/schemas/Id'
        template_id:
          $ref: '#/components/schemas/TemplateId'
        template_version:
          type: integer
          minimum: 1
        trigger:
          $ref: '#/components/schemas/RunTrigger'
        event_ref:
          type:
            - string
            - 'null'
          maxLength: 200
          description: >-
            For a run a store event started: the topic and what it was about,
            such as `inventory_levels/update · 4471`; never the event's body.
            Null otherwise.
        lane:
          $ref: '#/components/schemas/Lane'
        mode:
          $ref: '#/components/schemas/RunMode'
        status:
          $ref: '#/components/schemas/RunStatus'
        reason_code:
          oneOf:
            - $ref: '#/components/schemas/ReasonCode'
            - type: 'null'
        message:
          type:
            - string
            - 'null'
          description: Plain words for you, including what to do next.
        platform_fault:
          type: boolean
          description: >-
            True when the run ended because of a fault on Vortex IQ's side; it
            then never counts against the automation.
        attempt:
          type: integer
          minimum: 1
        store_label:
          type: string
        queued_at:
          $ref: '#/components/schemas/Timestamp'
        started_at:
          oneOf:
            - $ref: '#/components/schemas/Timestamp'
            - type: 'null'
        finished_at:
          oneOf:
            - $ref: '#/components/schemas/Timestamp'
            - type: 'null'
        duration_ms:
          type:
            - integer
            - 'null'
          minimum: 0
        queue_wait_ms:
          type:
            - integer
            - 'null'
          minimum: 0
          description: Time from queued to started, in milliseconds.
        cancel_requested_at:
          oneOf:
            - $ref: '#/components/schemas/Timestamp'
            - type: 'null'
        summary:
          type:
            - string
            - 'null'
          description: One or two sentences of what was found or done.
        result:
          description: >-
            The program's result, redacted, capped at 256 KB. Its shape is the
            template's `result_view`; for a `workflow` automation it is a
            `WorkflowResult`.
          type:
            - object
            - array
            - string
            - 'null'
          additionalProperties: true
        result_truncated:
          type: boolean
          description: True when the result was too large to include in full.
        usage:
          oneOf:
            - $ref: '#/components/schemas/RunUsage'
            - type: 'null'
        receipt:
          oneOf:
            - $ref: '#/components/schemas/Receipt'
            - type: 'null'
        created_by:
          type:
            - integer
            - 'null'
          description: >-
            The id of the person who started it by hand: with this API, the
            person named at login. Null for a run its schedule or a store event
            started.
        created_via:
          description: >-
            How it was started: `ui` in the Vortex IQ app, `api-token` through
            this API. Null for a run its schedule or a store event started.
          oneOf:
            - type: string
              enum:
                - ui
                - api-token
            - type: 'null'
        api_client_id:
          type:
            - string
            - 'null'
          description: >-
            The API credential's client id when `created_via` is `api-token`;
            null otherwise.
    ErrorResponse:
      type: object
      required:
        - success
        - message
        - contract_version
      properties:
        success:
          type: boolean
          const: false
        contract_version:
          $ref: '#/components/schemas/ContractVersion'
        message:
          type: string
          description: Plain words saying what happened and what to do.
        code:
          type: string
          description: >-
            A stable code to act on, such as `wrong_state`, `stale_version` or
            `allowance_spent`.
        errors:
          type: object
          description: Field name to messages, for 422.
          additionalProperties:
            type: array
            items:
              type: string
    TemplateId:
      type: string
      description: The template's id, such as `shopify-catalogue-quality`.
      pattern: ^[a-z0-9][a-z0-9-]{1,80}$
    RunTrigger:
      type: string
      enum:
        - manual
        - schedule
        - retry
        - event
      description: >-
        How the run started: `manual` (by hand), `schedule`, or `event` (a store
        event). `retry` is reserved and not used yet.
    Lane:
      type: string
      enum:
        - interactive
        - scheduled
      description: >-
        `interactive` for a run started by hand, which starts ahead of scheduled
        work; `scheduled` for the rest.
    RunMode:
      type: string
      enum:
        - normal
        - test
      description: >-
        `normal`, or `test`: reads are real and every change to your store is
        refused.
    RunStatus:
      type: string
      enum:
        - queued
        - running
        - waiting_approval
        - succeeded
        - failed
        - refused
        - cancelled
        - expired
    ReasonCode:
      type: string
      description: >-
        Why a run did not succeed, as a stable code; `message` says the same in
        plain words, and what to do. On Vortex IQ's side, setting
        `platform_fault` and never counting against the automation:
        `runner_lost`, `service_restart`, `runner_out_of_memory`,
        `run_over_memory`, `credentials_unavailable`, `needs_review` and
        `model_unavailable`. The automation's own: `timed_out` and
        `program_failed`. Neither a failure nor a fault: `connection_missing`
        (connect what it names), `approval_mismatch`, `refused_check`,
        `cancelled_by_merchant`, `approval_expired`, `superseded` (the workflow
        changed after the run was queued), `store_busy` (the store stayed too
        busy to answer), `automation_off` (the automation was paused, archived
        or deleted first), and, for a store event that was not run,
        `too_many_waiting` (200 of its runs were already waiting) and
        `event_too_large` (the event was over 256 KB).
      enum:
        - runner_lost
        - service_restart
        - runner_out_of_memory
        - credentials_unavailable
        - needs_review
        - model_unavailable
        - timed_out
        - program_failed
        - run_over_memory
        - connection_missing
        - approval_mismatch
        - refused_check
        - cancelled_by_merchant
        - approval_expired
        - superseded
        - too_many_waiting
        - event_too_large
        - store_busy
        - automation_off
    Timestamp:
      type: string
      format: date-time
      description: A time in UTC (ISO 8601).
    RunUsage:
      type: object
      description: What the run used, measured, never estimated.
      required:
        - connector_calls
        - ai_calls
        - ai_tokens_in
        - ai_tokens_out
        - peak_memory_mb
      properties:
        connector_calls:
          type: integer
          minimum: 0
        ai_calls:
          type: integer
          minimum: 0
        ai_tokens_in:
          type: integer
          minimum: 0
        ai_tokens_out:
          type: integer
          minimum: 0
        peak_memory_mb:
          type:
            - integer
            - 'null'
          minimum: 0
    Receipt:
      type: object
      description: What the run read, and which AI model it used, if any.
      required:
        - reads
        - ai_provider
        - ai_model
        - cached_answers_reused
      properties:
        reads:
          type: array
          items:
            type: object
            required:
              - what
              - count
            properties:
              what:
                type: string
              count:
                type: integer
                minimum: 0
        ai_provider:
          type:
            - string
            - 'null'
        ai_model:
          type:
            - string
            - 'null'
        cached_answers_reused:
          type: integer
          minimum: 0
  responses:
    Unauthorised:
      description: >-
        The token is missing, has expired, or is no longer valid (for example,
        the API credential was rotated or disabled). The answer carries
        `WWW-Authenticate`; log in again for a new token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: >-
        Your token is valid but may not do this: it lacks the scope, the
        operation is not part of the Automations API, or Automations are
        switched off for your organisation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: >-
        Not found. Anything that belongs to another organisation is answered the
        same way.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    WrongState:
      description: It is not in a state that allows this; nothing changed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: >-
        Too many calls in a minute from you or your organisation; nothing was
        done. `Retry-After` says how many seconds to wait.
      headers:
        Retry-After:
          schema:
            type: integer
            minimum: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        A bearer token from [Login](/automations/api/login), sent as
        `Authorization: Bearer <token>`. Valid for 60 minutes; it acts as the
        person named at login, within their organisation, and never approves.
        Rotating or disabling the organisation's API credential ends every token
        made with it on its next call. See
        [Authentication](/automations/api/authentication).
    apiCredential:
      type: oauth2
      description: >-
        Your organisation's API credential, exchanged at
        [Login](/automations/api/login) for the bearer token above: an OAuth 2.0
        client-credentials request, with the `username`, `email` and
        `organization_name` of the person the token acts as sent as extra
        fields, as Postman's OAuth 2.0 helper can send them. The token never
        holds `automations:approve`.
      flows:
        clientCredentials:
          tokenUrl: https://app.vortexiq.ai/v2/api/automations/login
          scopes:
            automations:read: >-
              Read automations, templates, stores, runs, the calendar, approvals
              and imports.
            automations:write: >-
              Set automations up, change, pause, resume, archive, restore and
              run them; move and skip coming runs; keep and delete imports.

````

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