EndpointsTasks

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

ParameterTypeRequiredDefaultDescription
source_video_urlstringYes-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.
languagestringNoAuto-detectedLanguage spoken in the source video (e.g., “en”, “es”). Klap works in 99+ languages. Omit it to detect the language automatically.
translate_tostringNo-Target language for translation
transcription_contextstringNo-Optional context (speaker names, brand names, jargon, acronyms, or topic) used to improve transcription accuracy. Max 1000 characters. Leave empty for default behavior.
namestringNo”Upload”A name for the task
target_clip_countintegerNo10Desired number of clips to generate
max_clip_countintegerNo10Maximum number of clips to generate
min_durationintegerNo1Minimum duration for clips in seconds (1-120)
max_durationintegerNo180Maximum duration for clips in seconds (1-180)
target_durationintegerNo60Target duration for clips in seconds (1-120)
editing_optionsobjectNo-See Editing Options
dimensionsobjectNo-See Dimensions
style_preset_idstringNo-Style preset identifier. See Styling
max_live_durationintegerNoYour key’s maximum input lengthLive streams only: how much of the stream is followed at most, in seconds (600-43200). See Live Streams

Editing Options

ParameterTypeDefaultDescription
captionsbooleantrueInclude captions in the shorts
reframebooleantrueReframe the video content
emojisbooleantrueInclude emojis in the captions
intro_titlebooleantrueInclude a hook title at the beginning
remove_silencesbooleanfalseRemove silences from the video

Dimensions

ParameterTypeDefaultDescription
widthinteger1080Width of the output video
heightinteger1920Height 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

  1. 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.
  2. A new pass then runs about every 30 minutes on what was broadcast since the last one.
  3. 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"
  }
}
FieldDescription
statelive while the stream is followed, ended once the stream is over, stopped when following stopped early
stop_reasonWhy a stopped task stopped. See the table below
pass_countPasses started so far. It goes up each time new clips are on their way
stream_started_atWhen the broadcast started, when the platform says so
stream_ended_atWhen the broadcast ended, null while it is live
clipped_from_secondsWhere clipping began, in seconds since the start of the stream
clipped_until_secondsHow far the passes started so far reach, in seconds since the start of the stream
next_pass_atWhen 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_reasonMeaning
userYou stopped the task
max_durationThe stream was followed for as long as allowed
payment_requiredYour subscription or credits could not cover the next pass
api_key_revokedThe API key that created the task was deleted
source_unavailableThe stream could no longer be read (removed, made private, age-restricted)
project_deletedThe task’s folder was deleted
error4 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_duration lowers it.
  • max_clip_count, target_clip_count and the duration parameters apply to each pass, not to the whole stream.
  • source_range and curation_range cannot be used with a live stream (400).

Errors

Statuserror_codeMeaning
422live_stream_not_startedThe broadcast is scheduled and has not started yet
422channel_not_liveThe Twitch or Kick channel is not on air
422live_no_recordingThe 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

ParameterTypeRequiredDefaultDescription
source_video_urlstringYes-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.
languagestringNoAuto-detectedLanguage spoken in the source video (e.g., “en”, “es”). Klap works in 99+ languages. Omit it to detect the language automatically.
translate_tostringNo-Target language for translation
transcription_contextstringNo-Optional context (speaker names, brand names, jargon, acronyms, or topic) used to improve transcription accuracy. Max 1000 characters. Leave empty for default behavior.
namestringNo”Upload”A name for the task
editing_optionsobjectYes-See Editing Options
dimensionsobjectNowidth: 1080, height: 1920See Dimensions
style_preset_idstringNo-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

ParameterTypeDescription
task_idstringID 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

StatusDescription
processingTask is still being processed
readyTask has completed successfully
errorTask has failed