Skip to main content
Your workspace routing settings choose how routing orders providers, which providers it never uses, and whether a key or Credits pays first. They apply to every sandbox you create. A request’s preferences can change the order for that one sandbox, unless prevent_overrides is on, and a provider in excluded_providers is never used. Edit the settings under Routing in the dashboard or with the clients below. Before You Begin: A workspace admin key in BOXROUTER_API_KEY, a client installed as in the quickstart, and jq for the CLI examples.

Set the Routing Mode

The mode decides how BoxRouter ranks providers: Auto draws at random, weighted toward lower hourly list price, so the leader can change from one sandbox to the next. Cheapest and Fastest compare the requested size. Custom uses your provider_order. For one request, preferences.sort replaces the ranking criterion used by the mode. An explicit provider order takes precedence; the funding order still applies. With prevent_overrides on, a request that sets preferences.sort fails with 400 routing_overrides_forbidden. details.fields lists the offending preferences. Even a value equal to the default is refused. only and ignore are never blocked. The Routing section has five fields: This switches the mode to Cheapest and keeps the other fields’ stored values:
The CLI prints JSON. Python and TypeScript print cheapest. Routing and each provider’s funding order are separate sections, each with its own ETag under section_etags. An update sends only the fields you name; the rest keep their stored values. The reply holds the full settings, with the section’s new ETag. If-Match is optional. Passing the section’s ETag as if_match, ifMatch or --if-match makes a stale write fail with 412 routing_settings_stale instead of overwriting a change made after the read.

Provider Keys and Credits Order

For each provider, you decide who pays: your own keys or Credits. The provider’s funding order is a list of your connected keys and, where Credits is offered, one Credits row. Keys above the row are Prioritized and keys below it are Fallback.
  • A new key joins the end of the Prioritized keys.
  • Deleting a key removes its row.
  • To reorder, update the provider’s funding section, which has its own ETag in section_etags.provider_funding.
BoxRouter combines the provider ranking and the funding orders as follows. Outside Custom mode:
  1. Group routes across all providers: Prioritized keys first, then Credits, then Fallback keys.
  2. Within each group, order providers by the routing mode.
  3. Keep each provider’s keys in their list order.
In Custom mode:
  1. Pick the provider using provider_order.
  2. Try that provider’s funding order from top to bottom.
If creating a sandbox fails, BoxRouter tries only later routes in the same group, so a failure never changes who pays. Spend limits cap what the Credits row can spend. Put every key above the Credits row to pay with your own accounts before Credits. This example does that for one provider, keeping the keys’ order and moving the Credits row last. Enter a provider ID, which is a key of provider_funding in your settings, when prompted:
The output lists the provider’s new order: your keys first, then the Credits row where the provider offers one. The list uses these entries:
  • Key: {"account_id": "<KEY_ACCOUNT_ID>"}.
  • Credits: {"supply": "managed"}.
To stop using the Credits row without moving it, set credits to false: in Python client.routing.update_funding(provider, credits=False), in TypeScript client.routing.updateFunding(provider, { credits: false }). A provider that does not offer Credits has no row, and asking for one fails with Credits are not offered for this provider. Each account ID must be one of your keys for that provider, listed once.

Regions

Set the region per request in resources.region: a country such as US, an area such as EU, or one provider’s region written <PROVIDER_ID>:<REGION>. An area matches a route only when the provider lists the countries its region covers, so a region listed only as “Europe” never matches EU. Ask for it by name. Match shows the answer without creating anything. This command prints the first exclusion. If there are none, it prints null fields. Reasons and offered values depend on your routes:
For example, this exclusion uses <PROVIDER_ID> in place of a provider ID: Use match to check a sandbox request. routing preview reports only Actions runner availability.

Next Steps

How Routing Works

How requirements filter and preferences rank.

Connect a Provider Key

Connect your own provider account.

Cap Your Spend

Cap what Credits can spend.