Skip to content

Get users and user info

By , Head of IntegrationsUpdated

Open this page in a new chat

Short answer

This page has 2 commands: Get users (GET /v2/account/users) and Get user info (GET /v2/user). It will return a list of user IDs and their roles. Each call needs a bearer token and counts towards your hourly API limit. Below are the parameters, sample code in 9 languages and a sample answer.

After reading this you will know

  • How to get users and user info
  • 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/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": "************************"
}
]
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": "****************************"
}
Back to top