Skip to content

Latest commit

 

History

History
2609 lines (2205 loc) · 64.1 KB

accounts.md

File metadata and controls

2609 lines (2205 loc) · 64.1 KB
id title sidebar_label description
accounts
Account Management API Endpoints
Accounts
Manage all aspects of your Sauce Labs organization, team, and member accounts.

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

The Accounts API exposes the following endpoints related to individual and team account configuration and monitoring.

Refer to Getting Started for Authentication and Server information.

Team

Lookup Teams

GET /team-management/v1/teams/

Queries the organization of the requesting account and returns the number of teams matching the query and a summary of each team, including the ID value, which may be a required parameter of other API calls related to a specific team.

You can filter the results of your query using the name parameter below.

Parameters

id

| QUERY | OPTIONAL | STRING |

Comma-separated team IDs. Allows to receive details of multiple teams at once. For example, id=3d60780314724ab8ac688b50aadd9ff9,f9acc7c5b1da4fd0902b184c4f0b6324 would return details of teams with IDs included in the provided list.

name

| QUERY | OPTIONAL | STRING |

Returns the set of teams that begin with the specified name value. For example, name=sauce would return all teams in the organization with names beginning with "sauce".

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.us-west-1.saucelabs.com/team-management/v1/teams?name=sauce' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.eu-central-1.saucelabs.com/team-management/v1/teams?name=sauce' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success. Team info returned.
404 Not found.
{
    "links": {...},
    "count": 1,
    "results": [
        {
            "id": "**************",
            "name": "Sauce-Docs",
            "settings": {
                "virtual_machines": 25,
                "real_devices": 0,
                "live_only": false
            },
            "group": {...},
            "is_default": false,
            "org_uuid": "**************",
            "user_count": 1
        }
    ]
}

Get a Specific Team

GET /team-management/v1/teams/{team_id}/

Returns the full profile of the specified team. The ID of the team is the only valid unique identifier.

Parameters

id

| PATH | REQUIRED | STRING |

The unique identifier of the team. You can look up the IDs of teams in your organization using the Lookup Teams endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.us-west-1.saucelabs.com/team-management/v1/teams/<team-id>' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.eu-central-1.saucelabs.com/team-management/v1/teams/<team-id>' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success. Team info returned.
404 Not found.
{
    "id": "80d69d16ebdb4c018cc9d81ea911761a",
    "name": "Sauce-Docs",
    "org_uuid": {
        "id": "**********",
        "name": "SLTC",
        "created_at": "2020-10-05T16:21:01.513495Z",
        "updated_at": "2020-11-09T23:46:47.752572Z",
        "total_vm_concurrency": 46,
        "settings": {...}
    },
    "group": {...},
    "created_at": "2020-12-30T17:09:12.473388Z",
    "updated_at": "2020-12-30T17:09:12.473415Z",
    "settings": {
        "virtual_machines": 25,
        "real_devices": 0,
        "live_only": false
    },
    "description": "Tech Content API Testing",
    "is_default": false,
    "links": {...}
}

Create a Team

POST /team-management/v1/teams/

Creates a new team under the organization of the requesting account.

Parameters

name

| BODY | REQUIRED | STRING |

A name for the new team.

settings

| BODY | REQUIRED | OBJECT |

The settings object specifies the concurrency allocations for the team within the organization. The available attributes are:

  • virtual_machines - INTEGER

The settings parameter is required, but you only need to include the applicable concurrency attribute(s) for the team.

description

| BODY | OPTIONAL | STRING |

A description to distinguish the team in the organization.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/teams/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "A-Team",
    "settings": {
        "virtual_machines": "10"
    },
    "description": "Docs QA Team"
}' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/teams/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "A-Team",
    "settings": {
        "virtual_machines": "10"
    },
    "description": "Docs QA Team"
}' | json_pp

Responses

201 Success. Team created.
400 Bad request.
{
    "id": "9d3460738c28491a81d7ea16704a9edd",
    "name": "A-Team",
    "org_uuid": "5f436681bbfc4d9ca4aef1eba49ea3b7",
    "group": {...},
    "created_at": "2021-04-02T17:52:42.578095Z",
    "updated_at": "2021-04-02T17:52:42.578126Z",
    "settings": {
        "virtual_machines": 10,
        "real_devices": 0,
        "live_only": false
    },
    "description": "Docs QA Team",
    "is_default": false
}

Delete a Team

DELETE /team-management/v1/teams/{team_id}/

Deletes the specified team from the organization of the requesting account.

Parameters

team_id

| PATH | REQUIRED | STRING |

The unique identifier of the team. You can look up the IDs of teams in your organization using the Lookup Teams endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request DELETE 'https://api.us-west-1.saucelabs.com/team-management/v1/teams/<team-id>/' \
--header 'Content-Type: application/json' \
--data-raw '' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request DELETE 'https://api.eu-central-1.saucelabs.com/team-management/v1/teams/<team-id>/' \
--header 'Content-Type: application/json' \
--data-raw '' | json_pp

Responses

204 Success. No content returned.
404 Not found.

Update a Team

PUT /team-management/v1/teams/{team_id}/

Replaces all values of the specified team with the new set of parameters passed in the request. To update only certain parameters, see Partially Update Team.

Parameters

team_id

| PATH | REQUIRED | STRING |

The unique identifier of the team. You can look up the IDs of teams in your organization using the Lookup Teams endpoint.

name

| BODY | REQUIRED | STRING |

The name of the team as it will be after the update. Pass the current value to keep the name unchanged.

settings

| BODY | REQUIRED | OBJECT |

The updated concurrency allocations for the team. The available attributes are:

  • virtual_machines - INTEGER

The settings parameter is required, but you only need to include the applicable concurrency attribute(s) for the team.

description

| BODY | OPTIONAL | STRING |

A description to distinguish the team in the organization. If the previous team definition included a description, omitting the parameter in the update will delete it from the team record.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PUT 'https://api.us-west-1.saucelabs.com/team-management/v1/teams/<team-id>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Doc-Team",
    "settings": {
        "virtual_machines": "10"
    },
    "description": "Docs Team"
}' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PUT 'https://api.eu-central-1.saucelabs.com/team-management/v1/teams/<team-id>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Doc-Team",
    "settings": {
        "virtual_machines": "10"
    },
    "description": "Docs Team"
}' | json_pp

Responses

201 Success. Team updated.
400 Bad request.
404 Not found.
{
    "id": "b3de7078b79841b59d2e54127269afe3",
    "name": "Doc-Team",
    "org_uuid": "5f436681bbfc4d9ca4aef1eba49ea3b7",
    "group": {...},
    "created_at": "2020-10-05T17:13:56.580592Z",
    "updated_at": "2021-04-05T13:49:22.107825Z",
    "settings": {
        "virtual_machines": 10,
        "real_devices": 0,
        "live_only": true
    },
    "description": "Docs Team",
    "is_default": false
}

Partially Update a Team

PATCH /team-management/v1/teams/{team_id}/

Updates one or more individual editable parameters (such as the concurrency allocation) of the specified team without requiring a full profile update.

Parameters

team_id

| PATH | REQUIRED | STRING |

The unique identifier of the team. You can look up the ID of teams in your organization using the Lookup Teams endpoint.

name

| BODY | OPTIONAL | STRING |

An updated name for the team.

settings

| BODY | OPTIONAL | OBJECT |

The updated concurrency allocations for the team. The available attributes are:

  • virtual_machines - INTEGER

description

| BODY | OPTIONAL | STRING |

An updated description.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PATCH 'https://api.us-west-1.saucelabs.com/team-management/v1/teams/<team-id>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "settings": {
        "virtual_machines": "25"
    }
}' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PATCH 'https://api.eu-central-1.saucelabs.com/team-management/v1/teams/<team-id>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "settings": {
        "virtual_machines": "25"
    }
}' | json_pp

Responses

200 Success. Team updated.
400 Bad request.
404 Not found.
{
    "id": "b3de7078b79841b59d2e54127269afe3",
    "name": "Doc-Team",
    "org_uuid": "5f436681bbfc4d9ca4aef1eba49ea3b7",
    "group": {...},
    "created_at": "2020-10-05T17:13:56.580592Z",
    "updated_at": "2021-04-05T13:49:22.107825Z",
    "settings": {
        "virtual_machines": 25,
        "real_devices": 0,
        "live_only": true
    },
    "description": "Docs Team",
    "is_default": false
}

List Team Members

GET /team-management/v1/teams/{team_id}/members/

Returns the number of members in the specified team and lists each member.

Parameters

team_id

| PATH | REQUIRED | STRING |

Identifies the team for which you are requesting the list of members.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.us-west-1.saucelabs.com/team-management/v1/teams/<team-id>/members' \
--header 'Content-Type: application/json' \
--data-raw '' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.eu-central-1.saucelabs.com/team-management/v1/teams/<team-id>/members' \
--header 'Content-Type: application/json' \
--data-raw '' | json_pp

Responses

200 Success. Team info returned.
404 Not found.
{
    "links": {...},
    "count": 0,
    "results": []
}

Reset Access Keys for Entire Team

POST /team-management/v1/teams/{team_id}/reset-access-key/

Globally regenerates new access key values for every member of the specified team.

:::warning Regenerating an access key invalidates the previous value and any tests containing the prior value will fail, so make sure you edit any tests and credential environment variables with the new value. :::

Parameters

team_id

| PATH | REQUIRED | STRING |

Identifies the team for which you are resetting member access keys.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/teams/<team-id>/reset-access-key' \
--header 'Content-Type: application/json' \
--data-raw '' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/teams/<team-id>/reset-access-key' \
--header 'Content-Type: application/json' \
--data-raw '' | json_pp

Responses

200 Success. All access keys reset.
404 Not found.
;[]

User

Lookup Users

GET /team-management/v1/users/

Queries the organization of the requesting account and returns the number of users matching the query and a basic profile of each user, including the ID value, which may be a required parameter of other API calls related to a specific user.

You can narrow the results of your query using any of the following filtering parameters.

Parameters

id

| QUERY | OPTIONAL | STRING |

Comma-separated user IDs. Allows to receive details of multiple user at once. For example, id=3d60780314724ab8ac688b50aadd9ff9,f9acc7c5b1da4fd0902b184c4f0b6324 would return details of users with IDs included in the provided list.

username

| QUERY | OPTIONAL | STRING |

Limits the results to usernames that begin with the specified value. For example, username=an would return all users in the organization with usernames beginning with "an".

teams

| QUERY | OPTIONAL | STRING |

Limit results to users who belong to the specified team_ids. Specify multiple teams as comma-separated values.

roles

| QUERY | OPTIONAL | INTEGER |

Limit results to users who are assigned certain roles. Valid values are:

  • 1 - Organization Admin
  • 4 - Team Admin
  • 3 - Member

Specify multiple roles as comma-separated values.

phrase

| QUERY | OPTIONAL | STRING |

Limit results to users whose first name, last name, or email address begins with the specified value.

status

| QUERY | OPTIONAL | STRING |

Limit results to users of the specifid status. Valid values are:

  • active
  • pending
  • inactive

limit

| QUERY | OPTIONAL | INTEGER MAX=100 |

Limit results to a maximum number per page. Default value is 20.

offset

| QUERY | OPTIONAL | INTEGER |

The starting record number from which to return results.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.us-west-1.saucelabs.com/team-management/v1/users?roles=3&limit=30' \
--header 'Content-Type: application/json' \
--data-raw '' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.eu-central-1.saucelabs.com/team-management/v1/users?roles=3&limit=30' \
--header 'Content-Type: application/json' \
--data-raw '' | json_pp

Responses

200 Success. Team info returned.
404 Not found.
{
    "links": {...},
    "count": 1,
    "results": [
        {
            "id": "80d69d16ebdb4c018cc9d81ea911761a",
            "name": "Sauce-Docs",
            "settings": {...},
            "group": {...},
            "is_default": false,
            "org_uuid": "******************",
            "user_count": 1
        }
    ]
}

Get a Specific User

GET /team-management/v1/users/{user_id}/

Returns the full profile of the specified user. The ID of the user is the only valid unique identifier.

Parameters

user_id

| PATH | REQUIRED | STRING |

The user's unique identifier. You can look up the IDs of users in your organization using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success. Team info returned.
404 Not found.
{
    "id": "e5be7513ba224f6f9463c209cb4c5d83",
    "username": "jim.smith",
    "email": "[email protected]",
    "first_name": "Jim",
    "last_name": "Smith",
    "is_active": true,
    "created_at": "2020-10-05T16:21:06.021260Z",
    "updated_at": "2020-12-30T17:28:35.969274Z",
    "teams": [...],
    "roles": [...],
    "is_staff": true,
    "is_superuser": false,
    "user_type": "admin",
    "groups": [],
    "organization": {...},
    "is_organization_admin": true,
    "is_team_admin": false
}

Create a New User

POST /team-management/v1/users/

Creates a new user in the Sauce Labs platform.

Parameters

first_name

| BODY | REQUIRED | STRING |

The new user's first name.

last_name

| BODY | REQUIRED | STRING |

The new user's last name.

email

| BODY | REQUIRED | STRING |

The user's contact email address.

username

| BODY | REQUIRED | STRING |

A login username for the new user.

password

| BODY | REQUIRED | STRING |

A login password for the new user. The password requirements are:

  • 1 lowercase letter
  • 1 uppercase letter
  • 1 digit
  • 1 special character
  • 8 characters minimum
  • No blank spaces

organization

| BODY | REQUIRED | STRING |

The identifier of the organization to create the user's account. You can look up organization IDs by calling the GET https://api.{region}.saucelabs.com/team-management/v1/organizations/ endpoint.

role

| BODY | REQUIRED | INTEGER |

Tnew user's permission role. Valid values are:

  • 1 - Organaization Admin
  • 4 - Team Admin
  • 3 - Member

team

| BODY | OPTIONAL | STRING |

The identifier of the team of which the new user is a member. You can look up team IDs using the Lookup Teams endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/users/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "first_name": "John",
    "last_name": "Smith",
    "email": "[email protected]",
    "username": "jsmith",
    "password": "$m1th*RULES",
    "role": 4,
    "team": "<team-id>"
}' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "first_name": "John",
    "last_name": "Smith",
    "email": "[email protected]",
    "username": "jsmith",
    "password": "$m1th*RULES",
    "role": 4,
    "team": "<team-id>"
}' | json_pp

Responses

201 Success. User created.
401 Unauthorized.
400 Bad input.
404 Not found.
{
    "id": "631dfdc7c20f499e9f9de19680543c35",
    "username": "jsmith",
    "email": "[email protected]",
    "first_name": "Jim",
    "last_name": "Smith",
    "is_active": true,
    "created_at": "2021-04-06T16:35:02.047237Z",
    "updated_at": "2021-04-06T16:35:02.713149Z",
    "teams": [
        {
            "id": "b3de7078b79841b59d2e54127269afe3",
            "name": "Doc-Team",
            "settings": {
                "virtual_machines": 100,
                "real_devices": 0,
                "live_only": true
            },
            "group": {...},
            "is_default": false,
            "org_uuid": "bed0a8a559404117b3d10d3bfff4c8ab"
        }
    ],
    "roles": [
        {
            "name": "team admin",
            "role": 4
        }
    ],
    "is_staff": false,
    "is_superuser": false,
    "user_type": "subaccount",
    "groups": [...],
    "organization": {...},
    "is_organization_admin": false,
    "is_team_admin": true
}

Update a User

PUT /team-management/v1/users/{user_id}

Replaces all values of the specified user profile with the new set of parameters passed in the request. To update only certain parameters, see Partially Update a User.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

first_name

| BODY | REQUIRED | STRING |

The user's first name.

last_name

| BODY | REQUIRED | STRING |

The user's last name.

email

| BODY | REQUIRED | STRING |

The user's contact email address.

password

| BODY | REQUIRED | STRING |

A login password for the new user. The password requirements are:

  • 1 lowercase letter
  • 1 uppercase letter
  • 1 digit
  • 1 special character
  • 8 characters minimum
  • No blank spaces

verify_password

| BODY | REQUIRED | STRING |

A confirmation of the password. This value must match the password value in the request.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PUT 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "first_name": "Hannibal",
    "last_name": "Smith",
    "email": "[email protected]",
    "password": "$m1th*RULEStheworld",
    "verify_password": "$m1th*RULEStheworld"
}' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PUT 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "first_name": "Hannibal",
    "last_name": "Smith",
    "email": "[email protected]",
    "password": "$m1th*RULEStheworld",
    "verify_password": "$m1th*RULEStheworld"
}' | json_pp

Responses

200 Success. User updated.
401 Unauthorized.
400 Bad request.
404 Not found.
{
  "status_code": 400,
  "non_field_errors": [
        "Passwords need to match"
    ]
}

Partially Update a User

PATCH /team-management/v1/users/{user_id}

Allows you to update individual user values without replacing the entire profile.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user to update. You can look up a user's ID using the Lookup Users endpoint.

first_name

| BODY | OPTIONAL | STRING |

The user's first name.

last_name

| BODY | OPTIONAL | STRING |

The user's last name.

email

| BODY | OPTIONAL | STRING |

The user's contact email address.

password

| BODY | OPTIONAL | STRING |

A login password for the new user. The password requirements are:

  • 1 lowercase letter
  • 1 uppercase letter
  • 1 digit
  • 1 special character
  • 8 characters minimum
  • No blank spaces

verify_password

| BODY | OPTIONAL | STRING |

A confirmation of the password. If the password parameter is included in the call, this parameter is required and the values for both must match.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PATCH 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "first_name": "Jimmy"
}' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PUT 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "first_name": "Jimmy"
}' | json_pp

Responses

200 Success. User updated.
401 Unauthorized.
400 Bad request.
404 Not found.
{
    "id": "e5be7513ba224f6f9463c209cb4c5d83",
    "username": "jsmith",
    "email": "[email protected]",
    "first_name": "Jimmy",
    "last_name": "Smith",
    "is_active": true,
    "created_at": "2020-10-05T16:21:06.021260Z",
    "updated_at": "2021-04-09T14:22:43.884794Z",
    "teams": [...],
    "roles": [...],
    "organization": {...}
    },
    "is_organization_admin": true,
    "is_team_admin": false
}

Get User Concurrency

GET /rest/v1.2/users/{username}/concurrency

Returns details about the current in-use virtual machines and real devices along with the maximum allowed values.

:::note Real Devices

At this time, the current usage for real devices is not accurately returned in the response. As a workaround, use the following endpoint:

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location --request GET 'https://api.us-west-1.saucelabs.com/v1/rdc/concurrency' --header 'Content-Type: application/json' | json_pp

:::

Parameters

username

| PATH | REQUIRED | STRING |

The username of the user whose concurrency you are looking up. You can look up a user's name using a variety of filtering parameters with the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.us-west-1.saucelabs.com/rest/v1.2/users/<username>/concurrency' \
--header 'Content-Type: application/json' \ | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.eu-central-1.saucelabs.com/rest/v1.2/users/<username>/concurrency' \
--header 'Content-Type: application/json' \ | json_pp

Responses

200 Success. User updated.
401 Unauthorized.
400 Bad request.
404 Not found.

Response Details

concurrency.organization.allowed The total allowed concurrency for each device type allocated to the organization.
concurrency.organization.current The total concurrency for each device type currently in use by the organization.
concurrency.team.allowed The total concurrency for each device type allocated to the logged-in user's team.
concurrency.team.current The total concurrency for each device type currently in use by the user's team.
*.{device_type}

Each set of concurrency reported in the response is broken down by the following device types:

  • mac_vms - Mac virtual machines represent any live, automated, desktop, or mobile test running in a Mac OS, which includes iOS Simulator tests.
  • rds - Real devices represent any live or automated mobile test running on a Sauce Labs real device.
  • vms - Windows virtual machines represent any live, automated, desktop, or mobile test running in a Windows or Android OS, which includes Android Emulator tests.

Note that mac_vms and vms are separated here, although they are typically presented as a combined total of virtual machine usage in other areas of the Sauce Labs platform.

{
   "concurrency" : {
      "organization" : {
         "allowed" : {
            "mac_vms" : 1000,
            "rds" : 20,
            "vms" : 1000
         },
         "current" : {
            "mac_vms" : 0,
            "rds" : 0,
            "vms" : 0
         },
         "id" : "7fb25570b4064716b9b6daae1a846790"
      },
      "team" : {
         "allowed" : {
            "mac_vms" : 1000,
            "rds" : 20,
            "vms" : 100
         },
         "current" : {
            "mac_vms" : 0,
            "rds" : 0,
            "vms" : 0
         },
         "id" : "98b9f34e596047d99abba56f517846a9"
      }
   },
   "timestamp" : 1631125800.61984
}

Get a User's Team

GET /team-management/v1/users/{user_id}/teams/

Returns the number of teams a user belongs to and provides information about each team, including whether it is the default and its concurrency settings.

:::note At this time, users may only belong to a maximum of one team. :::

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/teams/' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/teams/' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success.
404 Not found.
{
    "links": {...},
    "count": 1,
    "results": [
        {
            "id": "************",
            "name": "Sauce-Docs",
            "settings": {
                "virtual_machines": 25,
                "real_devices": 0,
                "live_only": false
            },
            "group": {},
            "is_default": false,
            "org_uuid": "************"
        }
    ]
}

Update User's Team Assignment

PUT /team-management/v1/users/{user_id}/teams/

Assign users to one or multiple teams. New team assignments will replace the existing ones. Users assigned to multiple teams will be able to switch between them.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the Sauce Labs user. You can look up the ID of a user in your organization using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PUT 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/teams/' \
--header 'Content-Type: application/json' \
--data-raw '["<team1-id>", "<team2-id>"]' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request PUT 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/teams/' \
--header 'Content-Type: application/json' \
--data-raw '["<team1-id>", "<team2-id>"]' | json_pp

Responses

204 Success. The list of assigned teams has been properly updated.
400 Bad Request.
403 Requester is not authorized to perform this action.
404 Not found.

Subscribe a User to a Team

POST /team-management/v1/membership/

This endpoint is DEPRECATED. Please use Update User's Team Assignment endpoint instead.


Set a user's team affiliation. Users are limited to one team affiliation, so if the user is already a member of a different team, this call will remove them from that team. Also, By default, the user will not have team-admin privileges, even if they did on a prior team.

Parameters

user

| PATH | REQUIRED | STRING |

The unique identifier of the Sauce Labs user to be added to the team.You can look up the ID of a user in your organization using the Lookup Users endpoint.

team

| PATH | REQUIRED | STRING |

The identifier of the team to which the user will be added. You can look up the ID of a team in your organization using the Lookup Teams endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/membership/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "user": "<user-id>",
    "team": "<team-id>"
}' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/membership/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "user": "<user-id>",
    "team": "<team-id>"
}' | json_pp

Responses

201 Success. User assigned Org Admin role.
400 Bad Request.
404 Not found.
{
    "id": 28099,
    "user": {
        "id": "e5be7513ba224f6f9463c209cb4c5d83",
        "username": "nancy.sweeney",
        "email": "[email protected]",
        "first_name": "Casey",
        "last_name": "Sweeney",
        "is_active": true,
        "created_at": "2020-10-05T16:21:06.021260Z",
        "updated_at": "2021-04-09T14:22:43.884794Z",
        "teams": [
            {
                "id": "80d69d16ebdb4c018cc9d81ea911761a",
                "name": "Sauce-Docs",
                "settings": {
                    "virtual_machines": 25,
                    "real_devices": 0,
                    "live_only": false
                },
                "group": {},
                "is_default": false,
                "org_uuid": "***********"
            }
        ],
        "roles": [...],
        "is_staff": true,
        "is_superuser": false,
        "user_type": "admin",
        "groups": [],
        "organization": {...},
        "team": {
            "id": "80d69d16ebdb4c018cc9d81ea911761a",
            "name": "Sauce-Docs",
            "organization": {...},
            "group": {...},
            "created_at": "2020-12-30T17:09:12.473388Z",
            "updated_at": "2020-12-30T17:09:12.473415Z",
            "settings": {...},
            "description": "Tech Content API Testing",
            "is_default": false,
            "links": {}
        }
    },
    "created_at": "2020-12-30T17:21:52.344918Z",
    "updated_at": "2020-12-30T17:21:52.344961Z"
}

Assign a User Org Admin Rights

POST /team-management/v1/users/{user_id}/set-admin/

Assigns administrator rights to the user within their organization. Organization Admins automatically have Team Admin rights in all the teams in the Organization.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/set-admin/' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/set-admin/' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success.
404 Not found.
{
    "id": "631dfdc7c20f499e9f9de19680543c35",
    "username": "jsmith",
    "email": "[email protected]",
    "first_name": "Jim",
    "last_name": "Smith",
    "is_active": true,
    "created_at": "2021-04-06T16:35:02.047237Z",
    "updated_at": "2021-04-09T15:37:20.278491Z",
    "teams": [...],
    "roles": [
        {
            "name": "organization admin",
            "role": 1
        }
    ],
    "is_staff": false,
    "is_superuser": false,
    "user_type": "subaccount",
    "groups": [...],
    "organization": {...},
    "is_organization_admin": true,
    "is_team_admin": false
}

Assign a User Team Admin Rights

POST /team-management/v1/users/{user_id}/set-team-admin/

Assigns administrator rights to the user within their current team. If the user is currently assigned an Org Admin role, this call would reduce the rights to only those of a Team Admin.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/set-team-admin/' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/set-team-admin/' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success.
404 Not found.
{
    "id": "631dfdc7c20f499e9f9de19680543c35",
    "username": "jsmith",
    "email": "[email protected]",
    "first_name": "Jim",
    "last_name": "Smith",
    "is_active": true,
    "created_at": "2021-04-06T16:35:02.047237Z",
    "updated_at": "2021-04-09T15:37:20.278491Z",
    "teams": [...],
    "roles": [
        {
            "name": "team admin",
            "role": 4
        }
    ],
    "is_staff": false,
    "is_superuser": false,
    "user_type": "subaccount",
    "groups": [...],
    "organization": {...},
    "is_organization_admin": false,
    "is_team_admin": true
}

Remove Admin Rights from User

POST /team-management/v1/users/{user_id}/set-member/

Assigns the member role to the user. If the user is currently assigned any Admin rights, this call removes those rights.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/set-team-admin/' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/set-team-admin/' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success.
404 Not found.
{
    "id": "631dfdc7c20f499e9f9de19680543c35",
    "username": "jsmith",
    "email": "[email protected]",
    "first_name": "Jim",
    "last_name": "Smith",
    "is_active": true,
    "created_at": "2021-04-06T16:35:02.047237Z",
    "updated_at": "2021-04-09T15:37:20.278491Z",
    "teams": [...],
    "roles": [
        {
            "name": "member",
            "role": 3
        }
    ],
    "is_staff": false,
    "is_superuser": false,
    "user_type": "subaccount",
    "groups": [...],
    "organization": {...},
    "is_organization_admin": false,
    "is_team_admin": false
}

Get a User's Access Key

GET /team-management/v1/users/{user_id}/access-key/

Retrieves the Sauce Labs access key for the specified user.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/access-key' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request GET 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/access-key' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success.
404 Not found.
{
    "id": "631dfdc7c20f499e9f9de19680543c35",
    "username": "jsmith",
    "access_key": "********-****-****-****-************"
}

Reset a User's Access Key

POST /team-management/v1/users/{user_id}/reset-access-key/

Creates a new auto-generated access key for the specified user.

:::warning Regenerating an access key invalidates the previous value and any tests containing the prior value will fail, so make sure you update any tests and credential environment variables with the new value. :::

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/reset-access-key' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/reset-access-key' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success.
404 Not found.
{
    "id": "631dfdc7c20f499e9f9de19680543c35",
    "username": "jsmith",
    "access_key": "********-****-****-****-************"
}

Deactivate a User

POST /team-management/v1/users/{user_id}/deactivate/

Suspends the specified user's account, preventing all access to Sauce Labs while deactivated.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/deactivate' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/deactivate' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success.
403 Forbidden.
404 Not found.
{
    "id": "631dfdc7c20f499e9f9de19680543c35",
    "username": "jsmith",
    "email": "[email protected]",
    "first_name": "Jim",
    "last_name": "Smith",
    "is_active": false,
    "created_at": "2021-04-06T16:35:02.047237Z",
    "updated_at": "2021-04-12T16:37:31.370711Z",
    "teams": [...],
    "roles": [...],
    "is_staff": false,
    "is_superuser": false,
    "user_type": "subaccount",
    "groups": [...],
    "organization": {...}
    },
    "is_organization_admin": false,
    "is_team_admin": false
}

Activate a User

POST /team-management/v1/users/{user_id}/activate/

Re-activates the specified user's account, if it had been previously deactivated.

Parameters

user_id

| PATH | REQUIRED | STRING |

The unique identifier of the user. You can look up a user's ID using the Lookup Users endpoint.

<Tabs groupId="dc-url" defaultValue="us" values={[ {label: 'United States', value: 'us'}, {label: 'Europe', value: 'eu'}, ]}>

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/team-management/v1/users/<user-id>/activate' \
--header 'Content-Type: application/json' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.eu-central-1.saucelabs.com/team-management/v1/users/<user-id>/activate' \
--header 'Content-Type: application/json' | json_pp

Responses

200 Success.
403 Forbidden.
404 Not found.
{
    "id": "631dfdc7c20f499e9f9de19680543c35",
    "username": "jsmith",
    "email": "[email protected]",
    "first_name": "Jim",
    "last_name": "Smith",
    "is_active": true,
    "created_at": "2021-04-06T16:35:02.047237Z",
    "updated_at": "2021-04-12T16:37:31.370711Z",
    "teams": [...],
    "roles": [...],
    "is_staff": false,
    "is_superuser": false,
    "user_type": "subaccount",
    "groups": [...],
    "organization": {...}
    },
    "is_organization_admin": false,
    "is_team_admin": false
}