One run, optionally waiting up to 60 s for a final state.
curl --request GET \
--url https://api.spiral.ai/v1/runs/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.spiral.ai/v1/runs/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.spiral.ai/v1/runs/{id}', 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://api.spiral.ai/v1/runs/{id}",
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://api.spiral.ai/v1/runs/{id}"
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://api.spiral.ai/v1/runs/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spiral.ai/v1/runs/{id}")
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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "run",
"status": "queued",
"provider": "<string>",
"model": "<string>",
"output": {
"items": [
{
"type": "image",
"url": "<string>",
"mime_type": "<string>",
"size_bytes": 0,
"width": 0,
"height": 0,
"duration_seconds": 123,
"kind": "<string>",
"data": "<unknown>",
"expires_at": "<string>",
"field": "<string>",
"source": "provider",
"notice": "<string>",
"error": {
"code": "OUTPUT_UNAVAILABLE",
"message": "<string>"
}
}
],
"expired": true,
"dropped_count": 0
},
"usage": {
"units": [
{
"unit": "<string>",
"quantity": 123
}
]
},
"cost": {
"currency": "USD",
"state": "held",
"estimated": {
"amount": "<string>",
"amount_micros": 0
},
"charged": {
"amount": "<string>",
"amount_micros": 0
}
},
"charge_reason": "provider_billed_failure",
"timings": {
"created_at": "<string>",
"started_at": "<string>",
"completed_at": "<string>"
},
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
]
},
"metadata": {},
"idempotency_key": "<string>",
"app": {
"id": "<string>",
"url": "<string>",
"title": "<string>"
},
"sequence": 1,
"links": {
"self": "<string>"
}
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}Runs
Get a run
GET
/
v1
/
runs
/
{id}
One run, optionally waiting up to 60 s for a final state.
curl --request GET \
--url https://api.spiral.ai/v1/runs/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.spiral.ai/v1/runs/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.spiral.ai/v1/runs/{id}', 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://api.spiral.ai/v1/runs/{id}",
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://api.spiral.ai/v1/runs/{id}"
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://api.spiral.ai/v1/runs/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spiral.ai/v1/runs/{id}")
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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "run",
"status": "queued",
"provider": "<string>",
"model": "<string>",
"output": {
"items": [
{
"type": "image",
"url": "<string>",
"mime_type": "<string>",
"size_bytes": 0,
"width": 0,
"height": 0,
"duration_seconds": 123,
"kind": "<string>",
"data": "<unknown>",
"expires_at": "<string>",
"field": "<string>",
"source": "provider",
"notice": "<string>",
"error": {
"code": "OUTPUT_UNAVAILABLE",
"message": "<string>"
}
}
],
"expired": true,
"dropped_count": 0
},
"usage": {
"units": [
{
"unit": "<string>",
"quantity": 123
}
]
},
"cost": {
"currency": "USD",
"state": "held",
"estimated": {
"amount": "<string>",
"amount_micros": 0
},
"charged": {
"amount": "<string>",
"amount_micros": 0
}
},
"charge_reason": "provider_billed_failure",
"timings": {
"created_at": "<string>",
"started_at": "<string>",
"completed_at": "<string>"
},
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
]
},
"metadata": {},
"idempotency_key": "<string>",
"app": {
"id": "<string>",
"url": "<string>",
"title": "<string>"
},
"sequence": 1,
"links": {
"self": "<string>"
}
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}{
"type": "<string>",
"title": "<string>",
"status": 0,
"detail": "<string>",
"code": "<string>",
"retryable": true,
"request_id": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>",
"reason": "unknown_field",
"expected": "<string>",
"received": "<string>",
"allowed": [
"<string>"
]
}
],
"retry_after_seconds": 0
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
Long poll up to this many seconds for a final state (default 0).
Required range:
0 <= x <= 60Response
The run (also when it failed or was canceled); Retry-After while it is not final.
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Allowed value:
"run"Available options:
queued, running, completed, failed, canceled Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
provider_billed_failure, provider_billed_cancel Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes