Integrate TollCalc into Your Application
TollCalc can be integrated into your software or AI workflows in three ways:
| Method | Best for |
|---|---|
| REST API | Server-to-server integration, custom backends |
| MCP (Model Context Protocol) | AI assistants (Claude, Cursor, GPT, and more) |
Python package tollcalc |
Scripts, data science, Jupyter Notebooks |
REST API
Full API documentation (OpenAPI 3.0) is available at:
Quick Start
curl -X POST https://app.tollcalc.eu/api/calculate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "X-Subaccount: client_123" \
-d '{
"origin": "Munich, Germany",
"destination": "Vienna, Austria",
"vehicle": {
"weight": 40,
"axles": 5,
"emission_class": "euro6",
"co2_class": "class_1"
}
}'
Parameters
| Parameter | Type | Description |
|---|---|---|
origin |
string | Start point: address or "lat;lon" |
destination |
string | End point: address or "lat;lon" |
via |
string[] | Optional waypoints (max 48; origin + via + destination must not exceed 50) |
vehicle.weight |
number | Gross vehicle mass in tonnes (e.g. 40) |
vehicle.axles |
integer | Number of axles: 2, 3, 4, or 5 |
vehicle.emission_class |
string | Euro standard: euro0–euro6 |
vehicle.co2_class |
string | CO₂ class: class_1 (standard diesel) to class_5 (zero emission) |
plannedTripStart |
string | Optional ISO-8601 date ("2026-09-01") or RFC3339 date-time ("2026-09-01T06:00:00Z"); selects the toll rules valid at that time. Default: now |
The following HTTP header is optional:
| Header | Description |
|---|---|
X-Subaccount |
Optional usage attribution, e.g. for a client company or department. Counted per sub-account and shown in your account's usage statistics. Missing/empty → Default; max 64 chars; allowed A-Z a-z 0-9 _ : -; invalid → HTTP 400 |
Authentication
API tokens are available after registering at app.tollcalc.eu. Without a token, 10 free requests per month (per IP address) are allowed.
Retrieving Usage & Quota
Once integrated, you can retrieve your consumption and remaining quota programmatically. Both endpoints are read-only, do not consume quota themselves, and accept the same bearer token:
| Endpoint | Description |
|---|---|
GET /api/usage |
Successful calculations for the month, broken down by X-Subaccount |
GET /api/quota |
Used calls, monthly limit and remaining quota |
Optional query parameters: year and month (default: current month).
# Usage per sub-account
curl https://app.tollcalc.eu/api/usage \
-H "Authorization: Bearer YOUR_API_TOKEN"
# {"year":2026,"month":9,"total":1000,
# "sub_accounts":[{"key":"client_a","count":500},{"key":"Default","count":320}]}
# Remaining quota
curl https://app.tollcalc.eu/api/quota \
-H "Authorization: Bearer YOUR_API_TOKEN"
# {"year":2026,"month":9,"plan":"api","used":123,"limit":5000,"remaining":4877}
Without an X-Subaccount header on a calculation, calls are attributed to the Default key. For unlimited plans, limit and remaining are null. See the OpenAPI reference for the full specification.
MCP – Integration into AI Assistants
TollCalc supports the Model Context Protocol (MCP) and can be connected directly to AI tools such as Claude Desktop, Cursor, or any other MCP-compatible assistant.
Endpoint
POST https://app.tollcalc.eu/mcp
Available Tools
| Tool | Description |
|---|---|
calculate_toll |
Calculate toll costs for a truck route |
get_quota |
Query remaining quota for the current session |
Configuration in Claude Desktop
Add the following to your Claude Desktop configuration (claude_desktop_config.json):
Option A – OAuth (recommended): Just the URL, no token needed.
{
"mcpServers": {
"tollcalc": {
"url": "https://app.tollcalc.eu/mcp"
}
}
}
Option B – API Key (for automation): Set a token manually, e.g. for server-to-server integrations.
{
"mcpServers": {
"tollcalc": {
"url": "https://app.tollcalc.eu/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}
Without any configuration, 10 free requests per MCP session (= per conversation) are available — no account required. After 10 requests, Claude Desktop automatically opens a browser login (OAuth 2.0). After signing in, your plan quota applies. API tokens for Option B can be created at app.tollcalc.eu.
Example Interaction via MCP
Once configured, you can ask the assistant directly:
"What is the toll cost for a 40-tonne truck from Munich to Vienna?"
The assistant will call the calculate_toll tool and return a structured response.
Detail Levels
The calculate_toll tool supports three detail levels via the detail parameter:
| Value | Contents |
|---|---|
compact (default) |
Total toll, toll km, toll-free km, per-country breakdown |
detailed |
Like compact, plus per-segment costs (no geometry) |
full |
Like detailed, plus coordinates and debug information |
Response Fields
All detail levels include the following fields:
| Field | Type | Description |
|---|---|---|
origin |
string | Resolved start location name |
destination |
string | Resolved destination name |
total_toll_eur |
number | Total toll cost in EUR |
total_distance_km |
number | Total route distance in km |
toll_km |
number | Toll-bearing distance in km |
toll_free_km |
number | Toll-free distance in km |
countries |
array | Per-country breakdown (country, country_name, total_km, toll_km, toll_eur) |
info_url |
string | Link to view this calculation in the TollCalc web app — including the planned route on an interactive map; shareable with colleagues or open in browser |
With detail=detailed, countries also includes segments (road, type, km, toll_eur per segment).
With detail=full, segments gain coordinates, source_url, matched_geofence, and geometry.
Server Card
The MCP server description (Server Card) is available at:
GET https://app.tollcalc.eu/.well-known/mcp-server
Python Package tollcalc
The tollcalc Python package wraps the REST API for use from Python scripts or Jupyter Notebooks.
Installation
pip install tollcalc
Usage
from tollcalc import calculate_toll
result = calculate_toll(
"Munich, Germany",
"Vienna, Austria",
weight=40,
axles=5,
emission_class="euro6",
co2_class="class_1",
token="YOUR_API_TOKEN",
)
print(f"Total toll: {result['total_toll_eur']:.2f} EUR")
print(f"Distance: {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} toll km)")
Usage & Quota from Python
from tollcalc import get_usage, get_quota
# Optional: consumption per sub-account (default: current month)
usage = get_usage(token="YOUR_API_TOKEN")
print(usage["total"], "calls")
for s in usage["sub_accounts"]:
print(f" {s['key']}: {s['count']}")
# Remaining monthly quota
quota = get_quota(token="YOUR_API_TOKEN")
print(f"{quota['used']} / {quota['limit']} — remaining: {quota['remaining']}")
Coordinates as Input
result = calculate_toll(
origin="48.1374;11.5755", # Munich (lat;lon)
destination="48.2082;16.3738", # Vienna
weight=40,
axles=5,
)
Package Documentation
Full documentation and further examples are available on PyPI: pypi.org/project/tollcalc
Pricing & Quotas
| Plan | Requests/month | Price |
|---|---|---|
| Free (no token) | 10 per MCP session (= per conversation) | free |
| Starter | up to 500 | from €9/month |
| Professional | up to 5,000 | from €49/month |
| Enterprise | unlimited | on request |
All plans and current pricing: tollcalc.eu/en/#pricing
For integration questions, contact support@tollcalc.eu.