Generations API: quote, submit and settle media jobs
Use UplinkSwitch media jobs with validated settings, a no-charge quote, asynchronous status and explicit output retention and settlement rules.
Treat media generation as an asynchronous job with a separate price check. Discover a model’s settings, quote the exact input, submit once, then follow the returned job identifier to its result. This keeps acceptance, completion and final charge distinct in your integration.
Discover the model-specific inputs
The public GET /v1/catalog/media returns object: list and a data array of media entries. Inspect id, kind, endpoints, params, unit and pricing before composing a request. This discovery route requires no key and its description specifies a five-minute cache. The general /v1/catalog is a separate feed; use the media catalog for media identifiers.
A parameter always declares its type; other declared controls are required, values, default, min, max and max_items. The contract’s media kinds are image, video, audio and 3d. These categories do not guarantee current availability in every category.
Validate and quote
Both POST /v1/generations/quote and POST /v1/generations require a string model and an object input. Settings inside input come from the selected entry’s params, not from a universal list of image or video options. A quote validates the same settings as creation, returns 200 and holds, charges and logs nothing.
| Quote field | Contract |
|---|---|
object, endpoint | Fixed to quote and /v1/generations. |
model, kind, input | Model, media category and validated settings with defaults applied. |
units, unit | Numeric quantity and string billing unit. |
charge_usd | Decimal-string charge for this key. |
list_usd, saved_usd | Nullable strings for comparison with the recorded developer price. |
settles | True when the quoted maximum-output charge settles after completion. |
All fields in this quote table are required, including those that can be null. No fixed model price is reproduced here.
Follow the accepted job
Creation answers 202 with a generation to poll. Charging occurs when the model accepts the task; a failed generation is refunded in full. GET /v1/generations/{generation_id} returns the record and refreshes upstream progress for an open job at most once every two seconds. A 200 read reports a record, not necessarily successful output.
The required response members are id, object, model, kind, status, progress, created, completed, outputs, error and charge. The ID matches gen_ followed by 24 lowercase hex characters, and object is generation.
| Member | Interpretation |
|---|---|
status | queued, running, succeeded or failed. |
progress | Integer percentage or null; 100 once successful. |
created, completed | Unix seconds; completion is nullable. |
outputs | Array whose entries require url, content_type and integer bytes. |
error | Null or an object requiring message. |
charge | Requires decimal-string amount_usd, numeric units, string unit and boolean refunded. |
After failure the documented charge is zero and refunded is true. For models declaring settles_on_completion, optional charge.hold_usd records the initial maximum charge and charge.settled confirms final settlement; the unused difference returns to balance.
List jobs and keep the files
GET /v1/generations lists organization jobs newest first. Set limit from 1 to 100, default 20, and optionally filter by kind, model or status. before accepts Unix seconds or milliseconds. The response contains object: list, data, has_more and nullable next_before; pass the latter as before for the next page when has_more is true. A list read refreshes up to ten open jobs.
This read example uses an ordinary key in UPLINKSWITCH_API_KEY:
curl --fail-with-body 'https://api.uplinkswitch.com/v1/generations?kind=image&status=succeeded&limit=20' \
-H "Authorization: Bearer ${UPLINKSWITCH_API_KEY}"Output files are kept for 30 days. Their URLs grant downloads without a key, unlike the authenticated job record. The files reference explains that access distinction; SDK setup covers initial connection settings.
Access and documented failures
Generation operations inherit ordinary API-key authentication. For console-session support, the OpenAPI document does not say. Quote errors include 400 invalid settings, 401 invalid key, 403 scope failure and 404 unknown model. Creation additionally declares balance and spending failures (402), a 1 MB body ceiling (413), rate limiting (429), failure to start (502, uncharged) and unavailable media generation (503). A job read declares 401 and 404; listing also declares 400 for invalid status. These response sets are operation-specific.
For idempotent creation, cancellation and completion webhooks, the OpenAPI document does not say. Keep those gaps separate from the lifecycle explicitly documented above.