DocsAPI

API

Send a video, track processing, and download clips with an API key.

9 min read

Authentication

Create an API key in API tokens after signing in with Google. Copy it immediately: its value appears once. Store it in your secret manager or the ALKIN_API_TOKEN environment variable.

Base URL: https://alkin.app/api/v1. Send Authorization: Bearer <token> with every request. The API key identifies your account and grants access to your own projects, jobs, and uploads.

Applications can also send an OAuth access token issued for the resource https://alkin.app/api/v1. Its approved scopes determine access; personal API keys keep the permission presets below.

Choose Read only to list projects, check jobs, and download clips. Choose Automation to also create and update projects, upload videos, and start jobs. Keys expire after 7, 30 or 90 days; the default is 30 days. Each account can have three active keys.

Quickstart

Send a video, check the job, then download its clips. A project is optional.

Alkin generates all project and job IDs. Creation requests do not accept an id. The commands below read the returned data.id into JOB_ID and reuse it automatically.

These terminal examples use curl and jq. Set ALKIN_API_TOKEN securely first and run the commands in the same shell. Replace YOUR_VIDEO_ID with your video's YouTube ID. If a command fails, resolve the error before continuing.

Start a run

Requires Automation. Send only the video source. Returns 202 with the new job in data; JOB_ID captures its server-generated ID. This starts video processing.

Terminal
JOB_ID=$(
  curl --fail-with-body https://alkin.app/api/v1/jobs \
    --header "Authorization: Bearer $ALKIN_API_TOKEN" \
    --header 'Content-Type: application/json' \
    --data '{"source":{"type":"youtube","url":"https://www.youtube.com/watch?v=YOUR_VIDEO_ID"}}' |
  jq -er '.data.id'
)

Check a run

Uses JOB_ID from the creation response. Repeat every 2–3 seconds, backing off on errors. Stop when data.status is completed or failed. A 200 response means the lookup succeeded, not that processing finished.

Terminal
curl --fail-with-body \
  --header "Authorization: Bearer $ALKIN_API_TOKEN" \
  "https://alkin.app/api/v1/jobs/$JOB_ID"

Job statuses: queued, running, completed, failed. The optional stage is downloading, transcribing, choosing, cutting, or null. A failed job includes error.code.

Download clips

Run after completion, using the same JOB_ID. Returns data.clips, each with filename, previewUrl, and downloadUrl, plus data.expiresIn in seconds. Links expire after 15 minutes; request fresh ones when needed. Download directly from those links without forwarding your API key.

Terminal
curl --fail-with-body \
  --header "Authorization: Bearer $ALKIN_API_TOKEN" \
  "https://alkin.app/api/v1/jobs/$JOB_ID/downloads"

Routes

These are all methods available with an API key. JSON requests need Content-Type: application/json. Responses use { "data": ... } on success or { "error": { "code": "...", "message": "..." } } on failure. Use IDs returned by the API wherever a route contains {id}.

Routes
Method and routePermissionRequest and result
POST/api/v1/jobsAutomationsource, optional projectId and ranges → 202, job with a server-generated id.
GET/api/v1/jobs/{id}Read only or AutomationJob status, stage, configuration, clips, and error.
GET/api/v1/jobs/{id}/downloadsRead only or AutomationSigned links for a completed job; 409 until complete.
POST/api/v1/uploadsAutomationfilename and size in bytes → a signed PUT URL and server-generated objectKey.
POST/api/v1/game-assets/ball-headAutomationRaw transparent PNG/WebP, up to 2 MiB → private reusable head asset ID.
GET/api/v1/game-assets/ball-headRead only or AutomationYour uploaded heads and temporary preview links.
POST/api/v1/projectsAutomationtitle (1–120 characters), optional configuration → 201, project with a server-generated id.
GET/api/v1/projectsRead only or AutomationUp to 100 owned projects, newest first, with latestJob.
GET/api/v1/projects/{id}Read only or AutomationProject metadata, configuration, and up to 100 runs in jobs.
PATCH/api/v1/projects/{id}AutomationUpdate title and/or complete configuration → updated project.

Jobs accept an HTTPS YouTube video URL or an owned upload key as source. Optional manual ranges use seconds: [{ "start": 20, "end": 50 }], at most 100 ranges. Manual ranges bypass automatic selection and generated post text. Without projectId, the job uses the default clip settings.

Projects (optional)

Create a project when you want saved configuration and grouped run history. Starting a job directly, as above, does not require a project.

List projects

Works with either permission preset. Returns data, an array of your projects, with latestJob for each project.

Terminal
curl --fail-with-body \
  --header "Authorization: Bearer $ALKIN_API_TOKEN" \
  https://alkin.app/api/v1/projects

Create a project

Requires Automation. Send a title and optional configuration. Alkin creates the ID and returns 201 with the project in data. This command stores its data.id as PROJECT_ID.

Terminal
PROJECT_ID=$(
  curl --fail-with-body https://alkin.app/api/v1/projects \
    --header "Authorization: Bearer $ALKIN_API_TOKEN" \
    --header 'Content-Type: application/json' \
    --data '{"title":"Podcast highlights"}' |
  jq -er '.data.id'
)

To attach a new job to this project, include the returned PROJECT_ID as the job request's projectId. Each new run snapshots the project's saved configuration.

Update a project

Requires Automation or the OAuth projects:update scope. Send title, a complete configuration, or both. Read the project first and preserve fields you do not intend to change. Existing runs keep their saved settings; new runs use the update.

Terminal
curl --fail-with-body --request PATCH "https://alkin.app/api/v1/projects/$PROJECT_ID" \
  --header "Authorization: Bearer $ALKIN_API_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{"title":"Updated project name"}'

Project configuration

Configuration example

Include configuration when creating a project to choose its clip settings. Send the following JSON body to POST /api/v1/projects. This example uses Fit framing.

JSON
{
  "title": "Podcast highlights",
  "configuration": {
  "subtitles": true,
  "preferredSeconds": 30,
  "minSeconds": 20,
  "maxSeconds": 60,
  "hook": false,
  "hookText": "",
  "additionalPrompt": "",
  "framing": "fit",
  "game": {
    "enabled": false,
    "position": "bottom",
    "headAssetId": null,
    "headerLabel": ""
  }
}
}

See Configuration for each setting. Updating or deleting projects through an API key is not supported.

For the ball game, set configuration.game to { "enabled": true, "position": "bottom", "headAssetId": null, "headerLabel": "" }. Position may be top or bottom. The built-in header shows the project name when headerLabel is empty. An uploaded head's ID can replace null. The game adjusts its motion to the clip length and leaves at least four rings at the end.

For a top title, set configuration.title to { "enabled": true, "text": "", "showPart": true }. Empty text uses each clip's publishing title; custom text allows up to 120 characters. Part numbering follows the saved clip order. Set configuration.subtitlePosition to "center" or "bottom" (the default).

Rebuild a completed run

POST /api/v1/jobs/{jobId}/rebuild requires jobs:create. Send { "configuration": { ... }, "clipIndices": [1, 2] } to edit specific finished clips (one-based indices); this also works for older clips without saved source ranges. Send ranges with absolute source seconds and each clip's metadata (title, description, hashtags, tags) to render an exact ordered plan from the saved source and transcript, without selecting moments or transcribing again. ranges and clipIndices cannot be combined. Omit both to rebuild saved moments or choose clips again when selection settings change. Send {} to use the project's saved settings. Idempotency-Key is optional; equivalent concurrent rebuilds also deduplicate.

The response's data contains { "job": { ... }, "reused": false }. A new version returns 202 and can be polled through the normal job endpoint. Unchanged settings or an existing equivalent version return 200 with reused: true. No work starts for unchanged effective settings. Old versions stay available.

Appearance changes keep exact clip boundaries. Changes to additionalPrompt, preferredSeconds, minSeconds or maxSeconds select new clips from the stored transcript. The video and transcript are read from R2; YouTube download and transcription are skipped. Rendering reserves the total selected source seconds; selection changes reserve the full source duration. Storage retention still applies.

Missing cached media returns 409 reusable_media_missing. An older automatic job without saved boundaries returns 409 clip_plan_unavailable for an appearance-only change; change the clipping prompt or duration to select again from retained media. Arbitrary storage keys are not accepted by this endpoint.

Upload a ball head

Upload a transparent square PNG/WebP through POST /api/v1/game-assets/ball-head with your API key, Content-Type: image/png or image/webp, and the raw file body; the API returns data.id. Images must be 256–2048 px wide and no larger than 2 MiB.

Terminal
curl --fail-with-body \
  --header "Authorization: Bearer $ALKIN_API_TOKEN" \
  --header "Content-Type: image/png" \
  --data-binary @head.png \
  "https://alkin.app/api/v1/game-assets/ball-head"

Video files

Upload a video

Alternative to a YouTube source. Requires Automation. Supported files: MP4, MOV, WEBM, MKV, up to 5 GiB. Use the file's actual byte size.

Terminal
curl --fail-with-body https://alkin.app/api/v1/uploads \
  --header "Authorization: Bearer $ALKIN_API_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{"filename":"video.mp4","size":1048576}'

The response's data contains url, method, headers, objectKey, and expiresIn. Upload the file bytes to that URL with PUT and the returned headers. Do not forward your API key to storage. Only after the upload succeeds, create a job with source: { "type": "upload", "objectKey": "<returned objectKey>" } instead of the YouTube source. Use the objectKey generated by the API.

Retries (optional)

Idempotency-Key is optional. It protects clients that automatically retry project or job creation after a timeout. It is a retry label; Alkin still generates the resource ID.

If you use this header, keep its value and JSON body unchanged for retries of the same creation request. A matching retry returns the original resource; changed input returns 409. Use a different retry label for a new operation. Values accept 16–128 letters, digits, underscores, or hyphens.

Without the header, each accepted creation request creates a new resource. Do not automatically retry a creation request without retry protection. Status and download-link reads can be retried safely.

Limits

All API keys and app requests share your account's allowance. Creating another key does not reset a limit. Project creation and updates share their bucket with deletion in the app. Request windows are fixed and UTC-aligned; daily processing allowances reset at midnight UTC.

Limits
OperationAllowance per account
API reads, including polling and download signing120 per minute
Project creation and updates60 per minute
Job creation attempts10 per hour
Upload links10 per hour
API key creation attempts10 per hour
Active queued or running jobs1
Source-video processing180 minutes per UTC day

The service also permits 900 source-video minutes per UTC day across all accounts. Processing charges the measured source duration before transcription and rendering. A rejected reservation starts neither. The same reservation is never charged twice; admitted source duration remains charged if processing later fails.

Errors and recovery

Errors and recovery
ResponseWhat to do
400validation_errorCheck the JSON shape, required fields, video URL, IDs, and limits.
401unauthorizedReplace a missing, invalid, expired, or revoked API key.
403Check the key's permission preset and use an upload owned by your account.
404Check the project or job ID. Missing and other accounts' resources return the same response.
409Wait for job completion, or retry creation with the original body and idempotency key.
415unsupported_media_typeSend Content-Type: application/json for JSON bodies.
429Wait for the Retry-After delay, in seconds, before retrying.
503Authentication, quota storage, or another required service is unavailable. Retry later.

For a failed job, read data.error.code. DOWNLOAD_FAILED concerns the source, PROCESSING_FAILED concerns processing, and UPLOAD_FAILED concerns storage. PROCESSING_LIMIT_EXCEEDED means the source exceeded the remaining account or service daily allowance; use a shorter source or wait until midnight UTC. No transcription or rendering started for that rejected reservation.

Replace or revoke a key

Create a replacement in API tokens, test it with the read-only project listing, update your client, then choose Revoke on the old key. Revocation immediately blocks new requests. Accepted jobs continue to finish. Revocation does not invalidate already issued storage links; they expire separately. Expired or revoked keys free an active slot. A lost key cannot be recovered; create a replacement.