Skip to content

Get and set folder options

By , Head of IntegrationsUpdated

Open this page in a new chat

Short answer

This page has 2 commands: Get folder options (GET /v2/files/options) and Set folder options (POST /v2/files/options). It will tell you the settings for spin scanning, spin naming, public listing and folder locking (Enterprise accounts only). Each call needs a bearer token and counts towards your hourly API limit.

After reading this you will know

  • How to get and set folder options
  • Which parameters each of the 2 commands takes
  • Sample code in 9 languages and a sample answer

Every command on this page needs a bearer token and counts towards your hourly limit.

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

Use this API method to check the options of a folder.

It will tell you the settings for spin scanning, spin naming, public listing and folder locking (Enterprise accounts only).

Query parameters

NameTypeRequiredExampleDescription
filenamestringYes/REST API ExamplesPath of the folder, starting with /.
withInheritedbooleanNotrueInclude options inherited from parent folders

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/options?filename=%2FREST%20API%20Examples', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

{
"scanSpins": true,
"allowListing": false
}
POSThttps://api.sirv.com/v2/files/options

Use this API method to change the folder options. You can enable/disable spin scanning, change the spin naming convention and enable/disable publicly viewable folder listings.

Query parameters

NameTypeRequiredExampleDescription
filenamestringYes/REST API ExamplesPath of the folder, starting with /.

Request body (JSON)

FieldTypeRequiredExampleDescription
scanSpinsbooleanNotruetrue to let Sirv build spins from the images in this folder, false to never build them here.
nameSpinsAfterFolderbooleanNotruetrue to name each new spin after its folder.
allowListingbooleanNofalsetrue to let anyone get a list of the folder’s files from its URL, as JSON.

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/options?filename=%2FREST%20API%20Examples', {
method: 'POST',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify({
"scanSpins": true,
"allowListing": false
}),
});
console.log(res.status, await res.text());

Response

HTTP 200 with an empty body when the command succeeds.

Back to top