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, TMS/ERP, custom backends |
| MCP (Model Context Protocol) | AI assistants such as Claude, ChatGPT, Cursor or Claude Code |
Python package tollcalc |
Scripts, data science, Jupyter Notebooks |
REST API
The 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" \
-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 intermediate stops (max. 498) |
vehicle.weight |
number | Gross vehicle weight 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 RFC 3339 datetime ("2026-09-01T06:00:00Z"); selects the toll rules valid at that time. Default: now |
Limits: Max. 500 waypoints per request (origin + via + destination). Overly dense coordinate chains (closer than 1 point per 500 m) are thinned out automatically on the server; ORS rejects routes longer than 3,000 km – split longer trips into several requests.
Optional HTTP header:
| Header | Description |
|---|---|
X-Subaccount |
Optional usage attribution, e.g. for a customer company or department. Counted per sub-account and shown in your usage statistics. Missing/empty → Default; max. 64 characters; allowed A-Z a-z 0-9 _ : -; invalid → HTTP 400 |
Authentication
Administrators of your organization create API tokens after registering at app.tollcalc.eu. Send the token as Authorization: Bearer <token>. Without a token, 10 free calculations per month (per IP address) are available.
Retrieving usage & quota
Once integrated, you can query your usage and 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 this month, broken down by X-Subaccount |
GET /api/quota |
Usage, 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":"customer_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}
Calls without an X-Subaccount header are attributed to the key Default. For unlimited plans, limit and remaining are null. The full specification is in the OpenAPI reference.
MCP – Integration with AI Assistants
TollCalc is a remote MCP server (Model Context Protocol, "Streamable HTTP" transport). Connect it to your AI assistant once and then simply ask for toll costs in the chat.
Server URL
https://app.tollcalc.eu/mcp
Available tools
| Tool | Description |
|---|---|
calculate_toll |
Toll calculation for a truck route |
get_quota |
Shows whether you are signed in, or how many free requests the session has left |
Sign-in: OAuth or API token
| Option | Best for | How it works |
|---|---|---|
| OAuth (recommended) | Claude, ChatGPT and other assistants with a connector UI | Enter only the server URL. When connecting, the TollCalc login opens in your browser; afterwards your plan's quota applies. The assistant registers itself automatically (Dynamic Client Registration) – you do not need to enter a client ID or secret. |
| API token | Cursor, Claude Code, custom agents and automations | Send the token as HTTP header Authorization: Bearer YOUR_API_TOKEN. |
Setup in Claude (claude.ai & Claude Desktop)
- Open Settings → Connectors.
- Choose Add custom connector.
- Enter the name
TollCalcand the URLhttps://app.tollcalc.eu/mcp. - Click Connect and sign in with your TollCalc account in the browser.
Setup in ChatGPT
- In the ChatGPT settings, create a new connector under Apps & Connectors (depending on your plan, Developer mode must be enabled in the advanced settings first).
- Enter the name
TollCalcand the URLhttps://app.tollcalc.eu/mcp. - Choose OAuth as authentication. Client registration happens automatically – you don't need your own OAuth credentials.
- Save and sign in with your TollCalc account in the browser.
Menu labels in Claude and ChatGPT change from time to time. What matters is always: a remote MCP server or connector with the URL
https://app.tollcalc.eu/mcpand OAuth sign-in.
Setup in Claude Code
# With OAuth login (the browser opens on first use via /mcp)
claude mcp add --transport http tollcalc https://app.tollcalc.eu/mcp
# Or with an API token
claude mcp add --transport http tollcalc https://app.tollcalc.eu/mcp \
--header "Authorization: Bearer YOUR_API_TOKEN"
Setup in Cursor & other MCP clients
Clients that add remote servers via JSON configuration (e.g. Cursor via mcp.json) use:
{
"mcpServers": {
"tollcalc": {
"url": "https://app.tollcalc.eu/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}
If the client supports OAuth, you can omit the headers block – the login then starts automatically.
Try it for free
Without signing in, 10 free calculations per MCP session are available – no account required. Once they are used up, TollCalc requests sign-in (HTTP 401); OAuth-capable assistants then start the login automatically. After signing in, your plan's quota applies and every calculation appears in your usage statistics.
Security
- OAuth sign-ins use short-lived access tokens (1 hour) that the assistant renews automatically.
- If you reset your password or an admin removes you from the organization, all connected assistants are signed out within one hour at the latest.
- Deactivated or expired API tokens are rejected immediately.
Example MCP request
Once set up, you can simply ask the assistant:
"What is the toll for a 40-tonne truck from Munich to Vienna?"
The assistant calls the calculate_toll tool and returns a structured answer.
Detail levels
The calculate_toll tool supports three detail levels via the detail parameter:
| Value | Content |
|---|---|
compact (default) |
Total toll, toll km, toll-free km, breakdown per country |
detailed |
Like compact, plus costs per segment (without geometry) |
full |
Like detailed, plus coordinates and debug information |
Response fields
All detail levels include the following fields:
| Field | Type | Description |
|---|---|---|
origin |
string | Resolved origin name |
destination |
string | Resolved destination name |
total_toll_eur |
number | Total toll in euros |
total_distance_km |
number | Total distance in km |
toll_km |
number | Tolled km |
toll_free_km |
number | Toll-free km |
countries |
array | Breakdown per country (country, country_name, total_km, toll_km, toll_eur) |
info_url |
string | Link to the calculation in the TollCalc web app — including the planned route on the map, to share with colleagues or open in the browser |
With detail=detailed, countries additionally contains segments (sections with road, type, km, toll_eur).
With detail=full, coordinates, source_url, matched_geofence and geometry are added.
Technical details for developers
For custom MCP clients, TollCalc provides the standard discovery endpoints:
| Endpoint | Content |
|---|---|
GET /.well-known/oauth-protected-resource |
Protected Resource Metadata (RFC 9728) |
GET /.well-known/oauth-authorization-server |
OAuth metadata (RFC 8414): authorization, token and registration endpoint |
POST /oauth/register |
Dynamic Client Registration (RFC 7591) |
GET /.well-known/mcp-server |
MCP Server Card |
Supported are the authorization code flow with PKCE (S256) for public clients and (rotating) refresh tokens. All URLs are relative to https://app.tollcalc.eu.
Python package tollcalc
The tollcalc Python package wraps the REST API and lets you use it 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: usage 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 more examples are available on PyPI: pypi.org/project/tollcalc
Pricing & quotas
| Plan | Price (excl. VAT) | Calculations |
|---|---|---|
| Without sign-in | free | REST API: 10 per month (per IP) · MCP: 10 per session |
| Free | €0 /month | 10 per month |
| Basic | €10 /user/month | 2,000 per user per month |
| API access | €25 /month | incl. 1 web user and 2,000 API calls, then €0.005 per call (example: 10,000 calls = €65 /month) |
API access includes your own auth tokens, call limits per token and usage-based billing. All plans can be cancelled monthly – details: tollcalc.eu/en/#pricing
For integration questions, contact support@tollcalc.eu.
FAQ
How do I connect TollCalc to ChatGPT?
Create a new connector in ChatGPT with the URL https://app.tollcalc.eu/mcp, choose OAuth as authentication and sign in with your TollCalc account in the browser. Client registration happens automatically.
Do I need an OAuth client ID or client secret?
No. TollCalc supports Dynamic Client Registration (RFC 7591) – Claude, ChatGPT and other MCP clients register themselves. You only enter the server URL.
How do I connect TollCalc to Claude?
Go to Settings → Connectors → Add custom connector, enter the URL https://app.tollcalc.eu/mcp, click Connect and sign in in the browser. This works in claude.ai and in Claude Desktop.
Can I test the MCP server without an account?
Yes. Without signing in, 10 free calculations per MCP session are available. After that, TollCalc asks you to sign in and your plan's quota applies.
Do MCP calculations count towards my quota?
Yes. Once signed in, every successful calculation via MCP counts exactly like a REST API call and appears in your usage statistics.
How much does API access cost?
€25 per month including 1 web user and 2,000 API calls, then €0.005 per call (excl. VAT). 10,000 calls therefore cost €65 per month.