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

# 复制已保存的字幕

> 保存独立的可编辑字幕副本，无需再次生成转写文本。

保存独立的可编辑字幕副本，无需再次生成转写文本。

```http theme={null}
POST https://api.voicecheap.ai/v1/actions/subtitles_history_duplicate
```

## 身份验证和权限

<ParamField header="x-api-key" type="string" required>
  在此请求头中发送 VoiceCheap API 密钥。也支持通过 Authorization: Bearer 发送同一 API 密钥。OAuth 访问令牌仅适用于 MCP，此 REST 端点不接受 OAuth
  访问令牌。
</ParamField>

所需权限: `subtitles:write`.

需要有效的付费订阅。权限不会改变团队角色、资源归属、媒体额度或套餐限制。

## 参数

<ParamField body="historyId" type="string" required>
  文本值。

  最小长度: 1. 最大长度: 160. 匹配模式: `^[A-Za-z0-9_-]+$`.
</ParamField>

<ParamField body="currentSrtContent" type="string" required>
  文本值。

  最小长度: 1. 最大长度: 2097152.
</ParamField>

<ParamField body="layoutOptions" type="object">
  JSON 对象。嵌套字段请参阅完整输入架构。
</ParamField>

<ParamField body="styleOptions" type="object">
  JSON 对象。嵌套字段请参阅完整输入架构。
</ParamField>

<ParamField body="requestId" type="string">
  在传输层可选：如果省略，服务器会在验证前注入标识符。请自行提供稳定的 UUID v4，以便在响应丢失后安全恢复。

  格式: "uuid". 匹配模式: `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`.
</ParamField>

<Accordion title="完整输入架构">
  以下 JSON Schema 保留了发现接口公开的确切字段名、嵌套类型、默认值、范围和可接受值。其他跨字段规则列于操作说明中。

  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "historyId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 160,
        "pattern": "^[A-Za-z0-9_-]+$"
      },
      "currentSrtContent": {
        "type": "string",
        "minLength": 1,
        "maxLength": 2097152
      },
      "layoutOptions": {
        "type": "object",
        "properties": {
          "maxLinesPerCaption": {
            "anyOf": [
              {
                "type": "number",
                "const": 1
              },
              {
                "type": "number",
                "const": 2
              },
              {
                "type": "number",
                "const": 3
              }
            ]
          },
          "maxCharactersPerLine": {
            "type": "integer",
            "minimum": 24,
            "maximum": 64
          }
        },
        "required": ["maxLinesPerCaption", "maxCharactersPerLine"],
        "additionalProperties": false
      },
      "styleOptions": {
        "type": "object",
        "properties": {
          "fontFamily": {
            "type": "string",
            "enum": ["sans", "serif", "mono"]
          },
          "fontSize": {
            "type": "string",
            "enum": ["small", "medium", "large"]
          },
          "textColor": {
            "type": "string",
            "enum": ["white", "yellow", "cyan"]
          },
          "backgroundStyle": {
            "type": "string",
            "enum": ["outline", "box", "shadow"]
          },
          "position": {
            "type": "string",
            "enum": ["bottom", "middle"]
          }
        },
        "required": ["fontFamily", "fontSize", "textColor", "backgroundStyle", "position"],
        "additionalProperties": false
      },
      "requestId": {
        "description": "UUID v4 for this action. Reuse the same ID with identical arguments on retries.",
        "type": "string",
        "format": "uuid",
        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
      }
    },
    "required": ["historyId", "currentSrtContent"],
    "additionalProperties": false
  }
  ```
</Accordion>

## 幂等性

为每次修改操作在 requestId 或 Idempotency-Key HTTP 请求头中提供 UUID v4。网络故障后，请使用相同标识符和完全相同的参数重试。如果同时提供这两个值，它们必须一致。重放已保存的请求不会重复执行操作，也不会再次扣除月度调用次数。失败或中断的请求不会自动重新执行。

对于每次修改操作，如果重试时发现同一请求仍在运行，即使首次执行通常为同步操作，也可能返回 HTTP 202。如果执行已完成但 resultStored 为 false，重试会返回 HTTP 200 和已保存的请求状态，而非原始结果。请通过对应领域的历史记录、结果或下载操作获取输出。

## 请求示例

请将示例资源标识符和媒体键替换为账户返回的值。重试同一次修改操作时，请保持请求标识符不变。

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST 'https://api.voicecheap.ai/v1/actions/subtitles_history_duplicate' \
    --header "x-api-key: $VOICECHEAP_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{"historyId":"history_20261016_001","currentSrtContent":"1\n00:00:00,000 --> 00:00:01,500\nHello world.\n","layoutOptions":{"maxLinesPerCaption":2,"maxCharactersPerLine":42},"styleOptions":{"fontFamily":"sans","fontSize":"medium","textColor":"white","backgroundStyle":"outline","position":"bottom"},"requestId":"13579bdf-2468-4ace-8bdf-0123456789ab"}'
  ```

  ```javascript JavaScript theme={null}
  const input = {
    historyId: 'history_20261016_001',
    currentSrtContent: '1\n00:00:00,000 --> 00:00:01,500\nHello world.\n',
    layoutOptions: {
      maxLinesPerCaption: 2,
      maxCharactersPerLine: 42,
    },
    styleOptions: {
      fontFamily: 'sans',
      fontSize: 'medium',
      textColor: 'white',
      backgroundStyle: 'outline',
      position: 'bottom',
    },
    requestId: '13579bdf-2468-4ace-8bdf-0123456789ab',
  };
  const response = await fetch('https://api.voicecheap.ai/v1/actions/subtitles_history_duplicate', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.VOICECHEAP_API_KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(input),
  });
  const body = await response.json();
  if (!response.ok) throw new Error(body.code + ': ' + body.message);
  console.log(body);
  ```

  ```python Python theme={null}
  import os
  import requests

  response = requests.post(
      "https://api.voicecheap.ai/v1/actions/subtitles_history_duplicate",
      headers={"x-api-key": os.environ["VOICECHEAP_API_KEY"]},
      json={"historyId": "history_20261016_001", "currentSrtContent": "1\n00:00:00,000 --> 00:00:01,500\nHello world.\n", "layoutOptions": {"maxLinesPerCaption": 2, "maxCharactersPerLine": 42}, "styleOptions": {"fontFamily": "sans", "fontSize": "medium", "textColor": "white", "backgroundStyle": "outline", "position": "bottom"}, "requestId": "13579bdf-2468-4ace-8bdf-0123456789ab"},
      timeout=120,
  )
  body = response.json()
  if not response.ok:
      raise RuntimeError(f"{body.get('code')}: {body.get('message')}")
  print(body)
  ```
</RequestExample>

## 响应

首次执行成功时返回 HTTP 200，操作结果位于 data 下。重放请求时可能改为返回已保存的请求状态。示例展示了一种支持的响应，并未包含所有可选字段。

新的可独立编辑的字幕历史记录 ID，修订号从 1 开始，并附带其规范化后的 SRT 和创建时间戳。

<ResponseExample>
  ```json HTTP 200 theme={null}
  {
    "data": {
      "historyId": "history_20261016_copy",
      "revision": 1,
      "updatedAt": 1792152010000,
      "currentSrtContent": "1\n00:00:00,000 --> 00:00:01,500\nHello world.\n"
    },
    "requestId": "13579bdf-2468-4ace-8bdf-0123456789ab"
  }
  ```

  ```json HTTP 202 replay_running theme={null}
  {
    "data": {
      "requestId": "13579bdf-2468-4ace-8bdf-0123456789ab",
      "operation": "subtitles_history_duplicate",
      "createdAt": 1792144800000,
      "updatedAt": 1792144820000,
      "status": "running",
      "pollAfterSeconds": 5
    },
    "requestId": "13579bdf-2468-4ace-8bdf-0123456789ab"
  }
  ```

  ```json HTTP 200 replay_completed_without_result theme={null}
  {
    "data": {
      "requestId": "13579bdf-2468-4ace-8bdf-0123456789ab",
      "operation": "subtitles_history_duplicate",
      "createdAt": 1792144800000,
      "updatedAt": 1792144820000,
      "status": "completed",
      "resultStored": false,
      "message": "The action completed. Retrieve its output from the corresponding history or resource action."
    },
    "requestId": "13579bdf-2468-4ace-8bdf-0123456789ab"
  }
  ```
</ResponseExample>

## 结果字段

| 字段 | 说明 |
| - | - |
| `data.historyId` | 新保存的字幕条目，与输入的 historyId 不同。 |
| `data.revision` | 新的可编辑副本为 1。 |
| `data.updatedAt` | 新建副本的 Unix 时间戳，单位为毫秒。 |
| `data.currentSrtContent` | 已规范化的输入字幕内容。 |

## 恢复并轮询此请求

即使连接丢失，也应使用同一标识符。如果 resultStored 为 false，请通过相应的历史记录、结果或下载操作获取输出。切勿仅为查看进度而启动第二次生成。

```bash theme={null}
curl --request POST 'https://api.voicecheap.ai/v1/actions/action_request_get' \
  --header "x-api-key: $VOICECHEAP_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"requestId":"13579bdf-2468-4ace-8bdf-0123456789ab","operation":"subtitles_history_duplicate"}'
```

```json HTTP 200 theme={null}
{
  "data": {
    "requestId": "13579bdf-2468-4ace-8bdf-0123456789ab",
    "operation": "subtitles_history_duplicate",
    "status": "completed",
    "createdAt": 1792144800000,
    "updatedAt": 1792144820000,
    "resultStored": true,
    "result": {
      "historyId": "history_20261016_copy",
      "revision": 1,
      "updatedAt": 1792152010000,
      "currentSrtContent": "1\n00:00:00,000 --> 00:00:01,500\nHello world.\n"
    }
  }
}
```

## 操作说明

* 需要付费订阅和操作权限。执行时会重新检查调用者的个人工具套餐；已保存的工具和上传引用均属于该调用者，包括凭据与团队关联时。
* 成功操作会消耗一次 API/MCP 共用的每月调用次数。Beginner 每月 500 次、Starter 5,000 次、Creator 25,000 次；Pro、Scale 和 Enterprise 无每月上限。每分钟限制仍然适用，分别为 30、60、120、180、300 和 600 次。工具生成限额单独计算。
* 使用 UUID v4 格式的 requestId，或值与其相同的 Idempotency-Key 请求头，并在重试时保持操作、ID 和参数不变。返回缓存结果不会再次消耗每月调用次数。
* 输入的 historyId 用于选择当前账户拥有的源条目。请提供要复制的完整 currentSrtContent；不会自动从已保存的源条目获取。
* 字幕条目验证和 2 MiB 上限与 subtitles\_history\_update 一致。省略 layoutOptions/styleOptions 时使用标准默认值。
* 创建副本不会生成新的转写文本、消耗已上传的源文件或使用每日工具生成次数，但会消耗一次成功的每月集成调用。

## 用量

每次成功调用消耗一次月度 API/MCP 调用额度。媒体额度和操作本身的生成限额也适用。

## 错误

| HTTP 状态 | 代码 | 含义或恢复方式 |
| - | - | - |
| 400 | `CREDENTIAL_IN_QUERY` | 凭证通过 access\_token 或 api\_key 查询参数提供。请在标头中发送凭证。 |
| 400 | `IDEMPOTENCY_CONFLICT` | 标头与请求体中的请求 ID 不同。 |
| 400 | `INVALID_REQUEST_ID` | requestId 或 Idempotency-Key 不是 UUID v4。 |
| 400 | `VALIDATION_ERROR` | 参数不符合操作架构，或提供了未知参数。 |
| 400 | `VIDEO_TO_SRT_HISTORY_INVALID_SRT` | SRT 字幕条目文本或时间戳结构无效。 |
| 400 | `VIDEO_TO_SRT_HISTORY_OUTSIDE_MEDIA` | 某个字幕条目的结束时间超过了记录的源时长及其 0.5 秒容差。 |
| 400 | `VIDEO_TO_SRT_HISTORY_OVERLAP` | 至少有两个字幕条目的时间重叠。 |
| 400 | `VIDEO_TO_SRT_HISTORY_SRT_TOO_LARGE` | 编辑后的 SRT 超出了 2 MiB 的 UTF-8 大小限制。 |
| 401 | `API_KEY_EXPIRED` | API 密钥已过期。 |
| 401 | `INVALID_API_KEY` | 请提供有效且未过期的 API 密钥。 |
| 401 | `INVALID_CREDENTIAL` | Authorization 标头格式错误或与 x-api-key 冲突。 |
| 401 | `MISSING_CREDENTIAL` | 未提供可用的请求头凭据，或其长度超过 4096 个字符。 |
| 401 | `USER_NOT_FOUND` | 该凭据对应的账户已不存在。 |
| 403 | `ACCOUNT_UNAVAILABLE` | 调用者账户或计费账户不可用，或正在删除。 |
| 403 | `AMBIGUOUS_TEAM_API_KEY` | 此凭据对应的用户属于多个团队，因此计费上下文不明确。 |
| 403 | `INSUFFICIENT_SCOPE` | API 密钥或 MCP 连接缺少所需的操作权限。 |
| 403 | `INTEGRATION_PLAN_UNSUPPORTED` | 无法验证该账户的集成限制。 |
| 403 | `PAID_SUBSCRIPTION_REQUIRED` | 此工具操作执行时，已认证的调用者已无付费订阅。 |
| 403 | `SUBSCRIPTION_REQUIRED` | 请使用有效的付费订阅。 |
| 403 | `TEAM_OWNER_NOT_FOUND` | 找不到实际生效的团队所有者账户。 |
| 404 | `VIDEO_TO_SRT_HISTORY_NOT_FOUND` | 当前账户拥有的可编辑字幕历史记录项不存在。 |
| 409 | `CONCURRENT_ACTION_LIMIT_REACHED` | 此账户已有 10 个集成操作正在运行。请先轮询现有请求，再启动另一个操作。 |
| 409 | `IDEMPOTENCY_CONFLICT` | 只有操作和参数完全相同时，才能复用标识符。 |
| 429 | `INTEGRATION_MONTHLY_LIMIT_REACHED` | 已使用和待处理的调用次数已达到共享的每月 API/MCP 限额。 |
| 429 | `INTEGRATION_RATE_LIMIT_REACHED` | 该账户已达到每分钟集成调用上限；请检查 retryAfterSeconds。 |
| 500 | `INTERNAL_ERROR` | 在决定是否重试修改操作前，请检查已保存的请求状态和资源历史记录。 |
| 503 | `ACTION_RESULT_UNAVAILABLE` | 操作已执行，但无法确认请求结果是否已持久化。开始另一次写入前，请使用相同操作和 requestId 轮询，并检查资源历史记录。 |
| 503 | `SERVER_RESTARTING` | 服务器正在重启。请稍后重试；对于修改操作，请保持请求标识符不变。 |

```json theme={null}
{
  "code": "INSUFFICIENT_SCOPE",
  "message": "This credential does not permit the requested action.",
  "status": 403,
  "details": {
    "requiredScopes": ["subtitles:write"]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.