YTDL.my

Download API (API key)

Use this HTTP API to download YouTube videos from your own scripts and integrations.

Base URL — Your deployment origin, e.g. https://ytdl.my (all paths are relative to it).

API key — Create an API key in the Dashboard after you have an active subscription. Treat it like a password; do not commit it to source control.

OpenAPI — Machine-readable spec: /openapi.yaml


Authentication

Send your key on every request that requires it:

HeaderExample
X-API-KeyX-API-Key: ytdl_…
AuthorizationAuthorization: Bearer ytdl_…

GET /healthz and GET /api/healthz

Optional liveness check. No API key.

200 — Service is up (typically { "ok": true }).


POST /api/v1/jobs

Starts a download job. The request may stay open until processing finishes (long-running).

Headers: Content-Type: application/json, plus your API key.

Body:

{
  "url": "https://www.youtube.com/watch?v=VIDEO_ID",
  "minutes": 20
}
FieldRequiredDescription
urlYesYouTube watch or youtu.be URL (10–2000 characters).
minutesNoOmit or use 0 for full length (within plan limits). Otherwise clip to the first N minutes.

200 — Success body includes a download_url pointing at this same host (/api/v1/d?…). Example shape:

{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "minutes": 20,
  "download_url": "https://your-host.example.com/api/v1/d?job_id=…&e=…&s=…",
  "error": null
}

If extraction fails, you may still get 200 with status: "failed" and error set, or 502 from the gateway.

StatusMeaning
400Invalid JSON or fields
401Missing or invalid API key
402No active subscription or monthly quota used up
502Upstream download/extraction error

GET /api/v1/jobs/{job_id}

Poll job status with the same API key.

200 — Job object (job_id, status, download_url when ready, error, etc.).

401 — Invalid API key.


GET /api/v1/d

No API key. Call the exact download_url returned by the job API (signed query: job_id, e, s). Do not build this URL by hand.

200 — File stream (Content-Disposition: attachment).

403 — Link expired or signature invalid.

404 — File no longer available.


Quotas

Successful downloads count against your plan’s monthly limit. Typical tiers:

PlanDownloads / month (approx.)
Starter150
Growth1500
Scale15000

Exact limits and billing period apply as shown in your account.


Example (curl)

Replace BASE and KEY, then use the download_url from the JSON (or curl/wget it directly).

curl -sS -X POST "$BASE/api/v1/jobs" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $KEY" \
  -d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","minutes":0}'

Notes

  • The internal extractor service URL is not public; you only talk to this app.
  • Keep your API key secret; revoke unused keys from the Dashboard.