Skip to content

From a link to an MP4 in five calls

Every call sends the key as a bearer token. Responses are JSON, and errors always carry an error code and a message you can show to a person.

  1. 01

    Create a key

    In the workspace, open Settings > API access and create a key. It is shown once, so store it as a secret. Workspace owners and admins can create keys.

    export CASTKIT_KEY="ck_live_..."
  2. 02

    Create a project from a URL

    Pass a public video or audio link: YouTube, a podcast MP3 or a direct file. Processing starts right away and the response carries the project id. To send a file instead, ask for an upload target, PUT the file, then call start.

    curl -X POST https://api.castkit.ai/api/v1/projects \
      -H "Authorization: Bearer $CASTKIT_KEY" \
      -H "Content-Type: application/json" \
      -d '{"url": "https://www.youtube.com/watch?v=VIDEO_ID", "clipCount": 8}'
  3. 03

    Poll the project

    Status moves from processing to ready, with progress from 0 to 100 on the way. Or skip polling and listen for the project.ready webhook.

    curl https://api.castkit.ai/api/v1/projects/$PROJECT_ID \
      -H "Authorization: Bearer $CASTKIT_KEY"
  4. 04

    List the clips

    Clips come back best score first, with title, hook, timings, transcript and caption lines, so your code can pick the ones worth rendering.

    curl https://api.castkit.ai/api/v1/projects/$PROJECT_ID/clips \
      -H "Authorization: Bearer $CASTKIT_KEY"
  5. 05

    Render an export

    Pick an aspect (9:16, 1:1, 4:5 or 16:9) and a quality. The render burns the captions in and returns an export id.

    curl -X POST https://api.castkit.ai/api/v1/clips/$CLIP_ID/exports \
      -H "Authorization: Bearer $CASTKIT_KEY" \
      -H "Content-Type: application/json" \
      -d '{"aspect": "9:16", "quality": "1080p"}'
  6. 06

    Get the download URL

    Once the export status is done, it carries a signed MP4 link. Links expire, so fetch the export again whenever you need a fresh one.

    curl https://api.castkit.ai/api/v1/exports/$EXPORT_ID \
      -H "Authorization: Bearer $CASTKIT_KEY"

Your first clip from code is one key away.

Create a key, paste the quick start into a terminal and watch the first export land. The first episode is free.