HTTP API.
Every endpoint an agent or script can call, with the exact shapes the server returns.
Basics
| Base URL | https://www.usemontage.com |
| Transport | HTTPS only |
| Format | JSON request and response bodies |
| Errors | { "error": "message" }, sometimes with extra fields |
A machine-readable description of this page lives at /openapi.json, and a Markdown copy at /docs/agent-api.md.
Authentication
Send a Bearer token on every request. Keys are minted at /account/api-keys and start with mk_live_.
Authorization: Bearer mk_live_...A key acts as the user who created it, with that user’s full permissions. Browser cookie sessions authenticate against the same endpoints, which is how the web app uses them.
/api/upload/audio/presign points at object storage, not at Montage. Do not send an Authorization header with that PUT — it will be rejected.Status codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Validation error — bad input or missing required fields |
| 401 | Missing, invalid, revoked, or expired credentials |
| 402 | Insufficient credits |
| 403 | Forbidden — usually no connected YouTube channel, returned with { "needsAuth": true } |
| 404 | Not found, or not owned by you |
| 409 | Conflict — a publish for that video is already uploading or live, or an intent is in the wrong state to cancel or retry |
| 429 | Rate limited or too many active jobs. Carries a Retry-After header in seconds. |
| 500 | Server error — safe to retry with backoff |
Rate limits
| Limit | Value | Scope |
|---|---|---|
| Concurrent active jobs | 10 | per account |
| Render jobs created | 20 / hour | per account |
| Publish requests | 25 / hour | per account |
| Audio presign requests | 200 / hour | per account |
Limits are shared across every API key and browser session on the account. On a 429, wait the number of seconds in Retry-After.
Account
Everything an agent needs to decide whether it can proceed: identity, subscription, credits, connected channels, in-flight jobs, and platform limits. One call, no parameters.
{
"userId": "550e8400-e29b-41d4-a716-446655440000",
"email": "[email protected]",
"authMethod": "api_key",
"subscription": {
"status": "active",
"currentPeriodEnd": "2026-10-07T00:00:00Z"
},
"credits": { "balance": 95, "costPerVideo": 5 },
"youtubeChannels": [
{
"id": "8f14e45f-ceea-467a-9f6b-2f1c3d4e5a6b",
"channelId": "UCxxxxxxxxxxxxx",
"channelName": "My Beat Channel",
"connectedAt": "2026-08-01T12:00:00Z"
}
],
"activeJobs": 0,
"limits": {
"maxConcurrentJobs": 10,
"maxClipSeconds": 60,
"maxAudioBytes": 209715200
}
}subscription.status is null when there has never been a subscription. authMethod is api_key or cookie.
Just the connected channels — the same array /api/me returns. Use channelId (the UC… value) when publishing.
{
"channels": [
{
"id": "8f14e45f-ceea-467a-9f6b-2f1c3d4e5a6b",
"channelId": "UCxxxxxxxxxxxxx",
"channelName": "My Beat Channel",
"connectedAt": "2026-08-01T12:00:00Z"
}
]
}The caller’s saved YouTube detail templates — the reusable title/description/tags presets from the publish page. Lets an agent reuse a producer’s own presets instead of inventing metadata. Read-only; creating and editing templates stays in the web UI.
{
"templates": [
{
"id": "uuid",
"name": "Default type beat",
"title": "Dark Trap Type Beat",
"description": "Free for non-profit use...",
"tags": "type beat,trap,free beat",
"isPublic": true,
"allowComments": true,
"createdAt": "2026-08-01T12:00:00Z",
"updatedAt": "2026-08-01T12:00:00Z"
}
]
}tags is already the comma-separated string that POST /api/publish/intent expects.
Current balance plus recent ledger entries.
{
"balance": 95,
"recentLedger": [
{
"id": "3c9f...",
"delta": -5,
"reason": "video_render",
"created_at": "2026-09-07T10:15:00Z",
"balance_after": 95
}
]
}Audio upload
Uploads audio straight to the API domain. Use this when the caller cannot reach third-party storage hosts — sandboxed agents with egress allowlists usually cannot. Accepts multipart/form-data with an audio field, or a raw body with an audio/* content type and an x-filename header.
curl -X POST https://www.usemontage.com/api/upload/audio \
-H "Authorization: Bearer $MONTAGE_API_KEY" \
-F "[email protected]"{
"success": true,
"fileKey": "audio/1757241600000-8f14e45f-beat.mp3",
"audioStoragePath": "audio/1757241600000-8f14e45f-beat.mp3",
"file": {
"path": "audio/1757241600000-8f14e45f-beat.mp3",
"url": "https://cdn.usemontage.com/audio/...",
"original_name": "beat.mp3",
"sanitized_name": "beat.mp3",
"storage_type": "r2"
}
}fileKey, audioStoragePath, and file.path are all the same string — pass any of them to the schedule endpoint. Uploading costs no credits on either path; only rendering does. The multipart field is audio, and the older name file still works.
413 beforethis handler runs, so you will not get a JSON error back. Send at most 4 MB here — the exact figure is in limits.maxDirectUploadBytes from GET /api/me— and use the presign flow below for anything larger. A 3-minute MP3 above about 192 kbps will exceed this.Returns a short-lived URL to upload audio directly to storage. Montage never proxies the bytes.
{
"filename": "beat.mp3",
"filetype": "audio/mpeg",
"filesize": 5242880
}| Field | Rules |
|---|---|
filename | Required. Extension must be one of .mp3, .wav, .flac, .aac, .ogg, .m4a, .opus. |
filetype | Required. MIME type matching the extension, e.g. audio/mpeg. |
filesize | Required. Bytes, at most 209,715,200 (200 MB). |
{
"presignedUrl": "https://....r2.cloudflarestorage.com/audio/...?X-Amz-Signature=...",
"fileKey": "audio/1757241600000-8f14e45f-.../beat.mp3"
}The URL is valid for one hour. PUT the raw bytes to it with Content-Type set to the same filetype, and no authorization header. Then pass fileKey to the schedule endpoint as audioStoragePath.
Render jobs
Creates a render job and returns immediately. This call spends credits and is not idempotent — store the returned jobId before doing anything else.
{
"title": "Dark Trap Type Beat",
"audioStoragePath": "audio/1757241600000-.../beat.mp3",
"video_source_type": "youtube",
"source_youtube_url": "https://www.youtube.com/watch?v=VIDEO_ID",
"startTime": 30,
"endTime": 150
}| Field | Rules |
|---|---|
title | Required. |
audioStoragePath | Required. The fileKey from presign; must belong to you and already be uploaded. |
video_source_type | youtube (default), upload, or image. |
source_youtube_url | Required when the source type is youtube. Must be a public video. |
startTime / endTime | Seconds into the source video marking the segment to loop. |
uploaded_video_path | Required when the source type is upload. |
uploaded_image_path | Required when the source type is image. |
{
"success": true,
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"creditsRemaining": 90
}Returns 402 when credits are short, and 429 when you already have 10 active jobs or have created 20 in the last hour.
Status of one render. Poll this every 10 seconds; give up after 30 minutes. The montage object appears only once the status is complete.
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Dark Trap Type Beat",
"status": "complete",
"progress": 100,
"createdAt": "2026-09-07T10:00:00Z",
"updatedAt": "2026-09-07T10:15:00Z",
"input": {
"videoSourceType": "youtube",
"sourceYoutubeUrl": "https://www.youtube.com/watch?v=VIDEO_ID",
"startTime": 30,
"endTime": 150
},
"montage": {
"id": "b7e2c1a0-...",
"title": "Dark Trap Type Beat",
"videoUrl": "https://cdn.usemontage.com/montages/.../video.mp4",
"thumbnailUrl": null,
"youtubeVideoId": null,
"createdAt": "2026-09-07T10:15:00Z"
},
"publishIntents": []
}On failure the status is error and an errorMessage field is present. A malformed job ID returns 400; someone else’s job returns 404.
Job status machine
pending → downloading → processing → uploading → complete
↘ errorpending— queued, waiting for a workerdownloading— fetching the background sourceprocessing— FFmpeg combining video and audiouploading— storing the finished filecomplete— done;montageis populatederror— failed; seeerrorMessage
Re-queues a failed job. No additional credits are charged. Body: { "jobId": "..." }.
Deletes a job. Credits already spent are not refunded. Body: { "jobId": "..." }.
Video library
Your finished videos, newest first.
| Query param | Default | Notes |
|---|---|---|
limit | 20 | Capped at 100 |
offset | 0 | For pagination |
status | all | published or unpublished filter by whether a YouTube video ID exists |
{
"montages": [
{
"id": "b7e2c1a0-...",
"title": "Dark Trap Type Beat",
"videoUrl": "https://cdn.usemontage.com/montages/.../video.mp4",
"thumbnailUrl": null,
"storageType": "r2",
"youtubeVideoId": "dQw4w9WgXcQ",
"createdAt": "2026-09-07T10:15:00Z",
"updatedAt": "2026-09-07T10:35:00Z"
}
],
"total": 42,
"limit": 20,
"offset": 0
}Publishing
Queues a YouTube upload. You can publish the full video, a vertical Short cut from it, or both in one call. There is one intent per montage and kind: repeating the call while it is still queued just updates it. Once the upload has started or finished, a repeat returns 409 instead of uploading a second copy — code is publish_in_progress (keep polling) or already_published (the body's intents carry the youtubeUrl). Send "force": true only to deliberately upload a published video again.
{
"montageId": "b7e2c1a0-...",
"channelId": "UCxxxxxxxxxxxxx",
"title": "Dark Trap Type Beat - \"Nightshift\"",
"description": "Free for non-profit use.",
"tags": "type beat,trap,free beat",
"privacy": "public",
"category": "music",
"publishFull": true,
"clip": {
"inSeconds": 10,
"outSeconds": 70,
"title": "Nightshift - SHORT"
}
}| Field | Rules |
|---|---|
montageId / jobId | One of the two is required — identifies what to publish. |
channelId | Required. The UC… channel ID from /api/me. |
title | Required. |
privacy | Required. public, private, or unlisted. |
tags | Comma-separated string. |
publishFull | Defaults to true. Set false with a clip to publish only the Short. |
clip | Optional Short. inSeconds and outSeconds are required together and must span 60 seconds or less. |
thumbnailUrl | Optional custom thumbnail. |
{
"success": true,
"intentId": "c3d4e5f6-...",
"intentIds": { "full": "c3d4e5f6-...", "short": "d4e5f6a7-..." },
"status": "queued"
}403 carrying { "needsAuth": true } means there is no usable YouTube authorization. The account owner has to reconnect at /connections — an agent cannot resolve this on its own.Attaches a custom thumbnail to a finished video before publishing. multipart/form-data with montageId or jobId, plus either a file field or a dataUrl string. Maximum 5 MB. Returns { success, thumbnailUrl }.
Look up publish intents. Exactly one selector is required; anything else returns 400.
| Query param | Selects |
|---|---|
id | A single intent by its own ID |
jobId | Every intent for a render job |
montageId | Every intent for a montage |
id. Polling with ?intentId= returns a 400. When in doubt, poll by jobId — it returns the full video and the Short together.{
"intents": [
{
"id": "c3d4e5f6-...",
"kind": "youtube_full",
"status": "published",
"jobId": "550e8400-...",
"montageId": "b7e2c1a0-...",
"channelId": "UCxxxxxxxxxxxxx",
"title": "Dark Trap Type Beat - \"Nightshift\"",
"privacy": "public",
"youtubeVideoId": "dQw4w9WgXcQ",
"youtubeUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"errorMessage": null,
"attemptCount": 1,
"createdAt": "2026-09-07T10:20:00Z",
"updatedAt": "2026-09-07T10:35:00Z",
"completedAt": "2026-09-07T10:35:00Z"
}
]
}Intents come back oldest first. When you published both a full video and a Short, wait for every intent to reach a terminal state before reporting success.
Publish status machine
queued → publishing → published
↘ error
↘ cancelledRetries a failed intent. Body: { "intentId": "..." }.
Cancels an intent that is still queued. Body: { "intentId": "..." }. Returns { success, cancelledIntentIds }— cancelling a full video also cancels the Short queued behind it. Once the upload has started it can't be stopped, so anything past queued returns 409.
Public endpoints
These need no authentication:
Credit pack pricing.