Get model run
curl --request GET \
--url https://inference.magica.com/v1/nodes/runs/{runId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://inference.magica.com/v1/nodes/runs/{runId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://inference.magica.com/v1/nodes/runs/{runId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://inference.magica.com/v1/nodes/runs/{runId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://inference.magica.com/v1/nodes/runs/{runId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://inference.magica.com/v1/nodes/runs/{runId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.magica.com/v1/nodes/runs/{runId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"nodeType": "<string>",
"status": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"subModelId": "<string>",
"input": "<unknown>",
"output": "<unknown>",
"error": "<string>",
"userMessage": "<string>",
"replacedBy": "<string>",
"creditUsed": 123,
"source": "<string>"
}Standalone Model Runs
Get model run
Fetch the status and output for a model run you started.
GET
/
v1
/
nodes
/
runs
/
{runId}
Get model run
curl --request GET \
--url https://inference.magica.com/v1/nodes/runs/{runId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://inference.magica.com/v1/nodes/runs/{runId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://inference.magica.com/v1/nodes/runs/{runId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://inference.magica.com/v1/nodes/runs/{runId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://inference.magica.com/v1/nodes/runs/{runId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://inference.magica.com/v1/nodes/runs/{runId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.magica.com/v1/nodes/runs/{runId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"nodeType": "<string>",
"status": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"subModelId": "<string>",
"input": "<unknown>",
"output": "<unknown>",
"error": "<string>",
"userMessage": "<string>",
"replacedBy": "<string>",
"creditUsed": 123,
"source": "<string>"
}Use this endpoint only for runs started by
Clients should keep polling the same
If the lookup returns
POST /v1/nodes/{nodeType}/run.
Authorization
Path parameters
The
runId returned by POST /v1/nodes/{nodeType} /run.Response
Current run status. Poll until it reaches a terminal status such as
COMPLETED, FAILED, or CANCELED.Credits charged in microcredits. This may be
0 before a run settles or when
a failed run did not consume credits.Polling pattern
Poll every few seconds until the run reaches a terminal status.const terminal = new Set(["COMPLETED", "FAILED", "CANCELED"]);
let run = await getModelRun(runId);
const maxAttempts = 60;
for (
let attempt = 0;
attempt < maxAttempts && !terminal.has(run.status);
attempt++
) {
await new Promise((resolve) => setTimeout(resolve, 2000));
run = await getModelRun(runId);
}
if (!terminal.has(run.status)) {
throw new Error(`Run ${runId} did not finish before the polling timeout`);
}
runId until the API reports a terminal status.
Status handling
| Status | Meaning |
|---|---|
QUEUED | The run is waiting for model execution. Keep polling. |
RUNNING | The model execution is in progress. Keep polling. |
COMPLETED | The model output is ready to read from the response payload. |
FAILED | The run reached a terminal error state. Log the runId and inspect the error fields returned by the API. |
CANCELED | The run was canceled before completion. |
404, confirm that the runId came from the standalone model-run endpoint and belongs to the same authenticated account.
Request
- cURL
- Node.js
- Python
curl https://inference.magica.com/v1/nodes/runs/cmr7abc123modelrun \
-H "Authorization: Bearer $MAGICA_API_KEY"
async function getModelRun(runId) {
const res = await fetch(`https://inference.magica.com/v1/nodes/runs/${runId}`, {
headers: { Authorization: `Bearer ${process.env.MAGICA_API_KEY}` },
});
if (res.status === 404) return null;
if (!res.ok) throw new Error(`Status lookup failed: ${res.status}`);
return res.json();
}
import os, requests
res = requests.get(
"https://inference.magica.com/v1/nodes/runs/cmr7abc123modelrun",
headers={"Authorization": f"Bearer {os.environ['MAGICA_API_KEY']}"},
)
run = None if res.status_code == 404 else res.json()
Response example
{
"id": "cmr7abc123modelrun",
"nodeType": "nano_banana_pro",
"subModelId": "nano-banana-pro-text",
"status": "COMPLETED",
"input": {
"prompt": "A cinematic product photo of a glass speaker"
},
"output": {
"images": ["https://..."]
},
"error": null,
"creditUsed": 195000,
"source": "api",
"createdAt": "2026-07-05T13:00:00.000Z"
}
Errors
| Status | Reason |
|---|---|
400 | Missing or malformed runId path parameter |
401 | Missing or invalid API key |
404 | No standalone model run with that ID for the authenticated account |
429 | API key rate limit exceeded |
500 | Server error while loading or reconciling run status |
Authorizations
Response
Current model-run status and output.
Was this page helpful?