Create a translation
Create a translation using exactly one source: JSON content for verbatim UTF-8 text, JSON file_url for an HTTPS download without redirects, JSON upload_id for a completed temporary upload on this same credential, or multipart/form-data with a file field for local binary bytes. Omit filename with upload_id; the session already owns its name. Repeating an upload_id returns the existing batch without changing its instruction. Send an Idempotency-Key header (any 1 to 255 printable characters, a UUID is fine) on the other sources to make a retry after a lost response safe: a repeat returns the batch the first attempt created, without fetching or storing the file or planning again, and the same key with different content is refused with 409 idempotency_key_reused. Otherwise filename is optional and inferred if absent. Include instruction to receive the verified plan, measured counts, credit cost and extraction preview; omit it to receive suggested_instructions. Check plan.not_included before approval. Creating and planning cost no credits. Per-format limits are on GET /v1/account. The translation appears in the web app.
POST/v1/batches
Requires batches:create. Creating a translation costs nothing: credits are reserved only when you approve a plan.
Choosing how to send the file
Choose the transport that matches where the document lives and what your client can do.
| Transport | Use it for | Notes |
|---|---|---|
JSON with upload_id | A local file sent through a temporary upload session | Use the same credential that created the session. Omit filename. Repeating creation returns the existing translation without changing its instruction. |
JSON with content | Any text format | The file itself as UTF-8 text. The simplest path for an agent that already holds the content in memory. |
JSON with file_url | A file already hosted | HTTPS only, fetched server-side. Redirects are not followed, so give the final URL. |
multipart/form-data | Local binary files, including XLSX, DOCX, PPTX, PDF, IDML and ZIP | Send the original bytes in the file field. This is the CLI’s local-file transport. |
filename is optional but worth sending. The extension is how the format is identified, so a name like strings.xml and a name like export.csv lead to different parsers on identical bytes.
Retrying safely
Send an Idempotency-Key header (any 1 to 255 printable characters; a UUID is a good choice) so a retry after a lost response returns the translation the first attempt created, instead of a second one. A repeat is answered before the file is fetched or stored and does not plan again, so it costs nothing. The key is bound to what you sent: the same key with a different file, name or instruction is refused with idempotency_key_reused. Use a new key for new work. Where headers are not available (MCP tools, Code Mode) pass idempotency_key in the body. A creation with an instruction returns plan_revision with the plan: pass it as expected_plan_revision when you approve.
What happens next
The response gives you an id, used as batch_id in subsequent paths. From there the sequence is always the same:
POST /v1/batches/{batch_id}/plan: describe what to translate, in your own words.POST /v1/batches/{batch_id}/approve: spend credits and start.GET /v1/batches/{batch_id}: poll until it finishes.GET /v1/batches/{batch_id}/result: collect the result. It returns a signed link, not the file itself.
Response
Create a translation from a file
dataobjectrequiredrequest_idstringrequiredPossible codes: invalid_request, unknown_field, invalid_parameter, invalid_cursor
errorobjectrequiredrequest_idstringrequiredPossible codes: authentication_required, invalid_api_key, api_key_expired, api_key_revoked
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_credits
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_scope, feature_not_available, admin_required, file_retention_expired
errorobjectrequiredrequest_idstringrequiredPossible codes: batch_not_found, glossary_not_found, resource_not_found
errorobjectrequiredrequest_idstringrequiredPossible codes: glossary_already_exists, result_not_ready, batch_not_editable, idempotency_key_reused, no_plan_yet, plan_changed, batch_not_awaiting_approval
errorobjectrequiredrequest_idstringrequiredPossible codes: file_expired
errorobjectrequiredrequest_idstringrequiredPossible codes: request_too_large, file_too_large, result_too_large
errorobjectrequiredrequest_idstringrequiredPossible codes: language_not_supported, invalid_language_pair, glossary_term_limit_reached, glossary_limit_reached, invalid_glossary_terms, unsupported_format, file_fetch_failed, plan_invalid
errorobjectrequiredrequest_idstringrequiredPossible codes: rate_limited
errorobjectrequiredrequest_idstringrequiredPossible codes: internal_error
errorobjectrequiredrequest_idstringrequiredPossible codes: service_unavailable
errorobjectrequiredrequest_idstringrequired