---
title: "Add captions to a video"
description: "Adds or replaces a video's captions from a WebVTT (.vtt) or SubRip (.srt) file's text, at most 2 MB."
canonical_url: https://docs.markdrop.in/api/files/add-captions-to-a-video
last_updated: 2026-11-06
site: "Markdrop Docs"
index: https://docs.markdrop.in/llms.txt
---

# Add captions to a video

`PUT https://api.markdrop.in/api/v1/artifacts/{slug}/captions`

Adds or replaces a video's captions from a WebVTT (.vtt) or SubRip (.srt) file's text, at most 2 MB. The player shows them as subtitles, and search and Ask read the video by minute. Needs edit rights on the file.

- **Authentication:** API token required: `Authorization: Bearer mdk_…`.
- **Rate limit:** 20 per minute per IP address.
- **MCP tool:** `set_captions` ([tools](https://docs.markdrop.in/ai/tools))
- **Guide:** [Captions](https://docs.markdrop.in/files/video-and-audio#captions)

## Path parameters

- `slug` (string, required): The document's address: the part after `markdrop.in/`.

## Request body

`application/json`, required.

- `file_name` (string): Up to 200 characters.
- `content` (string, required): The document's Markdown. 1–2,200,000 characters.

## Responses

- `200`: OK.
  - `slug` (string)
  - `url` (string)
  - `title` (string | null): Shown on the page and in link previews.
  - `kind` (string): Default `"artifact"`.
  - `mime` (string)
  - `renderer` (string)
  - `type_label` (string)
  - `size_bytes` (integer)
  - `original_filename` (string | null)
  - `artifact_url` (string)
  - `workspace_url` (string | null)
  - `download_url` (string)
  - `poster_url` (string | null)
  - `captions_url` (string | null)
  - `captions_name` (string | null)
  - `media` (object | null)
  - `created_at` (string (date-time)): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `updated_at` (string (date-time)): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `expires_at` (string (date-time) | null): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `views` (integer): Default `0`.
  - `is_password_protected` (boolean): Default `false`.
  - `is_owner` (boolean): Default `false`.
- `401`: No token, or the token is revoked or mistyped.
- `422`: Not a video, or no captions found in the text (use a .vtt or .srt file).
- `429`: Too many requests from your IP address. Wait the seconds in `Retry-After`.

## Examples

**curl**

```bash
curl -X PUT https://api.markdrop.in/api/v1/artifacts/k3x9q2m/captions \
  -H "Authorization: Bearer $MARKDROP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
       "file_name": "demo.vtt",
       "content": "WEBVTT\n\n00:00:01.000 --> 00:00:04.000\nWelcome to the demo."
     }'
```

**JavaScript**

```javascript
const res = await fetch("https://api.markdrop.in/api/v1/artifacts/k3x9q2m/captions", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.MARKDROP_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "file_name": "demo.vtt",
    "content": "WEBVTT\n\n00:00:01.000 --> 00:00:04.000\nWelcome to the demo."
  }),
});
const data = await res.json();
```

**Python**

```python
import os

import requests

r = requests.put(
    "https://api.markdrop.in/api/v1/artifacts/k3x9q2m/captions",
    headers={"Authorization": f"Bearer {os.environ['MARKDROP_TOKEN']}"},
    json={
        "file_name": "demo.vtt",
        "content": "WEBVTT\n\n00:00:01.000 --> 00:00:04.000\nWelcome to the demo.",
    },
)
r.raise_for_status()
print(r.json())
```
