
Deploy Cobalt Self-Hosted — Fix YouTube Downloads on Railway
Self-host Cobalt: YouTube, TikTok & 20+ platforms. No ads. No tracking.
Cobalt
Just deployed
Deploy and Host Cobalt Media Downloader on Railway

Cobalt is the open-source, ad-free media downloader with 39k+ GitHub stars — paste a URL from YouTube, TikTok, Instagram, Twitter/X, Reddit, SoundCloud, Vimeo, or 20+ other platforms and receive a direct download link with no ads, no tracking, no paywalls, and no files ever cached on the server.
The public cobalt.tools instance no longer works for YouTube as of mid-2025 — blocked by YouTube's anti-downloader measures. A self-hosted Railway instance bypasses this entirely. If you need YouTube downloads in 2026, self-hosting is the solution.
What This Template Deploys
| Service | Purpose |
|---|---|
| Cobalt API | The stateless media processing server — accepts a URL, resolves the media stream, and returns a direct download link or proxied stream on port 9000 |
Single container. No database. No Redis. No volume. No persistent state. Cobalt proxies media directly to the requester — nothing is ever stored on the server.
About Hosting Cobalt
Cobalt is a privacy-first downloader by design — no logs, no caches, no user accounts. The server processes each request independently and proxies the resolved media stream directly to the client. Without a managed host, you're setting up Docker, configuring CORS headers, managing SSL certificates, and exposing port configuration manually.
Railway deploys Cobalt as a managed HTTPS container with zero server administration. Your personal instance processes requests through your own Railway domain — independent of the public cobalt.tools instance and unaffected by platform-level blocks on shared instances.
Typical cost: ~$2–5/month on Railway's Hobby plan. Ad-supported downloader sites like y2mate and 9convert are free but serve malware-adjacent ads and log your requests. A personal Cobalt instance on Railway is cleaner, faster, and fully private.
Deploy in Under 3 Minutes
- Click Deploy on Railway — Cobalt builds automatically (~2 minutes)
- Set
API_URLto your Railway public domain (e.g.https://your-app.up.railway.app) - Optionally set
API_AUTH_REQUIRED=1and configure an API key for private access - Open your domain — send a POST request or use the web UI to download media
No SSH. No database configuration. No server setup.

Common Use Cases
- YouTube downloads when cobalt.tools is blocked — the public instance has been blocked by YouTube since mid-2025; your self-hosted Railway instance operates independently and resolves YouTube videos, Shorts, and Music directly
- Ad-free, tracking-free media downloads — replace y2mate, 9convert, and SaveFrom with a personal instance that serves no ads, runs no trackers, and logs nothing about your requests
- TikTok, Instagram Reels, and Twitter/X video saving — download public social media content without watermarks or platform restrictions via a clean REST API call
- Audio extraction from video platforms — extract MP3 audio from YouTube, SoundCloud,
and other platforms programmatically via the Cobalt API
audioOnlyparameter - Automation and n8n integration — call the Cobalt REST API from n8n, Make, or any backend workflow to automate media downloads without ad-laden third-party services
- Private team media downloader — deploy with API key authentication for your team; every download request is private, logged nowhere, and proxied directly to the requester
Supported Platforms
Cobalt supports downloading from 20+ platforms including:
| Category | Platforms |
|---|---|
| Video | YouTube (inc. Shorts & Music), Vimeo, Dailymotion, Twitch clips, Bilibili |
| Social | TikTok, Instagram Reels & Stories, Twitter/X, Reddit, Snapchat |
| Audio | SoundCloud, Bandcamp, Deezer, Tidal |
| Other | VK, Pinterest, Rutube, Bluesky, Tumblr |
Supported platforms change as sites update their infrastructure. Always check the cobalt GitHub for the current compatibility list.
Configuration
| Variable | Required | Description |
|---|---|---|
API_URL | ✅ Required | Your Railway public domain — e.g. https://your-app.up.railway.app. Required for correct response URL generation |
API_AUTH_REQUIRED | Optional | Set to 1 to require Bearer token authentication on all API requests |
API_KEY_URL | Optional | URL to a JSON file containing valid API keys — used with API_AUTH_REQUIRED=1 |
CORS_WILDCARD | Optional | Set to 1 to allow all CORS origins — useful for web frontend integration |
CORS_URL | Optional | Specific allowed CORS origin — restrict access to your frontend domain |
COOKIE_PATH | Optional | Path to a cookies file for authenticated platform access (e.g. YouTube login cookies) |
API_NAME | Optional | Name of your instance — displayed in API responses |
PORT | Auto-set | Railway injects this automatically — do not set manually |
No database variables. Cobalt is entirely stateless — it has no database, no Redis, and stores nothing. Any template claiming
COBALT_DB_HOSTor similar variables is incorrect.
Cobalt vs. Ad-Supported Downloader Sites
| Cobalt (self-hosted) | y2mate | 9convert | SaveFrom.net | |
|---|---|---|---|---|
| Ads | ✅ None | ❌ Aggressive | ❌ Aggressive | ❌ Yes |
| Tracking | ✅ None | ❌ Logs requests | ❌ Yes | ❌ Yes |
| YouTube support | ✅ Via self-hosted | ✅ Yes | ✅ Yes | ✅ Yes |
| TikTok watermark-free | ✅ Yes | ⚠️ Inconsistent | ⚠️ Inconsistent | ❌ No |
| API access | ✅ REST API | ❌ No | ❌ No | ❌ No |
| Open source | ✅ AGPL-3.0 | ❌ No | ❌ No | ❌ No |
| Malware risk | ✅ None | ❌ High | ❌ High | ⚠️ Medium |
| Self-hostable | ✅ Yes | ❌ No | ❌ No | ❌ No |
Dependencies for Cobalt Hosting
- Railway account — Hobby plan (~$2–5/month) for a single stateless container
- No external API keys, no database, no storage required
- Optional: YouTube account cookies for authenticated YouTube access
Deployment Dependencies
- Cobalt GitHub Repository — source, supported platforms, and releases
- Cobalt API Documentation — full request/response reference
- Cobalt Instance List — community-maintained public instances
Implementation Details
Cobalt deploys from ghcr.io/imputnet/cobalt:latest as a fully stateless Go/Node.js
container. Each request is processed independently — Cobalt resolves the media URL from
the target platform, then either redirects the client directly or proxies the stream, with
nothing stored server-side. The API accepts POST requests at / with a JSON body containing
the URL and optional quality/format parameters, and returns a response with a direct
download link or stream URL.
Set API_URL to your Railway domain immediately after deploy — without it, Cobalt generates
incorrect response URLs pointing to localhost instead of your public domain.
Frequently Asked Questions
Why doesn't cobalt.tools work for YouTube anymore? The public cobalt.tools instance was blocked by YouTube's infrastructure in mid-2025 as part of YouTube's escalating measures against shared download services. A self-hosted instance on Railway operates under your own Railway domain and IP — independent of the public instance's block status. YouTube downloads work on a fresh self-hosted instance.
Is Cobalt legal to use? Cobalt only downloads free and publicly accessible content — the same content accessible via any browser's developer tools. It is not a piracy tool and cannot download paywalled or private content. Responsibility for how downloaded content is used rests with the user. Check the terms of service of each platform before downloading their content.
Does Cobalt store or log my downloads? No. Cobalt is stateless by design — no database, no logs, no caches. Each request is processed and the media is proxied directly to you. Nothing about your downloads is retained on the server after the request completes.
How do I use the Cobalt API? Send a POST request to your Railway domain with a JSON body:
POST https://your-app.up.railway.app
Content-Type: application/json
{ "url": "https://www.youtube.com/watch?v=..." }
The response includes a direct download URL or stream link. Full parameter reference (quality, format, audioOnly, etc.) is in the Cobalt API docs.
Can I restrict my Cobalt instance to only my own use?
Yes. Set API_AUTH_REQUIRED=1 and configure an API key file via API_KEY_URL. All requests
without a valid Authorization: Bearer [key] header will be rejected.
How do I update Cobalt to a newer version?
Trigger a redeploy in Railway — the latest tag pulls the most recent Cobalt release.
To pin a version, change the image tag in Railway service settings to a specific release
(e.g. ghcr.io/imputnet/cobalt:10).
Why Deploy and Host Cobalt on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Cobalt on Railway, you get a private, ad-free media downloader — no tracking, no malware risk, no shared-instance blocks — at ~$2–5/month with YouTube downloads working independently of the public cobalt.tools instance.
Template Content