---
title: "Generate Mask by Prompt"
method: POST
path: "/mask_by_prompt"
tags: ["Masking Endpoints"]
---

# Generate Mask by Prompt

`POST /mask_by_prompt`

Generates a segmentation mask video based on a text prompt.

Response behavior:
- Returns HTTP 202 with `request_id` and `status_url`
- The final result (via Status Service) will contain a `mask_url`.

Constraints:
- Max Duration: 5 seconds (Truncated if `auto_trim`=true).
- Max Resolution: 750p.

## Headers

- `api_token` string, required

## Request body

- object
  - `video` string, required — Publicly accessible URL for the input video file.
  - `prompt` string, required — The text instruction describing the object to be masked.
  - `auto_trim` boolean — If true, trims the video to the 5s limit.
  - `output_container_and_codec` 'mp4_h264' | 'mp4_h265' | 'webm_vp9' | 'mov_h265' | 'mov_proresks' | 'mkv_h264' | 'mkv_h265' | 'mkv_vp9' | 'gif'
  - `webhook_url` string, uri — Optional URL for receiving the result via webhook when the async job completes. See [Webhooks](https://docs.bria.ai/webhooks).

## Response `202`

Accepted

- AsyncInitialResponse
  - `request_id` string, required
  - `status_url` string, required

## Other responses

- `400` — Bad request
- `403` — Forbidden
- `405` — Method not allowed
- `415` — Unsupported input container or codec
- `422` — Unprocessable entity
- `429` — Too many requests
- `500` — Internal server error

---

[API](https://skmtc.net/bria-ai/apis/video-api-reference.md) · [All operations](https://skmtc.net/bria-ai/apis/video-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bria-ai/video-api-reference/revisions/fa6d2efc9689/schema)
