YouTube Downloader API Documentation

Programmatic access to download YouTube videos and read public website statistics.

Who can use each endpoint?

API token holders

/api/ping and /api/download require Authorization: Bearer <token>. Use these from your own integration.

Anyone

Website statistics, service status, and the changelog are public read-only endpoints. They do not require an account or token.

Signed-in website users

Token and account management routes use the browser session cookie. API tokens cannot be used for these website actions.

Try an authenticated request

Run a real GET /api/ping request from this page. The test creates a random two-minute token for your signed-in account and deletes it immediately after the request.


    

Token-authenticated endpoints

GET /api/ping

Checks that an API token is valid without starting a download. This is useful for verifying a saved token during integration setup.

GET /api/ping
Authorization: Bearer <your_api_token>
    

A successful response includes { "status": "ok", "message": "Authenticated API request accepted" }.

POST /api/download

This is the main endpoint to download videos or audio from YouTube.

Request

URL: /api/download

Method: POST

Headers:

Authorization: Bearer <your_api_token>
Content-Type: application/json
    

Body (JSON):

{
  "url": "https://www.youtube.com/watch?v=cNMXSKfWfLQ",
  "format": "mp4",
  "quality": 720
}
    

quality is optional for MP4 and defaults to 2160 (up to 4K). Supported values are 144, 240, 360, 480, 720, 1080, 1440, and 2160. If the requested maximum is unavailable, the next lower available quality is used. Audio formats ignore this option.

Playlist URLs may contain up to 50 videos. Every video must be 3 hours or shorter. Each API token can request up to 2 playlists per hour. Requests beyond that limit receive 429 Too Many Requests with a Retry-After header.

Response (Success)

{
  "status": "ok",
  "quality": 720,
  "url": "/api/downloads/api_1675234.mp4"
}
    

The returned URL is temporary and downloads the file directly from the API. If it is unavailable, it returns a JSON error explaining whether the file has expired.

Example cURL Request

curl -X POST https://download4yt.live/api/download \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.youtube.com/watch?v=cNMXSKfWfLQ","format":"flac"}'
    

Public website data endpoints

These read-only endpoints can be used by anyone. They do not expose account details and do not accept or need an API token.

EndpointWhat it returnsWho can use itTry it
GET /api/status Service availability for the database and mail service, plus server uptime and a timestamp. Anyone. Suitable for a simple health check.
GET /api/download-stats Lifetime totalDownloads and totalBytes. Anyone. Suitable for a compact counter.
GET /api/stats Lifetime totals, average and largest download size, plus live activeDownloads, queuedDownloads, and maxConcurrentDownloads. Anyone. Suitable for the website statistics page or a status display.
GET /api/changelog The active changelog entries shown by the website. Anyone. Suitable for a release-notes view.
GET /api/downloads/:fileName Delivers the temporary file URL returned by POST /api/download. An unavailable file returns a JSON error response. Anyone holding the temporary URL. It is not a general file listing. Use the url from a successful download response.


    

Example: read website statistics

curl https://download4yt.live/api/stats

The live queue values can change between requests. Size values are returned in bytes.

Signed-in website routes

These routes power the website controls. They require a signed-in browser session and are not endpoints for bearer-token integrations.

RouteUse
GET /apiOpen the API token dashboard.
GET /api/sesOpen the legacy API token dashboard. Use GET /api for the current page.
POST /api/registerCreate a token through the website form using its name field.
POST /api/revoke-tokenRevoke one of the signed-in user's tokens with its id.
POST /api/cleanup-revoked-tokensRemove revoked tokens and their associated download history for the signed-in user.
GET /api/account/manage, GET /api/account/current-userRead the signed-in user's account management page or current profile data.
POST /api/account/change-username, /api/account/reset-password-request, /api/account/deleteWebsite account actions for the signed-in user.
POST /api/documentation-test-token, DELETE /api/documentation-test-token/:tokenIdInternal controls used only by the “Run API test” button above. The temporary token expires after two minutes.

Account recovery routes

POST /api/forgot-password-request starts the email recovery flow. GET /api/reset-password and POST /api/reset-password are used from the emailed reset link. They are public website flows, not bearer-token API endpoints.

Notes & Limitations

Back to API Tokens Page

Need help integrating? Check the FFmpeg docs for advanced format options.