About the Sauce REST APIs

Sauce Labs exposes a set of REST API endpoints that allow you to perform operations, manage accounts, and retrieve data programmatically so you can use the Sauce platform in the way that best suits your business logic.

tip

You can check the current accessibility of any Sauce Labs system on the Sauce Labs System Status page.

Accessing the APIs#

The Sauce Labs APIs are organized around REST and each endpoint is structured as a resource-oriented URL that accepts inline query parameters and form-encoded request bodies, then returns JSON-encoded responses.

Each endpoint is constructed from a {base-url} prefix that is based on the data center associated with the Sauce Labs account for which the request is relevant, plus the latests version for the given method. The following table provide the base URLs for each data center.

Data CenterAPI Base URL
Nonehttps://saucelabs.com/
UShttps://api.us-west-1.saucelabs.com/
Europehttps://api.eu-central-1.saucelabs.com/

Versioning#

The API is versioned by URL, each of which may be in a different stage of release. The currently published version of each endpoint is reflected in the URL itself, as demonstrated in the following two endpoints:

  • https://api.us-west-1.saucelabs.com/rest/v1.2/users/<USERNAME>/concurrency
  • https://api.us-west-1.saucelabs.com/rest/v1/users/<USERNAME>/activity

Methods#

Unspecified method requests default to GET. All other supported request types (PUT; POST; DELETE: PATCH) require setting the Content-Type header to application/json.

Authentication#

The Sauce Labs REST API uses Basic Authentication. You can pass the SAUCE_USERNAME and SAUCE_ACCESS_KEY authentication credentials as inline parameters in the URL, or include an Authorization Header to the request.

The following pseudocode examples illustrate how to authenticate the Sauce Labs REST API:

Inline Parameter Authentication
curl -XGET 'https://<SAUCE_USERNAME>:<SAUCE_ACCESS_KEY>@api.us-west-1.saucelabs.com/team-management/v1/users'
Auth Header Authentication
curl -L -X GET 'https://api.us-west-1.saucelabs.com/team-management/v1/users/' -H 'Authorization: Basic' -U <SAUCE_USERNAME> -K <SAUCE_ACCESS_KEY>

Rate Limits#

The Sauce Labs REST API places rate limits on some endpoints in order to prevent over-utilization.

For example:

  • Incoming authenticated API requests have rate limits imposed against the individual user accounts.
  • Incoming unauthenticated API requests have rate limits imposed against the IP addresses.

Requests received after the rate limit is reached return a 429 response code indicating that the number of allowable requests has been exceeded.

Rate Limit Breakdown#

REST API EndpointRate LimitAuthenticated
/rest/v1/*/activity3 requests per second, or 3,500 requests per hourโœ”๏ธ
All other authenticated request endpoints10 requests per second, or 3,500 requests per hourโœ”๏ธ
All unauthenticated request endpoints2 requests per minute

For more information about rate limiting check out this blog post: Announcing New Rest API Usage Limits.

Last updated on by Nancy Sweeney