Mage Pipeline Runs API

Trigger pipeline runs and read run status.

OpenAPI Specification

mage-ai-pipeline-runs-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Mage Blocks Pipeline Runs API
  description: REST API exposed by the self-hosted Mage data pipeline app. It covers triggering pipeline runs via API triggers (pipeline schedules), reading pipeline runs, and managing pipelines, blocks, and pipeline schedules. Requests are authenticated with an api_key (query parameter or request body) plus an OAuth token supplied via the OAUTH-TOKEN header or the oauth_token cookie. The default local server runs on port 6789.
  termsOfService: https://www.mage.ai/terms
  contact:
    name: Mage
    url: https://www.mage.ai
  version: '1.0'
servers:
- url: http://localhost:6789/api
  description: Default self-hosted Mage app
- url: https://{host}/api
  description: Custom self-hosted or Mage Pro cloud deployment
  variables:
    host:
      default: localhost:6789
      description: Host and port of the Mage deployment
security:
- ApiKeyAuth: []
  OAuthToken: []
tags:
- name: Pipeline Runs
  description: Trigger pipeline runs and read run status.
paths:
  /pipeline_schedules/{schedule_id}/pipeline_runs/{token}:
    post:
      operationId: triggerPipelineRun
      tags:
      - Pipeline Runs
      summary: Trigger a pipeline run via an API trigger
      description: Creates a pipeline run for the pipeline schedule (API trigger) identified by schedule_id. The token is the unique token associated with the API trigger. Runtime variables can be passed nested under pipeline_run.variables or as a flat object.
      parameters:
      - name: schedule_id
        in: path
        required: true
        description: The unique ID of the pipeline schedule (API trigger).
        schema:
          type: integer
      - name: token
        in: path
        required: true
        description: The unique token associated with the API trigger.
        schema:
          type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriggerPipelineRunRequest'
            examples:
              nested:
                summary: Nested runtime variables
                value:
                  pipeline_run:
                    variables:
                      env: staging
                      schema: public
      responses:
        '200':
          description: Pipeline run created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineRunResponse'
  /pipeline_runs:
    get:
      operationId: listPipelineRuns
      tags:
      - Pipeline Runs
      summary: List pipeline runs
      parameters:
      - name: api_key
        in: query
        required: false
        schema:
          type: string
      - name: _limit
        in: query
        required: false
        schema:
          type: integer
      - name: _offset
        in: query
        required: false
        schema:
          type: integer
      responses:
        '200':
          description: A collection of pipeline runs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineRunsResponse'
  /pipeline_runs/{id}:
    get:
      operationId: readPipelineRun
      tags:
      - Pipeline Runs
      summary: Read a single pipeline run
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: api_key
        in: query
        required: false
        schema:
          type: string
      responses:
        '200':
          description: A single pipeline run.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineRunResponse'
components:
  schemas:
    TriggerPipelineRunRequest:
      type: object
      properties:
        pipeline_run:
          type: object
          properties:
            variables:
              type: object
              additionalProperties: true
              description: Runtime variables passed to the pipeline run.
    PipelineRunResponse:
      type: object
      properties:
        pipeline_run:
          $ref: '#/components/schemas/PipelineRun'
    PipelineRun:
      type: object
      properties:
        id:
          type: integer
        pipeline_uuid:
          type: string
        pipeline_schedule_id:
          type: integer
        status:
          type: string
          enum:
          - initial
          - running
          - completed
          - failed
          - cancelled
        execution_date:
          type: string
          format: date-time
        variables:
          type: object
          additionalProperties: true
    PipelineRunsResponse:
      type: object
      properties:
        pipeline_runs:
          type: array
          items:
            $ref: '#/components/schemas/PipelineRun'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: query
      name: api_key
      description: API key passed as the api_key query parameter or in the request body.
    OAuthToken:
      type: apiKey
      in: header
      name: OAUTH-TOKEN
      description: Decoded OAuth token passed in the OAUTH-TOKEN header, or the raw token passed via the oauth_token cookie.