> ## Documentation Index
> Fetch the complete documentation index at: https://www.octoparse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Save one locale's translation (owner only)

> Replace the whole overlay for one locale; origin becomes `author`.
Saving a translation never creates a Release — translations hang off
the app identity and apply to every version.

Hard checks (400): locale must be valid and must not equal the app's
`source_locale` (locale-is-source); entries must map paths to strings
/ string arrays (translation-invalid); at most 20 locales per app
(translation-locale-limit); 413 above 4MB. Path-level problems
(unknown path, wrong type, `enum_titles` length not matching `enum`,
duplicate event/example ids) are `warnings`, not rejections —
consumers skip those entries. The hash basis is the **workspace**
(what the author sees while translating), falling back to the
latest Release when there is no draft; `stale` in the response is
computed against the latest Release, so a translation saved for a
not-yet-published draft change reports stale=true until that change
ships. `expected_revision` mismatch → 409 revision-conflict.



## OpenAPI

````yaml /jp/datahub/api/openapi.json put /v1/data-apps/{app_id}/translations/{locale}
openapi: 3.1.0
info:
  title: DataHub API
  version: 0.2.0
  description: Public /v1 contract of Octoparse DataHub. Internal channels are excluded.
servers:
  - url: https://api-datahub.octoparse.com
security:
  - bearerAuth: []
tags:
  - name: Discovery
    description: >-
      Anonymous access: platform metadata (currency), data app search, detail
      and input contract, machine-readable manifest spec.
  - name: Publishing
    description: >-
      Self-service publishing channel (API Key auth), two-phase: validate first
      (validate / package, nothing persisted), then publish (POST /data-apps,
      the submission goes live as a new Release). api kind (declarative
      integration) becomes visible on publish; code kind (code package) returns
      202 and enters an async image build; once ready it is promoted to a
      Release, visible and runnable. Poll progress via GET
      /data-apps/{ref}/builds.
  - name: Runs & Results
    description: >-
      Start / query / cancel runs and read result records with pagination.
      Business inputs go in the request body; platform run options (wait,
      max_records) go in query parameters.
  - name: Datasets
    description: >-
      Metadata and record access for platform datasets (including seeded stock
      data).
  - name: Account
    description: Account info and cumulative usage for the current API Key.
  - name: Secrets
    description: >-
      CRUD for upstream credentials (environment entries referenced by manifest
      `runtime.env`). Plaintext is write-only: every read returns a mask.
paths:
  /v1/data-apps/{app_id}/translations/{locale}:
    put:
      tags:
        - Publishing
      summary: Save one locale's translation (owner only)
      description: |-
        Replace the whole overlay for one locale; origin becomes `author`.
        Saving a translation never creates a Release — translations hang off
        the app identity and apply to every version.

        Hard checks (400): locale must be valid and must not equal the app's
        `source_locale` (locale-is-source); entries must map paths to strings
        / string arrays (translation-invalid); at most 20 locales per app
        (translation-locale-limit); 413 above 4MB. Path-level problems
        (unknown path, wrong type, `enum_titles` length not matching `enum`,
        duplicate event/example ids) are `warnings`, not rejections —
        consumers skip those entries. The hash basis is the **workspace**
        (what the author sees while translating), falling back to the
        latest Release when there is no draft; `stale` in the response is
        computed against the latest Release, so a translation saved for a
        not-yet-published draft change reports stale=true until that change
        ships. `expected_revision` mismatch → 409 revision-conflict.
      operationId: put_app_translation_v1_data_apps__app_id__translations__locale__put
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            title: App Id
        - name: locale
          in: path
          required: true
          schema:
            type: string
            title: Locale
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TranslationPut'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataEnvelope_TranslationSaveResult_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TranslationPut:
      properties:
        entries:
          additionalProperties: true
          type: object
          title: Entries
        expected_revision:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expected Revision
      type: object
      required:
        - entries
      title: TranslationPut
      description: |-
        PUT translations/{locale} request body: the whole entries object
        (replace semantics). Values must be strings or string arrays.
    DataEnvelope_TranslationSaveResult_:
      properties:
        data:
          $ref: '#/components/schemas/TranslationSaveResult'
      type: object
      required:
        - data
      title: DataEnvelope[TranslationSaveResult]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TranslationSaveResult:
      properties:
        locale:
          type: string
          title: Locale
        origin:
          type: string
          enum:
            - author
            - platform
          title: Origin
        revision:
          type: integer
          title: Revision
        based_on_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Based On Version
        based_on_hash:
          type: string
          title: Based On Hash
        stale:
          type: boolean
          title: Stale
        stale_paths:
          items:
            type: string
          type: array
          title: Stale Paths
        warnings:
          items:
            $ref: '#/components/schemas/ContractWarning'
          type: array
          title: Warnings
      type: object
      required:
        - locale
        - origin
        - revision
        - based_on_hash
        - stale
      title: TranslationSaveResult
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ContractWarning:
      properties:
        code:
          type: string
          title: Code
        params:
          additionalProperties: true
          type: object
          title: Params
      type: object
      required:
        - code
      title: ContractWarning
      description: >-
        One structured soft warning from contract assembly. `code` is a stable

        kebab-case identifier; `params` carries the variables (file names, the

        ignored-file list, ...). Localization happens in consuming display
        layers

        keyed by `code`; unknown codes should be shown as the code itself.


        Codes: `contract-file-missing` (a non-optional slot file is absent;

        params.file), `readme-missing`, `duplicate-contract-file` (same name at

        several levels; params.file/kept/ignored), `id-field-missing`

        (output_schema.json has no id_field and runtime has no dedup_by to infer

        it from), `pricing-missing` (no pricing.json and no pricing section in

        dataapp.json), `non-contract-files-ignored` (params.files is the full

        list), `folder-name-mismatch` (params.folder_name/declared_name).

        i18n.json codes (params.locale/path): `i18n-locale-is-source` (a locale

        equal to `source`, skipped), `i18n-path-unresolved` (path not in the

        translatable allowlist or absent from the manifest),
        `i18n-type-mismatch`

        (params.expected string/list), `i18n-length-mismatch` (`enum_titles`

        length differs from `enum`; params.expected/actual),
        `i18n-path-ambiguous`

        (duplicate pricing event / example id makes the path ambiguous).
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: DataHub API Key

````