The Samplecut API converts a public YouTube, TikTok, Instagram or SoundCloud link into an MP3 or WAV file: the full track or an exact time range, returned as a short-lived download URL or as the audio bytes. It is a single synchronous JSON endpoint, free to use, with no API key or account. It runs on the same engine as the Samplecut editor and the MCP connector.
Overview
- Endpoint:
POST https://api.samplecut.app/v1/downloads - Authentication: none. Calls are rate-limited per IP address (see Limits).
- Request: a JSON body, sent with
Content-Type: application/json. - Response: JSON, or the audio file when
"response": "file"is set. Errors are always JSON. - Specification: OpenAPI 3.1. Import it into Postman or Insomnia, or use it to generate a typed client.
Quickstart
Only url is required. With no range you get the full track, and with no format you get MP3.
curl -X POST https://api.samplecut.app/v1/downloads \
-H 'content-type: application/json' \
-d '{"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"}'A successful call returns 201 Created:
{
"id": "969cb27b-…",
"download_url": "https://api.samplecut.app/d/969cb27b-…",
"expires_at": "2026-10-27T17:08:46.886Z",
"title": "Me at the zoo",
"filename": "samplecut-me-at-the-zoo.mp3",
"format": "mp3",
"full": true,
"track_duration_sec": 19.05,
"editor_url": "https://samplecut.app/?url=…"
}The request is synchronous: the response arrives once the file is ready. That usually takes a few seconds, and up to about a minute for an hour-long source, so set a client timeout of at least 120 seconds.
Request body
| Field | Type | Description |
|---|---|---|
url | string, required | A YouTube, TikTok, Instagram or SoundCloud link. Shorts, short links, share links and mobile links are accepted. |
start_sec | number | Start of the range in seconds. Use it together with end_sec or duration_sec. |
end_sec | number | End of the range in seconds. |
duration_sec | number | Length of the range, an alternative to end_sec. Counted from start_sec, or from 0 when start_sec is omitted. |
format | "mp3" | "wav" | Output format. Defaults to "mp3" (320 kbps). WAV is lossless. |
response | "url" | "file" | "url" (the default) returns JSON with a download URL. "file" returns the audio bytes. |
Example: a 6-second WAV clip.
curl -X POST https://api.samplecut.app/v1/downloads \
-H 'content-type: application/json' \
-d '{"url": "https://youtu.be/jNQXAC9IVRw", "start_sec": 2, "end_sec": 8, "format": "wav"}'A ranged response also includes start_sec and end_sec, and full is false. A body sent with any other content type is rejected with 415.
Returning the file directly
With "response": "file", the API returns 200 OK with the audio as the response body (audio/mpeg or audio/wav). The filename is set in Content-Disposition, so curl can save the file in one step:
curl -X POST https://api.samplecut.app/v1/downloads -OJ \
-H 'content-type: application/json' \
-d '{"url": "https://youtu.be/jNQXAC9IVRw", "response": "file"}'Metadata comes in response headers: X-Samplecut-Title (URL-encoded), X-Samplecut-Download-Url and X-Samplecut-Expires-At. If a transfer is interrupted, use the download URL to fetch the file again without spending another call.
Client examples
Node.js 18+ (built-in fetch):
const res = await fetch('https://api.samplecut.app/v1/downloads', {
method: 'POST',
headers: { 'content-type': 'application/json', 'x-client-name': 'my-app' },
body: JSON.stringify({ url: 'https://youtu.be/jNQXAC9IVRw' }),
signal: AbortSignal.timeout(120_000),
})
const body = await res.json()
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`)
console.log(body.download_url)Python (requests):
import requests
res = requests.post(
"https://api.samplecut.app/v1/downloads",
json={"url": "https://youtu.be/jNQXAC9IVRw", "start_sec": 2, "end_sec": 8},
headers={"X-Client-Name": "my-app"},
timeout=120,
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
print(body["download_url"])Call the API from a server, a script or a CLI. CORS is limited to samplecut.app, so a browser page on another origin cannot call it directly. Send an optional X-Client-Name header with your app's name; it lets us see which integrations are in use and keep them working.
Errors
Every error response has the same shape. code is stable and safe to branch on. message is readable by an end user. retryable is true only when the same request can succeed later.
{ "error": { "code": "unsupported_url", "message": "…", "retryable": false } }| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The body does not match the schema. |
| 400 | unsupported_url | The link is not from a supported platform. |
| 400 | invalid_range | The range is malformed, for example only one end given, or it extends past the end of the track. |
| 400 | set_not_track | The link is a playlist or album, not a single track. |
| 415 | unsupported_media_type | The body was not sent as application/json. |
| 422 | too_long | The source is longer than 60 minutes. |
| 422 | extract_failed | The source is private, removed, age-restricted or region-blocked. |
| 429 | rate_limited | Retryable. Wait the number of seconds in the Retry-After header. |
| 502 | source_unreachable | Retryable. The source platform did not respond. |
| 503 | api_disabled | The API is temporarily switched off. |
The OpenAPI document is the authoritative contract for every field and error code.
Integrate with an AI coding assistant
To have Claude Code, Cursor, Copilot or ChatGPT write the integration, paste this prompt into it. It points the assistant at this page and the OpenAPI document, so the code it writes follows the real contract instead of a guessed one.
Integrate the Samplecut audio API into this project.
Docs: https://samplecut.app/developers
OpenAPI 3.1 spec: https://api.samplecut.app/v1/openapi.json
Read both before writing code. Requirements:
- Call POST https://api.samplecut.app/v1/downloads from server-side code only (CORS blocks other browser origins). No API key is needed.
- Send JSON with Content-Type: application/json and an X-Client-Name header set to this app's name.
- Use a request timeout of at least 120 seconds; the call is synchronous.
- Support the optional fields start_sec, end_sec or duration_sec, format ("mp3" | "wav") and response ("url" | "file").
- download_url expires after about an hour: download and store the file, never the URL.
- Handle errors by error.code. On 429, wait Retry-After seconds and retry; retry 502 with backoff; surface error.message to the user otherwise.
- Write a typed client based on the OpenAPI schema, plus a test for the error handling.Want the assistant to cut audio for you itself, without writing any code? Add the MCP connector instead. For a one-page overview with copyable samples, see samplecut.app/developers.
Frequently asked questions
Do I need an API key?
No. The API is free and anonymous. Each IP address gets 10 calls per 10 minutes.
How do I get the full track?
Send only url. With no start_sec or end_sec you get the whole track, and with no format you get MP3.
Can I get the audio file instead of a link?
Yes. Send "response": "file" and the response body is the MP3 or WAV itself.
How long does the download link last?
About an hour. The exact time is in expires_at. After that, call the API again for a new link.
Can I use it from an AI assistant instead?
Yes. The same cut is available as an MCP connector for ChatGPT, Claude, Cursor and Claude Code: see samplecut.app/mcp.
Limits
- Rate limit: 10 calls per 10 minutes per IP address, shared with the site's own per-IP allowance. Repeat cuts of the same source within a few minutes reuse the downloaded audio, so cutting one video into many clips is cheap.
- Source length: up to 60 minutes.
- Link lifetime:
download_urlexpires after about an hour (seeexpires_at). Store the file, not the URL. - Availability: best effort, with no SLA. The API is free and shares infrastructure with samplecut.app.
Need higher limits? Tell us what you're building through the feedback link on samplecut.app.
Recently cut on Samplecut
- Imposter Sound Effect 0:00–0:05 from The Only Sound Effects Pack You Need in 2026 (150+ HD SFX)
- Classic BOOM Meme 0:00–0:02 from BOOM sound effect
- Huh sound effect 0:03–0:04 from Huh sound effect
- Record Scratch 0:00–0:01 from DJ Record Scratch Sound Effect (NO COPYRIGHT) #Shorts
- Record Scratch 0:00–0:01 from DJ Record Scratch Sound Effect (NO COPYRIGHT) #Shorts
- ACTION! 0:00–0:01 from 🦖 Hollywood Created a Dinosaur vs Helicopter Battle #Shorts #Hollywood #Dinosaurs #practicaleffects
- Shigatsu wa kimi no uso - Chopin's ballade no.1 in G minor, op. 23 (Piano with Violin ver.) 4:16–4:45 from Shigatsu wa kimi no uso - Chopin's ballade no.1 in G minor, op. 23 (Piano with Violin ver.)
- 3 1:01–1:08 from P. Ramlee - Dendang Perantau [Official Music Video]