Mage Pipelines API

Manage pipelines.

OpenAPI Specification

mage-ai-pipelines-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Mage Blocks Pipelines 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: Pipelines
  description: Manage pipelines.
paths:
  /pipelines:
    get:
      operationId: listPipelines
      tags:
      - Pipelines
      summary: List pipelines
      parameters:
      - name: api_key
        in: query
        required: false
        schema:
          type: string
      responses:
        '200':
          description: A collection of pipelines.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelinesResponse'
    post:
      operationId: createPipeline
      tags:
      - Pipelines
      summary: Create a pipeline
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePipelineRequest'
            examples:
              default:
                value:
                  pipeline:
                    name: arwen-starlight
                    type: python
      responses:
        '200':
          description: The created pipeline.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineResponse'
  /pipelines/{uuid}:
    get:
      operationId: readPipeline
      tags:
      - Pipelines
      summary: Read a pipeline
      parameters:
      - name: uuid
        in: path
        required: true
        schema:
          type: string
      - name: api_key
        in: query
        required: false
        schema:
          type: string
      responses:
        '200':
          description: A single pipeline.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineResponse'
    put:
      operationId: updatePipeline
      tags:
      - Pipelines
      summary: Update a pipeline
      parameters:
      - name: uuid
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePipelineRequest'
      responses:
        '200':
          description: The updated pipeline.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineResponse'
    delete:
      operationId: deletePipeline
      tags:
      - Pipelines
      summary: Delete a pipeline
      parameters:
      - name: uuid
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: The deleted pipeline.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineResponse'
components:
  schemas:
    Pipeline:
      type: object
      properties:
        uuid:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
          - python
          - pyspark
          - streaming
          - integration
        blocks:
          type: array
          items:
            $ref: '#/components/schemas/Block'
    UpdatePipelineRequest:
      type: object
      properties:
        pipeline:
          $ref: '#/components/schemas/Pipeline'
    Block:
      type: object
      properties:
        uuid:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
          - data_loader
          - transformer
          - data_exporter
          - scratchpad
          - sensor
          - custom
        language:
          type: string
        upstream_blocks:
          type: array
          items:
            type: string
        downstream_blocks:
          type: array
          items:
            type: string
    PipelineResponse:
      type: object
      properties:
        pipeline:
          $ref: '#/components/schemas/Pipeline'
    CreatePipelineRequest:
      type: object
      required:
      - pipeline
      properties:
        api_key:
          type: string
        pipeline:
          type: object
          properties:
            name:
              type: string
            type:
              type: string
    PipelinesResponse:
      type: object
      properties:
        pipelines:
          type: array
          items:
            $ref: '#/components/schemas/Pipeline'
  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.