General Translation Translation API

Translate content at runtime and queue files for translation.

OpenAPI Specification

general-translation-translation-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: General Branches Translation API
  version: 2026-03-06.v1
  description: 'The public General Translation API. Use it to upload source content and translated files, download translations, queue and translate content, manage branches and tags, and read project and job status.


    Most endpoints operate on a single project and live under `https://api2.gtx.dev`. The runtime translation endpoint (`POST /v2/translate`) is served from `https://runtime2.gtx.dev`.


    Authenticate every request with an API key as a bearer token in the standard `Authorization: Bearer <key>` header. Project keys (`gtx-api-`, `gtx-dev-`) are bound to one project. Organization keys (`gtx-org-`) work across projects but must include the target project in the `gt-project-id` header for project-scoped routes.

    '
  contact:
    name: General Translation Support
    email: support@generaltranslation.com
    url: https://generaltranslation.com
servers:
- url: https://api2.gtx.dev
  description: Project and file API
- url: https://runtime2.gtx.dev
  description: Runtime translation API (POST /v2/translate)
security:
- Bearer: []
tags:
- name: Translation
  description: Translate content at runtime and queue files for translation.
paths:
  /v2/project/translations/enqueue:
    post:
      tags:
      - Translation
      summary: Queue files for translation
      description: 'Enqueue uploaded source files for background translation. Max 100 files per request. The response shape depends on the requested `gt-api-version`.

        '
      operationId: enqueueTranslations
      parameters:
      - $ref: '#/components/parameters/GtApiVersion'
      - $ref: '#/components/parameters/GtProjectId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - files
              properties:
                files:
                  type: array
                  minItems: 1
                  maxItems: 100
                  items:
                    type: object
                    required:
                    - fileId
                    - versionId
                    properties:
                      branchId:
                        type: string
                      fileId:
                        type: string
                      versionId:
                        type: string
                      fileName:
                        type: string
                      transformFormat:
                        type: string
                targetLocales:
                  type: array
                  items:
                    type: string
                sourceLocale:
                  type: string
                force:
                  type: boolean
                  default: false
                modelProvider:
                  type: string
                  enum:
                  - ANTHROPIC
                  - OPENAI
                  - XAI
                  - GOOGLE
                  description: AI model provider override.
                publish:
                  type: boolean
                  description: Publish translations once complete.
      responses:
        '200':
          description: Files queued.
          content:
            application/json:
              schema:
                type: object
                description: 'On `gt-api-version` >= 2025-11-03.v1 returns `jobData`; earlier versions return inline `translations` and `data`.

                  '
                properties:
                  jobData:
                    type: object
                    additionalProperties: true
                    description: Map of jobId to job details.
                  locales:
                    type: array
                    items:
                      type: string
                  message:
                    type: string
        '400':
          description: Bad request, including missing source files.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  missing:
                    type: array
                    items:
                      type: string
                  count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
  /v2/translate:
    servers:
    - url: https://runtime2.gtx.dev
      description: Runtime translation API
    post:
      tags:
      - Translation
      summary: Translate content at runtime
      description: 'Translate one or more strings or structured content entries with caching and memoization. Authentication is optional; unauthenticated requests may receive partial results.

        '
      operationId: translate
      security:
      - Bearer: []
      - {}
      parameters:
      - $ref: '#/components/parameters/GtApiVersion'
      - $ref: '#/components/parameters/GtProjectId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - requests
              - targetLocale
              - sourceLocale
              - metadata
              properties:
                requests:
                  type: object
                  minProperties: 1
                  description: Map of request key to a translation request entry.
                  additionalProperties:
                    type: object
                    required:
                    - source
                    properties:
                      source:
                        description: String, JSX, ICU, or i18next content to translate.
                      metadata:
                        type: object
                        properties:
                          id:
                            type: string
                          hash:
                            type: string
                          context:
                            type: string
                          maxChars:
                            type: integer
                          dataFormat:
                            type: string
                            enum:
                            - STRING
                            - JSX
                            - ICU
                            - I18NEXT
                            default: STRING
                          actionType:
                            type: string
                            default: fast
                          sourceCode:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: object
                                properties:
                                  before:
                                    type: string
                                    maxLength: 2000
                                  target:
                                    type: string
                                    maxLength: 500
                                  after:
                                    type: string
                                    maxLength: 2000
                targetLocale:
                  type: string
                  minLength: 1
                sourceLocale:
                  type: string
                  minLength: 1
                metadata:
                  type: object
                  properties:
                    modelProvider:
                      type: string
                      enum:
                      - ANTHROPIC
                      - OPENAI
                      - XAI
                      - GOOGLE
      responses:
        '200':
          description: Cached or partially completed translation results, keyed by request key.
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: object
                  properties:
                    success:
                      type: boolean
                    translation:
                      type: string
                    error:
                      type: string
        '201':
          description: Translation results, keyed by request key.
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: object
                  properties:
                    success:
                      type: boolean
                    translation:
                      type: string
                    error:
                      type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
  responses:
    PaymentRequired:
      description: Payment or quota validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: The request was invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The API key lacks the required permission, or the action is not allowed on the current plan.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit or quota exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  parameters:
    GtProjectId:
      name: gt-project-id
      in: header
      required: false
      description: Target project ID. Required when authenticating with an organization API key.
      schema:
        type: string
    GtApiVersion:
      name: gt-api-version
      in: header
      required: false
      description: 'API version. Defaults to the earliest supported version. Latest is `2026-03-06.v1`.

        '
      schema:
        type: string
        enum:
        - 2025-01-01.v0
        - 2025-11-03.v1
        - 2026-02-18.v1
        - 2026-03-06.v1
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      description: 'API key sent as a bearer token in the standard `Authorization: Bearer <key>` header. Use a project key (`gtx-api-`, `gtx-dev-`) or an organization key (`gtx-org-`). Organization keys must also send `gt-project-id` on project-scoped routes.

        '