Toll calculator
API as a product

Build auditable, explainable toll costs into your fleet, reimbursement or accounting workflow

TollCalculation exposes the same route and toll-station engine that powers our public calculator as a REST API — single calculations, batches of up to 10,000 requests, and an NVDB-synchronised toll-station catalogue — built for accountants, fleet operators and transport/logistics integrators who need a verifiable cost per passage, not just a total.

Who this is for

Fleet and logistics

Pre-trip toll estimates per vehicle and route, batched across a whole day's dispatch plan, with the AutoPASS agreement and the vehicle class (small / large) priced in.

Employee expense reimbursement

Attach a cost breakdown per passage and per station to an expense claim instead of a rounded estimate — every passage carries the toll station's NVDB id (tollStationNvdbId).

Accounting / ERP

Store the calculationId with the voucher and fetch the calculation again with GET /calculations/{calculationId} when the forecast is reconciled against invoiced amounts.

Route planning tools

Compare toll cost across route alternatives (alternatives[]) before you decide on a route.

Operations

The contract (OpenAPI v1) has these operations. Schemas, parameters and all response codes are in the OpenAPI v1 reference.

OperationPurpose
GET /api/toll-calculation/toll-stationsList the toll stations of the NVDB-synchronised catalogue, paged.
GET /api/toll-calculation/toll-stations/{nvdbId}Get one toll station by its NVDB id.
POST /api/toll-calculation/place-lookupsSearch for a place by name.
POST /api/toll-calculation/place-lookups/reverseFind the place nearest to a coordinate.
GET /api/toll-calculation/calculations/{calculationId}Get a completed toll calculation.
GET /api/toll-calculation/ferry-quaysList the ferry quays, paged.
POST /api/toll-calculation/calculation-batchesSubmit a batch of toll calculations.
GET /api/toll-calculation/calculation-batches/{batchId}Get the status and results of a batch.
POST /api/toll-calculation/calculationsCalculate tolls for a route.

Authentication

How a caller authenticates depends on who it is: an external customer, or a solution that AutoSync runs itself.

External customers

External customers will receive a client id and a secret from AutoSync, issued per customer through the API gateway, and use them together with the customer's own subscription key. This client id and secret flow is being built and is not available yet. Until then, request access from AutoSync as described under Get access; AutoSync agrees with you how your access is set up.

AutoSync-internal solutions

AutoSync-internal solutions use Entra ID. They send an Entra ID bearer token in the standard Authorization request header on every request. A service without a signed-in user gets the token with an OAuth2 client-credentials grant and the scope .default of the API application; a service that runs in Azure uses a managed identity instead of a client secret. The service's identity must have been assigned the app role TollCalculation.Access; ask the API owner for the assignment, see Get access. Calls through the API gateway also send a subscription key in Ocp-Apim-Subscription-Key. The calculator calls the API through its own backend, which holds the token, so the browser never sees a token or a key.

# Example: get a token with client credentials (placeholders — insert your own values)
curl -s -X POST "https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token" \
  -d "grant_type=client_credentials" \
  -d "client_id=<your-client-id>" \
  -d "client_secret=<your-client-secret>" \
  -d "scope=api://<api-app-id>/.default"

Calculate one toll cost

POST /api/toll-calculation/calculations — an origin, a destination, up to 3 waypoints, a vehicle profile and a departure time. vehicle.class large is priced as a large vehicle, every other value as a small one (small). departureTime must be between now and 30 days ahead.

# Request (the example from the contract; set departureTime between now and 30 days ahead)
POST /api/toll-calculation/calculations
Authorization: Bearer <token>
Ocp-Apim-Subscription-Key: <subscription-key>
Content-Type: application/json
Idempotency-Key: 8f4d2c1e-5b7a-4e0f-9c3d-2a6b1d7e9f40

{
  "origin": { "lat": 59.9139, "lon": 10.7522, "label": "Oslo" },
  "destination": { "lat": 59.7441, "lon": 10.2045, "label": "Drammen" },
  "waypoints": [],
  "vehicle": { "class": "small", "fuelType": "petrol", "autopassAgreement": true, "lengthMeters": 4.8 },
  "departureTime": "2026-10-07T08:00:00Z",
  "includeGeometry": false
}

# Response — 201 Created (200 OK on an Idempotency-Key replay of the same request).
# Abridged: alternatives[] is empty here; an alternative has label, totalAmount, route, warnings and passages.
{
  "calculationId": "01M52N4JDQ31WY49SE6TMPTEWH",
  "totalAmount": 30.4,
  "currency": "NOK",
  "crossesBorder": false,
  "countriesTraversed": ["NO"],
  "passageCount": 1,
  "routeSource": "HERE",
  "warnings": [],
  "createdAt": "2026-10-16T15:26:23.1590053+00:00",
  "route": { "distanceMeters": 43589, "durationSeconds": 2103, "polyline": [] },
  "alternatives": [],
  "passages": [
    {
      "index": 0,
      "tollStationNvdbId": "929790703",
      "tollStationName": "Dronning Blancas vei",
      "bompengeprosjektKey": "FJELLINJEN_INDRE_RING",
      "country": "NO",
      "timestamp": "2026-10-20T08:04:16.4840028+00:00",
      "basePrice": 38,
      "appliedPeriod": "OFF_PEAK",
      "finalAmount": 30.4,
      "currency": "NOK",
      "suppressedByHourlyRule": false,
      "priceSource": "TARIFF_TABLE",
      "priceVerifiedAt": "2026-10-16T15:23:30.9872603+00:00",
      "priceConfidence": "MEDIUM",
      "sourceAmount": null,
      "sourceCurrency": null,
      "amountWithAutopass": 30.4,
      "amountWithoutAutopass": 38
    }
  ],
  "dataSources": {
    "tollStations": "NVDB_V4",
    "tollStationsLoadedAt": "2026-10-16T15:23:30.9872603+00:00",
    "ferryPrices": null,
    "ferryPricesLoadedAt": null,
    "ferryPricesAttribution": null,
    "ferryPricingDegraded": false,
    "crossBorder": null
  },
  "fxConversion": null,
  "autopassComparison": { "totalWithAutopass": 30.4, "totalWithoutAutopass": 38, "savings": 7.6, "requested": "WITH_AUTOPASS" }
}

Idempotency-Key

Send a client-generated UUID as Idempotency-Key on every POST /calculations. Repeating the same key with identical content returns the original result (200 OK, the same calculationId) instead of creating a duplicate — safe to retry after a network timeout. Reusing the same key with different content returns 409 Conflict, so always generate a fresh key per distinct request, not per retry. (Note that this applies to single calculations — batch submission is not idempotent, see the next section.)

Round trip (tur/retur)

Set roundTrip to true on POST /calculations and the API also prices the way back in the same call: the same route the other way (origin and destination swapped, waypoints in reverse order, same vehicle and options). Both legs are stored and returned with one combined total. roundTrip defaults to false, and then the response has no roundTrip member. returnDepartureTime (RFC 3339) is optional, only allowed with roundTrip true, and says when the return leg starts. If you leave it out, the return leg departs at the outbound departure. It follows the same window as departureTime and must not be earlier than the outbound departure; a violation is 400 and nothing is calculated or stored.

# Request: the same body as above, with a round trip (set both times between now and 30 days ahead)
POST /api/toll-calculation/calculations

{
  "origin": { "lat": 59.9139, "lon": 10.7522, "label": "Oslo" },
  "destination": { "lat": 59.7441, "lon": 10.2045, "label": "Drammen" },
  "waypoints": [],
  "vehicle": { "class": "small", "fuelType": "petrol", "autopassAgreement": true, "lengthMeters": 4.8 },
  "departureTime": "2026-10-07T08:00:00Z",
  "returnDepartureTime": "2026-10-07T16:00:00Z",
  "includeGeometry": false,
  "roundTrip": true
}

The response is the outbound leg at the top level, exactly as for a single calculation, plus a roundTrip object with roundTripId (links the two stored calculations), combinedTotalAmount (the sum of the two primary routes; alternatives are not included), currency and returnLeg. The return leg has the same members as the normal response, in the same order, with its own calculationId, and has no roundTrip member. A new round trip is 201 Created. GET /calculations/{calculationId} reads either leg and answers as for a single calculation, without a roundTrip member, so keep roundTripId from the POST if you need it.

Batch calculations (up to 10,000 requests)

For a whole day's dispatch plan or a combined reimbursement run: submit many requests in one call and poll for completion instead of making thousands of synchronous calls.

# 1. Submit — 202 Accepted (the request is the example from the contract; the response values are illustrative)
POST /api/toll-calculation/calculation-batches
Authorization: Bearer <token>
Ocp-Apim-Subscription-Key: <subscription-key>
Content-Type: application/json

{ "requests": [ { "origin": { "lat": 59.9139, "lon": 10.7522, "label": "Oslo" }, "destination": { "lat": 59.7441, "lon": 10.2045, "label": "Drammen" }, "waypoints": [], "vehicle": { "class": "small", "fuelType": "petrol", "autopassAgreement": true }, "departureTime": "2026-10-07T08:00:00Z", "includeGeometry": false } ] }

{
  "batchId": "01J9ZK4R9Y6N3V8W5P7C1E2F3G",
  "acceptedAt": "2026-10-16T15:30:00Z",
  "statusUrl": "/api/toll-calculation/calculation-batches/01J9ZK4R9Y6N3V8W5P7C1E2F3G",
  "estimatedCompletionSeconds": 2
}

# 2. Poll statusUrl until status is COMPLETED, PARTIAL_FAILURE or FAILED
GET /api/toll-calculation/calculation-batches/01J9ZK4R9Y6N3V8W5P7C1E2F3G
Authorization: Bearer <token>
Ocp-Apim-Subscription-Key: <subscription-key>

{
  "batchId": "01J9ZK4R9Y6N3V8W5P7C1E2F3G",
  "status": "RUNNING",
  "totalRequests": 1,
  "completed": 0,
  "failed": 0,
  "results": [],
  "errors": [],
  "updatedAt": "2026-10-16T15:30:01Z"
}
# results[] holds one CalculateTollResponse per successful request (the same shape as the
# single-call endpoint above); errors[] holds { requestIndex, code, message } for each
# request in the batch that failed.

An item with roundTrip true is priced as a round trip. It counts as two against the limit of 10,000: a batch that counts more than that is 400 with the key Requests, the message names the weighted count, and nothing is accepted or stored. The result of the item has the roundTrip object. If a leg fails, the whole item fails and its entry in errors[] names the leg with the code ROUND_TRIP_OUTBOUND_FAILED or ROUND_TRIP_RETURN_FAILED; the other items are not affected. estimatedCompletionSeconds counts a round-trip item as two.

Batch submission is not idempotent.
Unlike POST /calculations, POST /calculation-batches takes no Idempotency-Key: each submission creates a new batch with its own batchId. A blind retry after a timeout can therefore queue a duplicate of a batch of up to 10,000 calculations. How to handle a timeout:
  • Did you receive the 202 response (with batchId and statusUrl), but a later step failed? Then confirm the outcome through statusUrl before you do anything else.
  • Did you never get the response (a real submission timeout)? Then you have no batchId/statusUrl to look up, and the API has no operation to look up or deduplicate the submission. Avoid an automatic retry in this case — it can create a duplicate.

Data freshness and result semantics

These fields in the response tell you where the result comes from and how reliable it is:

FieldMeaning
passages[].priceConfidenceThe price confidence of each passage: HIGH, MEDIUM or LOW. The field is always present.
passages[].priceSource, passages[].priceVerifiedAtThe tariff source that was used (for example NVDB_V4, TARIFF_TABLE, BROBIZZ_RECIPROCITY or DK_CURATED_TARIFF) and the time the price was verified; both can be null.
dataSources.tollStations, dataSources.tollStationsLoadedAtThe source of the toll-station data, NVDB_V4 or DEMO (or null), and when it was loaded.
dataSources.ferryPrices, dataSources.ferryPricesLoadedAt, dataSources.ferryPricingDegradedThe source of the ferry prices, AUTOPASS_FERJE_PRISAPI, DEMO_FERRY_FALLBACK or MIXED_FERRY_SOURCES (null when no ferry passage was priced), when they were loaded, and whether the ferry pricing is degraded.
dataSources.ferryPricesAttributionThe attribution that the CC BY 4.0 licence of the ferry prices requires, when at least one passage is priced from AUTOPASS_FERJE_PRISAPI; otherwise null. A client that shows ferry prices must show this text together with them.
dataSources.crossBorderHow the border crossing was found: ROUTE_ENDPOINTS, ROUTE_GEOMETRY, TOLL_STATIONS or ROUTE_SPANS, or null when the route does not cross a border. Included in the response of POST /calculations and in each result in results[] of GET /calculation-batches/{batchId}; not in the response of GET /calculations/{calculationId}.
routeSourceThe routing service that produced the route (for example HERE). The field is free text in the contract; do not fail on a value you do not know.
warnings[]Non-fatal conditions with code and message, for example NO_TOLL_STATIONS_ON_ROUTE, FERRY_CROSSING_UNPRICED or ROUTE_DEGRADED_STRAIGHT_LINE.
crossesBorder, countriesTraversedWhether the route crosses a national border, and the country codes (ISO 3166-1 alpha-2) the route passes through, in order.
GET /toll-stations → syncedAtTimestamp per station in the NVDB-synchronised catalogue — use it to show how fresh your reference data is.

Rate limits and errors

All operations can respond 429 Too Many Requests when the request limit is reached. If the response has a Retry-After header, wait that long before you try again; otherwise wait and retry with an increasing pause and some random jitter. The API's own limit does not send Retry-After when it refuses a request, except for a round trip that is refused its second permit, which does. A 429 response from the API gateway may also have the header.

Errors follow RFC7807 application/problem+json:

StatusMeaning
400Validation error — the response includes an errors lookup table that maps field names → messages.
401 / 403Missing, invalid or unauthorised bearer token.
404Unknown toll station, calculation or batch, and place lookup by coordinate where it is not available.
409An Idempotency-Key was repeated with a different request content (for a round trip: another returnDepartureTime).
500A round trip where a leg could not be calculated; nothing is stored and detail names the leg.
429Rate limited — follow Retry-After when the header is present, otherwise wait and retry with an increasing pause.
503The place lookup cannot respond right now (only POST /place-lookups and POST /place-lookups/reverse).

Get access

Access is not self-service. To get access for your integration with fleet, reimbursement or accounting systems, contact your AutoSync contact person or the TollCalculation product team — refer to this API and the use case (fleet, reimbursement or accounting). Until the client id and secret flow for external customers is available, AutoSync agrees with each external customer how the access is set up. AutoSync-internal solutions follow AutoSync-internal solutions.

Contact details will be published here.