Jobs API
Submit asynchronous generations through POST /v2/jobs. Poll or register a webhook for the result. All supported models use the same job envelope. The selected model defines the fields inside input.
| Resource | Purpose |
|---|---|
| Model inputs | Validate parameters and inspect example requests. |
| Models and prices | Discover supported models and estimate charges. |
| Failures and retries | Handle submit errors and recover jobs by idempotency key. |
| Webhooks | Verify signed terminal events and handle retries. |
Base URL: https://api.sociaro.com. Authenticate with Authorization: Bearer <your-api-key>.
Submit
POST /v2/jobs requires an Idempotency-Key header. Repeating a request with the same key and body returns the original job. Reusing a key with a different body returns 409. A lost response can be recovered by looking up the key.
Example image generation request and response:
curl https://api.sociaro.com/v2/jobs \
-H "Authorization: Bearer $SOCIARO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: my-request-0001" \
-d '{
"model": "alibaba/wan-2-7-image",
"input": {"prompt": "a paper boat drifting down a rain-soaked street"}
}'
# Requires Python 3 and requests (pip install requests).
import os
import requests
payload = {'model': 'alibaba/wan-2-7-image',
'input': {'prompt': 'a paper boat drifting down a rain-soaked street'}}
response = requests.post(
'https://api.sociaro.com/v2/jobs',
headers={
'Authorization': 'Bearer ' + os.environ['SOCIARO_API_KEY'],
'Content-Type': 'application/json',
'Idempotency-Key': 'my-request-0001',
},
json=payload,
timeout=120,
)
response.raise_for_status()
print(response.text)// Run as an .mjs file with Node.js 22 or later.
const payload = {
"model": "alibaba/wan-2-7-image",
"input": {
"prompt": "a paper boat drifting down a rain-soaked street"
}
};
const response = await fetch("https://api.sociaro.com/v2/jobs", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.SOCIARO_API_KEY,
"Content-Type": "application/json",
"Idempotency-Key": "my-request-0001",
},
body: JSON.stringify(payload),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.text());{"id": "job_5cc8778b79574aaa7ea8fc09caec23e5",
"model": "alibaba/wan-2-7-image",
"status": "queued",
"created_at": "2026-08-24T08:54:16.457268+00:00"}
| Field | Required | Description |
|---|---|---|
model |
Yes | Model ID returned by GET /v2/models. |
input |
Yes | Model parameters. An unknown field, invalid type or out-of-range value returns 400 invalid_input. See model inputs. |
output |
No | Output count and format. |
callback_url |
No | Public HTTPS endpoint for a signed terminal event. |
prompt_enhance |
No | Prompt enhancement mode. Availability is listed per model. |
Several outputs
Set output.count for independent outputs, up to the model's max_output_count. The supported output.format is url. Send parameters directly under input. Image generators that use separate provider count or batch controls reject conflicting fields such as input.n or a truthy enable_sequential with 400 invalid_input.
A model may define additional outputs. For example, Seedance can append an optional closing frame after a clip. Seedream layer decomposition returns the base and its layers as one composition with output.count: 1. Read the model's schema and outputs[].type when processing these results.
If a generator exceeds the permitted result count, the gateway withholds the outputs and charge. The job can remain running until it expires.
Callback
Set callback_url to receive the job after it reaches succeeded, failed, expired or canceled. The gateway signs each delivery and retries on failure. See webhook headers and retries.
Prompt enhancement
Use the modes listed in the model's prompt_enhance field in GET /v2/models. If the field is absent, only off is accepted.
| Mode | Behaviour |
|---|---|
off |
Default. Use the submitted prompt. |
basic |
Rewrite the prompt into a structured shot description. |
full |
Use reference images and audio, when supplied, to create a timed shot plan. Reference videos are excluded from analysis. |
For models that generate audio, the rewrite may include a soundscape, quoted dialogue and explicitly requested music. When you provide a soundtrack, it treats it as the full audio track. Enhancement uses Groq to process the prompt and, in full mode, the relevant images and audio. The rewritten prompt is not returned. Enhancement is free. The original prompt is used if rewriting fails or the prompt exceeds 4,000 characters.
Poll
GET /v2/jobs/{id} returns the current job. For a queued or running job, wait the number of seconds in retry_after or the Retry-After header before polling again.
Example completed image job:
{"id": "job_5cc8778b79574aaa7ea8fc09caec23e5",
"status": "succeeded",
"model": "alibaba/wan-2-7-image",
"media": "image",
"created_at": "2026-08-24T08:54:16.457268+00:00",
"completed_at": "2026-08-24T08:55:28.624694+00:00",
"retention_until": "2026-09-23T08:54:16.457268+00:00",
"cost_usd": 0.03,
"outputs": [{"url": "https://cdn.sociaro.com/v2/job_5cc8778b79574aaa7ea8fc09caec23e5/0-3f21c8ead6af7a981b5bf99fd705a745.png",
"type": "image",
"content_type": "image/png",
"expires_at": "2036-08-24T08:55:28.608057+00:00"}]}
Stop polling at succeeded, failed, canceled or expired. Use outputs[] on success and inspect the error on failure. Repeating the original submit with the same idempotency key also returns the job and its available outputs.
CDN output URLs, public URLs and presigned links allow downloads without a key. Anyone with the link can read the file. The file can outlive the job record's retention_until. Its expires_at describes the output lifetime. If the returned URL is on api.sociaro.com/v1/media/, use an API key from the owning account for the download. Send credentials only to the API host.
curl -L -o boat.png "https://cdn.sociaro.com/v2/job_5cc8778b79574aaa7ea8fc09caec23e5/0-3f21c8ead6af7a981b5bf99fd705a745.png"
# Requires Python 3 and requests (pip install requests).
from pathlib import Path
import requests
response = requests.get(
'https://cdn.sociaro.com/v2/job_5cc8778b79574aaa7ea8fc09caec23e5/0-3f21c8ead6af7a981b5bf99fd705a745.png',
timeout=120,
)
response.raise_for_status()
Path('boat.png').write_bytes(response.content)// Run as an .mjs file with Node.js 22 or later.
import { writeFile } from "node:fs/promises";
const response = await fetch("https://cdn.sociaro.com/v2/job_5cc8778b79574aaa7ea8fc09caec23e5/0-3f21c8ead6af7a981b5bf99fd705a745.png");
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
await writeFile("boat.png", new Uint8Array(await response.arrayBuffer()));Where the file is kept depends on the organisation's storage setting: on Sociaro storage outputs[].url is a permanent cdn.sociaro.com link. With "Do not store on gateway" it is a temporary link that works for up to its link lifetime (at least one hour) and only while the provider keeps the result, and expires_at is when it is meant to stop working. The provider can remove the result sooner, so expires_at is not a guaranteed availability deadline. With your own bucket it is a presigned link, a proxied link or a URL on your public address, and the file is in your bucket. A presigned link works for up to the lifetime you set (it stops sooner if the object, the bucket, the signing key or its read permission goes away): when it has expired, fetch the job again for a fresh one, because expires_at is then the file's retention, not the link's. retention_until only describes the job record. If the job record is gone but the file is still in your bucket, keep the file id and use GET /v2/files/{id} to get a fresh link. It gives a working link while the file is in your current storage; for a file in a former bucket see Switching.
To delete an output, locate its file ID with GET /v2/files?job_id=<job id> and send DELETE /v2/files/{id}. See Files API.
Cancel
POST /v2/jobs/{id}/cancel requests cancellation where supported. A terminal job is returned unchanged.
Limits
- Read
max_runtime_secandmax_output_countfrom the selected model's catalogue entry.deadline_atappears on the submitted job. Some models have extended processing windows. For example, MAGI-2 can continue past its reported deadline for up to six hours from submission. - A temporary error checking a running job does not by itself mark the job failed. Poll again after
Retry-After. - Read
cost_usdfor the settled charge. See billing.