Introduction
Environments
Section titled “Environments”B2Brouter has three environments — see Environments for a full comparison.
| Environment | Base URL | When to use |
|---|---|---|
| Sandbox | https://api.b2brouter.net (key prefix test_) | Daily development, payload validation, onboarding |
| Staging | https://api-staging.b2brouter.net | Large integrations, broad end-to-end tests, authority QA environments |
| Production | https://api.b2brouter.net | Live traffic |
Start with Sandbox. It is the recommended environment for initial development and day-to-day testing. Use staging only for large-scale integrations or broad end-to-end tests that require a full environment setup.
First steps
Section titled “First steps”Register and configure your account
Section titled “Register and configure your account”To start using the B2Brouter API, register at app.b2brouter.net/en/register. Detailed setup instructions are available here.
Once registered, log in to B2Brouter and set up your account with a Basic plan. You can find detailed instructions here.
Get a sandbox API key
Section titled “Get a sandbox API key”Open the Developers section and create a sandbox. Your sandbox API key starts with test_ and routes all requests to the sandbox environment automatically — no separate URL needed. See Sandbox for full setup instructions.
Staging Environment Activation
Section titled “Staging Environment Activation”If you need the staging environment (large integrations, broad end-to-end tests), register at app-staging.b2brouter.net/en/register. Staging accounts start with limited permissions — submit a support ticket to request the necessary access. Our team will grant it.
Using the REST API
Section titled “Using the REST API”To access the B2Brouter API, follow these steps:
- Access your account.
- Within your account, click on the Developers tab.
- Click on the API key to copy it to the clipboard.
- To find the accounts IDs, click on View IDs for each account or click on the Edit group icon next to your group name.
- Access to the API Reference.
Note:
API keys are environment-specific. Sandbox keys (prefix test_) only work in sandbox; production keys only work in production; staging keys only work in staging. Obtain each key by logging in to the corresponding environment.
By default, the API Reference is documented with the staging environment. To switch to sandbox or production, open the Base URL dropdown.
Authentication
Section titled “Authentication”The credentials must be provided in the request headers, with the name X-B2B-API-Key.
API Version
Section titled “API Version”In B2Brouter each group has a default API Version. You can check it in the Developers tab, under API Keys. You can manually specify the API Version in the request headers, with the name X-B2B-API-Version. If no version is specified, B2Brouter will use the default version of the group.
Response Formats
Section titled “Response Formats”B2Brouter only provides the response in JSON format.
Account Identifiers
Section titled “Account Identifiers”Use the List Accounts endpoint
curl --request GET \ --url https://api-staging.b2brouter.net/accounts \ --header 'X-B2B-API-Key: {YOUR_API_KEY}' \ --header 'X-B2B-API-Version: {YOUR_API_VERSION}' \ --header 'accept: application/json'In this response, pay attention to the information in the identifier field. You should use this ID when you want to interact with the account through the API.
Note: You can also find the accounts IDs in the Developers tab by clicking the Edit group icon next to your group name. The list of accounts and their IDs will be displayed.
API Rate Limiting
Section titled “API Rate Limiting”To ensure optimal performance and fair usage, B2Brouter API enforces rate limits on incoming requests:
Rate Limits:
- Production: 1,000 requests per minute
- Sandbox / Staging: 600 requests per minute
Rate Limit Exceeded: When you exceed the rate limit, the API returns:
- HTTP status code
429 Too Many Requests
Best Practices:
- Implement exponential backoff when receiving 429 responses
- Cache responses when possible to reduce API calls
- Use webhooks instead of polling for real-time updates
SDKs and client libraries
Section titled “SDKs and client libraries”You can integrate with the API directly over HTTP or by using an official SDK. The first official SDK is the PHP SDK:
It provides methods for complete invoice management, multi-format documents downloads, complete tax reports operations (including Verifactu), pagination utilities, and error handling. Additional SDKs for other programming languages will be added over time.
Download the OpenAPI Reference
Section titled “Download the OpenAPI Reference”You can download the full REST API reference in OpenAPI (YAML) format from the following links: