SauceREST Java example workflow Maven Central

A Java client for Sauce Labs REST API.

Using this client you can update Job info, including pass/fail status and other information supported. Only the Sauce Labs Virtual Device Cloud is supported. For Real Devices, please see the docs.

If a function you’re after isn’t supported, we suggest either shelling out and using the curl version, or sending a pull request! Contribution Details Here.


Create an instance of the client

SauceREST sauce = new SauceREST("username", "access-key", "data_center");


SauceREST sauce = new SauceREST("username", "access-key", DataCenter.US_WEST);


Name Type Details
username String (required) your sauce labs username
access-key String (required) your sauce labs accesskey
data_center String or DataCenter (required) one of US_WEST, US_EAST, EU_CENTRAL, APAC_SOUTHEAST

Users generally only have access to their own jobs and resources. Parent accounts may have access to their children’s jobs. Check out the Sauce Labs documentation for more information.

Change a job’s metadata

Mark a job passed or failed:


Get all tunnels

String tunnels = sauce.getTunnels();

Download Assets

Assets are downloaded by providing a job ID and the location to save the asset to.

Filenames are set automatically to jobId_yyyyMMdd_HHmmSS_filename.ext, where yyyyMMdd_HHmmSS is the retrieval timestamp and ext is determined by the asset type.

Each of these methods comes in two flavours; the downloadX methods which ignore exceptions, and the downloadXOrThrow methods which throw:

The downloadX methods return a boolean indicating if the download was successful.

Selenium log

// Download the log; Ignore exceptions
sauce.downloadLog("job_id", "/var/tmp/");  // => true if the Log downloads correctly

// Download the log; Raise SauceException.NotAuthorized, FileNotFound, IOException
sauce.downloadLogOrThrow("job_id", "/var/tmp");

Extension: .log

HAR File

HAR files are only available for jobs using Extended Debugging.

// Download the HAR file; Ignore exceptions
sauce.downloadHAR("job_id", "/var/tmp/"); // => true if the HAR File downloads correctly

// Download the HAR file; Raise SauceException.NotAuthorized, FileNotFound, IOException
sauce.downloadHAROrThrow("job_id", "/var/tmp");

Extension: .har


Video is only available for jobs which have not [disabled video recording](

// Download the Log; Ignore exceptions
sauce.downloadVideo("job_id", "/var/tmp"); // => true if the Video downloads correctly

// Download the Log; Raise SauceException.NotAuthorized, FileNotFound, IOException
sauce.downloadVideoOrThrow("job_id", "/var/tmp");

Extension: .mp4

Get Information

About a particular job


About the last 20 jobs


About a requested number of jobs

sauce.getJobInfo(n);  #n is the number of jobs to retrieve,as an integer

About your tunnels

String tunnels=sauce.getTunnels();

SauceREST 2.x

With version 2.x of SauceREST we have made code-breaking changes to this wrapper. It has been updated to be more future-proof and to also support the newest APIs from Sauce Labs.

This is going to be continuous process which means we will release changes to SauceREST over time.


Get all files

Storage storage = new SauceREST(DataCenter.EU_CENTRAL).getStorage();
GetAppFiles getAppFiles = storage.getFiles();


    <version>LATEST VERSION</version>

For latest version please check the following link:


Check out our contribution guide Here for details.

Want a fast, setup dev environment? Open in Gitpod.


Here for Hacktoberfest?. Check out Our Hacktoberfest Issues, or visit to see all our Hacktoberfest projects!