API calls & examples
The Routix API is a versioned REST API accessible through the API proxy. All requests require a valid OAuth token.
User level: Advanced
Base URL
https://api.routix.com/functions/v1/api/{version}/{publicBranchId}/{resource}| Segment | Description | Example |
|---|---|---|
{version} | API version | v1 or v2 |
{publicBranchId} | 8-character public branch ID | RS2RDH3B |
{resource} | Resource name | accounts |
Full example:
GET https://api.routix.com/functions/v1/api/v1/RS2RDH3B/accountsAuthentication
Include the OAuth access token in every request:
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...Only OAuth tokens are accepted. Regular Routix user tokens are rejected by the API proxy.
Available resources
| Resource | Required scope | Status |
|---|---|---|
| accounts | routix:accounts:read | Live |
| orders | routix:orders:read | Planned |
| vehicles | routix:vehicles:read | Planned |
Accounts
List accounts
GET /functions/v1/api/v1/{branchId}/accountsQuery parameters:
| Parameter | Type | Default | Max | Description |
|---|---|---|---|---|
| limit | integer | 50 | 1000 | Number of records per page. |
| offset | integer | 0 | - | Pagination offset. |
Example request:
curl -X GET "https://api.routix.com/functions/v1/api/v1/RS2RDH3B/accounts?limit=10&offset=0" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."Example response for v1:
{
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"company_name": "Acme Transport B.V.",
"email": "info@acmetransport.nl",
"phone": "+31 20 123 4567",
"account_type": "customer",
"status": "active"
},
{
"id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"company_name": "FastFreight Logistics",
"email": "contact@fastfreight.nl",
"phone": "+31 30 987 6543",
"account_type": "carrier",
"status": "active"
}
],
"pagination": {
"limit": 10,
"offset": 0,
"total": 2
},
"version": "v1"
}Fields per version
v1 fields for accounts
The v1 response contains a stable, immutable set of 6 fields:
| Field | Type | Description |
|---|---|---|
| id | uuid | Unique identifier. |
| company_name | string | Company name. |
| string | Primary email address. | |
| phone | string | Phone number. |
| account_type | string | customer, vendor, or carrier. |
| status | string | Account status. |
v2 fields for accounts
v2 returns all v1 fields plus additional detail fields:
| Additional field | Type | Description |
|---|---|---|
| website | string | Company website. |
| industry | string | Industry sector. |
| lead_source | string | How the account was acquired. |
| visit_address_street | string | Visit address street. |
| visit_address_number | string | Visit address number. |
| visit_address_addition | string | Visit address addition. |
| visit_address_zipcode | string | Visit address postal code. |
| visit_address_city | string | Visit address city. |
| shipping_address_street | string | Shipping address street. |
| shipping_address_number | string | Shipping address number. |
| shipping_address_addition | string | Shipping address addition. |
| shipping_address_zipcode | string | Shipping address postal code. |
| shipping_address_city | string | Shipping address city. |
| billing_address_street | string | Billing address street. |
| billing_address_number | string | Billing address number. |
| billing_address_addition | string | Billing address addition. |
| billing_address_zipcode | string | Billing address postal code. |
| billing_address_city | string | Billing address city. |
| invoice_email | string | Separate invoicing email. |
| vat_number | string | VAT registration number. |
| chamber_of_commerce_number | string | Chamber of commerce number. |
| iban | string | Bank account number. |
| bic | string | Bank BIC or SWIFT code. |
| payment_terms | string | Payment terms. |
| credit_limit | number | Credit limit. |
| comment | string | Internal notes. |
| registration_date | timestamp | Registration date. |
| created_at | timestamp | Record creation date. |
| last_updated_at | timestamp | Last modification date. |
Recommendation: use v1 for stable production integrations. Use v2 when you need more detail and can handle field additions.
Response format
Success: list response
{
"data": [],
"pagination": {
"limit": 50,
"offset": 0,
"total": 123
},
"version": "v1"
}Error response
{
"error": "insufficient_scope",
"error_description": "Token does not contain the required scope: routix:accounts:read"
}HTTP status codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad request, invalid parameters |
| 401 | Unauthorized, missing or expired token |
| 403 | Forbidden, insufficient scope or branch access |
| 404 | Not found, invalid branch ID or resource |
| 405 | Method not allowed, only GET is supported |
| 429 | Rate limited |
| 500 | Internal server error |
Rate limits
| Endpoint | Limit |
|---|---|
| REST API | 1000 requests per minute per organization |
| Edge Functions | 100 requests per minute per user |
| Token endpoint | 30 requests per minute per client |
When you receive a 429, implement exponential backoff with jitter.
Code examples
JavaScript / Node.js
const ROUTIX_URL = 'https://api.routix.com';
async function getToken(clientId, clientSecret) {
const res = await fetch(`${ROUTIX_URL}/functions/v1/oauth-token`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret,
}),
});
if (!res.ok) {
const err = await res.json();
throw new Error(`Auth failed: ${err.error_description}`);
}
const data = await res.json();
return data.access_token;
}
async function getAccounts(token, branchId, { limit = 50, offset = 0 } = {}) {
const url = `${ROUTIX_URL}/functions/v1/api/v1/${branchId}/accounts?limit=${limit}&offset=${offset}`;
const res = await fetch(url, {
headers: { Authorization: `Bearer ${token}` },
});
if (!res.ok) {
const err = await res.json();
throw new Error(`API error: ${err.error_description}`);
}
return res.json();
}Python
import requests
ROUTIX_URL = "https://api.routix.com"
def get_token(client_id: str, client_secret: str) -> str:
response = requests.post(
f"{ROUTIX_URL}/functions/v1/oauth-token",
json={
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret,
},
)
response.raise_for_status()
return response.json()["access_token"]
def get_accounts(token: str, branch_id: str, limit: int = 50, offset: int = 0) -> dict:
response = requests.get(
f"{ROUTIX_URL}/functions/v1/api/v1/{branch_id}/accounts",
headers={"Authorization": f"Bearer {token}"},
params={"limit": limit, "offset": offset},
)
response.raise_for_status()
return response.json()PHP
<?php
$routixUrl = 'https://api.routix.com';
function getToken(string $clientId, string $clientSecret): string {
global $routixUrl;
$ch = curl_init("$routixUrl/functions/v1/oauth-token");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'grant_type' => 'client_credentials',
'client_id' => $clientId,
'client_secret' => $clientSecret,
]),
]);
$response = json_decode(curl_exec($ch), true);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode !== 200) {
throw new Exception('Auth failed: ' . ($response['error_description'] ?? 'Unknown error'));
}
return $response['access_token'];
}C# / .NET
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
var routixUrl = "https://api.routix.com";
var httpClient = new HttpClient();
var tokenResponse = await httpClient.PostAsJsonAsync(
$"{routixUrl}/functions/v1/oauth-token",
new {
grant_type = "client_credentials",
client_id = "your-client-id",
client_secret = "routix_a1b2c3d4..."
});
var tokenData = await tokenResponse.Content.ReadFromJsonAsync<Dictionary<string, object>>();
var token = tokenData!["access_token"].ToString();
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", token);
var accounts = await httpClient.GetFromJsonAsync<JsonElement>(
$"{routixUrl}/functions/v1/api/v1/RS2RDH3B/accounts?limit=10");Related pages
- API integration
- Setup guide
Last updated on

