Skip to Content
API KoppelingAPI Calls & Voorbeelden

API Calls & Voorbeelden

De Routix API is een versioned REST API toegankelijk via de API proxy. Alle requests vereisen een geldig OAuth-token.


Base URL

https://api.routix.nl/functions/v1/api/{versie}/{publiekVestigingId}/{resource}
SegmentBeschrijvingVoorbeeld
{versie}API versiev1 of v2
{publiekVestigingId}8-teken publiek vestiging-IDRS2RDH3B
{resource}Resource naamaccounts

Volledig voorbeeld:

GET https://api.routix.nl/functions/v1/api/v1/RS2RDH3B/accounts

Authenticatie

Voeg het OAuth access token toe aan elk request:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Alleen OAuth-tokens worden geaccepteerd. Reguliere Routix-gebruikerstokens worden geweigerd door de API proxy.


Beschikbare Resources

ResourceVereiste ScopeStatus
accountsroutix:accounts:read✅ Live
ordersroutix:orders:read🔜 Gepland
vehiclesroutix:vehicles:read🔜 Gepland

Accounts

Accounts Ophalen

GET /functions/v1/api/v1/{vestigingId}/accounts

Query parameters:

ParameterTypeStandaardMaxBeschrijving
limitinteger501000Aantal records per pagina
offsetinteger0Paginatie offset

Voorbeeld request:

curl -X GET "https://api.routix.nl/functions/v1/api/v1/RS2RDH3B/accounts?limit=10&offset=0" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

Voorbeeld response (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 (Accounts)

De v1 response bevat een stabiele, onveranderlijke set van 6 velden:

VeldTypeBeschrijving
iduuidUniek identifier
company_namestringBedrijfsnaam
emailstringPrimair e-mailadres
phonestringTelefoonnummer
account_typestringcustomer, vendor of carrier
statusstringAccountstatus

v2 Velden (Accounts)

v2 retourneert alle v1 velden plus extra detailvelden:

Extra VeldTypeBeschrijving
websitestringBedrijfswebsite
industrystringBranche
lead_sourcestringHoe het account is verkregen
visit_address_streetstringBezoekadres — straat
visit_address_numberstringBezoekadres — nummer
visit_address_additionstringBezoekadres — toevoeging
visit_address_zipcodestringBezoekadres — postcode
visit_address_citystringBezoekadres — stad
shipping_address_streetstringVerzendadres — straat
shipping_address_numberstringVerzendadres — nummer
shipping_address_additionstringVerzendadres — toevoeging
shipping_address_zipcodestringVerzendadres — postcode
shipping_address_citystringVerzendadres — stad
billing_address_streetstringFactuuradres — straat
billing_address_numberstringFactuuradres — nummer
billing_address_additionstringFactuuradres — toevoeging
billing_address_zipcodestringFactuuradres — postcode
billing_address_citystringFactuuradres — stad
invoice_emailstringApart factuur-e-mailadres
vat_numberstringBTW-nummer
chamber_of_commerce_numberstringKvK-nummer
ibanstringBankrekening (IBAN)
bicstringBank BIC/SWIFT-code
payment_termsstringBetalingsvoorwaarden
credit_limitnumberKredietlimiet
commentstringInterne opmerkingen
registration_datetimestampRegistratiedatum
created_attimestampAanmaakdatum record
last_updated_attimestampLaatste wijzigingsdatum

Aanbeveling: Gebruik v1 voor stabiele productie-integraties. Gebruik v2 als je de extra details nodig hebt en om kunt gaan met veldtoevoegingen.


Response Formaat

Succes — Lijst

{ "data": [ ... ], "pagination": { "limit": 50, "offset": 0, "total": 123 }, "version": "v1" }

Fout

{ "error": "insufficient_scope", "error_description": "Token does not contain the required scope: routix:accounts:read" }

HTTP Statuscodes

CodeBetekenis
200Succes
400Ongeldig verzoek — ongeldige parameters
401Niet geautoriseerd — token ontbreekt of verlopen
403Verboden — onvoldoende scopes of vestigingstoegang
404Niet gevonden — ongeldig vestiging-ID of resource
405Methode niet toegestaan — alleen GET wordt ondersteund
429Rate limit bereikt
500Interne serverfout

Rate Limits

EndpointLimiet
REST API1000 requests/min per organisatie
Edge Functions100 requests/min per gebruiker
Token endpoint30 requests/min per client

Bij rate limiting ontvang je een 429 response. Implementeer exponential backoff met jitter.


Codevoorbeelden

JavaScript / Node.js

const ROUTIX_URL = 'https://api.routix.nl'; // Stap 1: Token ophalen (Client Credentials) 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 mislukt: ${err.error_description}`); } const data = await res.json(); return data.access_token; } // Stap 2: Accounts ophalen 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 fout: ${err.error_description}`); } return res.json(); } // Gebruik const token = await getToken('your-client-id', 'routix_a1b2c3d4...'); const result = await getAccounts(token, 'RS2RDH3B', { limit: 10 }); console.log(`${result.pagination.total} accounts gevonden`); result.data.forEach(a => console.log(`${a.company_name} (${a.account_type})`));

Python

import requests ROUTIX_URL = "https://api.routix.nl" def get_token(client_id: str, client_secret: str) -> str: """Haal een OAuth access token op via Client Credentials.""" 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: """Haal accounts op van een specifieke vestiging.""" 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() # Gebruik token = get_token("your-client-id", "routix_a1b2c3d4...") result = get_accounts(token, "RS2RDH3B", limit=10) print(f"{result['pagination']['total']} accounts gevonden") for account in result["data"]: print(f" {account['company_name']} ({account['account_type']})")

PHP

<?php $routixUrl = 'https://api.routix.nl'; // Stap 1: Token ophalen 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 mislukt: " . ($response['error_description'] ?? 'Onbekende fout')); } return $response['access_token']; } // Stap 2: Accounts ophalen function getAccounts(string $token, string $branchId, int $limit = 50, int $offset = 0): array { global $routixUrl; $url = "$routixUrl/functions/v1/api/v1/$branchId/accounts?" . http_build_query([ 'limit' => $limit, 'offset' => $offset, ]); $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"], ]); $response = json_decode(curl_exec($ch), true); curl_close($ch); return $response; } // Gebruik $token = getToken('your-client-id', 'routix_a1b2c3d4...'); $result = getAccounts($token, 'RS2RDH3B', 10); echo "{$result['pagination']['total']} accounts gevonden\n"; foreach ($result['data'] as $account) { echo " {$account['company_name']} ({$account['account_type']})\n"; }

C# / .NET

using System.Net.Http.Json; var routixUrl = "https://api.routix.nl"; var httpClient = new HttpClient(); // Token ophalen 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(); // Accounts ophalen httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token); var accounts = await httpClient.GetFromJsonAsync<JsonElement>( $"{routixUrl}/functions/v1/api/v1/RS2RDH3B/accounts?limit=10"); Console.WriteLine($"{accounts.GetProperty("pagination").GetProperty("total")} accounts gevonden");
Last updated on