Send completed rides to Tomcabs
For dispatch platforms. The driver connects your platform once; every ride you dispatch to them then lands in their shift, road sheet and accounts, as if they had recorded it in Tomcabs.
The API opens soon. Dispatch platforms can request early access now.
- 1
The driver connects
They sign in to Tomcabs, pick their fleet and allow your platform.
GET /oauth/authorize
- 2
You get a token
Your server exchanges the code for tokens bound to that driver and fleet.
POST /api/v1/oauth/token
- 3
You send each ride
One idempotent call per completed ride, retried safely.
PUT /api/v1/rides/{id}
How a connection works
Every rule follows from one idea: the driver decides who may write rides for them, and your platform only ever acts through that decision.
You never name a driver
You can't send
driver_id = 384. The driver authorizes your platform for one fleet, and your token is that connection.The token does one thing
Create, correct and read back the rides you sent for this driver in this fleet. It can't read their other rides, shifts, earnings, documents or the fleet.
Source and payment stay apart
Your platform is
recordedas the ride's source.payment_methodonly says how the customer paid.A completed shift never changes
Once the shift is closed, its rides are part of the road sheet. A manager corrects them in Tomcabs.
Either side can end it
The driver or a manager disconnects you in Tomcabs, you revoke the token, or the driver leaves the fleet.
Quick start
Building with a coding agent? Paste this prompt into it. It reads this page and builds the integration in your codebase, then stops for your credentials.
Integrate the Tomcabs Dispatch API into this codebase. Read the documentation first: https://www.tomcabs.com/developers/dispatch and the OpenAPI spec at https://www.tomcabs.com/openapi.json (tag "Dispatch API").
1. Add a "Connect Tomcabs" action for drivers that starts the OAuth 2.0 authorization code flow with PKCE (S256) and a random state, and a callback route that checks the state and exchanges the code on the server with client_secret_basic.
2. Store the access token, the single-use refresh token and the connection_id per driver, server-side and encrypted, using the project's existing secret storage. Never send them to a browser or an app.
3. When a ride is completed, send it with PUT /api/v1/rides/{our ride id}. Map our payment method to cash, card or invoice. Retry the same PUT on network errors, timeouts and 5xx; never retry a 4xx unchanged.
4. On 401, refresh once; if that fails, mark the connection as disconnected and ask the driver to connect again.
5. Read the client id and secret from configuration. If they are not set, stop and ask me instead of inventing values.
6. Add tests for the payment mapping, the retry rule and the token refresh, using the project's test setup.1. The driver connects
Create a PKCE verifier (43 to 128 characters) and its S256 challenge, then send the driver's browser to the consent page. Add workspace=<fleet slug> to preselect the fleet.
https://www.tomcabs.com/oauth/authorize ?response_type=code &client_id=tcp_3f1c… &redirect_uri=https%3A%2F%2Fdispatch.example%2Ftomcabs%2Fcallback &scope=rides%3Awrite &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM &code_challenge_method=S256 &state=af0ifjsldkjThe driver signs in if needed, chooses the fleet and allows. Tomcabs redirects to your redirect_uri with code and state, or with error=access_denied if they cancel. The code works once, for 10 minutes.
Redirect URIs must match a registered one exactly. https only; http://localhost is accepted for development.
2. Exchange the code
Exchange the code from your server, with your client credentials in HTTP Basic (or as client_id and client_secret form fields).
POST /api/v1/oauth/tokenAuthorization: Basic base64(client_id:client_secret)Content-Type: application/x-www-form-urlencodedgrant_type=authorization_code&code=tcc_…&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk&redirect_uri=https%3A%2F%2Fdispatch.example%2Ftomcabs%2Fcallback&external_account_id=DRV-48213external_account_id is your id for this driver. Tomcabs shows it to the driver and their manager, next to your platform's name. One id is one driver: an id already connected to another driver of the workspace answers 400 invalid_request, and the code still works for a retry.
{ "access_token": "tca_…", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "tcr_…", "scope": "rides:write", "connection_id": "6f0c2a4e-…"}- Access tokens last one hour. Refresh tokens last 90 days and work once: each refresh returns a new pair.
- A used refresh token presented again revokes the whole connection, so a stolen copy stops working. The driver connects again.
- Connecting the same driver to the same fleet again keeps the connection and its rides, and replaces the tokens.
- Keep tokens on your servers. Never in an app or a browser.
POST /api/v1/oauth/tokenAuthorization: Basic base64(client_id:client_secret)Content-Type: application/x-www-form-urlencodedgrant_type=refresh_token&refresh_token=tcr_…Who the token is connected as: the fleet's name, the driver's first name and your external_account_id. Useful for "Connected to Tomcabs, Taxi Dupont" in your app.
GET /api/v1/connectionAuthorization: Bearer tca_…To disconnect from your side. Always answers 200, even for an unknown token.
POST /api/v1/oauth/revokeAuthorization: Basic base64(client_id:client_secret)Content-Type: application/x-www-form-urlencodedtoken=tcr_…3. Send a completed ride
Send each ride once it is completed, at the path of your own ride id. The same call creates it, corrects it, or changes nothing if you send it again.
PUT /api/v1/rides/DSP-2026-000123Authorization: Bearer tca_…Content-Type: application/json{ "started_at": "2026-11-24T14:05:00+01:00", "ended_at": "2026-11-24T14:23:00+01:00", "pickup": { "address": "Gare du Midi, 1060 Saint-Gilles", "lat": 50.8357, "lng": 4.3361 }, "dropoff": { "address": "Place Flagey, 1050 Ixelles", "lat": 50.8272, "lng": 4.3722 }, "distance_m": 6400, "fare": 23.50, "tip": 2.00, "payment_method": "cash"}| Field | Required | Rule |
|---|---|---|
{id} | Yes | Your ride id, in the path. [A-Za-z0-9._:-], 1–128 characters, the same on every retry. |
started_at, ended_at | Yes | ISO 8601 with a UTC offset. The ride ends after it starts, at most 24 hours later, and not in the future. |
pickup.address, dropoff.address | Yes | 1–300 characters. |
pickup.lat/lng, dropoff.lat/lng | No | Decimal degrees. Send both or neither. |
distance_m | No | Whole metres driven with the customer. Fills the meter reading. |
fare | Yes | EUR paid for the ride, without the tip. 0–10 000, two decimals at most. |
tip | No | EUR. Defaults to 0. |
payment_method | Yes | cash, card (Bancontact or any card) or invoice. How the customer paid, not who dispatched the ride. |
notes | No | Up to 1000 characters. |
Unknown fields are refused, so a typo fails loudly instead of being lost. Bodies are limited to 16 KB.
Responses and retries
Every answer is JSON, never cached. Errors carry error, and a 422 adds issues with each field.
| Status | Meaning |
|---|---|
201 | Created. |
200 | Already known: unchanged, or corrected (revision goes up). |
401 invalid_token | Expired, revoked or unknown token, or the driver left the fleet. Refresh, or ask the driver to connect again. |
409 ride_locked | The ride is in a completed shift. It can no longer change through the API. |
415 | The body is not JSON. |
422 invalid_ride | The ride breaks a rule. issues lists each field and why. |
HTTP/1.1 201 Created{ "id": "DSP-2026-000123", "status": "recorded", "shift_status": "active", "revision": 1, "received_at": "2026-11-24T13:23:04Z", "updated_at": "2026-11-24T13:23:04Z"}status is recorded (in a shift), held (waiting for the driver or a manager) or dismissed (set aside in Tomcabs). GET /api/v1/rides/{id} returns the same object.
What happens in Tomcabs
A ride that started during the driver's active shift becomes a completed ride of that shift at once, with its fare, tip, addresses, Brussels times and payment method. The meter reading continues from the shift's last ride plus distance_m. Shift totals and the road sheet include it.
Any other ride is held under Settings → Connected apps. The driver or a manager records it in one of the driver's shifts from that day or the day before, or sets it aside. Nothing is lost.
card maps to the fleet's Bancontact method, cash to Cash and invoice to its invoice method. Your platform takes no commission through Tomcabs; only the fleet's own rules for that payment method apply.
Getting access
The Tomcabs team registers each platform by hand. Write to us with:
- your platform's name and website,
- your redirect URIs, for production and for testing,
- the page in your platform where a driver starts connecting, which the Connect button in Tomcabs opens,
- a technical contact.
You receive your client_id and client_secret through a private channel. The secret is shown once and Tomcabs keeps only its hash. Before you go live, we set up a test fleet with test drivers and register your platform there.