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:
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.
- Group routes across all providers: Prioritized keys first, then Credits, then Fallback keys.
- Within each group, order providers by the routing mode.
- Keep each provider’s keys in their list order.
- Pick the provider using
provider_order. - Try that provider’s funding order from top to bottom.
provider_funding in your settings, when prompted:
- Key:
{"account_id": "<KEY_ACCOUNT_ID>"}. - Credits:
{"supply": "managed"}.
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 inresources.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:
<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.