Reference

HTTP API.

Every endpoint an agent or script can call, with the exact shapes the server returns.

Basics

Base URLhttps://www.usemontage.com
TransportHTTPS only
FormatJSON 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_.

header
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.

One exception
The presigned upload URL returned by /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

CodeMeaning
200Success
400Validation error — bad input or missing required fields
401Missing, invalid, revoked, or expired credentials
402Insufficient credits
403Forbidden — usually no connected YouTube channel, returned with { "needsAuth": true }
404Not found, or not owned by you
409Conflict — a publish for that video is already uploading or live, or an intent is in the wrong state to cancel or retry
429Rate limited or too many active jobs. Carries a Retry-After header in seconds.
500Server error — safe to retry with backoff

Rate limits

LimitValueScope
Concurrent active jobs10per account
Render jobs created20 / hourper account
Publish requests25 / hourper account
Audio presign requests200 / hourper 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

GET/api/me

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.

200 response
{
  "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.

GET/api/youtube/accounts

Just the connected channels — the same array /api/me returns. Use channelId (the UC… value) when publishing.

200 response
{
  "channels": [
    {
      "id": "8f14e45f-ceea-467a-9f6b-2f1c3d4e5a6b",
      "channelId": "UCxxxxxxxxxxxxx",
      "channelName": "My Beat Channel",
      "connectedAt": "2026-08-01T12:00:00Z"
    }
  ]
}
GET/api/youtube/templates

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.

200 response
{
  "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.

GET/api/credits

Current balance plus recent ledger entries.

200 response
{
  "balance": 95,
  "recentLedger": [
    {
      "id": "3c9f...",
      "delta": -5,
      "reason": "video_render",
      "created_at": "2026-09-07T10:15:00Z",
      "balance_after": 95
    }
  ]
}

Audio upload

POST/api/upload/audio

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.

multipart
curl -X POST https://www.usemontage.com/api/upload/audio \
  -H "Authorization: Bearer $MONTAGE_API_KEY" \
  -F "[email protected]"
200 response
{
  "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.

4 MB ceiling — this one is a hard platform limit
The host rejects request bodies over roughly 4.5 MB with a plain-text 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.
POST/api/upload/audio/presign

Returns a short-lived URL to upload audio directly to storage. Montage never proxies the bytes.

request
{
  "filename": "beat.mp3",
  "filetype": "audio/mpeg",
  "filesize": 5242880
}
FieldRules
filenameRequired. Extension must be one of .mp3, .wav, .flac, .aac, .ogg, .m4a, .opus.
filetypeRequired. MIME type matching the extension, e.g. audio/mpeg.
filesizeRequired. Bytes, at most 209,715,200 (200 MB).
200 response
{
  "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

POST/api/montage/schedule

Creates a render job and returns immediately. This call spends credits and is not idempotent — store the returned jobId before doing anything else.

request
{
  "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
}
FieldRules
titleRequired.
audioStoragePathRequired. The fileKey from presign; must belong to you and already be uploaded.
video_source_typeyoutube (default), upload, or image.
source_youtube_urlRequired when the source type is youtube. Must be a public video.
startTime / endTimeSeconds into the source video marking the segment to loop.
uploaded_video_pathRequired when the source type is upload.
uploaded_image_pathRequired when the source type is image.
200 response
{
  "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.

GET/api/jobs/{jobId}

Status of one render. Poll this every 10 seconds; give up after 30 minutes. The montage object appears only once the status is complete.

200 response — 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

states
pending → downloading → processing → uploading → complete
                                              ↘ error
  • pending — queued, waiting for a worker
  • downloading — fetching the background source
  • processing — FFmpeg combining video and audio
  • uploading — storing the finished file
  • complete — done; montage is populated
  • error — failed; see errorMessage
POST/api/jobs/retry

Re-queues a failed job. No additional credits are charged. Body: { "jobId": "..." }.

POST/api/jobs/delete

Deletes a job. Credits already spent are not refunded. Body: { "jobId": "..." }.

Video library

GET/api/montages

Your finished videos, newest first.

Query paramDefaultNotes
limit20Capped at 100
offset0For pagination
statusallpublished or unpublished filter by whether a YouTube video ID exists
200 response
{
  "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

POST/api/publish/intent

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.

request
{
  "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"
  }
}
FieldRules
montageId / jobIdOne of the two is required — identifies what to publish.
channelIdRequired. The UC… channel ID from /api/me.
titleRequired.
privacyRequired. public, private, or unlisted.
tagsComma-separated string.
publishFullDefaults to true. Set false with a clip to publish only the Short.
clipOptional Short. inSeconds and outSeconds are required together and must span 60 seconds or less.
thumbnailUrlOptional custom thumbnail.
200 response
{
  "success": true,
  "intentId": "c3d4e5f6-...",
  "intentIds": { "full": "c3d4e5f6-...", "short": "d4e5f6a7-..." },
  "status": "queued"
}
403 means connect a channel
A 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.
POST/api/upload/thumbnail

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 }.

GET/api/publish/intent

Look up publish intents. Exactly one selector is required; anything else returns 400.

Query paramSelects
idA single intent by its own ID
jobIdEvery intent for a render job
montageIdEvery intent for a montage
Not intentId
The parameter is id. Polling with ?intentId= returns a 400. When in doubt, poll by jobId — it returns the full video and the Short together.
200 response
{
  "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

states
queued → publishing → published
                   ↘ error
                   ↘ cancelled
POST/api/publish/intent/retry

Retries a failed intent. Body: { "intentId": "..." }.

POST/api/publish/intent/cancel

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:

GET/api/credits/plans

Credit pack pricing.