The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Insights

External Resources

More Info


Page tree
Skip to end of metadata
Go to start of metadata

The following endpoints allow you to manage user accounts:

What You'll Need

  • Access to Sauce Labs most recent Team Management features. 
    • To verify you have access, click your account name in the user interface. You should see your org name followed by panels for Concurrency, Peak VM Concurrency, and Tests By Day. 
    • If you do not have this configured for your site, speak to your Customer Success Manager for help migrating.  
  • The data center endpoint you're working with; for more information, see Data Center Endpoints
  • The User ID for any specific user you want to manage. To get user IDs:
    1.  Click your account name and select Team Management
    2. In the Users tab on the far right side of the panel, click the Download icon. A CSV file with all users associated with your team or org is downloaded. This includes an ID for each user in your team or org, depending on your admin level. 
  • To use the below APIs you will need organization admin rights

Base URL

The base URL for the endpoints described in this doc is SAUCE_DC/team-management/ where SAUCE_DC is the data center you're working with. For more information, see Data Center Endpoints.

List Users

Get a list of all users. By default limit the returned number of users to `20`. 

GET v1/users/
Query Parameters

These optional parameters can be included in a URL query string.

username

Filters members by a username which starts with `username`
teamsGets members of one or more teams. Separate multiple values (team UUID) with a comma.
team_nameGets members of one or more teams. Separate multiple values (team names) with a comma.
roles

Gets members with the specified role. Separate multiple values with a comma.
Options for values are:

1 - Organization Admin

3 - User

4 - Team Admin

phraseFilters members by a first name, last name, or email which starts with `phrase`.
statusFilters members by status. Possible values are pending, active, inactive.
It is also possible to paginate a list of users, by using these query parameters:

limit

The number of results to return per page. The default limit is `20`. Max limit you can set is `100`.
offsetThe initial index from which to return the results.

Create User

Create a user.

POST v1/users/

Request Body

The request body should be a "application/json" encoded object, containing these parameters

first_name

required

The first name of the new user

last_name

required

The last name of the new user

email

required

The email address for the new user

username

required

The username for the new user

password

required

A password for the user

organization

required

The organization the user should belong to

Use https://api.saucelabs.com/v1/organizations to get the organization ID

role

required

The user's role

Options for values are:

1 - Organization Admin

3 - User

4 - Team Admin

team

optional

The team the user should belong to

 


Read User

Get information about a user.

GET v1/users/{id}/

Path Parameters

These parameters should be provided in the URL path. 

id

required

The ID of the user


Update User

Update information about a user.

Put v1/users/{id}/

Path Parameters

These parameters should be provided in the URL path. 

id

required

The ID of the user to update

Request Body


The request body should be a "application/json" encoded object, containing these items.

ParameterDescription

password 

required

A password for the user

verify_password 

required

Verify the password update

email

required

An email address for the user

first_name 

required

The first name of the user 

last_name 

required

The last name of the user
Partial Update User


Update partial information about a user.

PATCH v1/users/{id}/

Path Parameters

These parameters should be included in the URL path.

ParameterDescription

id r

required

The ID of the user to update

Request Body

The request body should be a "application/json" encoded object, containing these items.

ParameterDescription

password 

optional

A password for the user

verify_password 

optional

Verify the password update

email

optional

An email address for the user

first_name 

optional

The first name of the user 

last_name 

optional

The last name of the user





Get Access Key

Get the access key for a user

GET /v1/users/{id}/access-key/

Path Parameters

These parameters should be included in the URL path.

id

required

The ID of the user who has the access key you want to get.

 

Activate User

Deactivate a user's account

POST /v1/users/{id}/activate/

Path Parameters

These parameters should be included in the URL path.

id

required

The ID of the user you want to activate

 

Deactivate User

Deactivate a user's account

POST /v1/users/{id}/deactivate/

Path Parameters

These parameters should be included in the URL path.

id

required

The ID of the user you want to deactivate

 

 Get Permissions

Get the permissions for a user.

GET /v1/users/{id}/permissions/

Path Parameters

These parameters should be included in the URL path.

id

required

The ID of the user you want to get permission information about




Reset Access Key

Reset a user's access token.

POST /v1/users/{id}/reset-access-key/

Path Parameters

These parameters should be included in the URL path.

id

required

The ID of the user you want to reset the access token for

 


Set Admin

Set admin rights for an organization to a user.

POST /v1/users/{id}/set-admin/

Path Parameters

These parameters should be included in the URL path.

id

required

The ID of the user you want to set admin rights for

 



Set Member

Remove admin rights for an organization from a user.

POST /v1/users/{id}/set-member/

 Path Parameters

 These parameters should be included in the URL path.

id

required

The ID of the user you want to set member rights for




Get Teams

Get a list of teams a user belongs to.

GET /v1/users/{id}/teams/

Path Parameters

These parameters should be included in the URL path.

id

required

The ID of the user you want to get team information for




Change team membership

Change user association with a team

POST /v1/membership/

Request Body

The request body should be a "application/json" encoded object, containing these items.


user

required

The ID of the user you want to change team

team

required

The ID of the team you want the user to be a member of

organization

required

The ID of the organization (have to be the same as the current one)