Skip to content

Download a file

By , Head of IntegrationsUpdated

Open this page in a new chat

Short answer

Download a file with GET /v2/files/download. Give its path in the filename parameter and the API returns the original file as it was uploaded, not a resized or converted copy. Each call needs a bearer token and counts towards your hourly API limit. Below is the parameter and sample code in 9 languages.

After reading this you will know

  • How to download a file
  • Which parameters it takes
  • Sample code in 9 languages and a sample answer

This command needs a bearer token and counts towards your hourly limit.

GEThttps://api.sirv.com/v2/files/download

Use this API method to download a single file from an account.

Query parameters

NameTypeRequiredExampleDescription
filenamestringYes/REST API Examples/uploaded.txtPath of the file to download.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/files/download?filename=%2FREST%20API%20Examples%2Fuploaded.txt', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Response

HTTP 200 with an empty body when the command succeeds.

Back to top