Skip to main content

Using Sauce Connect Proxy Tunnels for API Tests

Sauce Labs API Testing fully integrates with Sauce Connect Proxy tunnels, enabling you to test and monitor both internal and public APIs. If your APIs are behind a firewall on your private network, follow the steps below to launch a secure trusted connection between your network and Sauce Labs.


We do not support Allow-listing static IPs. We strongly suggest running your tests using Sauce Connect Proxy tunnel. For assistance, contact your CSM/SE or our Support Team.

What You'll Need

Start API-Specific Tunnel

  1. First, you'll need to create a YAML configuration file. From a text editor or IDE, create a file called api-config.yaml, then copy and paste it into the template below.
rest-url: ''
api-key: '$SAUCE_ACCESS_KEY'
vm-version: 'v2alpha'
tunnel-identifier: '$SAUCE_USERNAME_TUNNEL'
  1. In the api-config.yaml file:
    • Leave the rest-url and vm-version values as-is
    • Set the user and api-key values as your own Sauce username and access key, respectively
    • Set the tunnel-identifier value to whatever you'd like to name your tunnel
  2. Save the api-config.yaml file to the Sauce Connect Proxy root folder on your local machine.
    API Testing Sauce Connect folder structure
  3. Open your terminal and navigate to the Sauce Connect Proxy folder. If your folder is in your home directory, you'd run:
cd sc-4.9.2-linux
  1. Start your tunnel by issuing:
bin/sc -c api-config.yaml

If the tunnel was launched successfully, you'll see a CLI response indicating that you can start your tests.

Configure Test to Use Tunnel

  1. Find the test you'd like to run. Tests can be located and run under the Tests tab, Compose tab, HTTP Client tab, and Schedule tabs.

  2. Under the Run Configuration section, click on the Sauce Connect Proxy dropdown menu (defaults to No Tunnel), then click the name of your tunnel.
    API Testing Sauce Connect Nav

Session Stickiness

The Tests and Compose tabs have a session stickiness feature (also known as session persistence) that binds your tunnel session to our API testing server. When you select a tunnel from the Sauce Connect Proxy dropdown, that tunnel will stay as the default selection, even if you close your browser.

Learn more
This feature does not apply to the HTTP Client or Schedule tabs, where the tunnel dropdown will always default to No Tunnel.If you shut down a tunnel that's currently selected in a Sauce Connect dropdown anywhere in the platform (Tests, Compose, HTTP Client, or Schedule tab), the test would fail and you'd see the below error message. This is something to be mindful of when selecting a tunnel in the Schedule tab to run in the future.API Testing Sauce Connect Nav error

Run Test through Tunnel

  1. Once you've selected your tunnel from the dropdown, run your test.

More Information