Task Endpoints
Task endpoints are used to initiate processing jobs and check their status.
To apply your custom editing style, include a style_preset_id in the request body. See Styling to create a preset and copy its ID.
Video to Shorts
Convert a long video into multiple viral-ready short clips.
Endpoint: POST /tasks/video-to-shorts
Request
POST /v2/tasks/video-to-shorts
Authorization: Bearer <your-api-key>
Content-Type: application/json
{
"source_video_url": "https://example.com/video.mp4",
"language": "en",
"transcription_context": "A podcast episode about AI startups. Hosts: Sarah Chen and Marcus Lee. Topics include LLMs, RAG, fine-tuning, and companies like Anthropic and NVIDIA.",
"style_preset_id": "dd2875e8-4e75-4887-973c-2adc928dd2ab",
"max_duration": 30,
"max_clip_count": 5
}Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
source_video_url | string | Yes | - | URL of the video to be processed. Supports YouTube, Twitch, Vimeo, Loom, Google Drive and Dropbox links, direct storage links (AWS S3, GCP), and public HTTP/HTTPS URLs to a video file. |
language | string | No | Auto-detected | Language spoken in the source video (e.g., “en”, “es”). Klap works in 99+ languages. Omit it to detect the language automatically. |
translate_to | string | No | - | Target language for translation |
transcription_context | string | No | - | Optional context (speaker names, brand names, jargon, acronyms, or topic) used to improve transcription accuracy. Max 1000 characters. Leave empty for default behavior. |
name | string | No | ”Upload” | A name for the task |
target_clip_count | integer | No | 10 | Desired number of clips to generate |
max_clip_count | integer | No | 10 | Maximum number of clips to generate |
min_duration | integer | No | 1 | Minimum duration for clips in seconds (1-120) |
max_duration | integer | No | 180 | Maximum duration for clips in seconds (1-180) |
target_duration | integer | No | 60 | Target duration for clips in seconds (1-120) |
editing_options | object | No | - | See Editing Options |
dimensions | object | No | - | See Dimensions |
style_preset_id | string | No | - | Style preset identifier. See Styling |
max_live_duration | integer | No | Your key’s maximum input length | Live streams only: how much of the stream is followed at most, in seconds (600-43200). See Live Streams |
Editing Options
| Parameter | Type | Default | Description |
|---|---|---|---|
captions | boolean | true | Include captions in the shorts |
reframe | boolean | true | Reframe the video content |
emojis | boolean | true | Include emojis in the captions |
intro_title | boolean | true | Include a hook title at the beginning |
remove_silences | boolean | false | Remove silences from the video |
Dimensions
| Parameter | Type | Default | Description |
|---|---|---|---|
width | integer | 1080 | Width of the output video |
height | integer | 1920 | Height of the output video |
Limitations
- Maximum input video length: 5 hours
Response
Returns a Task Object with the following fields:
{
"id": "task_001",
"type": "video-to-shorts",
"status": "processing",
"created_at": "2023-10-01T12:00:00Z",
"output_type": "folder",
"output_id": "folder_001"
}Live Streams
When source_video_url is a stream that is live at the time of the request, Klap follows it: the stream is clipped in passes until it ends. There is no parameter to set. The request and the response are the same as for a video, and the task you get back stands for the whole stream.
Links that are followed
- A YouTube video link whose broadcast is live.
- A Twitch channel link (
https://www.twitch.tv/<channel>) or a Kick channel link (https://kick.com/<channel>) while the channel is on air.
A link to a Twitch or Kick video is imported as an ordinary video, even while its broadcast is still running.
How the stream is clipped
- The first pass takes the last 30 minutes of the stream at most. When the platform keeps no recording Klap can read, the stream is recorded from the moment of your request instead, 10 minutes for the first pass.
- A new pass then runs about every 30 minutes on what was broadcast since the last one.
- The task ends when the stream ends, when you stop it, or when the limit below is reached. The pass in progress always finishes first.
The first clips are usually ready 10 to 20 minutes after the request. Every pass adds its clips to the same folder (output_id), so GET /projects/{folder_id} returns more clips after each pass.
The task
The task stays processing for as long as the stream is followed and carries a live object:
{
"id": "task_001",
"type": "video-to-shorts",
"status": "processing",
"created_at": "2026-11-23T12:00:00Z",
"output_type": "folder",
"output_id": "folder_001",
"live": {
"state": "live",
"stop_reason": null,
"pass_count": 2,
"stream_started_at": "2026-11-23T11:00:00Z",
"stream_ended_at": null,
"clipped_from_seconds": 1800,
"clipped_until_seconds": 5400,
"next_pass_at": "2026-11-23T13:00:00Z"
}
}| Field | Description |
|---|---|
state | live while the stream is followed, ended once the stream is over, stopped when following stopped early |
stop_reason | Why a stopped task stopped. See the table below |
pass_count | Passes started so far. It goes up each time new clips are on their way |
stream_started_at | When the broadcast started, when the platform says so |
stream_ended_at | When the broadcast ended, null while it is live |
clipped_from_seconds | Where clipping began, in seconds since the start of the stream |
clipped_until_seconds | How far the passes started so far reach, in seconds since the start of the stream |
next_pass_at | When the next pass is planned, null once the task is no longer live |
Once the stream is over and the last pass has finished, status becomes ready. It becomes error only if no pass produced a clip. A pass that fails does not fail the task: the next one runs as planned, and the task stops after 4 failures in a row.
stop_reason | Meaning |
|---|---|
user | You stopped the task |
max_duration | The stream was followed for as long as allowed |
payment_required | Your subscription or credits could not cover the next pass |
api_key_revoked | The API key that created the task was deleted |
source_unavailable | The stream could no longer be read (removed, made private, age-restricted) |
project_deleted | The task’s folder was deleted |
error | 4 passes failed in a row |
To be told when clips arrive instead of polling, set a webhook: task.pass_completed is sent after each pass, then task.ready when the task ends.
Limits and parameters
- A stream is followed for at most your API key’s maximum input video length, counted from where clipping began, and never more than 12 hours.
max_live_durationlowers it. max_clip_count,target_clip_countand the duration parameters apply to each pass, not to the whole stream.source_rangeandcuration_rangecannot be used with a live stream (400).
Errors
| Status | error_code | Meaning |
|---|---|---|
| 422 | live_stream_not_started | The broadcast is scheduled and has not started yet |
| 422 | channel_not_live | The Twitch or Kick channel is not on air |
| 422 | live_no_recording | The stream is live but has no recording Klap can read |
| 503 | - | The stream could not be checked. Try again in a moment |
Billing
Each pass is billed as one task: one input video, plus the shorts it generates. See Pricing.
Stop a Live Task
Stop following the live stream behind a task. No new pass starts. The pass in progress still finishes and is billed, after which the task becomes ready with the clips made so far.
Endpoint: POST /tasks/{task_id}/stop
Request
POST /v2/tasks/{task_id}/stop
Authorization: Bearer <your-api-key>Response
Returns the Task Object, with live.state set to stopped and live.stop_reason set to user. Stopping a task that has already ended returns it unchanged. A task that is not following a live stream answers 409 with error_code: "task_not_live".
Video to Video
Edit a single video with AI-powered enhancements.
Endpoint: POST /tasks/video-to-video
Request
POST /v2/tasks/video-to-video
Authorization: Bearer <your-api-key>
Content-Type: application/json
{
"source_video_url": "https://example.com/video.mp4",
"language": "en",
"style_preset_id": "dd2875e8-4e75-4887-973c-2adc928dd2ab",
"editing_options": {
"captions": true,
"reframe": true
}
}Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
source_video_url | string | Yes | - | URL of the video to be processed. Supports YouTube, Twitch, Vimeo, Loom, Google Drive and Dropbox links, direct storage links (AWS S3, GCP), and public HTTP/HTTPS URLs to a video file. |
language | string | No | Auto-detected | Language spoken in the source video (e.g., “en”, “es”). Klap works in 99+ languages. Omit it to detect the language automatically. |
translate_to | string | No | - | Target language for translation |
transcription_context | string | No | - | Optional context (speaker names, brand names, jargon, acronyms, or topic) used to improve transcription accuracy. Max 1000 characters. Leave empty for default behavior. |
name | string | No | ”Upload” | A name for the task |
editing_options | object | Yes | - | See Editing Options |
dimensions | object | No | width: 1080, height: 1920 | See Dimensions |
style_preset_id | string | No | - | Style preset identifier. See Styling |
Limitations
- Maximum input video length: 10 minutes (5 minutes with
translate_to)
Response
Returns a Task Object with the following fields:
{
"id": "task_001",
"type": "video-to-video",
"status": "processing",
"created_at": "2023-10-01T12:00:00Z",
"output_type": "project",
"output_id": "project_001"
}Get Task
Get the status of a processing task.
Endpoint: GET /tasks/{task_id}
Request
GET /v2/tasks/{task_id}
Authorization: Bearer <your-api-key>Path Parameters
| Parameter | Type | Description |
|---|---|---|
task_id | string | ID of the task to retrieve |
Response
Returns a Task Object with the current status:
{
"id": "task_001",
"type": "video-to-shorts",
"status": "ready",
"created_at": "2023-10-01T12:00:00Z",
"output_type": "folder",
"output_id": "folder_001"
}Possible Status Values
| Status | Description |
|---|---|
processing | Task is still being processed |
ready | Task has completed successfully |
error | Task has failed |