Translate endpoint
POST
/v1/translateTranslate xcstrings files and automatically create a GitHub PR with the translations. This endpoint is asynchronous—it returns a job ID that you can poll for status.
Request body
json
{
"github_repo": "owner/repo",
"files": [
{
"filename": "Localizable.xcstrings",
"content": "<file content as string>"
}
],
"target_languages": ["de", "fr", "ja"],
"source_language": "en",
"translator": "bulk",
"github_base_branch": "main",
"branch_name": "autoglot/translations",
"commit_message": "chore(i18n): update translations",
"pr_title": "chore(i18n): update translations",
"github_pat": "ghp_..."
}Parameters
| Parameter | Required | Description |
|---|---|---|
github_repo | Yes | Repository in "owner/repo" format |
files | Yes | Array of files with filename and content |
target_languages | Yes | Array of target language codes |
source_language | No | Source language (default: "en") |
translator | No | "bulk" (fast, default) or "batch" (24h, 50% cheaper) |
github_pat | No* | GitHub PAT (required if GitHub App not installed) |
github_base_branch | No | Base branch (default: "main") |
branch_name | No | PR branch name (default: "autoglot/translations") |
commit_message | No | Custom commit message |
pr_title | No | Custom PR title |
* Either install the autoglot GitHub App or provide a github_pat with repo access.
Response (202 Accepted)
json
{
"job_id": "abc123",
"status": "queued",
"translator": "bulk",
"message": "Translation job created. The PR will be created automatically when complete."
}Check job status
Poll the job status using the job ID:
GET
/v1/translate/:job_idjson
{
"job_id": "abc123",
"status": "completed",
"translator": "bulk",
"progress": 100,
"total_strings": 42,
"completed_strings": 42,
"github_repo": "owner/repo",
"github_pr_number": 123,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:31:00Z"
}Example
bash
# Start translation job
curl -X POST https://api.autoglot.app/v1/translate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"github_repo": "myorg/myapp",
"files": [
{
"filename": "Localizable.xcstrings",
"content": "'"$(cat Localizable.xcstrings)"'"
}
],
"target_languages": ["de", "fr", "ja"],
"github_pat": "ghp_xxxx"
}'
# Check job status
curl https://api.autoglot.app/v1/translate/abc123 \
-H "Authorization: Bearer YOUR_API_KEY"