Download a Prepared File
Download an MP4 or MP3 file using a temporary public download URL.
Download an MP4 or MP3 file using a temporary public download URL.
/api/v1/public/social-media/downloads/{token}Start a prepared MP4 or MP3 download.
Use the complete downloadUrl returned by Prepare a Social Media Download. No API key is required.
Use the URL exactly as returned. The opaque token already identifies the prepared format. Do not add an API key or replace the token with a format ID.
| Client | How to start the download | Redirect handling |
|---|---|---|
| Browser link | Set the anchor href to downloadUrl | Automatic |
| Browser JavaScript | Assign downloadUrl to window.location.href | Automatic |
| curl | Use --location or -L | Must be enabled explicitly |
| Server-side fetch | Send GET downloadUrl and enable redirect following | Usually automatic, but check your HTTP client |
<a
href="https://dopost.co/api/v1/public/social-media/downloads/dlt_TEMPORARY_TOKEN"
>
Download
</a><a
href="https://dopost.co/api/v1/public/social-media/downloads/dlt_TEMPORARY_TOKEN"
>
Download
</a>The final response includes Content-Disposition: attachment, so the browser opens its normal download flow.
curl --location \
--output downloaded-media.mp4 \
"https://dopost.co/api/v1/public/social-media/downloads/dlt_TEMPORARY_TOKEN"curl --location \
--output downloaded-media.mp4 \
"https://dopost.co/api/v1/public/social-media/downloads/dlt_TEMPORARY_TOKEN"To use the filename returned by the API, replace --output downloaded-media.mp4 with --remote-header-name --remote-name.
| Stage | Status | What happens |
|---|---|---|
| Public API | 307 | Redirects to the download server without exposing the source media URL |
| Download server | 200 | Resolves or converts the selected format and streams the file |
| Client | Completed | Saves the bytes using the filename from Content-Disposition |
The endpoint returns a 307 Temporary Redirect to the download server. Clients must follow redirects. The download server then streams the file with the correct Content-Type and Content-Disposition headers.
| Header | Example | Purpose |
|---|---|---|
Content-Type | video/mp4 or audio/mpeg | Identifies the returned MP4 or MP3 file |
Content-Disposition | attachment; filename*=UTF-8''video-title-dopost-co.mp4 | Supplies a safe filename based on the original title |
Cache-Control | private, no-store, max-age=0 | Prevents temporary downloads from being cached |
X-Content-Type-Options | nosniff | Prevents MIME type guessing |
expiresAt value returned by the prepare endpoint.dopost-co suffix.| Window | Limit per client IP |
|---|---|
| Burst protection | 1 download start every 5 seconds |
| Sustained use | 6 download starts per minute |
A 429 response includes Retry-After. Wait for that number of seconds before retrying. A download already in progress is not interrupted by a later rate-limited request.
{
"error": {
"code": "DOWNLOAD_EXPIRED",
"message": "This download link is invalid or expired."
}
}{
"error": {
"code": "DOWNLOAD_EXPIRED",
"message": "This download link is invalid or expired."
}
}Call the prepare endpoint again to receive a fresh URL.
| Status | Error | Cause |
|---|---|---|
400 | DOWNLOAD_EXPIRED | The token is malformed, unknown or older than its ten-minute lifetime |
429 | RATE_LIMITED | The client exceeded the short or per-minute download limit |
502 | UPSTREAM_ERROR | The source stopped responding while the file was being prepared |
503 | SERVICE_UNAVAILABLE | A required download dependency is unavailable |