Skip to content
sauce-labs-cli
Menu

How it works

How it works

Every command does the same four things: find your Credentials, pick a Region, call one Sauce Labs endpoint and print the result.

  1. Step 1

    Find Credentials

    Flags win over the environment: --username and --access-key, else SAUCE_USERNAME and SAUCE_ACCESS_KEY. A .env or .env.local file in the working directory is loaded first and never overwrites a variable that is already set.

  2. Step 2

    Pick a Region

    --region, else SAUCE_REGION, else us-west-1. The Region selects the API host, api.<region>.saucelabs.com.

  3. Step 3

    Call the API

    App Storage commands call /v1/storage/…, Virtual-device job commands /rest/v1/<username>/jobs and Real-device job commands /v1/rdc/jobs, with HTTP basic auth.

  4. Step 4

    Print and exit

    Terse output by default, the full response with --verbose, nothing with --silent. The exit code tells a script what happened.

Checked before the request

Options are validated before any request is sent: the Region, --output, --kind and --visibility must be one of the listed values, --per-page must be 1 to 100, and --custom-data must be a JSON object.

Missing Credentials exit with code 2 and name the flag and variable to set. --help and --version work without any Credentials.

Script App Storage and Jobs without curl

A Node.js command line tool you run on your machine or in CI, with your own Sauce Labs account. Nothing in between.