> 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-split.md).

# Clip Split

Split a Reel at its dominant scene cut and get the start + end sections back as a ZIP.

```
POST /api/v1/clip/split
```

Synchronous. Send a TikTok or Instagram Reel URL — we download it, detect the dominant scene change, and slice it into a **start section** (the hook, before the cut) and an **end section** (after the cut). The response body **is** a ZIP containing `start.mp4` and `end.mp4` — there's no JSON wrapper, and nothing is stored on our side.

Split targets the "hook → reveal" pattern — a single dominant scene change. If the source has no clear cut, the call fails with `502` and your balance is refunded.

## 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 a ZIP (`Content-Type: application/zip`) containing `start.mp4` and `end.mp4`. Billing and metadata come back as response headers:

```
Content-Type: application/zip
Content-Disposition: attachment; filename="some-title.zip"
X-Charged-Cents: 5
X-Balance-Cents: 4995
X-Clip-Duration: 12.4
X-Clip-Cut: 5.8
```

| Header            | Description                                     |
| ----------------- | ----------------------------------------------- |
| `X-Charged-Cents` | Amount deducted from your balance for this call |
| `X-Balance-Cents` | Remaining balance                               |
| `X-Clip-Duration` | Source video duration, in seconds               |
| `X-Clip-Cut`      | Timestamp of the detected scene cut, in seconds |

## Example

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

```python
import os, requests

res = requests.post(
    "https://substance-api.com/api/v1/clip/split",
    headers={"Authorization": f"Bearer {os.environ['SUBSTANCE_API_KEY']}"},
    json={"url": "https://www.tiktok.com/@user/video/1234567890"},
)
res.raise_for_status()
print("charged cents:", res.headers.get("X-Charged-Cents"))
with open("clip-sections.zip", "wb") as f:
    f.write(res.content)
```

## 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 or had no detectable cut. 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-split.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.
