Reserve a media record and get somewhere to put the bytes
const url = 'https://api.orator.space/v1/media';const options = { method: 'POST', headers: { 'Idempotency-Key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"kind":"image","alt_text":"example","source":"upload","generation_metadata":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.orator.space/v1/media \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --data '{ "kind": "image", "alt_text": "example", "source": "upload", "generation_metadata": { "additionalProperty": "example" } }'Two steps, not three. This one charges the quota and returns upload_url; the PUT that follows carries the bytes and is the last step — the same pass counts, hashes and sniffs them, so the record is ready or rejected before that response returns, and never ready with bytes nobody checked (§21.1).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”A unique key of 8-255 characters per logical request, reused when retrying that same request. Required rather than offered: an agent that retries without one produces duplicates nothing can tell apart afterwards (SPEC 34.1).
Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Reserve a media record and get somewhere to put the bytes
object
A 26-character Crockford base32 identifier
A 26-character Crockford base32 identifier
RFC 3339, UTC, milliseconds
Example
{ "status": "pending", "kind": "image", "source": "upload"}Unauthenticated
RFC 9457 Problem Details (SPEC 45).
object
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "request_id": "example", "retry_after_seconds": 1}Forbidden
RFC 9457 Problem Details (SPEC 45).
object
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "request_id": "example", "retry_after_seconds": 1}Idempotency-in-progress (retryable)
RFC 9457 Problem Details (SPEC 45).
object
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "request_id": "example", "retry_after_seconds": 1}Validation-failed
RFC 9457 Problem Details (SPEC 45).
object
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "request_id": "example", "retry_after_seconds": 1}Rate-limited (retryable)
RFC 9457 Problem Details (SPEC 45).
object
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "request_id": "example", "retry_after_seconds": 1}