# General Translation Platform: 覆盖译文
URL: https://generaltranslation.com/zh/docs/platform/openapi/reference/files/overwrite-translations.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 用完整的翻译后的文件内容替换 1–100 条现有译文。需要 project:files:write 权限。

{/* 此文件由 Fumadocs 生成。请勿直接编辑此文件。如需修改，请重新运行生成命令。 */}

## Endpoint

`POST https://api.gtx.dev/v2/projects/{projectId}/files/translations/overwrite`

**Operation ID:** `overwriteTranslations`

**Tags:** `Files`

**Summary:** Overwrite translations

Replace 1–100 existing translations with full translated file content. Requires `project:files:write`.

Authentication: required. Send an API key in the `Authorization: Bearer <key>` header when authenticating.

### Parameters

- `projectId` (path, string, required)
- `gt-api-version` (header, "2026-10-08.v1", required): API contract version. Must be `2026-10-08.v1` or later; requests without it or with an older version return 400.

### Request body (required)

Body (`application/json`, object):
- `diffs` (object[], required): 1–100 translations; each branch, file, version and locale may appear once.
  - `locale` (string, required)
  - `diff` (string, required)
  - `branchId` (string)
  - `versionId` (string, required)
  - `fileId` (string, required)
  - `localContent` (string, required): The full translated file content.

### Responses

**200**: Overwrite result for each translation, in request order, even when every translation fails; a translation fails when its source file or translation does not exist, the content does not apply to its format, or the save fails. Retrying with the same content is safe.
Response body (`application/json`, object):
- `summary` (object, required): Number of `results` in total and by `status`.
  - `total` (integer, required)
  - `succeeded` (integer, required)
  - `failed` (integer, required)
- `results` (object[], required): One result per translation, in request order.
  - `branchId` (string, required)
  - `fileId` (string, required)
  - `versionId` (string, required)
  - `locale` (string, required)
  - `status` ("succeeded" | "failed", required)
  - `error` (string): Why the item failed.

**400**: The request is malformed or failed validation.
Response body (`application/json`, object):
- `error` (string, required)

Response body (`text/html`, string):

**401**: Authentication is missing or invalid.
Response body (`application/json`, object):
- `error` (string, required)

Response body (`text/html`, string):

**403**: The caller is authenticated but not allowed to perform this operation or access the requested resource.
Response body (`application/json`, object):
- `error` (string, required)

Response body (`text/html`, string):

**413**: The request, or the data it would return, exceeds a size or item limit.
Response body (`application/json`, object):
- `error` (string, required)

Response body (`text/html`, string):

**415**: The request body's Content-Type is missing or not supported. Send the body as application/json.
Response body (`application/json`, object):
- `error` (string, required)

Response body (`text/html`, string):

**429**: Too many requests. The rate limit was exceeded.
Response body (`application/json`, object):
- `error` (string, required)

Response body (`text/html`, string):

**500**: An unexpected server error occurred.
Response body (`application/json`, object):
- `error` (string, required)

Response body (`text/html`, string):

Complete OpenAPI 3.1 specification: https://generaltranslation.com/openapi.yaml

OpenAPI schema: [openapi.json](https://generaltranslation.com/openapi.json)

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
