Tolgee Keys API

Manage translation keys within a project.

OpenAPI Specification

tolgee-keys-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Tolgee API Keys API
  description: Subset of the Tolgee localization platform REST API covering projects, keys, translations, languages, import/export, and screenshots. Tolgee is open source and can be self-hosted; this specification targets Tolgee Cloud at https://app.tolgee.io. Project-scoped resources are authenticated with a Project API key (prefixed `tgpak_`) sent in the `X-API-Key` header. A Project API key is bound to a single project, so endpoints that implicitly operate on "the current project" (such as export) are accessible when authenticated with that key.
  termsOfService: https://tolgee.io/terms_and_conditions
  contact:
    name: Tolgee Support
    email: support@tolgee.io
  license:
    name: Source available / AGPL and commercial (self-hosted)
    url: https://docs.tolgee.io/platform/self_hosting/licensing
  version: v2
servers:
- url: https://app.tolgee.io
  description: Tolgee Cloud
security:
- ApiKeyAuth: []
tags:
- name: Keys
  description: Manage translation keys within a project.
paths:
  /v2/projects/{projectId}/keys:
    parameters:
    - $ref: '#/components/parameters/ProjectId'
    get:
      operationId: getKeys
      tags:
      - Keys
      summary: List keys
      parameters:
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/Size'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedKeysModel'
    post:
      operationId: createKey
      tags:
      - Keys
      summary: Create a key
      description: Creates a key and, optionally, its translations in one request.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateKeyRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyModel'
        '400':
          $ref: '#/components/responses/BadRequest'
  /v2/projects/{projectId}/keys/{id}:
    parameters:
    - $ref: '#/components/parameters/ProjectId'
    - name: id
      in: path
      required: true
      schema:
        type: integer
        format: int64
    delete:
      operationId: deleteKey
      tags:
      - Keys
      summary: Delete a key
      responses:
        '200':
          description: OK
  /v2/projects/{projectId}/keys/search:
    parameters:
    - $ref: '#/components/parameters/ProjectId'
    get:
      operationId: searchForKey
      tags:
      - Keys
      summary: Search for keys
      parameters:
      - name: search
        in: query
        required: true
        schema:
          type: string
      - name: languageTag
        in: query
        required: false
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedKeysModel'
  /v2/projects/{projectId}/keys/import:
    parameters:
    - $ref: '#/components/parameters/ProjectId'
    post:
      operationId: importKeys
      tags:
      - Keys
      summary: Import keys
      description: Bulk-creates keys with translations.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportKeysRequest'
      responses:
        '200':
          description: OK
components:
  schemas:
    PagedKeysModel:
      type: object
      properties:
        _embedded:
          type: object
          properties:
            keys:
              type: array
              items:
                $ref: '#/components/schemas/KeyModel'
        page:
          $ref: '#/components/schemas/PageMeta'
    ImportKeysRequest:
      type: object
      required:
      - keys
      properties:
        keys:
          type: array
          items:
            $ref: '#/components/schemas/CreateKeyRequest'
    PageMeta:
      type: object
      properties:
        size:
          type: integer
          format: int32
        totalElements:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
        number:
          type: integer
          format: int32
    KeyModel:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        namespace:
          type: string
        tags:
          type: array
          items:
            type: string
    CreateKeyRequest:
      type: object
      required:
      - name
      properties:
        name:
          type: string
        namespace:
          type: string
        translations:
          type: object
          additionalProperties:
            type: string
          description: Map of language tag to translation text.
        tags:
          type: array
          items:
            type: string
  parameters:
    Page:
      name: page
      in: query
      required: false
      description: Zero-based page index.
      schema:
        type: integer
        format: int32
        default: 0
    ProjectId:
      name: projectId
      in: path
      required: true
      description: Numeric project identifier.
      schema:
        type: integer
        format: int64
    Size:
      name: size
      in: query
      required: false
      description: Page size.
      schema:
        type: integer
        format: int32
        default: 20
  responses:
    BadRequest:
      description: Invalid request payload.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Project API key prefixed with `tgpak_`. Scoped to a single project.