Growth Studio OpenAPI Integration Guide · 视频片段编辑
This endpoint starts an asynchronous Agent clip-replacement task. Retrieve the video details before calling it: only videos with supports_edit=true and an edit object in the response can be edited. clip_index is the one-based index of a clip persisted by the server, which validates that the index exists. Arbitrary time ranges, media paths, and user-specified output paths are not supported.
POST /openapi/v1/videos/{video_id}/edit
Content-Type: application/json
Authorization: Bearer <API_KEY>
curl --request POST \
"${BASE_URL}/openapi/v1/videos/627410861853514292/edit" \
--header "Authorization: Bearer ${API_KEY}" \
--header 'Content-Type: application/json' \
--data-raw '{
"clip_index": 2,
"instruction": "Make the expression more natural."
}'
| Field | Type | Required | Description |
|---|---|---|---|
clip_index |
integer | Yes | The starting sequence number of the server-side persistent fragment, ranging from 1–40; the server will verify that this fragment exists. |
instruction |
string | Yes | Explanation of the modifications made to this section, up to a maximum of 500 characters. |
HTTP status code:202 Accepted
Returning 202 indicates that the editing task has been accepted. Subsequently, retrieve edit.status and edit.latest via GET /openapi/v1/videos/{video_id}until the status becomes succeeded, failed or canceled. Once editing is successful, the output.video_url in the same detail will point to the new completed video.
Response header:
Location: /openapi/v1/videos/{video_id}
X-Request-Id: edit-video-001
Response body:
{
"video_id": "627410861853514292",
"edit": {
"id": "edit_01H...",
"status": "processing",
"clip_index": 2,
"instruction": "Make the expression more natural."
},
"request_id": "edit-video-001"
}
Free editing allowances are applied first. The discount is applied to the remaining billable editing amount, rounded up to whole cents. The video's price remains its original generation price and does not represent an edit charge. Use the editing transaction identifier described in Discounts and Wallet Transactions (Matching Video Tasks) to reconcile charges and refunds.
A video that cannot currently be edited may return 409 VIDEO_EDIT_UNAVAILABLE; query its details and edit status. This endpoint has no caller-provided idempotency key. If a request times out or receipt of its 202 response is uncertain, check edit.latest and your business records before resubmitting. See Errors and Retries.