Skip to content

Can I resume an interrupted private API download with a byte range?

The private job content route supports byte ranges and advertises Accept-Ranges: bytes. A downloader can request a range for an existing completed asset, but it must inspect 206, Content-Range and the actual returned bytes before appending. A 200 full response or 416 invalid range needs different handling; neither should be blindly concatenated to a partial file.

SHIP A RELIABLE INTEGRATIONAISwapLab team · Editorial methodPublished 2 min read
Open API documentationExplore 67 Image SkillsPrivate keys · Explicit credit approval
Article workflow: Measure the partial file; Request the remaining range; Validate the completed asset.
Workflow diagram: Measure the partial file → Request the remaining range → Validate the completed asset. Read the article for evidence and limits.

Resume only the same confirmed object

Keep the job ID, expected content type and saved-byte count with the partial transfer. A different task or a failed error response must not be appended merely because it has a similar filename. Authentication and ownership checks still apply to range requests, and an interrupted download is not a reason to create new media.

What to do next

  1. 01

    Measure the partial file

    Determine the number of valid saved bytes and retain the original job identity. Avoid assuming a file is complete based on its extension or a previous progress indicator.

  2. 02

    Request the remaining range

    Send the appropriate Range header through your authenticated backend. Check status and Content-Range before deciding whether to append, restart or investigate an invalid offset.

  3. 03

    Validate the completed asset

    Compare final size where known and confirm the expected media is readable. Finalize the file only after a complete successful transfer, preserving the original output rather than requesting another generation.

A concrete example

Illustrative request: a known MP4 partial contains its first 1,024 bytes. The downloader requests bytes=1024- and appends only a compatible 206 response. A JSON 401 body is handled as an error, not video continuation.

Before you call it ready

  • The partial belongs to the same job.
  • Range response headers are validated.
  • A full response is not appended as a partial continuation.

When to stop or choose another method

If the local partial's integrity is uncertain, redownload the existing asset cleanly. Do not concatenate ambiguous bytes or regenerate a paid result to solve a transfer issue.

Sources

One task. A recoverable workflow.

Check the contract, approve the quote and retain the job.

Open API documentation