TollCalc integreren in uw eigen applicatie
TollCalc kan op drie manieren worden geïntegreerd in uw software of AI-workflows:
| Methode | Geschikt voor |
|---|---|
| REST API | Server-naar-server-integratie, eigen backends |
| MCP (Model Context Protocol) | AI-assistenten (Claude, Cursor, GPT en meer) |
Python-pakket tollcalc |
Scripts, data science, Jupyter Notebooks |
REST API
Volledige API-documentatie (OpenAPI 3.0) beschikbaar op:
Snel starten
curl -X POST https://app.tollcalc.eu/api/calculate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer UW_API_TOKEN" \
-d '{
"origin": "Munich, Germany",
"destination": "Vienna, Austria",
"vehicle": {
"weight": 40,
"axles": 5,
"emission_class": "euro6",
"co2_class": "class_1"
}
}'
Parameters
| Parameter | Type | Beschrijving |
|---|---|---|
origin |
string | Startpunt: adres of "lat;lon" |
destination |
string | Eindpunt: adres of "lat;lon" |
via |
string[] | Optionele tussenstops (max. 48) |
vehicle.weight |
number | Totale massa in tonnen (bijv. 40) |
vehicle.axles |
integer | Aantal assen: 2, 3, 4 of 5 |
vehicle.emission_class |
string | Euro-norm: euro0–euro6 |
vehicle.co2_class |
string | CO₂-klasse: class_1 (standaard diesel) tot class_5 (nul-emissie) |
plannedTripStart |
string | Optionele ISO-8601-datum ("2026-09-01") of RFC3339-datumtijd ("2026-09-01T06:00:00Z"); kiest de tariefregels die op dat moment gelden. Standaard: nu |
Optionele HTTP-header:
| Header | Beschrijving |
|---|---|
X-Subaccount |
Optionele gebruiksattributie, bijv. voor een klantbedrijf of afdeling. Per sub-account geteld en getoond in je gebruiksstatistieken. Ontbrekend/leeg → Default; max. 64 tekens; toegestaan A-Z a-z 0-9 _ : -; ongeldig → HTTP 400 |
Authenticatie
API-tokens zijn beschikbaar na registratie op app.tollcalc.eu. Zonder token zijn 10 gratis verzoeken per maand (per IP-adres) toegestaan.
Verbruik en quota opvragen
Zodra de API is geïntegreerd, kun je je verbruik en quota programmatisch opvragen – beide endpoints zijn read-only, verbruiken zelf geen quota en accepteren dezelfde bearer-token:
| Endpoint | Beschrijving |
|---|---|
GET /api/usage |
Geslaagde berekeningen van de maand, uitgesplitst naar X-Subaccount |
GET /api/quota |
Verbruik, maandlimiet en resterende quota |
Optionele queryparameters: year en month (standaard: huidige maand).
# Verbruik per subaccount
curl https://app.tollcalc.eu/api/usage \
-H "Authorization: Bearer UW_API_TOKEN"
# {"year":2026,"month":9,"total":1000,
# "sub_accounts":[{"key":"kunde_a","count":500},{"key":"Default","count":320}]}
# Resterende quota
curl https://app.tollcalc.eu/api/quota \
-H "Authorization: Bearer UW_API_TOKEN"
# {"year":2026,"month":9,"plan":"api","used":123,"limit":5000,"remaining":4877}
Zonder X-Subaccount-header bij een berekening worden de aanroepen aan de sleutel Default toegewezen. Bij onbeperkte abonnementen zijn limit en remaining null.
MCP – Integratie in AI-assistenten
TollCalc ondersteunt het Model Context Protocol (MCP) en kan direct worden verbonden met AI-tools zoals Claude Desktop, Cursor of een andere MCP-compatibele assistent.
Endpoint
POST https://app.tollcalc.eu/mcp
Beschikbare tools
| Tool | Beschrijving |
|---|---|
calculate_toll |
Berekent tolkosten voor een vrachtwagenroute |
get_quota |
Controleer het resterende quotum voor de huidige sessie |
Configuratie in Claude Desktop
Voeg het volgende toe aan uw Claude Desktop-configuratie (claude_desktop_config.json):
Optie A – OAuth (aanbevolen): Alleen de URL, geen token nodig.
{
"mcpServers": {
"tollcalc": {
"url": "https://app.tollcalc.eu/mcp"
}
}
}
Optie B – API-sleutel (voor automatisering): Token handmatig instellen, bijv. voor server-naar-server-integraties.
{
"mcpServers": {
"tollcalc": {
"url": "https://app.tollcalc.eu/mcp",
"headers": {
"Authorization": "Bearer UW_API_TOKEN"
}
}
}
}
Zonder configuratie zijn 10 gratis verzoeken per MCP-sessie (= per gesprek) beschikbaar — geen account vereist. Na 10 verzoeken opent Claude Desktop automatisch een browserlogin (OAuth 2.0). Na het inloggen geldt het quotum van het gekozen abonnement. API-sleutels voor optie B kunt u aanmaken op app.tollcalc.eu.
Detailniveaus
De tool calculate_toll ondersteunt drie detailniveaus via de parameter detail:
| Waarde | Inhoud |
|---|---|
compact (standaard) |
Totaal tol, tol-km, tolvrije km, uitsplitsing per land |
detailed |
Zoals compact, plus kosten per segment (zonder geometrie) |
full |
Zoals detailed, plus coördinaten en debug-informatie |
Antwoordvelden
Alle detailniveaus bevatten de volgende velden:
| Veld | Type | Beschrijving |
|---|---|---|
origin |
string | Opgelost vertrekpunt |
destination |
string | Opgelost bestemmingspunt |
total_toll_eur |
number | Totale tol in EUR |
total_distance_km |
number | Totale routeafstand in km |
toll_km |
number | Tolplichtige km |
toll_free_km |
number | Tolvrije km |
countries |
array | Uitsplitsing per land (country, country_name, total_km, toll_km, toll_eur) |
info_url |
string | Link om deze berekening te bekijken in de TollCalc webapplicatie — inclusief de geplande route op een interactieve kaart; te delen met collega's of te openen in de browser |
Met detail=detailed bevat countries ook segments (weg, type, km, toll_eur per segment).
Met detail=full bevatten segmenten coördinaten, source_url, matched_geofence en geometrie.
Python-pakket tollcalc
Het Python-pakket tollcalc omhult de REST API voor gebruik vanuit Python-scripts of Jupyter Notebooks.
Installatie
pip install tollcalc
Gebruik
from tollcalc import calculate_toll, get_usage, get_quota
result = calculate_toll(
origin="Munich, Germany",
destination="Vienna, Austria",
weight=40,
axles=5,
emission_class="euro6",
co2_class="class_1",
token="UW_API_TOKEN",
)
print(f"Totaal tol: {result['total_toll_eur']:.2f} EUR")
print(f"Afstand: {result['total_distance_km']:.1f} km")
for country in result["countries"]:
print(f" {country['country_name']}: {country['toll_eur']:.2f} EUR ({country['toll_km']:.0f} tol-km)")
Verbruik en quota vanuit Python
from tollcalc import get_usage, get_quota
usage = get_usage(token="UW_API_TOKEN")
print(usage["total"], "Calls")
for s in usage["sub_accounts"]:
print(f" {s['key']}: {s['count']}")
quota = get_quota(token="UW_API_TOKEN")
print(f"{quota['used']} / {quota['limit']} – resterend: {quota['remaining']}")
Pakketdocumentatie
Volledige documentatie en voorbeelden op PyPI: pypi.org/project/tollcalc
Prijzen & quota
| Plan | Verzoeken/maand | Prijs |
|---|---|---|
| Free (zonder token) | 10 per MCP-sessie (= per gesprek) | gratis |
| Starter | tot 500 | vanaf €9/maand |
| Professional | tot 5.000 | vanaf €49/maand |
| Enterprise | onbeperkt | op aanvraag |
Alle plannen en actuele prijzen: tollcalc.eu/en/#pricing
Voor integratievragen: support@tollcalc.eu