FASTagJi Developer API · v1
Power your applications with FASTagJi Toll APIs
Integrate Indian highway toll calculation into your application with a REST API. Work out route-based toll charges, identify the toll plazas along a route, and get vehicle-specific toll pricing — either from waypoints we route for you, or from a route you already have.
View code examples Contact sales
- Endpoints
- 5
- Vehicle classes
- 7
- Coverage
- India
- Format
- REST · JSON
{
"waypoints": [
{ "lat": 13.0827, "lng": 80.2707 },
{ "lat": 12.9716, "lng": 77.5946 }
],
"vehicle_type": "car",
"trip_type": "single"
}
{
"success": true,
"data": {
"route": { "distance_km": 315.7, … },
"plazas": [ … ],
"totals": {
"plaza_count": 5,
"toll_fare": 500,
"currency": "INR",
"unpriced_plazas": 0,
"complete": true
}
}
}
Field names and structure are exact, and the figures come from real plaza rows on this corridor. Run the request with your own key for live rates.
Subscription Plans & Pricing
Transparent Pricing For Every Fleet & Application
Select the ideal plan for your developer integration. Flexible Prepaid Balance Packages with per-call paise billing and 30-day validity. All new accounts can claim a free 14-day trial pack.
Trial Pack
Free daily transaction limit, 14 days, to build and test an integration. No credit card required.
- ✓ 25 txns/day (Individual)
- ✓ 150 txns/day (Business)
- ✓ No credit card required
- ✓ 14 days validity
- ✓ 10 req / min limit
- ✓ 4 max waypoints
- ✓ 1 active API key
Starter Pack
₹6,000 of calls, valid 30 days. Around 4,800 waypoint routes.
- ✓ ₹6,000 call balance
- ✓ 30 days validity
- ✓ ₹3.50/call – Toll from a polyline
- ✓ ₹1.25/call – Toll by waypoints
- ✓ 60 req / min limit
- ✓ 4 max waypoints
- ✓ 2 active API keys
Basic Pack
₹20,000 of calls, valid 30 days. Around 20,000 waypoint routes.
- ✓ ₹20,000 call balance
- ✓ 30 days validity
- ✓ ₹3.00/call – Toll from a polyline
- ✓ ₹1.00/call – Toll by waypoints
- ✓ 180 req / min limit
- ✓ 8 max waypoints
- ✓ 3 active API keys
Standard Pack
₹75,000 of calls, valid 30 days. Around 100,000 waypoint routes.
- ✓ ₹75,000 call balance
- ✓ 30 days validity
- ✓ ₹2.25/call – Toll from a polyline
- ✓ ₹0.75/call – Toll by waypoints
- ✓ 600 req / min limit
- ✓ 10 max waypoints
- ✓ 5 active API keys
Corporate Pack
₹3,00,000 of calls, valid 30 days. Unlimited waypoints.
- ✓ ₹300,000 call balance
- ✓ 30 days validity
- ✓ ₹1.80/call – Toll from a polyline
- ✓ ₹0.60/call – Toll by waypoints
- ✓ 1200 req / min limit
- ✓ Up to 10 waypoints
- ✓ 10 active API keys
Why FASTagJi Toll APIs?
Built on our own NHAI and NETC toll data, for Indian roads specifically.
-
Route-based toll calculation
Send waypoints and get the toll charge for the whole journey, plaza by plaza.
-
Toll plaza identification
Every plaza on the route, in travel order, with coordinates, NH number and plaza code.
-
Your own route, priced
Already using Google Maps, Mapbox or HERE? Send that polyline and we price the road you are actually on.
-
Vehicle-specific pricing
Seven classes, from car to 7+ axle, each mapped to its NETC class and published rate.
-
Indian toll information
NHAI plaza rates with their revision dates, plus closed-loop entry and exit fares.
-
REST and JSON
One envelope on every endpoint, success or failure. Write your error branch once.
-
Usage monitoring
Quota and rate-limit headers on every response, plus endpoints for your account and daily usage.
-
Honest totals
A plaza with no published rate reports null and is counted, never silently charged as zero.
Available APIs
Every endpoint is documented on this page. Jump straight to one.
-
POST
/api/v1/developer/toll/calculate-polylineToll Calculation — Waypoints You send up to 10 waypoints. We build the route and price the toll plazas on it. -
POST
/api/v1/developer/toll/calculate-from-polylineToll Calculation — Your Own Route You send a route you already have. We price the toll plazas on that exact geometry. -
GET
/api/v1/developer/toll/vehicle-typesVehicle Types Every vehicle class and trip type the toll endpoints accept. -
GET
/api/v1/developer/meAccount Your account, plan, limits, feature flags and usage so far this period. -
GET
/api/v1/developer/usageUsage Daily call totals, for reconciling an invoice against your own records.
Getting started
A REST API over HTTPS. JSON in, JSON out, one envelope on every reply. You can be making real calls in about five minutes.
Base URL
https://fastagji.in/api/v1/developer
The version is in the path. Within v1 we will not remove a field,
rename one, or change its type, and we will not rename an
error.code. New fields may appear, so treat an unknown field as
something to ignore rather than an error — otherwise a routine addition on
our side breaks your client. Anything that cannot be done under those rules
goes to a v2 path and v1 keeps working.
Getting an API key
Self-service registration. Select a subscription plan below to register your developer account. Provide your name, email, and mobile number to register.
Trial Pack
Free daily transaction limit, 14 days, to build and test an integration. No credit card required.
- ✓ 25 txns/day (Individual)
- ✓ 150 txns/day (Business)
- ✓ 14 days validity
- ✓ No credit card required
- ✓ 10 req / minute
- ✓ 4 max waypoints
- ✓ 1 API key
Starter Pack
₹6,000 of calls, valid 30 days. Around 4,800 waypoint routes.
- ✓ ₹6,000 call balance
- ✓ 30 days validity
- ✓ ₹3.50/call – Toll from a polyline
- ✓ ₹1.25/call – Toll by waypoints
- ✓ 60 req / minute
- ✓ 4 max waypoints
- ✓ 2 API keys
Basic Pack
₹20,000 of calls, valid 30 days. Around 20,000 waypoint routes.
- ✓ ₹20,000 call balance
- ✓ 30 days validity
- ✓ ₹3.00/call – Toll from a polyline
- ✓ ₹1.00/call – Toll by waypoints
- ✓ 180 req / minute
- ✓ 8 max waypoints
- ✓ 3 API keys
Standard Pack
₹75,000 of calls, valid 30 days. Around 100,000 waypoint routes.
- ✓ ₹75,000 call balance
- ✓ 30 days validity
- ✓ ₹2.25/call – Toll from a polyline
- ✓ ₹0.75/call – Toll by waypoints
- ✓ 600 req / minute
- ✓ 10 max waypoints
- ✓ 5 API keys
Corporate Pack
₹3,00,000 of calls, valid 30 days. Unlimited waypoints.
- ✓ ₹300,000 call balance
- ✓ 30 days validity
- ✓ ₹1.80/call – Toll from a polyline
- ✓ ₹0.60/call – Toll by waypoints
- ✓ 1,200 req / minute
- ✓ Up to 10 waypoints
- ✓ 10 API keys
A key is shown to you once, at the moment it is issued. We store only a SHA-256 hash of it, so it cannot be read back later by you or by us. Put it in your secret store straight away. Lost keys are revoked and replaced, not recovered.
Your first call
Start with the vehicle types endpoint. It costs no credits, so it is a safe way to confirm your key and your headers are right before you spend anything.
curl -s https://fastagji.in/api/v1/developer/toll/vehicle-types \
-H "Authorization: Bearer $FASTAGJI_API_KEY"
A 200 with "success": true means you are
authenticated. A 401 means the key was not recognised — check you
copied all of it, including the fgj_live_ or
fgj_test_ prefix.
The shape of an integration
The response envelope
Every response has the same outer shape, success or failure, on every
endpoint. Branch on success and you have handled all of them.
{
"success": true,
"data": { },
"meta": {
"request_id": "a23e363c-bf36-4323-a608-47fbc3cf7fda",
"generated_at": "2026-11-09T09:02:58+00:00",
"credits_used": 1
}
}
{
"success": false,
"error": {
"code": "validation_failed",
"message": "The request could not be validated.",
"details": {
"waypoints": ["At least 2 waypoints (origin and destination) are required."]
}
},
"meta": {
"request_id": "7f1c0b2e-55aa-4d19-93a1-2b0d6f4e8c31",
"generated_at": "2026-11-09T09:03:11+00:00"
}
}
dataon success,erroron failure. Never both.error.codeis the stable machine-readable value. Branch on it, not onerror.message, which may be reworded.error.detailsnames each field that was rejected and why. It is present onvalidation_failedand may be absent otherwise.meta.request_idis on every response. It is the identifier of your call in our logs — quote it when reporting anything.
Conventions worth knowing up front
| Convention | What it means |
|---|---|
null against 0 |
null means unknown or unlimited. 0 means zero. They are never interchangeable — a null fare is a missing rate, not a free plaza. |
| Currency | All money is Indian rupees. Fares are whole rupees; currency is returned alongside so you need not assume. |
| Coordinates | Request bodies use named lat and lng. GeoJSON geometry, in and out, is [longitude, latitude] as the specification requires. |
| Timestamps | ISO 8601 with an offset. Dates without a time are YYYY-MM-DD. |
| Coverage | India only. A route outside the country is refused rather than returned with a total of zero. |
Authentication
Every endpoint under /api/v1/developer needs a key. There is no
anonymous access and no public tier.
Sending the key
Preferred:
Authorization: Bearer fgj_live_XXXXXXXXXXXX_YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
If your tooling reserves the Authorization header, use:
X-API-Key: fgj_live_XXXXXXXXXXXX_YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Authorization wins if you send both. Nothing else is accepted —
not a query parameter, not a cookie, not a form field. A key in a URL ends up
in access logs, browser history and referrer headers, which is how keys leak.
What a key looks like
fgj_test_… keys are for your own development and staging. They are
authenticated and metered exactly like live keys and return exactly the same
fares — the environment is a label for your own benefit, not a sandbox with
different data. Plan your test traffic accordingly.
The key is shown once
We store a SHA-256 hash of your key, its prefix, and its last four characters. We do not store the key. Nobody at FastagJi can look it up, read it back or email it to you, and no amount of escalation changes that — the information is not there. Put it in your secret store the moment you receive it.
Rotating without downtime
Every paid tier allows more than one active key, so you can change keys with no interruption:
- Ask us to issue a second key.
- Deploy it alongside the first.
- Confirm traffic is flowing on the new key —
GET /mereportskey.last_used_atfor whichever key you called it with. - Ask us to revoke the old one.
A revocation takes effect on the next request, with no grace period. That is the point: it is what you run when a key has leaked.
Why a request can be refused
| Status | error.code |
Meaning | What to do |
|---|---|---|---|
401 |
invalid_key |
No key was sent, or the key is not recognised. | Send the key as Authorization: Bearer, or as X-API-Key. Check it was copied in full. |
403 |
revoked_key |
This key was revoked. The message carries the date. | Use a current key, or ask us to issue one. |
403 |
expired_key |
This key passed its expiry date. | Rotate the key before the expiry date next time. |
403 |
inactive_developer |
The account is not active, so none of its keys work. | Contact us. This is an account state, not a key problem. |
401 means we do not know who you are. 403 means we
know, and the answer is no. Retrying helps with neither, so keep them out of a
retry loop — fix the credential or talk to us.
Protecting your key
- Server-side only. A key in a mobile app or a web page is a published key, however it is obfuscated; anyone can read it out of the bundle or the network tab.
- Out of source control, and out of CI logs.
- One key per environment, so revoking one does not take down the others.
- Rotate if a key has ever been pasted into a chat, a ticket or a screenshot.
A key identifies your account, not its own allowance. Plan, quota and limits live on the account's subscription and are shared by all of its keys: two keys on one account draw down one allowance.
Toll calculation · 1 of 2
Toll Calculation — Waypoints
You send the places. We work out the driving route between them, find the toll plazas on it, and price each one for your vehicle class.
https://fastagji.in/api/v1/developer/toll/calculate-polyline
1 credit per route
Key required
How it works
Request
{
"waypoints": [
{"lat": 13.0827, "lng": 80.2707, "address": "Chennai"},
{"lat": 12.9716, "lng": 77.5946, "address": "Bengaluru"}
],
"vehicle_type": "car",
"trip_type": "single"
}
POST /api/v1/developer/toll/calculate-polyline HTTP/1.1
Host: fastagji.in
Authorization: Bearer $FASTAGJI_API_KEY
Content-Type: application/json
Accept: application/json
{
"waypoints": [
{"lat": 13.0827, "lng": 80.2707, "address": "Chennai"},
{"lat": 12.9716, "lng": 77.5946, "address": "Bengaluru"}
],
"vehicle_type": "car",
"trip_type": "single"
}
Parameters
| Field | Type | Required | Notes |
|---|---|---|---|
waypoints |
array | Required | Two or more, in travel order. The ceiling is 10, and your plan may set it lower — read limits.max_waypoints from GET /me. |
waypoints[].lat |
number | Required | −90 to 90. |
waypoints[].lng |
number | Required | −180 to 180. |
waypoints[].address |
string | Optional | Up to 500 characters. Echoed back on the leg; never used for routing. |
vehicle_type |
string | Optional |
Defaults to car. One of
car, lcv, bus, multiaxle, four_six_axle, seven_more_axle, hcm_eme — see vehicle types.
|
trip_type |
string | Optional |
single or return .
Defaults to single.
|
alternatives |
boolean | Optional |
Defaults to false. true prices every road
the router offers and adds the alternatives block —
see route alternatives. Costs one
credit per route returned.
|
trip_type: "return" is not twice the single fare.
Most plazas publish a separate, cheaper return rate valid for 24 hours, and
that is the column we read. It affects fares only — the distance and
duration returned are still one way.
Response
The same worked example, shown as a reader sees it, as the JSON your client parses, and on a map.
- Distance
- 315.7 km
- Duration
- 5h 23m
- Toll plazas
- 5
- Toll total
- ₹500
- Sriperumbadur ₹50
- Chennasamaduram ₹160
- Pallikonda Toll Plaza ₹115
- Vaniyambadi Toll Plaza ₹110
- Electronic City Phase 1 Toll Plaza ₹65
totals.complete is true, so every plaza on this route has a published rate and the total is the fare.
{
"success": true,
"data": {
"route": {
"distance_km": 315.7,
"duration_seconds": 19380,
"duration_text": "5h 23m",
"polyline": {
"type": "geojson",
"geojson": {
"type": "LineString",
"coordinates": [[80.2707, 13.0827], [80.017, 13.0332], "…"]
}
},
"legs": [
{
"leg_index": 0,
"from": {"lat": 13.0827, "lng": 80.2707, "address": "Chennai"},
"to": {"lat": 12.9716, "lng": 77.5946, "address": "Bengaluru"},
"distance_km": 315.7,
"duration_seconds": 19380,
"plaza_count": 5
}
]
},
"vehicle": {
"type": "car",
"label": "Car / Jeep / Van",
"netc_class": "VC4",
"trip_type": "single"
},
"plazas": [
{
"id": 19,
"name": "Sriperumbadur",
"code": "360031",
"nh_no": "48",
"location": "Km 37.800",
"lat": 12.982155,
"lng": 79.968944,
"leg_index": 0,
"distance_from_start_km": 35.7,
"fare": {
"amount": 50,
"currency": "INR",
"basis": "flat",
"estimated": false,
"rate_revision": "30 Mar 2027"
},
"closed_loop": null,
"is_closed_loop_plaza": false,
"helpline": {"ambulance": "1033", "crane": "1033"}
}
],
"totals": {
"plaza_count": 5,
"closed_loop_groups": 0,
"toll_fare": 500,
"currency": "INR",
"unpriced_plazas": 0,
"complete": true
}
},
"meta": {
"request_id": "a23e363c-bf36-4323-a608-47fbc3cf7fda",
"generated_at": "2026-11-09T09:02:58+00:00",
"credits_used": 1
}
}
The response carries route.polyline.geojson, a GeoJSON LineString ready to hand to Leaflet, Mapbox GL or Google Maps. It is thinned to at most 300 points — plenty to draw, not enough to measure, so read distance_km for distance rather than computing it from the line.
Worked example. The plaza names, NETC codes, NH numbers, coordinates and car rates above are real rows from our toll data for this corridor, and the field names and structure are exactly what the API returns. The distances are measured along the 13-point sample line used throughout this page, so they read a little short of the road itself — a routed response follows the carriageway and comes back longer. The duration is illustrative. Run the call with your own key for live figures.
Reading totals
| Field | Meaning |
|---|---|
plaza_count | Plazas on the route, including those inside closed-loop stretches. |
closed_loop_groups | How many closed-loop stretches were priced as an entry/exit pair. |
toll_fare | The total. Each closed-loop stretch counted once; unpriced plazas not counted at all. |
unpriced_plazas | Plazas with no published rate for this vehicle class. |
complete | false whenever unpriced_plazas is above zero. |
complete: false means toll_fare is a floor, not the fare.
Show it as an estimate, or say how many plazas are missing. Presenting an
incomplete total as the price is how a customer ends up short at a barrier.
Reading plazas[]
| Field | Meaning |
|---|---|
id | Our plaza id. Stable — use it as your join key. |
code | The NETC plaza code, where we have one. May be null. |
nh_no | The highway the plaza sits on, as published. |
distance_from_start_km | Distance along the route to this plaza, from the first waypoint. |
leg_index | Which leg it falls on, zero-based. |
fare.amount | What this plaza charges. null means no rate on file, or the plaza belongs to a closed-loop stretch. |
fare.basis | flat, closed_loop or unavailable. |
fare.estimated | true when the fare was derived rather than published — a return journey on a pair that publishes only a single fare, doubled. |
fare.rate_revision | When the rate we used was published. |
closed_loop | The stretch this plaza belongs to, or null. |
is_closed_loop_plaza | Whether the plaza itself operates entry and exit. |
Closed-loop stretches
On a closed-loop corridor you are charged once for the distance between where
you entered and where you left, not at each barrier. Every plaza in such a
stretch shares a closed_loop.group and carries the same
group_fare, and each one's own fare.amount is
null.
To list fares per stop, show fare.amount and render the stretch as
one line item from its group_fare.
Do not add group_fare for each member.
totals.toll_fare already counts each group once; if you need your
own total, sum fare.amount and ignore the nulls.
Route alternatives
There is usually more than one road between two places, and the quickest one
is not always the cheapest. Send alternatives: true and every
road the router offers is priced separately, with its own plazas and its own
total, and the response says which is the fastest, which is the cheapest and
which is the shortest.
These are the same three rules our own Toll Calculator uses, so the API and the public page answer the same way for the same journey.
{
"waypoints": [
{"lat": 13.0827, "lng": 80.2707, "address": "Chennai"},
{"lat": 12.9716, "lng": 77.5946, "address": "Bengaluru"}
],
"vehicle_type": "car",
"alternatives": true
}
"alternatives": {
"count": 3,
"note": null,
"comparison": {
"fastest_index": 1,
"cheapest_index": 2,
"shortest_index": 0,
"toll_saving": 120,
"currency": "INR",
"extra_duration_seconds": 10800,
"extra_distance_km": 221.6,
"all_routes_priced": false
},
"routes": [
{
"index": 0,
"labels": ["shortest"],
"distance_km": 282.1,
"duration_seconds": 25200,
"duration_text": "7h 0m",
"toll_fare": 315,
"currency": "INR",
"plaza_count": 6,
"closed_loop_groups": 1,
"unpriced_plazas": 1,
"complete": false,
"polyline": { "type": "geojson", "geojson": {} },
"plazas": []
}
]
}
Nothing that was already there moves. route,
plazas and totals still
describe the best route, exactly as they do without the flag, and
alternatives is added beside them. Leave the flag out and the
response has no new key at all.
| Field | Meaning |
|---|---|
count | How many roads were priced. At most 3, which is the router's own ceiling. |
note | Why there is only one route, when there is only one. null when there is a real comparison to read. |
comparison | One index per label, plus what the cheapest road saves and what that saving costs. null for a single route. |
routes[].index | Position in the router's own order, best first. routes[0] is the same road as route. |
routes[].labels | Which of fastest, cheapest, shortest this road wins. May hold several; may be empty. |
routes[].toll_fare | This road's own total, each closed-loop stretch counted once. |
routes[].polyline | GeoJSON LineString, the same shape as route.polyline. |
routes[].plazas | The plazas on this road, the same shape as the top-level plazas. |
comparison.all_routes_priced | false when any compared road has a plaza with no published rate. |
How the three labels are decided
| Label | Means |
|---|---|
fastest | The lowest duration_seconds. |
cheapest | The lowest toll_fare. |
shortest | The lowest distance_km. |
Two things to expect. A road can win more than one label, so if one road is
both quickest and cheapest its labels holds both — do not assume
one label per road. And every tie is labelled: two roads that both cost ₹315
are both the cheapest. When you need to name a single winner, read
comparison.cheapest_index, which is the first of them. A road
that wins nothing has labels: [], which is an answer rather than
a gap.
all_routes_priced: false makes the price ranking provisional.
An unpriced plaza contributes nothing to a total, so a road with a gap in
its rates can come out as the cheapest while actually costing more than a
fully priced one. The ranking is still the best answer published rates
allow — but before you show a driver "save ₹120 this way", check
all_routes_priced, or check each road's own
complete.
Asking does not guarantee getting. Alternatives need a
straight origin-to-destination journey — the router does not offer them
for a route with via stops — and some roads genuinely have no second
option. Either way count is 1,
comparison is null, labels is empty
because "fastest of one" says nothing, note says which case
it was, and you are charged one credit, not three. You
are never billed for options the router could not offer.
Credits follow the work: one per road in routes, because three
roads is three plaza scans and three pricing passes.
meta.credits_used is the figure that reaches your usage and your
invoice. Quota is separate — the call counts once against your plan's monthly
allowance however many roads come back.
Errors on this endpoint
| Status | error.code | Why |
|---|---|---|
401 |
invalid_key |
No key was sent, or the key is not recognised. |
403 |
revoked_key |
This key was revoked. The message carries the date. |
403 |
expired_key |
This key passed its expiry date. |
403 |
inactive_developer |
The account is not active, so none of its keys work. |
403 |
origin_not_allowed |
The key was used from a browser origin that is not registered for it. |
403 |
feature_unavailable |
Your package does not include the API you called. |
422 |
validation_failed |
The request could not be used. error.details names each field. |
429 |
rate_limited |
Too many requests this minute for your plan. |
429 |
quota_exceeded |
This period's call allowance is used up. |
502 |
upstream_error |
Routing could not answer: no road between the points, or the routing service is unhappy. Waypoint endpoint only. |
500 |
server_error |
We failed. Nothing from the exception is returned. |
A 422 for too many waypoints is a plan limit rather than a bug —
read limits.max_waypoints from GET /me. The full list
of codes is in error codes.
alternatives has to be a boolean, or one of the forms we read as
one — true, false, 1, 0,
"1", "0". Anything else is a 422 rather
than a silent true: a truthy string would switch the feature on
and charge for it.
How the numbers are produced
- Plazas are matched within 0.5 km of the route line, so a plaza on a parallel service road or a nearby junction can be picked up. Check
lat,lnganddistance_from_start_kmif one looks out of place, and send us therequest_idif it is wrong. - A plaza is reported once per journey even if the route passes it twice.
distance_kmandduration_secondsdescribe free-flowing traffic. They are not a live ETA and carry no traffic data.- Fares come from published NHAI and NETC rate cards.
rate_revisionsays which revision. Rates change, typically on 1 April. - Two calls with the same waypoints can return slightly different geometry if the routing graph has been updated. The plazas and fares do not drift for that reason alone.
- With
alternatives: trueeach road is priced on its own — its own plaza scan, its own closed-loop grouping. A plaza matched on one road has no effect on another, so every total stands by itself. - The order of
routesis the router's, best first. It is not sorted by price, distance or time;labelsandcomparisonare what tell you that.
Toll calculation · 2 of 2
Toll Calculation — Your Own Route
You already have a route — from Google Maps, Mapbox, HERE, OSRM or your own router. Send it, and get the toll plazas on that exact road.
https://fastagji.in/api/v1/developer/toll/calculate-from-polyline
1 credit
Key required
We do not route your geometry again. We do not look for a cheaper alternative, and we do not move a point. The line you send is the line we price. This endpoint makes no call to any routing service at all, which is asserted by a test rather than only stated here.
Which endpoint do I want?
| Waypoints | Your own route | |
|---|---|---|
| You send | 2–10 waypoints | A complete route line |
| We route it | Yes | No |
| Road priced | The one we picked | The one you sent |
| Duration returned | Measured | null, unless you send one |
legs array | Yes, one per pair of waypoints | Absent — a supplied line is one route |
Possible 502 | Yes, if routing fails | No, nothing to fail |
| Credits | 1 | 1 |
If you already pay a mapping provider for routing, use this endpoint. The tolls then belong to the road your driver is actually on, and you are not paying twice to have the route calculated. If you have two places and no route, use the waypoint endpoint.
How it works
Request
{
"polyline": "{eznA{z|hNjtHrpp@j~HrkHbfGros@ztDnjy@{w@~}s@vwAjya@fqWrkf@ftXzp_@wdCrquAotLnp{@_sSzw^orWjeM",
"format": "google5",
"vehicle_type": "car",
"trip_type": "single"
}
{
"polyline": {
"type": "LineString",
"coordinates": [[80.2707, 13.0827], [79.9689, 12.9821], [77.5946, 12.9716]]
},
"vehicle_type": "car"
}
{
"polyline": "{eznA{z|hNjtHrpp@j~HrkHbfGros@ztDnjy@{w@~}s@vwAjya@fqWrkf@ftXzp_@wdCrquAotLnp{@_sSzw^orWjeM",
"format": "google5",
"vehicle_type": "bus",
"trip_type": "return",
"duration_seconds": 19380,
"proximity_meters": 1500
}
The encoded string above is a genuine Google-precision-5 polyline of the 13-point Chennai to Bengaluru line used throughout this page. You can paste it straight into the playground.
Parameters
| Field | Type | Required | Notes |
|---|---|---|---|
polyline |
string or array | Required | The encoded string, or a GeoJSON LineString, a Feature wrapping one, or a bare [[lng, lat], …] array. |
format |
string | For a string |
google5, google6, geojson .
Required when polyline is a string; optional when it is an array, because an array can only be GeoJSON.
|
vehicle_type |
string | Optional | Defaults to car. Same values as the waypoint endpoint. |
trip_type |
string | Optional | single or return. Defaults to single. |
duration_seconds |
integer | Optional | Your router's own travel time. Echoed back untouched, and used to fill duration_text. Omit it and both are null. |
proximity_meters |
integer | Optional | Plaza search radius. Defaults to 500; minimum 50, maximum 10,000. |
Supported formats
format | What it is | Who emits it | Notes |
|---|---|---|---|
google5 |
Google Encoded Polyline, precision 5 | Google Directions, and most providers | The common default. This is what overview_polyline contains. |
google6 |
Encoded Polyline, precision 6 | Mapbox and Valhalla, when asked | The same algorithm at a finer scale. Must be declared: read as precision 5 it decodes elsewhere. |
geojson |
GeoJSON LineString | Anything, including our own responses | A LineString, a Feature wrapping one, or a bare [[lng, lat], …] array. Order is longitude first. |
HERE Flexible Polyline is a different encoding and is not supported yet. Convert it to GeoJSON, or ask HERE for an encoded polyline.
Why you must declare the format
GeoJSON coordinate order
[longitude, latitude], as the GeoJSON specification requires — the
same order our own responses use. Sending [latitude, longitude]
is the most common mistake there is. For Indian routes it is caught, because
the swapped pair lands outside the area we hold data for.
How simplified can the line be?
As simplified as your provider gives you. A two-point line works. Google's
overview_polyline works with no special handling. Your own points
are all kept; we only add points between them, closely enough spaced that a
plaza in the middle of a long straight stretch is still found.
The same road returns the same fare whether you send 3 points or 1,200. Your toll bill does not depend on how hard your map provider simplified the line. There is a test that prices one road at 3, 12, 200 and 1,200 points and fails if the totals differ.
Limits
| Limit | Value |
|---|---|
| Encoded string length | 400,000 characters |
| Points after decoding | 40,000 |
| Minimum points | 2 distinct |
| Search radius | 50 m to 10,000 m, default 500 m |
Consecutive duplicate points are dropped before the count is taken.
Response
Identical in shape to the waypoint endpoint for plazas and
totals, so one parser serves both. The
route block differs, and there is no legs array.
- Distance
- 315.7 km
- Duration
- null
- Toll plazas
- 5
- Toll total
- ₹500
- Sriperumbadur ₹50
- Chennasamaduram ₹160
- Pallikonda Toll Plaza ₹115
- Vaniyambadi Toll Plaza ₹110
- Electronic City Phase 1 Toll Plaza ₹65
totals.complete is true, so every plaza on this route has a published rate and the total is the fare.
{
"success": true,
"data": {
"route": {
"source": "customer_provided",
"format": "google5",
"points_supplied": 13,
"distance_km": 315.7,
"distance_basis": "Measured along the supplied geometry.",
"duration_seconds": null,
"duration_text": null,
"polyline": {
"type": "geojson",
"geojson": {
"type": "LineString",
"coordinates": [[80.2707, 13.0827], [80.017, 13.0332], "…"]
}
}
},
"vehicle": {
"type": "car",
"label": "Car / Jeep / Van",
"netc_class": "VC4",
"trip_type": "single"
},
"plazas": [
{
"id": 19,
"name": "Sriperumbadur",
"code": "360031",
"nh_no": "48",
"location": "Km 37.800",
"lat": 12.982155,
"lng": 79.968944,
"leg_index": 0,
"distance_from_start_km": 35.7,
"fare": {
"amount": 50,
"currency": "INR",
"basis": "flat",
"estimated": false,
"rate_revision": "30 Mar 2027"
},
"closed_loop": null,
"is_closed_loop_plaza": false,
"helpline": {"ambulance": "1033", "crane": "1033"}
}
],
"totals": {
"plaza_count": 5,
"closed_loop_groups": 0,
"toll_fare": 500,
"currency": "INR",
"unpriced_plazas": 0,
"complete": true
}
},
"meta": {
"request_id": "b7d41e90-2c38-4a61-8f05-9ad3e2c71b44",
"generated_at": "2026-11-09T09:04:12+00:00",
"credits_used": 1
}
}
The line drawn here is the decoded sample polyline itself — your browser decoded it with the same algorithm the API uses. route.polyline in the response returns your geometry exactly as you sent it, not our filled version.
Worked example. Plaza names, NETC codes, NH numbers, coordinates and car rates are real rows from our toll data, and field names and structure are exactly what the API returns. The distances are measured along the sample line by the same great-circle sum the endpoint uses — open the playground and press Validate and decode to watch your own browser arrive at the same 315.7 km.
The route block
| Field | Meaning |
|---|---|
source | Always "customer_provided" on this endpoint. Useful if you log both endpoints into one table. |
format | The format we decoded, echoed back. |
points_supplied | How many distinct points your line had after consecutive duplicates were dropped. |
distance_km | Measured along your geometry, not along a route we chose. |
distance_basis | A sentence saying exactly that, so it is visible in a logged response. |
duration_seconds | null unless you sent one. A polyline carries no timing and we will not invent a travel time. |
duration_text | Formatted from duration_seconds, so also null when you send none. |
polyline.geojson | Your line, as you sent it. |
Errors on this endpoint
| Status | error.code | Why |
|---|---|---|
401 |
invalid_key |
No key was sent, or the key is not recognised. |
403 |
revoked_key |
This key was revoked. The message carries the date. |
403 |
expired_key |
This key passed its expiry date. |
403 |
inactive_developer |
The account is not active, so none of its keys work. |
403 |
origin_not_allowed |
The key was used from a browser origin that is not registered for it. |
403 |
feature_unavailable |
Your package does not include the API you called. |
422 |
validation_failed |
The request could not be used. error.details names each field. |
429 |
rate_limited |
Too many requests this minute for your plan. |
429 |
quota_exceeded |
This period's call allowance is used up. |
500 |
server_error |
We failed. Nothing from the exception is returned. |
No 502 on this endpoint. A 502 means a routing service
failed, and this one calls none.
What a 422 means here
- No
formaton a string polyline. Declare it. - The string is not a valid encoding — truncated mid-value, or a character outside the alphabet.
- A decoded point is off the globe. Usually precision 6 sent as
google5. - Fewer than two distinct points after consecutive duplicates were dropped.
- The route falls outside India. Also what a swapped
[lat, lng]pair, or precision 5 sent asgoogle6, looks like from here. - Over a size limit — see the table above.
error.details names the field and the reason in every case, so you
do not have to guess which of these it was.
Other available APIs
Three supporting endpoints. None of them costs a credit, which is on purpose: a limit you have to spend quota to inspect cannot be monitored.
Vehicle Types
https://fastagji.in/api/v1/developer/toll/vehicle-types
Free
The valid values for vehicle_type and trip_type, with
their NETC classes. Worth calling once at startup rather than hard-coding the
list — if we add a class, your dropdown gets it without a deploy.
curl -s https://fastagji.in/api/v1/developer/toll/vehicle-types \
-H "Authorization: Bearer $FASTAGJI_API_KEY"
{
"success": true,
"data": {
"vehicle_types": [
{"type": "car", "label": "Car / Jeep / Van", "netc_class": "VC4"},
{"type": "lcv", "label": "LCV (Light Commercial Vehicle)", "netc_class": "VC5"},
{"type": "bus", "label": "Bus / Mini-Bus / Truck", "netc_class": "VC7"},
{"type": "multiaxle", "label": "Multi-Axle (3 axles)", "netc_class": "VC11"},
{"type": "four_six_axle", "label": "4–6 Axle Vehicle", "netc_class": "VC12"},
{"type": "seven_more_axle", "label": "7+ Axle Vehicle", "netc_class": "VC15"},
{"type": "hcm_eme", "label": "HCM / EME", "netc_class": "VC16"}
],
"trip_types": [
{"type": "single", "label": "Single journey"},
{"type": "return", "label": "Return journey"}
]
},
"meta": {
"request_id": "c41a7b65-3e08-4f52-9ab1-6c0d2e94f817",
"generated_at": "2026-11-09T09:05:02+00:00",
"credits_used": 0
}
}
type is what you send. label is for your own UI.
netc_class is the official NETC class the fare was looked up
under — the value to quote if you are reconciling against a FASTag statement.
Account
https://fastagji.in/api/v1/developer/me
Free
Everything the API knows about the calling key, in one call: the account, the key you authenticated with, the plan, the subscription period, your enforced limits, your feature flags, and usage so far this period. Useful at startup and in a health check.
curl -s https://fastagji.in/api/v1/developer/me \
-H "Authorization: Bearer $FASTAGJI_API_KEY"
{
"success": true,
"data": {
"developer": {
"id": 127,
"name": "Example Integrator",
"email": "dev@example.com",
"company": "Example Integrator Pvt Ltd",
"status": "active",
"verified_at": "2026-11-02T09:02:58+00:00"
},
"key": {
"id": 144,
"name": "production",
"masked": "fgj_live_XXXXXXXXXXXX...YYYY",
"environment": "live",
"expires_at": null,
"last_used_at": "2026-11-09T09:05:40+00:00"
},
"plan": {
"code": "pkg-trial",
"name": "Trial Pack",
"billing_interval": "monthly",
"price": 0,
"currency": "INR"
},
"subscription": {
"status": "trialing",
"current_period_start": "2026-12-01",
"current_period_end": "2026-12-15",
"cancel_at_period_end": false,
"trial_ends_at": "2026-12-15"
},
"limits": {
"calls_per_period": null,
"daily_limit": 25,
"requests_per_minute": 10,
"max_waypoints": 4,
"max_keys": 1,
"overage_price_per_call": null
},
"features": {
"closed_loop_pricing": true,
"per_plaza_breakdown": true,
"polyline_output": true,
"historical_rates": false
},
"usage": {
"period_start": "2026-12-01",
"period_end": "2026-12-15",
"quota": 25,
"used": 8,
"remaining": 17,
"daily_limit": 25,
"used_today": 8,
"remaining_today": 17,
"period_used": 8,
"billing_method": "daily",
"balance": null
}
},
"meta": {
"request_id": "ea708b43-1224-47bf-ba73-6700af85ff43",
"generated_at": "2026-11-09T09:05:40+00:00",
"credits_used": 0
}
}
Reading it
keydescribes the key you authenticated with, not every key on the account.maskedis safe to display and to log.limitsreflects the terms your subscription was sold on (and fordailytrial plans,daily_limitreflects the limit for your Individual or Business account).usage.billing_methodis one ofdaily,balance, orcalls. Ondailyplans,daily_limit,used_today, andremaining_todaytrack today's usage (resetting at midnight), whileperiod_usedtracks total calls across the trial window.nullinlimitsmeans unlimited.0means none.featuresreports what your plan carries. Onlymax_waypointsis enforced today; the other switches are stored and reported but not yet read by any endpoint.planandsubscriptioncan both benullfor an account with no live subscription. Such an account is still served, at a fallback shape, rather than cut off — butlimitsis then the fallback's, not a plan you bought.
Do not call this before every request. The rate-limit and quota headers on your ordinary responses carry the same running numbers for free.
Usage
https://fastagji.in/api/v1/developer/usage
Free
The daily rollup, per endpoint. This is the same data your invoice is computed from — not a separate count kept alongside it — so it is the right thing to reconcile against.
| Parameter | Required | Notes |
|---|---|---|
from | Optional | A date. Defaults to the start of your billing period. |
to | Optional | A date, on or after from. Defaults to the end of your billing period. |
The range must be 366 days or fewer, otherwise 422 validation_failed.
curl -s "https://fastagji.in/api/v1/developer/usage?from=2026-11-01&to=2026-11-30" \
-H "Authorization: Bearer $FASTAGJI_API_KEY"
{
"success": true,
"data": {
"range": {"from": "2026-11-01", "to": "2026-11-30"},
"totals": {"calls": 1310, "billable_calls": 1310, "errors": 4, "credits": 1240},
"daily": [
{
"date": "2026-11-09",
"endpoint": "api.developer.toll.calculate-polyline",
"calls": 86,
"billable_calls": 86,
"errors": 0,
"credits": 86,
"average_duration_ms": 78
},
{
"date": "2026-11-09",
"endpoint": "api.developer.me",
"calls": 2,
"billable_calls": 2,
"errors": 0,
"credits": 0,
"average_duration_ms": 14
}
]
},
"meta": {
"request_id": "9d22f1c4-7b50-4e36-a7d2-13f8b6e05a9c",
"generated_at": "2026-11-09T09:06:11+00:00",
"credits_used": 0
}
}
| Field | Meaning |
|---|---|
calls | Every request, including the free endpoints. |
billable_calls | Requests that counted against you at all. |
errors | Requests that returned 400 or above. |
credits | What the quota and the invoice are computed from. |
average_duration_ms | Mean server time for that day and endpoint. |
calls being higher than credits is normal, not a
discrepancy: the free endpoints are counted as calls and cost nothing.
Reconcile an invoice against credits.
Rows cover the whole account, across all of its keys. A day and endpoint with no traffic has no row rather than a zero row. Per-request detail behind these totals is kept for 90 days and then pruned; the daily totals are kept indefinitely, so an old invoice stays checkable long after the individual calls are gone.
Not here yet. There is no batch endpoint — one route per request — no webhook, and no historical-rate lookup. If one of those is what you need, tell us; it is useful to know what is actually being asked for.
Vehicle types
7 classes. Each maps to the NETC vehicle class the fare is looked up under, and the response tells you which one was used.
vehicle_type |
Label | NETC class |
|---|---|---|
car |
Car / Jeep / Van | VC4 |
lcv |
LCV (Light Commercial Vehicle) | VC5 |
bus |
Bus / Mini-Bus / Truck | VC7 |
multiaxle |
Multi-Axle (3 axles) | VC11 |
four_six_axle |
4–6 Axle Vehicle | VC12 |
seven_more_axle |
7+ Axle Vehicle | VC15 |
hcm_eme |
HCM / EME | VC16 |
Trip types
trip_type | What it prices |
|---|---|
single | One journey. The default. |
return | The published return rate, which is usually valid for 24 hours and cheaper than two singles. Where a plaza publishes no return rate, the single is doubled and fare.estimated is true so you can see which it was. |
Response structure
One envelope on every endpoint. The headers alongside it carry your running quota and rate-limit numbers, so you rarely need to ask for them.
The meta block
| Field | Meaning |
|---|---|
request_id | A UUID for this call, on every response including errors. It is the identifier in our logs — log it, and quote it when you report anything. |
generated_at | When we produced the response. ISO 8601 with an offset. |
credits_used | What this call cost. 0 on the free endpoints. |
Response headers
| Header | On | Meaning |
|---|---|---|
X-RateLimit-Limit | Success | Requests per minute allowed per API key (burst protection). |
X-RateLimit-Remaining | Success | How many requests are left in the current 60-second window for this key. |
X-DailyLimit-Limit | Daily trial | Daily transaction limit configured for your account type (Individual or Business). |
X-DailyLimit-Used | Daily trial | Billable transactions used today (across all keys on your account). |
X-DailyLimit-Remaining | Daily trial | Billable transactions remaining today before midnight reset. |
X-Balance-Limit | Balance pack | Total prepaid INR balance granted for the active package. |
X-Balance-Remaining | Balance pack | Remaining INR balance after this request. |
X-Balance-Currency | Balance pack | Currency code (INR). |
X-Quota-Limit | Daily / Calls | Daily transaction limit (on daily) or period call allowance (on calls). Absent when unmetered. |
X-Quota-Used | Daily / Calls | Billable transactions used today (on daily) or this period (on calls). |
X-Quota-Remaining | Daily / Calls | Billable transactions remaining today (on daily) or this period (on calls). |
X-Quota-Overage | Overage only | 1 when this call was served beyond your included allowance and will be billed at the overage rate. |
Retry-After | 429 | Seconds to wait when rate_limited. Honour it instead of retrying immediately. |
Watch the headers, not the clock. Every successful response
tells you where you stand on both limits, so a well-behaved client can pace
itself without spending a call on GET /me to ask.
Error codes
Branch on error.code, which is stable within v1.
error.message is for a human and may be reworded.
| Status | error.code |
Meaning | What to do | Costs a credit |
|---|---|---|---|---|
401 |
invalid_key |
No key was sent, or the key is not recognised. | Send the key as Authorization: Bearer, or as X-API-Key. Check it was copied in full. | No |
403 |
revoked_key |
This key was revoked. The message carries the date. | Use a current key, or ask us to issue one. | No |
403 |
expired_key |
This key passed its expiry date. | Rotate the key before the expiry date next time. | No |
403 |
inactive_developer |
The account is not active, so none of its keys work. | Contact us. This is an account state, not a key problem. | No |
403 |
origin_not_allowed |
The key was used from a browser origin that is not registered for it. | Register the origin against the key, or call the API from your server, which sends no Origin header. | No |
403 |
feature_unavailable |
Your package does not include the API you called. | Move to a package that includes it. GET /me reports what yours covers. | No |
422 |
validation_failed |
The request could not be used. error.details names each field. | Read error.details. Every entry is a field name and what was wrong with it. | Yes |
429 |
rate_limited |
Too many requests this minute for your plan. | Back off using Retry-After. Watch X-RateLimit-Remaining to avoid it. | No |
429 |
quota_exceeded |
This period's call allowance is used up. | Wait for the period to roll over, or move to a plan that sells overage. | No |
404 |
not_found |
No endpoint at that path under /api/v1/developer. | Check the path against this page. | No |
502 |
upstream_error |
Routing could not answer: no road between the points, or the routing service is unhappy. Waypoint endpoint only. | Retry. If it persists, check the waypoints are on reachable roads. | No |
500 |
server_error |
We failed. Nothing from the exception is returned. | Retry, then send us the meta.request_id from the response. | No |
Which errors are worth retrying
| Retry | Codes | How |
|---|---|---|
| Yes | rate_limited |
Wait for Retry-After, then retry. Better still, pace from X-RateLimit-Remaining. |
| Yes | upstream_error, server_error |
Retry with backoff, a few attempts. Neither costs a credit, so a retry is free. |
| No | invalid_key, revoked_key, expired_key, inactive_developer |
Fix the credential or talk to us. Retrying cannot help, and a retry loop on a 401 just fills your logs. |
| No | validation_failed, not_found |
Fix the request. The same request will fail the same way. |
| No | quota_exceeded |
Depends on your plan's billing_method: on daily (Free Trial), your daily transaction limit resets at midnight; on calls, wait for the billing period to roll over or upgrade; on balance, the prepaid balance is spent or the package has ended — activate a new package. (Note: rate_limited is separate per-key per-minute burst protection.)
|
| No | feature_unavailable, origin_not_allowed |
Nothing about the request will change the answer. Move to a package that includes the API, or register the origin against the key. |
A 422 does cost a credit. The request reached the
calculation before it was rejected. Key problems, rate limits, quota limits
and faults on our side cost nothing.
Usage, credits and pricing
A credit is one route priced on a calculation endpoint. Everything else is free.
What each endpoint costs
| Endpoint | Credits |
|---|---|
POST
/toll/calculate-polyline
|
1 |
POST
/toll/calculate-from-polyline
|
1 |
GET
/toll/vehicle-types
|
Free |
GET
/me
|
Free |
GET
/usage
|
Free |
One credit buys one route. A waypoint call with
alternatives: true prices every
road the router offers, so it costs a credit per route returned — up to 3, and
only one when the router had only one road to offer.
meta.credits_used on the response is always the figure that
reaches your usage. Quota counts calls, not credits: one request is one call
against your monthly allowance however many routes come back.
Billing methods & limits
Every subscription uses one of three billing_method models:
daily(Free Trial): Enforces a daily transaction limit separately for Individual and Business accounts. Usage is aggregated across all API keys on your developer account and resets automatically at midnight.balance(Prepaid Balance Packages): Deducts exact per-endpoint INR rates from your prepaid balance over the package validity window.calls(Call-Quota Plans): Grants a fixed number of billable calls per billing period (monthly/yearly).
Per-minute rate limit vs daily/period quota: rate_limit_per_minute is per-API-key burst protection (returns 429 rate_limited). Daily/period quotas are aggregated across your developer account (returns 429 quota_exceeded). Informational endpoints (/me, /usage, and /toll/vehicle-types) never consume billable transactions or balance.
Available Packages
Start with our 14-day daily-limit Free Trial (no credit card required), or choose a Prepaid Balance Package with 30-day validity and per-call paise billing.
Trial Pack
Free daily transaction limit, 14 days, to build and test an integration. No credit card required.
- ✓ 25 txns/day (Individual)
- ✓ 150 txns/day (Business)
- ✓ 14 days validity period
- ✓ No credit card required
- ✓ 10 req / minute
- ✓ 4 max waypoints
- ✓ 1 API key
Starter Pack
₹6,000 of calls, valid 30 days. Around 4,800 waypoint routes.
- ✓ ₹6,000 call balance granted
- ✓ 30 days validity period
- ✓ ₹3.50/call – Toll from a polyline
- ✓ ₹1.25/call – Toll by waypoints
- ✓ 60 req / minute
- ✓ 4 max waypoints
- ✓ 2 API keys
Basic Pack
₹20,000 of calls, valid 30 days. Around 20,000 waypoint routes.
- ✓ ₹20,000 call balance granted
- ✓ 30 days validity period
- ✓ ₹3.00/call – Toll from a polyline
- ✓ ₹1.00/call – Toll by waypoints
- ✓ 180 req / minute
- ✓ 8 max waypoints
- ✓ 3 API keys
Standard Pack
₹75,000 of calls, valid 30 days. Around 100,000 waypoint routes.
- ✓ ₹75,000 call balance granted
- ✓ 30 days validity period
- ✓ ₹2.25/call – Toll from a polyline
- ✓ ₹0.75/call – Toll by waypoints
- ✓ 600 req / minute
- ✓ 10 max waypoints
- ✓ 5 API keys
Corporate Pack
₹3,00,000 of calls, valid 30 days. Unlimited waypoints.
- ✓ ₹300,000 call balance granted
- ✓ 30 days validity period
- ✓ ₹1.80/call – Toll from a polyline
- ✓ ₹0.60/call – Toll by waypoints
- ✓ 1,200 req / minute
- ✓ Up to 10 waypoints
- ✓ 10 API keys
Detailed plan & package comparison
| Plan / Package | Billing Model | Price | Allowance / Balance | Per-Call / Overage | Validity | Requests / min | Keys | Max waypoints | Action |
|---|---|---|---|---|---|---|---|---|---|
| Starter Pack | Prepaid Pack | ₹6,000/30d | ₹6,000 balance | ₹1.25 – ₹3.50 / call | 30 days | 60 | 2 | 4 | Choose Starter Pack |
| Basic Pack | Prepaid Pack | ₹20,000/30d | ₹20,000 balance | ₹1.00 – ₹3.00 / call | 30 days | 180 | 3 | 8 | Choose Basic Pack |
| Standard Pack | Prepaid Pack | ₹75,000/30d | ₹75,000 balance | ₹0.75 – ₹2.25 / call | 30 days | 600 | 5 | 10 | Choose Standard Pack |
| Corporate Pack | Prepaid Pack | ₹300,000/30d | ₹300,000 balance | ₹0.60 – ₹1.80 / call | 30 days | 1,200 | 10 | 10 (API cap) | Choose Corporate Pack |
Prices are in Indian rupees and exclude taxes (18% GST). Prepaid balance packages deduct exact per-endpoint prices (₹0.30 for from-polyline, ₹0.50 for waypoints) until the balance is exhausted. Higher volumes, annual terms and contractual commitments are arranged by conversation — talk to us.
Running out of calls
| Your plan | What happens past the allowance |
|---|---|
| Sells overage | The call is served and billed at the plan's overage rate. The response carries X-Quota-Overage: 1, so you hear about it at the time. |
| No overage | The call is refused with 429 quota_exceeded until the period rolls over. |
Why your limits may differ from the table
A live subscription holds its own snapshot of the terms it was sold on, so a
change to a plan applies to you at renewal rather than mid-period.
GET /me always reports what will actually be enforced on your
account, which is the figure to trust over this table.
Try it yourself
Build a real request in the browser. Your input is checked against the same rules the server applies, and a polyline is decoded, measured and drawn with the same algorithm the API uses.
Demonstration mode — nothing here calls the API. Every endpoint needs a key, and a key placed in a web page is a published key, so there is none on this page. What you get below is genuine: real validation, a real polyline decode, a real distance measurement, a real coverage check, and the exact request to copy. Toll plaza matching and pricing happen on our servers and need your own key — ask for one, or copy a code example.
Two waypoints here. The endpoint accepts up to 10, subject to your plan — add the rest in your own code.
An encoded string, or a GeoJSON LineString or
[[lng, lat], …] array. The sample loaded here is a real
precision-5 encoding of a 13-point
Chennai to Bengaluru line.
Required for a string. Ignored for an array.
Press “Validate and decode” to build the request body.
- Points decoded
- —
- Line length
- —
- Inside coverage
- —
- Validation
- —
Drawn from your own input, decoded in your browser. No toll plazas are shown, because finding them needs a call to the API.
Press “Validate and decode” to build the command.
Set FASTAGJI_API_KEY in your shell first. Never paste a key
into a web page, including this one.
Want to see real responses without writing code? The Postman collection is the quickest route: import it, set your key once, and every request on this page is there with its assertions.
Code examples
Plain HTTP, in the languages people ask for. Every one reads the key from the environment rather than carrying it.
No official SDKs yet. There is no FastagJi package to install in any language. These are ordinary HTTP calls with your normal HTTP client, which is also the quickest thing to debug.
Toll from waypoints
curl -s -X POST https://fastagji.in/api/v1/developer/toll/calculate-polyline \
-H "Authorization: Bearer $FASTAGJI_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"waypoints": [
{"lat": 13.0827, "lng": 80.2707, "address": "Chennai"},
{"lat": 12.9716, "lng": 77.5946, "address": "Bengaluru"}
],
"vehicle_type": "car",
"trip_type": "single"
}'
<?php
$key = getenv('FASTAGJI_API_KEY');
$ch = curl_init('https://fastagji.in/api/v1/developer/toll/calculate-polyline');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $key,
'Content-Type: application/json',
'Accept: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'waypoints' => [
['lat' => 13.0827, 'lng' => 80.2707, 'address' => 'Chennai'],
['lat' => 12.9716, 'lng' => 77.5946, 'address' => 'Bengaluru'],
],
'vehicle_type' => 'car',
'trip_type' => 'single',
]),
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
$body = json_decode($raw, true);
if (($body['success'] ?? false) !== true) {
// Branch on the code, not the message: the code is stable, the wording is not.
throw new RuntimeException(sprintf(
'%s (%d): %s [request %s]',
$body['error']['code'] ?? 'unknown',
$status,
$body['error']['message'] ?? 'no message',
$body['meta']['request_id'] ?? 'none'
));
}
$totals = $body['data']['totals'];
if (! $totals['complete']) {
// A floor, not the fare. Show it as an estimate.
error_log("{$totals['unpriced_plazas']} plaza(s) have no published rate");
}
printf("%d plazas, %s %d\n", $totals['plaza_count'], $totals['currency'], $totals['toll_fare']);
<?php
use Illuminate\Support\Facades\Http;
$response = Http::withToken(config('services.fastagji.key'))
->acceptJson()
->timeout(20)
->retry(3, 200, throw: false)
->post('https://fastagji.in/api/v1/developer/toll/calculate-polyline', [
'waypoints' => [
['lat' => 13.0827, 'lng' => 80.2707, 'address' => 'Chennai'],
['lat' => 12.9716, 'lng' => 77.5946, 'address' => 'Bengaluru'],
],
'vehicle_type' => 'car',
'trip_type' => 'single',
]);
if ($response->failed()) {
report(new RuntimeException(
$response->json('error.code', 'unknown')
. ': ' . $response->json('error.message', '')
. ' [request ' . $response->json('meta.request_id', 'none') . ']'
));
return null;
}
// Headers worth logging: they are how you notice a limit before you hit it.
logger()->info('fastagji quota', [
'remaining' => $response->header('X-Quota-Remaining'),
'overage' => $response->header('X-Quota-Overage') === '1',
]);
return [
'toll' => $response->json('data.totals.toll_fare'),
'complete' => $response->json('data.totals.complete'),
'plazas' => collect($response->json('data.plazas'))
->map(fn (array $p) => [
'name' => $p['name'],
'km' => $p['distance_from_start_km'],
// null is a missing rate, not a free plaza. Do not coalesce to 0.
'fare' => $p['fare']['amount'],
])
->all(),
];
// Node 18+ — fetch is built in. Server-side only: a key in the browser is a published key.
const BASE = 'https://fastagji.in/api/v1/developer';
export async function tollFromWaypoints(waypoints, vehicleType = 'car') {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 20_000);
try {
const res = await fetch(`${BASE}/toll/calculate-polyline`, {
method: 'POST',
signal: controller.signal,
headers: {
Authorization: `Bearer ${process.env.FASTAGJI_API_KEY}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({ waypoints, vehicle_type: vehicleType, trip_type: 'single' }),
});
const body = await res.json();
if (!body.success) {
const err = new Error(body.error?.message ?? 'request failed');
err.code = body.error?.code; // stable — branch on this
err.requestId = body.meta?.request_id; // quote this when reporting
err.retryable = ['rate_limited', 'upstream_error', 'server_error'].includes(err.code);
throw err;
}
const { totals, plazas } = body.data;
return {
tollFare: totals.toll_fare,
complete: totals.complete, // false means toll_fare is a floor
unpriced: totals.unpriced_plazas,
plazas: plazas.map((p) => ({
name: p.name,
km: p.distance_from_start_km,
fare: p.fare.amount, // may be null; that is not zero
group: p.closed_loop?.group ?? null,
})),
};
} finally {
clearTimeout(timeout);
}
}
import os
import requests
BASE = "https://fastagji.in/api/v1/developer"
RETRYABLE = {"rate_limited", "upstream_error", "server_error"}
class FastagJiError(RuntimeError):
def __init__(self, code, message, request_id):
super().__init__(f"{code}: {message} [request {request_id}]")
self.code = code
self.request_id = request_id
self.retryable = code in RETRYABLE
def toll_from_waypoints(waypoints, vehicle_type="car", trip_type="single"):
response = requests.post(
f"{BASE}/toll/calculate-polyline",
headers={
"Authorization": f"Bearer {os.environ['FASTAGJI_API_KEY']}",
"Accept": "application/json",
},
json={
"waypoints": waypoints,
"vehicle_type": vehicle_type,
"trip_type": trip_type,
},
timeout=20,
)
body = response.json()
if not body.get("success"):
error = body.get("error", {})
raise FastagJiError(
error.get("code", "unknown"),
error.get("message", ""),
body.get("meta", {}).get("request_id", "none"),
)
totals = body["data"]["totals"]
# None is a missing rate, not a free plaza — never sum with `or 0`.
return {
"toll_fare": totals["toll_fare"],
"complete": totals["complete"],
"unpriced_plazas": totals["unpriced_plazas"],
"plazas": [
{"name": p["name"], "km": p["distance_from_start_km"], "fare": p["fare"]["amount"]}
for p in body["data"]["plazas"]
],
}
Toll from your own route
curl -s -X POST https://fastagji.in/api/v1/developer/toll/calculate-from-polyline \
-H "Authorization: Bearer $FASTAGJI_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"polyline": "{eznA{z|hNjtHrpp@j~HrkHbfGros@ztDnjy@{w@~}s@vwAjya@fqWrkf@ftXzp_@wdCrquAotLnp{@_sSzw^orWjeM",
"format": "google5",
"vehicle_type": "car",
"trip_type": "single"
}'
<?php
// You already have a route from your map provider. Price that road, not another one.
$payload = [
'polyline' => $googleDirections['routes'][0]['overview_polyline']['points'],
'format' => 'google5', // what Google Directions returns
'vehicle_type' => 'car',
'trip_type' => 'single',
// Your router already measured the time. Send it and it comes back;
// leave it out and duration_seconds is null rather than invented.
'duration_seconds' => $googleDirections['routes'][0]['legs'][0]['duration']['value'],
];
$ch = curl_init('https://fastagji.in/api/v1/developer/toll/calculate-from-polyline');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('FASTAGJI_API_KEY'),
'Content-Type: application/json',
'Accept: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($body['success'] ?? false) !== true) {
throw new RuntimeException($body['error']['code'] ?? 'unknown');
}
echo $body['data']['route']['distance_km'], " km along your own line\n";
echo $body['data']['totals']['toll_fare'], " INR in tolls\n";
<?php
use Illuminate\Support\Facades\Http;
// GeoJSON needs no `format`: an array can only be GeoJSON.
// Order is [longitude, latitude] — the commonest mistake there is.
$response = Http::withToken(config('services.fastagji.key'))
->acceptJson()
->timeout(20)
->post('https://fastagji.in/api/v1/developer/toll/calculate-from-polyline', [
'polyline' => [
[80.2707, 13.0827],
[79.9689, 12.9821],
[77.5946, 12.9716],
],
'vehicle_type' => 'bus',
'trip_type' => 'return',
]);
abort_if($response->failed(), 502, $response->json('error.message', 'toll lookup failed'));
return [
'source' => $response->json('data.route.source'), // "customer_provided"
'points' => $response->json('data.route.points_supplied'),
'distance' => $response->json('data.route.distance_km'), // measured along your line
'duration' => $response->json('data.route.duration_seconds'), // null — you sent none
'toll' => $response->json('data.totals.toll_fare'),
];
// Straight from a Google Directions response to tolls on that same road.
const BASE = 'https://fastagji.in/api/v1/developer';
export async function tollsForGoogleRoute(googleRoute, vehicleType = 'car') {
const res = await fetch(`${BASE}/toll/calculate-from-polyline`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.FASTAGJI_API_KEY}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
polyline: googleRoute.overview_polyline.points,
format: 'google5',
vehicle_type: vehicleType,
duration_seconds: googleRoute.legs[0].duration.value,
}),
});
const body = await res.json();
if (!body.success) {
// 422 here usually means one of: no format on a string, a bad encoding,
// the wrong precision, or a route outside India. error.details says which.
throw Object.assign(new Error(body.error.message), {
code: body.error.code,
details: body.error.details,
requestId: body.meta?.request_id,
});
}
return body.data;
}
import os
import requests
BASE = "https://fastagji.in/api/v1/developer"
def tolls_for_polyline(encoded, fmt="google5", vehicle_type="car", duration_seconds=None):
"""Price the road you already have. We never reroute it."""
payload = {
"polyline": encoded,
"format": fmt, # required for a string, optional for a list
"vehicle_type": vehicle_type,
}
# Omit it entirely rather than sending None: duration comes back null,
# which is the honest answer when a polyline carries no timing.
if duration_seconds is not None:
payload["duration_seconds"] = duration_seconds
response = requests.post(
f"{BASE}/toll/calculate-from-polyline",
headers={
"Authorization": f"Bearer {os.environ['FASTAGJI_API_KEY']}",
"Accept": "application/json",
},
json=payload,
timeout=20,
)
body = response.json()
if not body.get("success"):
raise RuntimeError(body["error"]["code"], body["error"].get("details"))
route = body["data"]["route"]
print(route["source"], route["points_supplied"], "points", route["distance_km"], "km")
return body["data"]
Postman collection
The quickest way to see real responses without writing anything. Every endpoint
on this page is in it, each with assertions on the envelope, the quota headers
and credits_used, so a broken setup tells you so rather than
looking fine.
- Import the collection.
- Set the
base_urlvariable tohttps://fastagji.in. - Put your key in the
api_keyvariable — as a secret variable, so it is not written into the collection file you might later share. - Run the folder. Start with Vehicle types: it costs nothing.
Ask us for the collection file; it is sent
with your key. We do not publish it here, because a collection with a
base_url and an empty key field invites somebody to paste a key
into a public page.
Three things worth getting right first time
| Do | Why |
|---|---|
Log meta.request_id on every call |
It is the only thing that lets us look at your exact request rather than trying to reproduce it. |
Treat a null fare as unknown, never as 0 |
A ?? 0 turns a missing rate into a free plaza and silently understates the total. |
Check totals.complete before showing a price |
false means the number is a floor. Showing it as the fare is how a customer ends up short at a barrier. |
Frequently asked questions
The questions integrators actually ask, with the answers we actually give.
How do I get a FASTagJi API key?
Developer registration is available via self-service. Choose a subscription plan and register your account with your name, work email, and mobile number to get started.
Is the API key shown again after it is issued?
No. A key is stored only as a SHA-256 hash, so the full key is shown once at issue and cannot be recovered afterwards — not by you and not by us. Put it in your secret store straight away. If it is lost, we revoke it and issue a new one.
What is the difference between the two toll calculation endpoints?
The waypoint endpoint takes up to 10 coordinates and builds the route itself, then prices the plazas on the route it chose. The polyline endpoint takes a route you already have, from Google Maps, Mapbox, HERE or your own router, and prices the plazas on that exact geometry without routing it again. If you already pay a mapping provider for routing, use the polyline endpoint: the tolls then belong to the road your driver is actually on.
Which polyline formats are supported?
Google Encoded Polyline at precision 5, which is what Google Directions returns in overview_polyline; the same algorithm at precision 6, which Mapbox and Valhalla can be asked for; and GeoJSON LineString, including a Feature wrapper or a bare coordinate array. HERE Flexible Polyline is a different format and is not supported yet — convert it to GeoJSON, or ask HERE for an encoded polyline.
Why must I declare the polyline format?
Precision 5 and precision 6 are the same bytes read at different scales, so reading one as the other multiplies or divides your whole route by ten. In one direction the route leaves the globe and we refuse it immediately. In the other, every coordinate is still a legal coordinate and the route lands in the Gulf of Guinea, where there are no Indian toll plazas. Rather than guess and hand you an empty result, we ask. The format field is optional only when you send GeoJSON, because an array cannot be anything else.
Does a simplified polyline give a worse result?
No. We fill in the gaps in supplied geometry before matching plazas, closely enough that a plaza in the middle of a long straight stretch is still found. Google overview_polyline works with no special handling, and the same road returns the same fare whether you send three points or twelve hundred. Your toll total does not depend on how hard your provider simplified the line.
Why is a toll fare sometimes null?
Null means we hold no published rate for that plaza. It never means free. Those plazas are counted in totals.unpriced_plazas, and totals.complete is set to false, so you can tell that the total is a floor rather than the real fare. The alternative — treating a missing rate as zero and adding it — produces a total that looks complete and is wrong.
Why do the plazas in a closed-loop stretch have no individual fare?
On a closed-loop corridor you pay once for where you entered and where you left, not at every barrier. Those plazas share a closed_loop.group, each reports a null fare, and the charge for the whole stretch sits on closed_loop.group_fare. Summing fare.amount across the plazas gives the correct total. Summing group_fare per plaza would charge the stretch once for every barrier on it.
Which vehicle types can I price?
Seven: car, LCV, bus, multi-axle, four to six axle, seven or more axle, and HCM/EME. Each maps to its NETC vehicle class, and the response tells you which class was used. Both single and return journeys are supported, with the return rate taken from the published return column rather than doubled.
How are API calls counted?
One request is one credit on the toll calculation endpoints. The vehicle types, account and usage endpoints are free. Requests that fail because of a key problem, a rate limit, a quota limit, or a fault on our side consume no credit. A 422 validation failure does consume one, because the request reached the calculation.
What happens when I run out of calls?
On a plan that sells overage, the call is served and billed at the plan overage rate, and the response carries an X-Quota-Overage header so you hear about it at the time rather than on the invoice. On a plan without overage, the request is refused with a 429 and the quota_exceeded code. Either way, every successful response carries X-Quota-Limit, X-Quota-Used and X-Quota-Remaining so you can see where you stand without spending a call to ask.
Are there rate limits?
Yes, per minute and per key, taken from your plan rather than from a fixed number. Over the limit returns a 429 with a Retry-After header. Every successful response carries X-RateLimit-Limit and X-RateLimit-Remaining, so a well-behaved client can slow itself down instead of discovering the limit by hitting it.
Which countries are covered?
India only. We hold NHAI and NETC toll data. A route outside India is refused with a 422 rather than returned as a complete calculation with a total of zero, because a zero total would read as "this road is free" when it means "we do not cover this road".
Are there official SDKs?
Not yet. The code examples on this page are plain HTTP integrations in cURL, PHP, Laravel, JavaScript and Python — no FASTagJi package to install. A Postman collection is available, which is the quickest way to see the real responses.
Can I get a route with the tolls, or do I need two calls?
The waypoint endpoint returns the route geometry as GeoJSON alongside the tolls, so one call gives you both. By default it returns the single best route, because a caller asking for one route should not be billed for three. Send alternatives: true and you get every road the router offers instead, each priced on its own.
Can I compare the cheapest route against the fastest one?
Yes. Send alternatives: true to the waypoint endpoint. Every road the router offers between your two points is priced separately, and the response labels each one fastest, cheapest or shortest — lowest duration, lowest toll total, lowest distance. A comparison block says what the cheapest road saves against the fastest and what that saving costs in time and distance. These are the same three rules our own Toll Calculator uses, so the API and the public page answer the same way for the same journey.
What do route alternatives cost?
One credit per route returned, up to three. A call without the flag is one route and one credit, exactly as before alternatives existed. If the router can only offer one road, or the journey has via stops and so has no alternatives at all, you are charged for the one route you got. meta.credits_used on every response is the figure that reaches your usage and your invoice. Quota is separate: one request is one call against your monthly allowance however many routes come back.
How do I report a wrong fare?
Send us the meta.request_id from the response. Every response carries one, and it is the identifier of that request in our logs, so we can look at exactly the call you are asking about rather than trying to reproduce it.
Changelog
Official release notes for FASTagJi Developer Toll APIs. What we hold ourselves to within v1 is listed below.
-
FASTagJi Developer Toll APIs — Initial Launch
The complete suite of FASTagJi Developer Toll APIs is now live, providing route-based toll calculations, toll plaza identification, and vehicle-specific rates across Indian National Highways and Expressways.
- Toll Calculation from Waypoints:
POST /api/v1/developer/toll/calculate-polyline– send up to 10 waypoints to automatically route and calculate plaza-by-plaza toll charges across the entire journey. - Toll Calculation from Existing Route Geometries:
POST /api/v1/developer/toll/calculate-from-polyline– supply your own geometry from Google Maps, Mapbox, HERE, or OSRM ingoogle5,google6, orgeojsonformats, and price the exact road without rerouting. - 7 NETC Vehicle Classes Supported:
GET /api/v1/developer/toll/vehicle-types– free endpoint listing all vehicle classes (Car/Jeep/Van, LCV, 2-Axle Bus/Truck, 3-Axle Commercial, 4-6 Axle, and 7+ Axle) and trip types (single, return, monthly pass). - Account & Period Usage:
GET /api/v1/developer/meandGET /api/v1/developer/usage– inspect active plan, rate limits, remaining quotas, and daily call totals. - Closed-Loop Expressway Pricing: Entry and exit plaza pairs are priced accurately as a continuous journey according to published NETC fare tables.
- Transparent Null Handling: Plazas without gazetted rates report
nulland are counted intotals.unpriced_plazas, never silently misrepresented as zero. - Flexible Billing Models: Support for Prepaid Balance Packages (pay-as-you-go balance with 30-day validity), backed by a real-time usage ledger in the Partner Portal.
- Secure Key Authentication: Dual support for
Authorization: Bearer <key>andX-API-Keyheaders, with self-service key generation.
- Toll Calculation from Waypoints:
What we hold ourselves to within v1
- A field will not be removed or renamed, and its type will not change.
- An
error.codewill not be renamed. Messages may be reworded. - New fields may be added. Treat an unknown field as ignorable rather than as an error, or a routine addition will break your client.
- Anything that cannot be done under those rules goes to
/api/v2/developer, andv1keeps working.
Known limits today
- Self-service sign-up is available. Select a subscription plan to register your developer account.
- Of the plan feature switches, only
max_waypointsis enforced. The others are stored and reported but not yet read by any endpoint. - Key scopes are stored but not enforced; every current key can reach every v1 endpoint.
- No batch endpoint. One route per request.
- HERE Flexible Polyline is not supported yet.
Support
One channel, and one thing to include in your message.
Get a key, or ask anything
Accounts, keys, plans, a wrong fare, a feature you need — all through the same place.
Reporting a wrong fare or plaza
Send the meta.request_id from the response. Every response
carries one, and it identifies that exact call in our logs — so we look at
your request rather than guessing at a reproduction.
If a key has leaked
Tell us straight away and we revoke it. Revocation takes effect on the next request, with no grace period. Quote the key's prefix — the part before the final underscore — never the secret.
Before you write in: if a fare looks wrong, check
fare.rate_revision and totals.complete first. A
plaza's rate may simply have been revised, or the total may be flagged
incomplete already — both are visible in the response you already have.
This page documents v1 of the Developer Toll API and was last updated against the API on .