> For the complete documentation index, see [llms.txt](https://bountyv.gitbook.io/vdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bountyv.gitbook.io/vdocs/clip-api/clip-clean.md).

# Clean Clip

Re-download a TikTok or Instagram Reel without the platform's watermark overlay.

```
POST /api/v1/clip/clean
```

Synchronous. The cleaned HD MP4 streams back in the response body — there's no JSON wrapper, and nothing is stored on our side (the file is served once, then deleted).

Removes the platform's own bug/overlay by fetching the original source. It does **not** erase a watermark or caption that a creator burned into the pixels.

## Authentication

Standard header:

```
Authorization: Bearer sk_live_...
```

See [Authentication](/vdocs/authentication.md) for details. Requires the `clip` product on your account.

## Request

**Content-Type:** `application/json`

| Field | Type   | Required | Description                                                                         |
| ----- | ------ | -------- | ----------------------------------------------------------------------------------- |
| `url` | string | ✅        | A TikTok (`tiktok.com`) or Instagram (`instagram.com/reel/...`, `instagr.am`) link. |

## Response

`200 OK` — the body **is** the MP4 (`Content-Type: video/mp4`, `Content-Disposition: attachment`). Billing and metadata come back as response headers:

```
Content-Type: video/mp4
Content-Disposition: attachment; filename="some-title.mp4"
X-Charged-Cents: 5
X-Balance-Cents: 4995
X-Clean-Platform: tiktok
X-Clean-Duration: 12.4
```

| Header             | Description                                     |
| ------------------ | ----------------------------------------------- |
| `X-Charged-Cents`  | Amount deducted from your balance for this call |
| `X-Balance-Cents`  | Remaining balance                               |
| `X-Clean-Platform` | `tiktok` or `instagram`                         |
| `X-Clean-Duration` | Source video duration, in seconds               |

## Example

```bash
curl -X POST https://substance-api.com/api/v1/clip/clean \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://www.tiktok.com/@user/video/1234567890" }' \
  -o clean.mp4 -D -
```

```js
import fs from "node:fs";

const res = await fetch("https://substance-api.com/api/v1/clip/clean", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SUBSTANCE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: "https://www.tiktok.com/@user/video/1234567890" }),
});

if (!res.ok) throw new Error((await res.json()).error);
console.log("charged cents:", res.headers.get("X-Charged-Cents"));
fs.writeFileSync("clean.mp4", Buffer.from(await res.arrayBuffer()));
```

## Errors

| Status | When                                                                                                                 |
| ------ | -------------------------------------------------------------------------------------------------------------------- |
| `400`  | Missing/invalid `url` (must be a TikTok or Instagram link), or body wasn't JSON.                                     |
| `401`  | Missing/invalid API key.                                                                                             |
| `402`  | Insufficient balance.                                                                                                |
| `403`  | Your account doesn't have the `clip` product enabled.                                                                |
| `502`  | The source couldn't be fetched (private, region-locked, or unsupported). Balance is refunded — see `refunded_cents`. |
| `503`  | Pipeline temporarily offline.                                                                                        |

See [Errors](/vdocs/errors.md) for full details.

## Pricing

Billed per call — see [Credits & pricing](/vdocs/account/credits.md) for current rates.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bountyv.gitbook.io/vdocs/clip-api/clip-clean.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
