Create a job
Charges credits and starts a generation. The charge and the job row are written in one transaction: there is no state in which credits are gone and no job exists.
Idempotency-Key is required, not optional. API clients may run where
a dropped connection is routine, and a retry without a key buys the same generation twice.
The key is recorded before the provider is called, so a retry that races the original still
returns the first job. Repeating a key returns the original job and the same 200.
A supplied character_id must belong to the account even on replay. After that authorization,
a replay whose body has a different owned character_id, or omits character_id, returns the
original job unchanged. The same established winner-takes-key rule applies when kind, model,
or input differs; the endpoint does not fingerprint repeated request bodies.
API key sent in the Authorization bearer header. Used by programmatic clients.
In: header
Header Parameters
Client-generated unique string. Reusing one returns its original job even if kind, model, input, or owned character differs; any supplied character is still authorized.
1 <= length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/jobs" \ -H "Idempotency-Key: string" \ -H "Content-Type: application/json" \ -d '{ "kind": "sprite", "input": { "property1": null, "property2": null } }'{ "id": "string", "character_id": "string", "kind": "sprite", "status": "queued", "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "progress": 0, "model": "string", "cost": { "tokens": 0 }, "input": { "property1": null, "property2": null }, "files_expired": true, "output": { "files": [ { "role": "string", "url": "http://example.com", "content_type": "string" } ], "loop": { "from": 1, "to": 1 } }, "error": { "code": "invalid_request", "message": "string", "details": { "property1": null, "property2": null } }}