---
title: "Buy a behind-subject matte for one source window"
method: POST
path: "/v1/media/{id}/matte"
tags: ["media"]
---

# Buy a behind-subject matte for one source window

`POST /v1/media/{id}/matte`

## Request

- Base URL: `https://api.cueframe.ai`
- URL: `https://api.cueframe.ai/v1/media/{id}/matte`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.cueframe.ai/api/auth/mcp/authorize`, token URL `https://api.cueframe.ai/api/auth/mcp/token`, scopes: `media:write`)
  - API key in header `PAYMENT-SIGNATURE`

Bakes the alpha matte that lets a graphic sit BEHIND the subject for a specific source window. The window is the clip's SOURCE trim (`startSec`/`endSec` in seconds into the underlying file), not timeline time, and it is required — a matte's cost scales with its duration. Async: poll `GET /media/{id}/facts` for the matte fact's status. If a matte for this exact window already exists (bought earlier, or baked by a compose that put a graphic behind the subject) this returns 200 with the existing state and charges NOTHING. `summary.presenceFraction` on the delivered fact is the viability signal: below 0.6 there is no reliable silhouette, and that matte is delivered free.

## Path parameters

- `id` string, required

## Request body

- MatteBakeRequest: POST /media/:id/matte body. The window is REQUIRED and is the clip's SOURCE trim, not timeline time: a matte's cost scales with its duration, so there is no whole-source default to fall back on.
  - `startSec` number, required: Source-in of the window to matte, in seconds into the underlying source.
  - `endSec` number, required: Source-out of the window to matte, in seconds into the underlying source.

## Response `202`

Matte bake dispatched (`alreadyExisted:false`), or the matte already exists (`alreadyExisted:true`) — in which case nothing was dispatched and nothing will be charged.

- MatteBakeTriggerResponse: POST /media/:id/matte response — the claimed matte fact.
  - `factId` string, required
  - `status` 'pending' | 'ready' | 'failed', required
  - `quotedUsd` number, required: The server's price for this matte, in USD, quoted from the window duration.
  - `alreadyExisted` boolean, required: True when a matte for this exact window was already pending or ready. Nothing was dispatched and nothing will be charged.

## Other responses

- `400`: Bad request — validation_error / invalid_cursor / invalid_query.
- `401`: Missing or invalid Authorization header.
- `402`: Payment required — billing_required or x402 payment_*.
- `403`: Forbidden — permission insufficient.
- `404`: Resource not found.
- `409`: Conflict — stale_etag / idempotency_conflict / suggestions_already_complete.
- `422`: Unprocessable — invalid_composition / media_in_use / session_in_use / render_not_cancellable.
- `429`: Rate limited. Retry-After header present.
- `500`: Internal error.
- `503`: Service unavailable — billing_unavailable / honest-503 for runtime deps.

---

[API](https://skmtc.dev/cueframe/apis/cueframe-api.md) · [All operations](https://skmtc.dev/cueframe/apis/cueframe-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cueframe/apis/cueframe-api/revisions/8f9bfe362b4a?raw)
