Skip to main content

Mage Pro API overview

Mage Pro offers two main APIs for managing your workflows and infrastructure:
  • Mage Cloud API: Used to manage and update your Mage clusters from the Mage Cloud Portal.
  • Mage Pro cluster API: Runs on your Mage Pro cluster and is similar to the Mage OSS API, used to manage pipelines, runs, variables, and other resources.

Mage Cloud API

The Mage Cloud API is a private API used internally by the Mage Cloud Portal to manage Mage Pro clusters. It supports operations such as:
  • Starting, stopping, and restarting clusters
  • Updating cluster environment variables and configurations

Base URL

https://cloud.mage.ai/api/v1

Authentication

To interact with the Mage Cloud API, you must first authenticate with your Mage Cloud credentials and obtain a session token.

Example: Initialize session and get token

Start or stop a cluster

Once authenticated, you can update the cluster status by modifying the replicaCount and status in the cluster’s config.

Example: Start or stop a cluster

Example usage:

Update cluster environment variables

To add or update environment variables in a Mage Pro cluster, modify the extraEnvs field in the cluster config.

Example: update environment variables

Example usage:

Mage Pro cluster API

The Mage Pro Cluster API is the set of HTTP APIs available on your running Mage Pro cluster. It extends the Mage OSS API and allows:
  • Create/Get/Update/Delete pipelines/blocks
  • Trigger pipelines
  • CRUD pipeline schedules/triggers
  • CRUD pipeline runs
  • CRUD workspaces
  • Deploy git commits
  • More APIs available in Mage Pro UI
The /runs endpoint executes a single block within a pipeline and returns its output in the same HTTP response. No polling required.This is the right tool when an external application needs the result of a specific block right now, not after a full pipeline run. Common use cases include real-time scoring, record lookups, and enrichment logic triggered per request.

What It Does

When you call /runs, Mage works through the following steps:
  1. Validates the token against an API-type pipeline trigger
  2. Resolves the target pipeline and block
  3. Runs upstream blocks if run_upstream_blocks is true
  4. Executes the target block with any variables injected via kwargs
  5. Returns the block output in the same HTTP response
  6. Writes a PipelineRun and BlockRun record to the database if record is true

Endpoint


Authentication

Every call to /runs requires a token from an API-type pipeline trigger.Option A: Token in the URL
Option B: Bearer token in the Authorization header
To generate a token:
  1. Open your pipeline in Mage Pro and go to the Triggers tab
  2. Click Add Trigger and select type API
  3. Save and copy the token from the trigger detail page

Request Body


Example: Run a single block


Example: Run a block with runtime variables

Pass variables in the request body and they get injected into the block via kwargs.
Access the variable inside your block:

Response

A successful call returns HTTP 200 with the block output under the run key:

Request Options Reference


Error Handling

The endpoint raises exceptions directly rather than wrapping them in an error envelope.

Audit Trail

When record is true, Mage writes a PipelineRun and BlockRun record to the database on every call. You can see these in the Mage Pro UI under pipeline run history. Records are marked COMPLETED or FAILED depending on the outcome.If you are calling this endpoint at high frequency and do not need the audit log, set record to false to skip the database writes.

Base URL

https://<your-cluster-hostname>/api For the full list of cluster API endpoints, see the Mage Open Source API Reference.
Note: Mage Pro may expose additional admin or authentication APIs depending on your deployment and licensing tier.