Skip to content

Create or close a sub-account

By , Head of IntegrationsUpdated

Open this page in a new chat

Short answer

This page has 2 commands: Create sub-account (POST /v2/account/sub-account) and Close sub-account (DELETE /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. Each call needs a bearer token and counts towards your hourly API limit.

After reading this you will know

  • How to create or close a sub-account
  • 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.

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": {}
}
}
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"
}
Back to top