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
Update cluster environment variables
To add or update environment variables in a Mage Pro cluster, modify theextraEnvs field in the cluster config.
Example: update environment variables
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
Mage Pro /runs api endpoint
Mage Pro /runs api endpoint
The
Option B: Bearer token in the Authorization headerTo generate a token:
Access the variable inside your block:
/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:- Validates the token against an API-type pipeline trigger
- Resolves the target pipeline and block
- Runs upstream blocks if
run_upstream_blocksistrue - Executes the target block with any variables injected via
kwargs - Returns the block output in the same HTTP response
- Writes a
PipelineRunandBlockRunrecord to the database ifrecordistrue
Endpoint
Authentication
Every call to/runs requires a token from an API-type pipeline trigger.Option A: Token in the URL- Open your pipeline in Mage Pro and go to the Triggers tab
- Click Add Trigger and select type API
- 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 viakwargs.Response
A successful call returns HTTP 200 with the block output under therun key:Request Options Reference
| Option | Default | Description |
|---|---|---|
pipeline_uuid | required | The unique identifier of the pipeline containing the target block |
block_uuid | required | The unique identifier of the block to execute |
variables | {} | Key-value pairs injected into the block at runtime via kwargs |
project | null | Scopes the pipeline lookup to a specific sub-project in a multi-project workspace |
record | true | Write a PipelineRun and BlockRun record to the Mage database |
store_variables | true | Persist the passed variables to disk alongside the block run record |
run_upstream_blocks | false | Run all upstream block dependencies before executing the target block |
incomplete_only | false | When run_upstream_blocks is true, skip upstream blocks that already completed successfully |
Error Handling
The endpoint raises exceptions directly rather than wrapping them in an error envelope.| Condition | Behaviour |
|---|---|
| Missing or invalid token | 401 Unauthenticated. The request is rejected before any pipeline lookup. |
| Token does not match a trigger | 404 Resource Not Found |
pipeline_uuid not found | 404 Resource Not Found. UUIDs are case-sensitive. |
block_uuid not found | 404 Resource Not Found. The block must exist within the specified pipeline. |
| Block throws an exception | The exception propagates to the HTTP response. Database records are marked FAILED when record is true. |
Audit Trail
Whenrecord 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.