Skip to Content
APIAPI calls en voorbeelden

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}
SegmentBeschrijvingVoorbeeld
{version}API-versiev1 of v2
{publicBranchId}8-karakter publieke branch IDRS2RDH3B
{resource}Naam van de resourceaccounts

Volledig voorbeeld:

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

Authenticatie

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

ResourceVereiste scopeStatus
accountsroutix:accounts:readLive
ordersroutix:orders:readGepland
vehiclesroutix:vehicles:readGepland

Accounts

Accounts opvragen

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

Queryparameters:

ParameterTypeDefaultMaxBeschrijving
limitinteger501000Aantal records per pagina.
offsetinteger0-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:

VeldTypeBeschrijving
iduuidUnieke identifier.
company_namestringBedrijfsnaam.
emailstringPrimair emailadres.
phonestringTelefoonnummer.
account_typestringcustomer, vendor of carrier.
statusstringAccountstatus.

v2-velden voor accounts

v2 retourneert alle v1-velden plus extra detailvelden:

Extra veldTypeBeschrijving
websitestringWebsite van het bedrijf.
industrystringBranche of sector.
lead_sourcestringHoe het account is binnengekomen.
visit_address_streetstringStraat van bezoekadres.
visit_address_numberstringHuisnummer van bezoekadres.
visit_address_additionstringToevoeging van bezoekadres.
visit_address_zipcodestringPostcode van bezoekadres.
visit_address_citystringPlaats van bezoekadres.
shipping_address_streetstringStraat van verzendadres.
shipping_address_numberstringHuisnummer van verzendadres.
shipping_address_additionstringToevoeging van verzendadres.
shipping_address_zipcodestringPostcode van verzendadres.
shipping_address_citystringPlaats van verzendadres.
billing_address_streetstringStraat van factuuradres.
billing_address_numberstringHuisnummer van factuuradres.
billing_address_additionstringToevoeging van factuuradres.
billing_address_zipcodestringPostcode van factuuradres.
billing_address_citystringPlaats van factuuradres.
invoice_emailstringAfwijkend factuuremailadres.
vat_numberstringBTW-nummer.
chamber_of_commerce_numberstringKvK-nummer.
ibanstringIBAN-bankrekening.
bicstringBIC- of SWIFT-code.
payment_termsstringBetaalcondities.
credit_limitnumberKredietlimiet.
commentstringInterne notities.
registration_datetimestampRegistratiedatum.
created_attimestampAanmaakdatum van het record.
last_updated_attimestampLaatste 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

CodeBetekenis
200Succes
400Bad request, ongeldige parameters
401Unauthorized, ontbrekende of verlopen token
403Forbidden, onvoldoende scope of branch-toegang
404Not found, ongeldige branch ID of resource
405Method not allowed, alleen GET wordt ondersteund
429Rate limited
500Internal server error

Rate limits

EndpointLimiet
REST API1000 requests per minuut per organisatie
Edge Functions100 requests per minuut per gebruiker
Token endpoint30 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
Last updated on