{"openapi":"3.1.0","info":{"title":"CastKit API","version":"1.0.0","description":"Turn a long episode into ranked, captioned clips from your own code.\n\nAuthenticate with an API key from Settings > API access, sent as `Authorization: Bearer ck_live_...`.\nA key acts inside one workspace with the same plan, the same free first episode and the same export rules as the dashboard.\n\nLimits: 60 requests per minute per key, 3 projects processing and 5 exports running per workspace at once. Over a limit you get 429 with a Retry-After header.\n\nErrors always carry `{ error, message }`. A 402 means the plan does not cover the request and carries an `upgrade` object. A 403 `email_unverified` means the free first episode's clips and its free export are waiting on the account owner verifying their email.\n\nWebhooks: register an https endpoint in Settings > API access. Each delivery is a POST with a JSON event and a `CastKit-Signature: t=<unix seconds>,v1=<hex>` header, where v1 is HMAC-SHA256 of `<t>.<raw body>` keyed with the endpoint's signing secret. Reject a timestamp older than five minutes. Answer 2xx within 10 seconds; anything else is retried with exponential backoff, eight attempts over about an hour. `CastKit-Event-Id` stays the same across retries.\n\nMCP: the same key works at https://api.castkit.ai/mcp (Streamable HTTP, stateless)."},"servers":[{"url":"https://api.castkit.ai"}],"security":[{"bearer":[]}],"tags":[{"name":"Account"},{"name":"Projects","description":"A project is one episode: a video or audio source and everything CastKit makes from it."},{"name":"Clips"},{"name":"Exports","description":"An export is one rendered MP4 of a clip, with captions burned in."}],"paths":{"/api/v1/me":{"get":{"tags":["Account"],"operationId":"getMe","summary":"The workspace behind this key, its plan and its limits","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"$ref":"#/components/responses/E401"},"429":{"$ref":"#/components/responses/E429"}}}},"/api/v1/projects":{"get":{"tags":["Projects"],"operationId":"listProjects","summary":"List projects, newest first","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}}}}}}},"401":{"$ref":"#/components/responses/E401"},"429":{"$ref":"#/components/responses/E429"}}},"post":{"tags":["Projects"],"operationId":"createProject","summary":"Create a project from a URL or a file upload","description":"With `url`, CastKit fetches the source and starts processing right away. With `upload`, the response carries a presigned `upload.url`: PUT the file there with the given headers, then call `POST /api/v1/projects/{id}/start`. The account's one free first episode and the workspace's plan minutes apply exactly as in the dashboard.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProject"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","required":["project"],"properties":{"project":{"$ref":"#/components/schemas/Project"},"upload":{"$ref":"#/components/schemas/UploadTarget"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"413":{"$ref":"#/components/responses/E413"},"415":{"$ref":"#/components/responses/E415"},"429":{"$ref":"#/components/responses/E429"},"503":{"$ref":"#/components/responses/E503"}}}},"/api/v1/projects/{id}":{"get":{"tags":["Projects"],"operationId":"getProject","summary":"Get a project and its processing status","parameters":[{"name":"id","in":"path","required":true,"description":"Project id","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}}}}}},"401":{"$ref":"#/components/responses/E401"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/api/v1/projects/{id}/start":{"post":{"tags":["Projects"],"operationId":"startProject","summary":"Start processing after the upload PUT has finished","parameters":[{"name":"id","in":"path","required":true,"description":"Project id","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}}}}}},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"413":{"$ref":"#/components/responses/E413"},"429":{"$ref":"#/components/responses/E429"},"503":{"$ref":"#/components/responses/E503"}}}},"/api/v1/projects/{id}/clips":{"get":{"tags":["Clips"],"operationId":"listClips","summary":"List a project's clips, best score first, with transcript and caption lines","parameters":[{"name":"id","in":"path","required":true,"description":"Project id","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"clips":{"type":"array","items":{"$ref":"#/components/schemas/Clip"}}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/api/v1/projects/{id}/transcript":{"get":{"tags":["Projects"],"operationId":"getTranscript","summary":"Get the full transcript as JSON, SRT, VTT or plain text","parameters":[{"name":"id","in":"path","required":true,"description":"Project id","schema":{"type":"string"}},{"name":"format","in":"query","schema":{"type":"string","enum":["json","srt","vtt","txt"],"default":"json"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transcript"}},"application/x-subrip":{"schema":{"type":"string"}},"text/vtt":{"schema":{"type":"string"}},"text/plain":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/api/v1/clips/{id}":{"get":{"tags":["Clips"],"operationId":"getClip","summary":"Get one clip","parameters":[{"name":"id","in":"path","required":true,"description":"Clip id","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"clip":{"$ref":"#/components/schemas/Clip"}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/api/v1/clips/{id}/exports":{"post":{"tags":["Exports"],"operationId":"createExport","summary":"Render a clip to MP4","description":"Billed exactly like an export from the dashboard. A paid plan exports at the requested quality with no watermark. Without a plan, the free first episode gets one 1080p export with the CastKit mark; any other export answers 402.","parameters":[{"name":"id","in":"path","required":true,"description":"Clip id","schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateExport"}}}},"responses":{"201":{"description":"Started","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/Export"}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"402":{"$ref":"#/components/responses/E402"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"},"503":{"$ref":"#/components/responses/E503"}}},"get":{"tags":["Exports"],"operationId":"listExports","summary":"List a clip's exports, newest first","parameters":[{"name":"id","in":"path","required":true,"description":"Clip id","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"exports":{"type":"array","items":{"$ref":"#/components/schemas/Export"}}}}}}},"401":{"$ref":"#/components/responses/E401"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/api/v1/exports/{id}":{"get":{"tags":["Exports"],"operationId":"getExport","summary":"Get an export; a finished one carries a signed download URL","parameters":[{"name":"id","in":"path","required":true,"description":"Export id","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/Export"}}}}}},"401":{"$ref":"#/components/responses/E401"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}}},"webhooks":{"project.ready":{"post":{"summary":"project.ready","description":"A project finished processing. data.project carries the project; clipsReady is false when only the transcript finished.","parameters":[{"name":"CastKit-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of t.body>"},{"name":"CastKit-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"CastKit-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","data"],"properties":{"id":{"type":"string","examples":["evt_3f1c..."]},"type":{"type":"string","const":"project.ready"},"createdAt":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}}}}}}}},"responses":{"200":{"description":"Any 2xx acknowledges the event"}}}},"project.failed":{"post":{"summary":"project.failed","description":"A project stopped with an error. data.project.error says why.","parameters":[{"name":"CastKit-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of t.body>"},{"name":"CastKit-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"CastKit-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","data"],"properties":{"id":{"type":"string","examples":["evt_3f1c..."]},"type":{"type":"string","const":"project.failed"},"createdAt":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}}}}}}}},"responses":{"200":{"description":"Any 2xx acknowledges the event"}}}},"clip.rendered":{"post":{"summary":"clip.rendered","description":"An export finished. data.export.download holds a signed MP4 link that expires; call GET /api/v1/exports/{id} for a fresh one.","parameters":[{"name":"CastKit-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of t.body>"},{"name":"CastKit-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"CastKit-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","data"],"properties":{"id":{"type":"string","examples":["evt_3f1c..."]},"type":{"type":"string","const":"clip.rendered"},"createdAt":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/Export"},"clip":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"projectId":{"type":"string"}}}}}}}}}},"responses":{"200":{"description":"Any 2xx acknowledges the event"}}}},"export.failed":{"post":{"summary":"export.failed","description":"An export failed after its retries. data.export.error says why.","parameters":[{"name":"CastKit-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of t.body>"},{"name":"CastKit-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"CastKit-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","data"],"properties":{"id":{"type":"string","examples":["evt_3f1c..."]},"type":{"type":"string","const":"export.failed"},"createdAt":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/Export"},"clip":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"projectId":{"type":"string"}}}}}}}}}},"responses":{"200":{"description":"Any 2xx acknowledges the event"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"An API key: ck_live_..."}},"responses":{"E400":{"description":"The request body or a parameter is invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E401":{"description":"Missing, unknown or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E402":{"description":"The plan does not cover this. The body carries an upgrade object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E403":{"description":"email_unverified: the free first episode's clips and its free export need the workspace owner's email to be verified first","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E404":{"description":"Not found in this workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E409":{"description":"Conflict, for example the same export is already running","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E413":{"description":"The file is over the size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E415":{"description":"Not an audio or video file","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E429":{"description":"Rate or concurrency limit. Wait for Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E503":{"description":"Could not be queued. Safe to retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error","message"],"properties":{"error":{"type":"string","examples":["subscription_required"]},"message":{"type":"string"},"upgrade":{"type":"object","properties":{"plan":{"type":"string"},"monthlyCents":{"type":"integer"},"yearlyCents":{"type":"integer"}}}}},"Me":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}}},"plan":{"type":"object","properties":{"active":{"type":"boolean"},"key":{"type":["string","null"]}}},"freeEpisodeAvailable":{"type":"boolean"},"usage":{"type":"object","properties":{"minutesUsed":{"type":"number"},"minutesLimit":{"type":["number","null"]},"periodEnd":{"type":["string","null"],"format":"date-time"}}},"limits":{"type":"object","properties":{"requestsPerMinute":{"type":"integer"},"activeProjects":{"type":"integer"},"activeExports":{"type":"integer"},"maxKeys":{"type":"integer"}}}}},"CreateProject":{"oneOf":[{"type":"object","required":["url"],"additionalProperties":false,"properties":{"url":{"type":"string","format":"uri","description":"A public video or audio link (YouTube, a podcast MP3, a direct file URL)"},"title":{"type":"string","maxLength":300},"language":{"type":"string","description":"A language code, or auto (default)","examples":["auto","en","fr"]},"instructions":{"type":"string","description":"What to look for, in plain words, for the clip finder"},"vocabulary":{"type":"string","description":"Names and terms the transcript should spell right"},"clipCount":{"type":"integer","minimum":1,"maximum":20}}},{"type":"object","required":["upload"],"additionalProperties":false,"properties":{"upload":{"type":"object","required":["filename","sizeBytes"],"additionalProperties":false,"properties":{"filename":{"type":"string","examples":["episode-42.mp4"]},"contentType":{"type":"string","examples":["video/mp4"]},"sizeBytes":{"type":"integer","minimum":1}}},"title":{"type":"string","maxLength":300},"language":{"type":"string","description":"A language code, or auto (default)","examples":["auto","en","fr"]},"instructions":{"type":"string","description":"What to look for, in plain words, for the clip finder"},"vocabulary":{"type":"string","description":"Names and terms the transcript should spell right"},"clipCount":{"type":"integer","minimum":1,"maximum":20}}}]},"UploadTarget":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"method":{"type":"string","const":"PUT"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"expiresAt":{"type":"string","format":"date-time"}}},"Project":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["awaiting_upload","processing","ready","failed"]},"clipsReady":{"type":"boolean","description":"False when only the transcript finished"},"stage":{"type":["string","null"]},"progress":{"type":"integer","minimum":0,"maximum":100},"error":{"type":["string","null"]},"source":{"type":"object","properties":{"type":{"type":"string","enum":["url","upload"]},"url":{"type":"string"}}},"language":{"type":"string"},"durationMs":{"type":"integer"},"freeEpisode":{"type":"boolean"},"clipCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Clip":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"title":{"type":"string"},"hook":{"type":["string","null"]},"reason":{"type":["string","null"]},"startMs":{"type":"integer"},"endMs":{"type":"integer"},"durationMs":{"type":"integer"},"score":{"type":["number","null"],"description":"0 to 100, higher is more likely to hold a viewer"},"scoreParts":{"type":["object","null"],"properties":{"hook":{"type":"number"},"coherence":{"type":"number"},"value":{"type":"number"}}},"aspect":{"type":["string","null"]},"transcript":{"type":["string","null"]},"captions":{"type":["array","null"],"items":{"type":"object","properties":{"startMs":{"type":"integer"},"endMs":{"type":"integer"},"text":{"type":"string"}}}},"createdAt":{"type":"string","format":"date-time"}}},"Transcript":{"type":"object","properties":{"transcript":{"type":"object","properties":{"language":{"type":"string"},"durationMs":{"type":"integer"},"wordCount":{"type":"integer"},"text":{"type":"string"}}}}},"CreateExport":{"type":"object","additionalProperties":false,"properties":{"aspect":{"type":"string","enum":["9:16","1:1","4:5","16:9"],"default":"9:16"},"quality":{"type":"string","enum":["1080p","720p"],"default":"1080p"}}},"Export":{"type":"object","properties":{"id":{"type":"string"},"clipId":{"type":"string"},"projectId":{"type":"string"},"status":{"type":"string","enum":["queued","running","done","failed"]},"aspect":{"type":"string"},"quality":{"type":"string","enum":["1080p","720p"]},"watermarked":{"type":"boolean"},"width":{"type":["integer","null"]},"height":{"type":["integer","null"]},"durationMs":{"type":["integer","null"]},"bytes":{"type":["integer","null"]},"error":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"download":{"type":"object","description":"Present once status is done. The URL is signed and expires; fetch the export again for a fresh one.","properties":{"url":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"}}}}}}}}