> ## 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.

# 저장된 자막 편집

> 최신 리비전을 사용하여 저장된 SRT와 레이아웃을 수정합니다. 동시 편집이 서로 덮어쓰지 않도록 오래된 리비전은 거부됩니다.

최신 리비전을 사용하여 저장된 SRT와 레이아웃을 수정합니다. 동시 편집이 서로 덮어쓰지 않도록 오래된 리비전은 거부됩니다.

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

## 인증 및 권한

<ParamField header="x-api-key" type="string" required>
  이 헤더에 VoiceCheap API 키를 전달하세요. 동일한 API 키를 사용하는 Authorization: Bearer도 지원합니다. OAuth 액세스 토큰은 MCP에서만 허용되며, 이
  REST 엔드포인트에서는 사용할 수 없습니다.
</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="expectedRevision" type="integer" required>
  정수 값입니다.

  최댓값: 9007199254740991.
</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
      },
      "expectedRevision": {
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991
      },
      "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", "expectedRevision"],
    "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_update' \
    --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","expectedRevision":1,"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',
    expectedRevision: 1,
    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_update', {
    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_update",
      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", "expectedRevision": 1, "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>

## 응답

성공한 첫 실행은 작업 결과를 data 아래에 포함하여 HTTP 200을 반환합니다. 재전송 시에는 저장된 요청 상태를 대신 반환할 수 있습니다. 예제는 지원되는 응답 중 하나를 보여주며 모든 선택 필드를 포함하지는 않습니다.

동일한 편집 가능한 자막 기록 ID와 증가한 revision, 업데이트 타임스탬프 및 정규화된 현재 SRT입니다.

<ResponseExample>
  ```json HTTP 200 theme={null}
  {
    "data": {
      "historyId": "history_20261016_001",
      "revision": 2,
      "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_update",
      "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_update",
      "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` | 기존에 저장된 자막 항목입니다. |
| `data.revision` | 이전 리비전에 1을 더한 값입니다. |
| `data.updatedAt` | 밀리초 단위의 Unix 업데이트 타임스탬프입니다. |
| `data.currentSrtContent` | 검증, 정렬 및 정규화된 저장 SRT 텍스트입니다. |

## 이 요청 복구 및 폴링

연결이 끊어진 후에도 동일한 식별자를 사용하세요. 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_update"}'
```

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

## 작업 참고 사항

* 유료 구독과 해당 액션 권한이 필요합니다. 실행 시 실행 주체의 개인 도구 요금제를 다시 확인합니다. 인증 정보가 팀과 연결되어 있어도 저장된 도구와 업로드 참조는 해당 실행 주체에 속합니다.
* 성공한 액션은 공유 월간 API/MCP 호출 1회를 사용합니다. 월간 호출 허용량은 Beginner 500회, Starter 5,000회, Creator 25,000회이며, Pro, Scale 및 Enterprise에는 월간 상한이 없습니다. 분당 한도는 각각 30, 60, 120, 180, 300 및 600회로 계속 적용됩니다. 도구 생성 허용량은 별도입니다.
* UUID v4 requestId 또는 동일한 Idempotency-Key 헤더를 사용하고, 다시 시도할 때 동일한 액션, ID 및 인수를 유지하세요. 캐시된 결과를 다시 반환할 때는 월간 호출 횟수를 추가로 사용하지 않습니다.
* 먼저 subtitles\_history\_get을 조회한 다음 반환된 revision을 expectedRevision으로 전달하세요. 오래된 리비전은 VIDEO\_TO\_SRT\_HISTORY\_CONFLICT를 반환하며 다른 편집을 덮어쓸 수 없습니다.
* SRT 큐는 파싱, 정렬 및 정규화되며 서로 겹치거나 원본 미디어 길이에 0.5초를 더한 시점을 초과해서는 안 됩니다. 입력은 UTF-8 SRT 2 MiB로 제한됩니다.
* layoutOptions와 styleOptions를 생략하면 이전 사용자 지정 값을 암묵적으로 유지하는 대신 표준 기본값(2줄, 42자, sans/medium/white/outline/bottom)으로 정규화됩니다. 사용자 지정 서식을 유지하려면 둘 다 포함하세요.
* 저장된 SRT 기록의 텍스트와 서식을 편집합니다. 새 동영상을 렌더링하거나 다시 전사하지 않으며, 미디어 업로드나 추가 일일 생성 허용량을 소모하지 않습니다.

## 사용량

성공한 호출마다 월간 API/MCP 호출 1회가 차감됩니다. 미디어 크레딧과 해당 작업의 생성 허용량도 적용됩니다.

## 오류

| 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` | 동일한 작업과 인수에 대해서만 식별자를 재사용하세요. |
| 409 | `VIDEO_TO_SRT_HISTORY_CONFLICT` | expectedRevision이 오래되었습니다. subtitles\_history\_get을 다시 조회하고 현재 리비전을 사용하여 편집을 재시도하세요. |
| 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.