---
title: "Export a trimmed clip of a hosted artifact"
method: POST
path: "/v1/media/clip"
tags: ["Video"]
---

# Export a trimmed clip of a hosted artifact

`POST /v1/media/clip`

## Request

- Base URL: `http://localhost:9998`
- URL: `http://localhost:9998/v1/media/clip`
- Auth: HTTP bearer

Trims a `[startMs, endMs)` region of an already-hosted artifact (`id`) to a flat,
persistent `.mp4` under `…/ToolPiper/SavedStreams` via a passthrough
`AVMutableComposition` export (no ffmpeg). Premium (Video Editing). Returns 202 with
a `clip_`-prefixed job id; poll `GET /v1/media/clip/{id}` for `output_path`.

## Request body

- object
  - `id` string, required: A hosted media artifact id (med_-prefixed)
  - `startMs` integer, required: Clip start offset in milliseconds
  - `endMs` integer, required: Clip end offset in milliseconds (must be > startMs)

## Response `202`

Clip export started

- object
  - `id` string, required: Clip job id (clip_-prefixed)
  - `status` string, required: Job status (processing)

## Other responses

- `400`: Invalid request
- `404`: Resource not found
- `409`: Source artifact is still being produced
- `429`: Too many pending clip jobs
- `503`: Media host service not ready

---

[API](https://skmtc.dev/modelpiper/apis/toolpiper-api.md) · [All operations](https://skmtc.dev/modelpiper/apis/toolpiper-api/llms.txt) · [OpenAPI document](https://skmtc.dev/modelpiper/apis/toolpiper-api/revisions/6722bf56385c?raw)
