API calls en voorbeelden
De Routix API is een versiebeheerde REST API die via de API proxy beschikbaar is. Alle requests vereisen een geldige OAuth-token.
Gebruikersniveau: Gevorderd
Base URL
https://api.routix.com/functions/v1/api/{version}/{publicBranchId}/{resource}| Segment | Beschrijving | Voorbeeld |
|---|---|---|
{version} | API-versie | v1 of v2 |
{publicBranchId} | 8-karakter publieke branch ID | RS2RDH3B |
{resource} | Naam van de resource | accounts |
Volledig voorbeeld:
GET https://api.routix.com/functions/v1/api/v1/RS2RDH3B/accountsAuthenticatie
Stuur de OAuth access token mee in elke request:
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...Alleen OAuth-tokens worden geaccepteerd. Reguliere Routix-gebruikerstokens worden door de API proxy geweigerd.
Beschikbare resources
| Resource | Vereiste scope | Status |
|---|---|---|
| accounts | routix:accounts:read | Live |
| orders | routix:orders:read | Gepland |
| vehicles | routix:vehicles:read | Gepland |
Accounts
Accounts opvragen
GET /functions/v1/api/v1/{branchId}/accountsQueryparameters:
| Parameter | Type | Default | Max | Beschrijving |
|---|---|---|---|---|
| limit | integer | 50 | 1000 | Aantal records per pagina. |
| offset | integer | 0 | - | Paginatie-offset. |
Voorbeeldrequest:
curl -X GET "https://api.routix.com/functions/v1/api/v1/RS2RDH3B/accounts?limit=10&offset=0" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."Voorbeeldresponse voor 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"
}Velden per versie
v1-velden voor accounts
De v1-response bevat een stabiele, onveranderlijke set van 6 velden:
| Veld | Type | Beschrijving |
|---|---|---|
| id | uuid | Unieke identifier. |
| company_name | string | Bedrijfsnaam. |
| string | Primair emailadres. | |
| phone | string | Telefoonnummer. |
| account_type | string | customer, vendor of carrier. |
| status | string | Accountstatus. |
v2-velden voor accounts
v2 retourneert alle v1-velden plus extra detailvelden:
| Extra veld | Type | Beschrijving |
|---|---|---|
| website | string | Website van het bedrijf. |
| industry | string | Branche of sector. |
| lead_source | string | Hoe het account is binnengekomen. |
| visit_address_street | string | Straat van bezoekadres. |
| visit_address_number | string | Huisnummer van bezoekadres. |
| visit_address_addition | string | Toevoeging van bezoekadres. |
| visit_address_zipcode | string | Postcode van bezoekadres. |
| visit_address_city | string | Plaats van bezoekadres. |
| shipping_address_street | string | Straat van verzendadres. |
| shipping_address_number | string | Huisnummer van verzendadres. |
| shipping_address_addition | string | Toevoeging van verzendadres. |
| shipping_address_zipcode | string | Postcode van verzendadres. |
| shipping_address_city | string | Plaats van verzendadres. |
| billing_address_street | string | Straat van factuuradres. |
| billing_address_number | string | Huisnummer van factuuradres. |
| billing_address_addition | string | Toevoeging van factuuradres. |
| billing_address_zipcode | string | Postcode van factuuradres. |
| billing_address_city | string | Plaats van factuuradres. |
| invoice_email | string | Afwijkend factuuremailadres. |
| vat_number | string | BTW-nummer. |
| chamber_of_commerce_number | string | KvK-nummer. |
| iban | string | IBAN-bankrekening. |
| bic | string | BIC- of SWIFT-code. |
| payment_terms | string | Betaalcondities. |
| credit_limit | number | Kredietlimiet. |
| comment | string | Interne notities. |
| registration_date | timestamp | Registratiedatum. |
| created_at | timestamp | Aanmaakdatum van het record. |
| last_updated_at | timestamp | Laatste wijzigingsdatum. |
Aanbeveling: gebruik v1 voor stabiele productie-integraties. Gebruik v2 als je extra detail nodig hebt en toevoegingen aan velden kunt opvangen.
Responseformaat
Succes: lijstresponse
{
"data": [],
"pagination": {
"limit": 50,
"offset": 0,
"total": 123
},
"version": "v1"
}Foutresponse
{
"error": "insufficient_scope",
"error_description": "Token does not contain the required scope: routix:accounts:read"
}HTTP-statuscodes
| Code | Betekenis |
|---|---|
| 200 | Succes |
| 400 | Bad request, ongeldige parameters |
| 401 | Unauthorized, ontbrekende of verlopen token |
| 403 | Forbidden, onvoldoende scope of branch-toegang |
| 404 | Not found, ongeldige branch ID of resource |
| 405 | Method not allowed, alleen GET wordt ondersteund |
| 429 | Rate limited |
| 500 | Internal server error |
Rate limits
| Endpoint | Limiet |
|---|---|
| REST API | 1000 requests per minuut per organisatie |
| Edge Functions | 100 requests per minuut per gebruiker |
| Token endpoint | 30 requests per minuut per client |
Als je een 429 ontvangt, implementeer dan exponential backoff met jitter.
Codevoorbeelden
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");Gerelateerde pagina’s
- API integratie
- Setup guide

