Darstellung
Planung
Routenoptimierung, CSV-Import, Geokodierung.
| Endpunkt | Anfrage |
|---|---|
| Route der Tour optimieren | POST /v1/tours/{id}/optimize |
| CSV-Import | POST /v1/imports/csv |
| Stopp neu geokodieren oder Punkt von Hand setzen | POST /v1/stops/{id}/geocode |
| Adresse geokodieren | POST /v1/geocode |
Route der Tour optimieren POST
http
POST /v1/tours/{id}/optimizeBerücksichtigt nur offene Stopps; fixierte bleiben stehen.
Anmeldung: API-Schlüssel oder Sitzung eines Admins (mehr)
Parameter
| Name | Ort | Typ | Pflicht | Beschreibung |
|---|---|---|---|---|
id | Pfad | string (uuid) | ja | ID der Ressource. Im Beispiel $TOUR_ID. |
Anfrage
Body als JSON (Content-Type: application/json). Der Body ist optional. Nur offene Stopps werden optimiert; fixierte bleiben stehen.
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
depot_id | string (uuid) | – | Startdepot; Standard: Depot der Tour bzw. Standarddepot. |
return_to_depot | boolean | – | |
respect_time_windows | boolean | – | Zeitfenster berücksichtigen (Standard true). |
apply | boolean | – | false = nur berechnen, Reihenfolge nicht übernehmen (Standard true). |
Beispiel
Vorher setzen: TOUR_ID (Shell-Variable bzw. Umgebungsvariable, siehe Platzhalter).
bash
curl -sS --fail-with-body -X POST "https://api.tourblick.de/v1/tours/$TOUR_ID/optimize" \
-H "Authorization: Bearer $TOURBLICK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"respect_time_windows": true,
"apply": false
}'js
const tourId = process.env.TOUR_ID;
const res = await fetch(`https://api.tourblick.de/v1/tours/${tourId}/optimize`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TOURBLICK_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
respect_time_windows: true,
apply: false,
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const optimizeResult = await res.json();
console.log(optimizeResult);Antwort
200 Erfolgreich · Schema OptimizeResult
json
{
"tour_id": "ae514062-7f81-4293-ae3f-4a5b6c7d8e9f",
"applied": true,
"stop_ids": [
"c0736284-91a3-44b5-8051-6c7d8e9fa0b1",
"bf625173-8092-43a4-bf40-5b6c7d8e9fa0"
],
"total_distance_m": 18450,
"total_duration_s": 2940,
"geometry": {
"type": "LineString",
"coordinates": [
[
13.404954,
52.520008
],
[
13.3694,
52.5251
]
]
},
"unassigned_stop_ids": [],
"warnings": []
}Fehler
| Status | Code | Bedeutung |
|---|---|---|
| 401 | unauthorized | Nicht angemeldet |
| 403 | forbidden | Keine Berechtigung |
| 404 | not_found | Nicht gefunden |
| 422 | validation_failed | Eingabe ungültig |
| 429 | rate_limited | Zu viele Anfragen |
| sonst | internal | Fehler (Format siehe Error) |
Format und Codes: Fehler.
CSV-Import: Vorschau mit Spaltenzuordnung oder Ausführen POST
http
POST /v1/imports/csvAnmeldung: API-Schlüssel oder Sitzung eines Admins (mehr)
Anfrage
Body als JSON (Content-Type: application/json). preview liefert Spalten, Zuordnungsvorschlag und Fehler; execute legt die Stopps an.
Felder aller Varianten
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
csv | string | ja | Inhalt der CSV-Datei (UTF-8). Länge 1–10.000.000 Zeichen. |
delimiter | string | – | Trennzeichen; ohne Angabe automatisch erkannt. Werte: ,, ;, "\t". |
has_header | boolean | – | Erste Zeile enthält Spaltennamen (Standard true). |
mapping | object | – | Ohne Angabe wird die vorgeschlagene Zuordnung genutzt. |
mapping.first_name | integer | – | Bereich mindestens 0. |
mapping.last_name | integer | – | Bereich mindestens 0. |
mapping.company | integer | – | Bereich mindestens 0. |
mapping.address_line | integer | – | Bereich mindestens 0. |
mapping.postal_code | integer | – | Bereich mindestens 0. |
mapping.city | integer | – | Bereich mindestens 0. |
mapping.country | integer | – | Bereich mindestens 0. |
mapping.email | integer | – | Bereich mindestens 0. |
mapping.phone | integer | – | Bereich mindestens 0. |
mapping.external_ref | integer | – | Bereich mindestens 0. |
mapping.notes | integer | – | Bereich mindestens 0. |
mapping.time_window_start | integer | – | Bereich mindestens 0. |
mapping.time_window_end | integer | – | Bereich mindestens 0. |
Zusätzlich bei Variante mode: "preview"
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
mode | string | ja | Werte: preview. |
Zusätzlich bei Variante mode: "execute"
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
mode | string | ja | Werte: execute. |
tour_id | string (uuid) | null | – | Zieltour; null/fehlend = ohne Tour (sofern new_tour fehlt). |
new_tour | object | – | |
new_tour.name | string | ja | Länge 1–200 Zeichen. |
new_tour.planned_date | string (date) | null | – | Datum (YYYY-MM-DD). |
skip_invalid | boolean | – | Fehlerhafte Zeilen überspringen statt abbrechen (Standard true). |
Beispiel
bash
curl -sS --fail-with-body -X POST "https://api.tourblick.de/v1/imports/csv" \
-H "Authorization: Bearer $TOURBLICK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "preview",
"csv": "Nachname;Vorname;Straße;PLZ;Ort;E-Mail;Referenz\nSchmidt;Anna;Venloer Straße 151;50672;Köln;anna.schmidt@example.com;B-100234\nYilmaz;Deniz;Aachener Straße 1;50674;Köln;deniz.yilmaz@example.com;B-100235\n",
"delimiter": ";",
"has_header": true
}'js
const res = await fetch('https://api.tourblick.de/v1/imports/csv', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TOURBLICK_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
mode: 'preview',
csv: 'Nachname;Vorname;Straße;PLZ;Ort;E-Mail;Referenz\nSchmidt;Anna;Venloer Straße 151;50672;Köln;anna.schmidt@example.com;B-100234\nYilmaz;Deniz;Aachener Straße 1;50674;Köln;deniz.yilmaz@example.com;B-100235\n',
delimiter: ';',
has_header: true,
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const csvImportResult = await res.json();
console.log(csvImportResult);CSV aus einer Datei: jq -n --rawfile csv stopps.csv '{mode: "preview", csv: $csv}' erzeugt den Body, curl … -d @- liest ihn von der Standardeingabe.
Antwort
200 Erfolgreich · Schema CsvImportResult
Beispiel-Antwort
json
{
"mode": "preview",
"delimiter": ";",
"columns": [
{
"index": 0,
"header": "Name",
"samples": [
"Schmidt"
]
},
{
"index": 1,
"header": "Vorname",
"samples": [
"Anna"
]
},
{
"index": 2,
"header": "Straße",
"samples": [
"Invalidenstraße 50"
]
},
{
"index": 3,
"header": "PLZ",
"samples": [
"10557"
]
},
{
"index": 4,
"header": "Ort",
"samples": [
"Berlin"
]
}
],
"suggested_mapping": {
"last_name": 0,
"first_name": 1,
"address_line": 2,
"postal_code": 3,
"city": 4
},
"rows_total": 1,
"valid_rows": 1,
"preview_rows": [
{
"row": 2,
"stop": {
"last_name": "Schmidt",
"first_name": "Anna",
"address_line": "Invalidenstraße 50",
"postal_code": "10557",
"city": "Berlin"
}
}
],
"errors": []
}Fehler
| Status | Code | Bedeutung |
|---|---|---|
| 401 | unauthorized | Nicht angemeldet |
| 403 | forbidden | Keine Berechtigung |
| 422 | validation_failed | Eingabe ungültig |
| 429 | rate_limited | Zu viele Anfragen |
| sonst | internal | Fehler (Format siehe Error) |
Format und Codes: Fehler.
Stopp neu geokodieren oder Punkt von Hand setzen POST
http
POST /v1/stops/{id}/geocodeAnmeldung: API-Schlüssel oder Sitzung eines Admins (mehr)
Parameter
| Name | Ort | Typ | Pflicht | Beschreibung |
|---|---|---|---|---|
id | Pfad | string (uuid) | ja | ID der Ressource. Im Beispiel $STOP_ID. |
Anfrage
Body als JSON (Content-Type: application/json). Der Body ist optional.
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
lat | number | – | Punkt von Hand setzen (Status manual); ohne lat/lng neu geokodieren. Bereich -90–90. |
lng | number | – | Bereich -180–180. |
Beispiel
Vorher setzen: STOP_ID (Shell-Variable bzw. Umgebungsvariable, siehe Platzhalter).
bash
curl -sS --fail-with-body -X POST "https://api.tourblick.de/v1/stops/$STOP_ID/geocode" \
-H "Authorization: Bearer $TOURBLICK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"lat": 50.94276,
"lng": 6.93453
}'js
const stopId = process.env.STOP_ID;
const res = await fetch(`https://api.tourblick.de/v1/stops/${stopId}/geocode`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TOURBLICK_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
lat: 50.94276,
lng: 6.93453,
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const stop = await res.json();
console.log(stop);Antwort
200 Erfolgreich · Schema Stop
Beispiel-Antwort
json
{
"id": "bf625173-8092-43a4-bf40-5b6c7d8e9fa0",
"tenant_id": "6a1f0c2e-3b4d-4e5f-8a9b-0c1d2e3f4a5b",
"tour_id": "ae514062-7f81-4293-ae3f-4a5b6c7d8e9f",
"first_name": "Anna",
"last_name": "Schmidt",
"company": null,
"address_line": "Invalidenstraße 50",
"postal_code": "10557",
"city": "Berlin",
"country": "DE",
"lat": 52.5251,
"lng": 13.3694,
"geocode_status": "ok",
"geocode_quality": 0.97,
"email": "anna.schmidt@example.com",
"phone": "+4915112345678",
"external_ref": "B-100234",
"notes": "Hinterhaus, 2. OG",
"time_window_start": null,
"time_window_end": null,
"sequence": 1,
"fixed": false,
"status": "open",
"completed_at": null,
"tracking_url": null,
"created_at": "2026-11-24T08:15:00.000Z",
"updated_at": "2026-11-24T08:15:00.000Z"
}Fehler
| Status | Code | Bedeutung |
|---|---|---|
| 401 | unauthorized | Nicht angemeldet |
| 403 | forbidden | Keine Berechtigung |
| 404 | not_found | Nicht gefunden |
| 422 | validation_failed | Eingabe ungültig |
| 429 | rate_limited | Zu viele Anfragen |
| sonst | internal | Fehler (Format siehe Error) |
Format und Codes: Fehler.
Adresse geokodieren POST
http
POST /v1/geocodeAnmeldung: API-Schlüssel oder Sitzung eines Admins (mehr)
Anfrage
Body als JSON (Content-Type: application/json).
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
address_line | string | ja | Länge 1–300 Zeichen. |
postal_code | string | – | Länge höchstens 20 Zeichen. |
city | string | – | Länge höchstens 120 Zeichen. |
country | string | – | Ländercode ISO 3166-1 alpha-2. Muster ^[A-Z]{2}$. |
Beispiel
bash
curl -sS --fail-with-body -X POST "https://api.tourblick.de/v1/geocode" \
-H "Authorization: Bearer $TOURBLICK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"address_line": "Domkloster 4",
"postal_code": "50667",
"city": "Köln",
"country": "DE"
}'js
const res = await fetch('https://api.tourblick.de/v1/geocode', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TOURBLICK_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
address_line: 'Domkloster 4',
postal_code: '50667',
city: 'Köln',
country: 'DE',
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const geocodeResult = await res.json();
console.log(geocodeResult);Antwort
200 Erfolgreich · Schema GeocodeResult
json
{
"status": "ok",
"best": {
"lat": 52.5251,
"lng": 13.3694,
"quality": 0.97,
"formatted_address": "Invalidenstraße 50, 10557 Berlin, Deutschland",
"address_line": "Invalidenstraße 50",
"postal_code": "10557",
"city": "Berlin",
"country": "DE"
},
"candidates": [],
"provider": "local"
}Fehler
| Status | Code | Bedeutung |
|---|---|---|
| 401 | unauthorized | Nicht angemeldet |
| 403 | forbidden | Keine Berechtigung |
| 422 | validation_failed | Eingabe ungültig |
| 429 | rate_limited | Zu viele Anfragen |
| sonst | internal | Fehler (Format siehe Error) |
Format und Codes: Fehler.