Create Translation Job
const url = 'https://example.com/%7B%7Bapp_url%7D/api/v1/workspaces/1/emails/1/translation_jobs';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"target_locales":["fr-FR","de-DE"],"provider":"ai","keys":["example"],"provider_options":{"name":"example","project_template_uid":"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://example.com/%7B%7Bapp_url%7D/api/v1/workspaces/1/emails/1/translation_jobs \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "target_locales": [ "fr-FR", "de-DE" ], "provider": "ai", "keys": [ "example" ], "provider_options": { "name": "example", "project_template_uid": "example" } }'Creates a new translation job for the email. While the job is in flight the email is locked for editing.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Workspace ID
Email ID
Request Body
Section titled “Request Body”object
The locales to translate the email into.
Example
[ "fr-FR", "de-DE"]The translation provider to use.
Optional subset of translation keys to translate; defaults to all translatable fields. Use to re-translate only stale fields.
Options for a Phrase TMS translation job.
object
Name for the Phrase project.
The uid of the project template to create the project from. Obtained from the connector’s project_templates endpoint.
Responses
Section titled “Responses”Successful
object
How the job is fulfilled.
The localization connector fulfilling this job, or null for built-in providers.
A BCP 47 language tag identifying the language and region of a piece of content. Must carry both a language and a region subtag, and must be in canonical case (lowercase language, titlecase script, uppercase region) — en-GB, not en-gb or en_GB. The region may be a UN M.49 code, so en-001 (world) is valid.
Per-target-locale progress.
object
A BCP 47 language tag identifying the language and region of a piece of content. Must carry both a language and a region subtag, and must be in canonical case (lowercase language, titlecase script, uppercase region) — en-GB, not en-gb or en_GB. The region may be a UN M.49 code, so en-001 (world) is valid.
Example
{ "id": 12345, "email_id": 12345, "provider": "ai", "connector_id": 12345, "status": "pending", "source_locale": "en-GB", "locales": [ { "locale": "en-GB", "status": "pending" } ], "created_at": "2023-08-23T10:30:00.000Z", "completed_at": "2023-08-23T10:30:00.000Z"}Unauthorized
object
Example
{ "message": "Record not found"}Forbidden
object
Example
{ "message": "Record not found"}Unprocessable Entity
object
object
Example
{ "errors": { "username": [ "Username is required.", "Username must be unique." ], "email": [ "Invalid email format." ] }}