FleetOS API
Dansk: Dette er dokumentationen til udviklere. Bed busselskabet om en API-nøgle – den laves i FleetOS under API og webhooks.
The FleetOS API lets a booking system, tour operator or partner work directly with a coach company's departures in FleetOS: read departures and live ETAs, create bookings – optionally with a taxi from the traveller's door to the coach and back – cancel them, and get webhooks when something changes.
Authentication
The coach company creates an API key in FleetOS and gives it to you. Each key belongs to one company, only has the rights the company ticked, and can be revoked at any time. FleetOS only stores a hash – the key is shown once.
Authorization: Bearer fos_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Base URL: https://api.fleetos.dk. All bodies are JSON (Content-Type: application/json). Times are ISO 8601 (UTC); dates and departure times (dato, afgang) are local Danish time. Field names are Danish – the meaning is listed below.
Departures
The company's departures. fra defaults to today, til to 30 days after fra (max 92 days).
{ "afgange": [ {
"id": "6f1c…", "rute": "Næstved – Berlin", "dato": "2026-12-04", "afgang": "06:30",
"status": "planlagt", "vogn": "12", "pladser": 49, "koerestolspladser": 1, "bestilt": 31,
"forsinkelse_min": 0,
"stop": [ { "nr": 0, "navn": "Næstved Station", "adresse": "Jernbanegade 1, 4700 Næstved", "minutter_efter_start": 0 },
{ "nr": 1, "navn": "Køge Nord", "adresse": "…", "minutter_efter_start": 35 } ]
} ] }
| Field | Meaning |
|---|---|
dato, afgang | Date and departure time from the first stop (local time) |
pladser, bestilt | Seats on the coach, seats booked |
status | planlagt (planned), bekraeftet (running), gennemfoert (completed), aflyst (cancelled) |
forsinkelse_min | Current delay in minutes, from the coach's GPS |
stop[].nr | Stop number – use it as fra_stop / til_stop when booking |
One departure with live ETA per stop (planlagt planned, forventet expected, ankommet arrived), the coach's last position and all bookings.
Bookings
Creates a booking. bookingnr is your booking number and is required: sending the same number again returns the existing booking (status 200, header X-FleetOS-Genkendt) instead of booking twice – safe to retry after a timeout.
curl -X POST https://api.fleetos.dk/api/v1/bus/afgange/6f1c…/bookinger \
-H "Authorization: Bearer fos_…" -H "Content-Type: application/json" \
-d '{
"bookingnr": "TRV-104233",
"navn": "Grete Hansen",
"telefon": "+4512345678",
"antal": 2,
"fra_stop": 1,
"koerestol": false,
"taxa_til_bussen": { "adresse": "Algade 12, 4760 Vordingborg" },
"taxa_fra_bussen": { "adresse": "Algade 12, 4760 Vordingborg" },
"saede_oenske": "Gerne foran",
"sms": true
}'
| Field | Meaning |
|---|---|
bookingnr * | Your booking number (max 60 characters) |
navn *, telefon | Traveller's name and mobile number |
antal | Number of travellers (1–20, default 1) |
fra_stop or afrejsested | Boarding stop: its number, or its name as text |
til_stop | Alighting stop number (default: last stop) |
koerestol | Wheelchair user |
taxa_til_bussen.adresse | Taxi from this address to the boarding stop. It arrives in good time before the coach's planned time. |
taxa_fra_bussen.adresse | Taxi from the alighting stop to this address. It follows the coach's real ETA, so it is there when the coach arrives – also when it is late. |
saede_oenske | A seat wish (noted, not guaranteed) |
sms | false = FleetOS does not text the traveller (you do it yourself). Default: the traveller gets one SMS with a live trip link. |
Answer 201:
{ "booking": { "bookingnr": "TRV-104233", "afgang_id": "6f1c…", "dato": "2026-12-04", "afgang": "06:30",
"navn": "Grete Hansen", "antal": 2, "fra_stop": 1, "til_stop": 3, "saeder": [7, 8], "status": "bekraeftet",
"taxa": [ { "retning": "til_bussen", "status": "bestilt", "afhentning": "2026-12-04T05:20:00.000Z", "adresse": "Algade 12, 4760 Vordingborg" },
{ "retning": "fra_bussen", "status": "bestilt", "afhentning": "2026-12-07T17:43:00.000Z", "adresse": "Algade 12, 4760 Vordingborg" } ] },
"rejselink": "https://kiosk.fleetos.dk/rejse.html#…" }
rejselink is the traveller's live page (taxi, coach, seats) and is only returned once. A booking is rejected with 409 ingen_plads if the coach is full on that stretch, and a taxi is rejected if the address is outside the area the taxi company may drive in.
Status of one booking, including its taxis.
Cancels the booking and its taxis. Nothing is deleted – the status becomes aflyst.
Taxi trips
For taxi companies on FleetOS. The key needs the right taxa (the company ticks it when it creates the key). Prices come from the company's own tariff and are estimates (bindende: false); the company's dispatch assigns the car.
Price estimate and distance. Send fra and til as an address string or { "adresse", "lat", "lon" }. Optional: tidspunkt (night/weekend tariff), passagerer, vogntype.
{ "pris": { "beloeb": 312, "foer_rabat": 312, "nattakst": false, "valuta": "DKK", "takst": "Standard", "bindende": false },
"straekning": { "km": 18.4, "minutter": 21 }, "gyldig_til": "2026-12-01T10:15:00.000Z" }
Books a trip. jeres_reference is your own reference: sending it again returns the existing trip (header X-FleetOS-Genkendt) – safe to retry. Without tidspunkt the trip is for now.
{ "fra": "Jernbanegade 1, 4700 Næstved", "til": { "adresse": "Kastrup Lufthavn", "lat": 55.6180, "lon": 12.6508 },
"tidspunkt": "2026-12-04T05:30:00Z", "passagerer": 2,
"kunde": { "navn": "Anna Hansen", "telefon": "+4512345678" }, "noter": "2 kufferter", "jeres_reference": "HTL-88123" }
One trip, or your trips (newest first, max 200). status: modtaget, tildelt, accepteret, ankommet, ombord, afsluttet, afbestilt.
Cancels the trip (body { "aarsag": "…" } optional). A completed or cancelled trip gives 409 kan_ikke_afbestilles.
Receipt for a completed trip; a 1–5 star rating ({ "stjerner", "kommentar" }); the company's active cars with seats and whether they are free (no positions).
| Status | fejl | Meaning |
|---|---|---|
| 422 | ukendt_adresse, ukendt_rute | The address could not be found – send lat/lon |
| 422 | uden_for_omraade | The company's licence only covers trips that start or end in its area |
| 400 | ugyldigt_tidspunkt, ugyldigt_antal | Time in the past or more than a year ahead; passengers not 1–16 |
Webhooks
The coach company adds your https address in FleetOS and gives you a signing secret (whsec_…). FleetOS then POSTs to you when:
| Event | When |
|---|---|
bus.booking.oprettet | A booking is created through the API |
bus.booking.aflyst | A booking is cancelled – by you or by the coach company |
bus.afgang.forsinket | The coach's expected arrival changes enough to move the taxis home |
tur.oprettet, tur.accepteret, tur.ankommet, tur.afsluttet, tur.afbestilt | Taxi trips (key right taxa): created, accepted by a car, car at the address, completed, cancelled |
test.ping | The company pressed "Send test" |
POST https://your-system.example/fleetos
X-FleetOS-Signatur: t=1764000000,v1=5f2b…
{ "haendelse": "bus.booking.aflyst", "sendt": "2026-12-01T10:00:00.000Z", "data": { "bookingnr": "TRV-104233", … } }
Check the signature before you trust the message: HMAC-SHA256 of "{t}.{raw body}" with the secret, compared to v1, and reject messages older than 5 minutes.
const crypto = require('crypto');
function ok(secret, rawBody, header) {
const p = Object.fromEntries(header.split(',').map((x) => x.split('=')));
if (Math.abs(Date.now() / 1000 - Number(p.t)) > 300) return false;
const want = crypto.createHmac('sha256', secret).update(p.t + '.' + rawBody).digest('hex');
return want.length === p.v1.length && crypto.timingSafeEqual(Buffer.from(want), Buffer.from(p.v1));
}
Answer with any 2xx within 10 seconds. Failed deliveries are retried after 1, 5, 15, 60, 360 and 720 minutes. After 20 failures in a row the receiver is switched off until the company turns it on again.
Errors and limits
Errors have the form { "fejl": "code", "besked": "text" }. React to fejl; besked is for people and may change.
| Status | fejl | Meaning |
|---|---|---|
| 401 | mangler_noegle, ugyldig_noegle | No key, or the key is unknown or revoked |
| 403 | mangler_rettighed | The key does not have the right bus or taxa |
| 404 | findes_ikke | Not found (or belongs to another company) |
| 409 | ingen_plads, allerede_aflyst, afgang_lukket | Full, already cancelled, departure closed |
| 429 | for_mange_kald | More than 120 calls per minute per key |
Questions: help@fleetos.dk