Skip to content

Account and users

By , Head of IntegrationsUpdated

Open this page in a new chat

Short answer

The account commands read and change your Sirv account: its settings, API limits, storage, users, billing plan, custom domains, sub-accounts and event notifications. Most are GET requests that return JSON; changes use POST or DELETE. Each one needs a bearer token from an API client allowed to read or manage account settings.

After reading this you will know

  • How to read account, storage, limit, user and billing details
  • How to add or remove a custom domain and create or close sub-accounts
  • How to list account events and mark them as seen

Every command on this page needs a bearer token.

POSThttps://api.sirv.com/v2/account/custom-domain

Use this method to configure a custom CDN domain for an account alias.

Request body (JSON)

FieldTypeRequiredExampleDescription
aliasstringYesmy-accountAccount name (alias) that the domain serves.
domainstringYescdn.example.comYour custom domain, for example cdn.example.com.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/custom-domain', {
method: 'POST',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify({
"alias": "my-account",
"domain": "cdn.example.com"
}),
});
console.log(res.status, await res.text());

Response

HTTP 200 with an empty body when the command succeeds.

DELETEhttps://api.sirv.com/v2/account/sub-account

Use this method to close a sub-account.

Query parameters

NameTypeRequiredExampleDescription
aliasstringYessub-account-1Name of the sub-account to close.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/sub-account?alias=sub-account-1', {
method: 'DELETE',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

{
"alias": "sub-account-1",
"status": "closed"
}
POSThttps://api.sirv.com/v2/account/sub-account

Use this method to create a sub-account under the account. Sub-account functions as a fully independent account, but uses main account’s billing, storage, and bandwidth.

Request body (JSON)

FieldTypeRequiredExampleDescription
aliasstringYessub-account-1Name of the new sub-account. Its files are served from alias.sirv.com.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/sub-account', {
method: 'POST',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify({
"alias": "sub-account-1"
}),
});
console.log(res.status, await res.text());

Example response

{
"dateCreated": "2026-02-23T19:12:31.111Z",
"alias": "sub-account-1",
"fileSizeLimit": 33554432,
"aliases": {
"sub-account-1": {
"prefix": "/"
}
},
"fetching": {
"maxFilesize": 3145728
},
"status": {
"status": "active",
"details": {}
}
}
GEThttps://api.sirv.com/v2/account

Use this API method to get information about the account, including its CDN URL; account name; additional domains; remote fetching status; date created and more.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

{
"dateCreated": "2014-10-14T14:15:18.580Z",
"alias": "demo",
"fileSizeLimit": 50000000,
"fetching": {
"enabled": false,
"type": "http",
"http": {
"auth": {
"enabled": false,
"password": "",
"username": ""
},
"url": "https://somesite.com/folder/"
},
"maxFilesize": 2097152
},
"minify": {
"enabled": true
},
"cdnTempURL": "demo.sirv.com",
"cdnURL": "demo.sirv.com",
"aliases": {
"demo": {
"prefix": "/",
"cdn": true
},
"anotherdemo": {
"prefix": "/",
"cdn": true
},
"demo-cdntest": {
"prefix": "/"
},
"demo-jwt": {
"prefix": "/",
"cdn": true
}
},
"status": {
"status": "active",
"details": {}
}
}
GEThttps://api.sirv.com/v2/account/limits

Use this method to check the allowed number of API requests and the number of requests used in the past 60 minutes.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/limits', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

{
"s3:global": {
"count": 0,
"limit": 7000,
"remaining": 7000,
"reset": 1771859252
},
"s3:PUT": {
"count": 0,
"limit": 2000,
"remaining": 2000,
"reset": 1771859252
},
"s3:GET": {
"count": 0,
"limit": 3000,
"remaining": 3000,
"reset": 1771859252
},
"s3:DELETE": {
"count": 0,
"limit": 3000,
"remaining": 3000,
"reset": 1771859252
},
"rest:global": {
"count": 64,
"limit": 7000,
"remaining": 6936,
"reset": 1771858410
},
"rest:post:files:search": {
"count": 1,
"limit": 1000,
"remaining": 999,
"reset": 1771858422
},
"rest:post:files:search:scroll": {
"count": 0,
"limit": 2000,
"remaining": 2000,
"reset": 1771859252
},
"rest:post:files:video2spin": {
"count": 1,
"limit": 200,
"remaining": 199,
"reset": 1771858423
},
"rest:post:files:spin2video": {
"count": 1,
"limit": 200,
"remaining": 199,
"reset": 1771858426
},
"rest:post:files:upload": {
"count": 0,
"limit": 2000,
"remaining": 2000,
"reset": 1771859252
},
"rest:post:files:delete": {
"count": 1,
"limit": 3000,
"remaining": 2999,
"reset": 1771858504
},
"rest:post:files:batch:delete": {
"count": 1,
"limit": 25,
"remaining": 24,
"reset": 1771858518
},
"rest:post:account": {
"count": 2,
"limit": 50,
"remaining": 48,
"reset": 1771858410
},
"rest:post:account:fetching": {
"count": 0,
"limit": 50,
"remaining": 50,
"reset": 1771859252
},
"rest:get:stats:http": {
"count": 1,
"limit": 100,
"remaining": 99,
"reset": 1771858419
},
"rest:get:stats:storage": {
"count": 1,
"limit": 100,
"remaining": 99,
"reset": 1771858420
},
"rest:post:account:new": {
"count": 0,
"limit": 5,
"remaining": 5,
"reset": 1771859252
},
"rest:post:user:accounts": {
"count": 0,
"limit": 20,
"remaining": 20,
"reset": 1771859252
},
"rest:get:rest:credentials": {
"count": 0,
"limit": 50,
"remaining": 50,
"reset": 1771859252
},
"rest:post:video:toSpin": {
"count": 0,
"limit": 400,
"remaining": 400,
"reset": 1771859252
},
"rest:post:upload:toSirv": {
"count": 0,
"limit": 2000,
"remaining": 2000,
"reset": 1595076350
},
"ftp:global": {
"count": 0,
"limit": 10000,
"remaining": 10000,
"reset": 1771859252
},
"ftp:STOR": {
"count": 0,
"limit": 2000,
"remaining": 2000,
"reset": 1771859252
},
"ftp:RETR": {
"count": 0,
"limit": 3000,
"remaining": 3000,
"reset": 1771859252
},
"ftp:DELE": {
"count": 0,
"limit": 3000,
"remaining": 3000,
"reset": 1771859252
},
"fetch:file": {
"count": 2,
"limit": 1000,
"remaining": 998,
"reset": 1771858429
},
"fetch:largefile": {
"count": 0,
"limit": 10,
"remaining": 10,
"reset": 1771859252
},
"fetch:largetimeout": {
"count": 0,
"limit": 10,
"remaining": 10,
"reset": 1771859252
},
"zips2:create": {
"count": 276737,
"limit": 536870912000,
"remaining": 536870635263,
"reset": 1771858513
}
}
GEThttps://api.sirv.com/v2/billing/plan

Use this API method to get all the billing plan information of an account, including price, storage and transfer allowances.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/billing/plan', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

{
"dateActive": "2017-05-31T00:00:00.000Z",
"id": "Business_5_v2",
"period": "month",
"name": "Business 5",
"description": "The complete set of features, with large allowances and no branding",
"price": {
"month": 19,
"year": 209,
"quarter": 57
},
"storage": 1000000000,
"burstableStorage": 5000000000
}
GEThttps://api.sirv.com/v2/account/storage

Use this to check the current storage usage of an account.

It will also return the total allowed storage; any extra storage provided; the temporary 30-day burstable storage allowance; the total files stored.

If the account has exceeded its storage allowance, it will state the when that happened.

If the account is one of a multi-account group, it will show the total storage used by all accounts.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/storage', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

{
"plan": 100000000000,
"burstable": 500000000000,
"extra": 0,
"used": 51916252571,
"files": 73143,
"quotaExceededDate": null
}
GEThttps://api.sirv.com/v2/user

Use this API method to get information about a user, including their name, email and S3 key.

Query parameters

NameTypeRequiredExampleDescription
userIdstringYesGt6ljl1AxwmtGBIHX0WBo3qKdtKID of the user, from GET /v2/account/users.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/user?userId=Gt6ljl1AxwmtGBIHX0WBo3qKdtK', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

{
"email": "restapi@sirv.com",
"firstName": "Rest",
"lastName": "Api",
"dateCreated": "2020-07-17T13:55:10.462Z",
"s3Secret": "****************************"
}
GEThttps://api.sirv.com/v2/account/users

Use this API method to get a list of all users of an account. It will return a list of user IDs and their roles.

If you need a users email address, the user ID can be used to obtain it.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/users', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

[
{
"role": "primaryOwner",
"userId": "************************"
},
{
"role": "owner",
"userId": "************************"
}
]
POSThttps://api.sirv.com/v2/account/events/search

List all events triggered for account.

Request body (JSON)

FieldTypeRequiredExampleDescription
modulestringNofetchingOnly events from this part of Sirv, for example fetching.
typestringNoOnly events of this type.
filenamestringNo/REST API Examples/aurora.jpgOnly events about this file.
levelstringNoerrorOne of: error, warn, info.
seenbooleanNofalseFilter seen/unseen events

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/events/search', {
method: 'POST',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify({
"module": "fetching"
}),
});
console.log(res.status, await res.text());

Example response

[
{
"module": "fetching",
"type": "http",
"level": "error",
"filename": "/REST API Examples/missing.jpg",
"fetching": {
"url": "https://demo.sirv.com/missing.jpg",
"statusCode": 404,
"maxFilesize": 2097152,
"contentLength": "4140",
"error": "Request not successful: expected status code 200 but got 404"
},
"initiator": {
"type": "api",
"remoteAddr": "176.105.166.4",
"date": "2020-07-18T11:31:32.229Z"
},
"notify": true,
"_seen": false,
"_submitted": "2020-07-18T11:31:32.612Z",
"_accountId": "sdulth0oi0t9zxpxqtxwkwvgipjgv6ud",
"_id": "8fbb11a7dd77f7f64337e581ccbce2d62fc7cda0"
}
]
POSThttps://api.sirv.com/v2/account/events/seen

Add seen flag for specified account event(s)

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/events/seen', {
method: 'POST',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify([
"f1f5d68ef232e5d27d10f28bcef836efbb7cdeba",
"199cf48046964f8567fe49e22107c4c5d27271e7"
]),
});
console.log(res.status, await res.text());

Response

HTTP 200 with an empty body when the command succeeds.

DELETEhttps://api.sirv.com/v2/account/custom-domain

Use this method to remove the custom CDN domain from an account alias.

Query parameters

NameTypeRequiredExampleDescription
aliasstringYesmy-accountAccount name (alias) that the domain serves.
domainstringYescdn.example.comCustom domain to remove.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/custom-domain?alias=my-account&domain=cdn.example.com', {
method: 'DELETE',
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.

POSThttps://api.sirv.com/v2/account

Use this method to change the account options. You can enable or disable JS/CSS file minification.

You can also enable/disable automatic fetching via HTTP or S3 from a remote location.

Request body (JSON)

FieldTypeRequiredExampleDescription
minifyobjectNoMinification of JS and CSS files served from your account.
minify.enabledbooleanYestrueEnable or disable automatic minification of JS/CSS files
fetchingobjectNoFetching: Sirv copies a file from your own server or S3 bucket the first time someone requests it.
fetching.enabledbooleanYesfalsetrue to turn fetching on, false to turn it off.
fetching.typestringYeshttpOne of: http, s3.
fetching.httpobjectYesWhere to fetch from when the type is http: the address of your server.
fetching.s3objectYesWhere to fetch from when the type is s3: the bucket, its access keys and an optional endpoint and prefix.
aliasesobjectNoSettings for each account name (alias), with the alias as the key.
aliases.<alias>objectNoSettings for one alias: cdn (true to serve it through the CDN), prefix and defaultProfile.

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account', {
method: 'POST',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify({
"fetching": {
"enabled": false
}
}),
});
console.log(res.status, await res.text());

Response

HTTP 200 with an empty body when the command succeeds.

Back to top