PerDiemo

REST API: Integrations, Authentication & Calculation Engine

PerDiemo User Guide & Statutory Documentation: REST API: Integrations, Authentication & Calculation Engine.

PerDiemo Documentation v1.0 Valid for 2026 Legislation

REST API: Integrations, Authentication & Calculation Engine

Welcome to the official developer documentation for the PerDiemo REST API (v1).

PerDiemo provides an automated calculation and parsing engine for statutory domestic and foreign per diems (cestovní náhrady a stravné), mandatory meal reductions (§ 163 & § 170 of Act No. 262/2006 Coll., Czech Labour Code), decisive Czech National Bank (CNB) exchange rate anchoring (§ 183 ZP), and tamper-proof SHA-256 cryptographic audit trails for tax audit defense.

---

🌐 Base URLs & Environments

EnvironmentBase URLVersionStatus
Production (Official API)`https://api.perdiemo.eu/api/v1``v1`Active / Stable
NOTE: > Interactive OpenAPI documentation (Swagger UI) and machine-readable JSON schemas are live at:
* Swagger UI: https://api.perdiemo.eu/docs
* OpenAPI 3.0 Schema: https://api.perdiemo.eu/openapi.json
* GitHub Developer Gateway: dataquo/PerDiemoEU (API.md)

---

🔐 Dual-Auth Security Architecture

PerDiemo uses a Dual-Auth architecture, allowing external automation agents and accounting connectors to authenticate alongside web users:

Request SourceAuthentication HeaderTarget EndpointsAuthorization & Capabilities
Make.com / Zapier / ERP / Scripts`X-API-Key: pd_live_...`All `/api/v1/*` routes✅ Full Access (Calculation Engine + AI services)
PerDiemo Web Application`Authorization: Bearer `All `/api/v1/*` routes✅ Interactive Session (Authenticated user)
Unauthenticated Request (No Key)(Missing header)All `/api/v1/*` routes❌ HTTP 401 Unauthorized (Authentication required)

Access Mechanisms:

1. API Keys (`X-API-Key`): Recommended for workflow automation (Make.com, Zapier), ERP systems (Pohoda, ABRA Flexi), telematics providers, and backend cron jobs. * Format: `pd_live_` followed by 48 hexadecimal characters. * Keys are stored hashed with SHA-256 in the database. Generate and revoke keys anytime in your Account Settings under REST API Keys*. 2. Mandatory API Authentication (Closed API Architecture): All programmatic endpoints (including `/api/v1/calculate`) strictly require a valid API key in the `X-API-Key` header or a valid JWT bearer token, preventing unauthorized scraper bots or competitors from parasitic engine abuse. 3. Free Tier Evaluation: Every registered user can generate API keys directly in Account Settings and test integrations with 10 free trips per year. For unrestricted one-off calculations, our interactive web calculator runs entirely client-side in the browser.

---

🚀 Core API Endpoints

1. Complete Business Allowance from Text (One-Shot API) (`POST /api/v1/complete-business-allowance-from-text`)

The most powerful endpoint for integration platforms (Make.com, Zapier, n8n, Slack bots, and corporate ERPs). Accepts unstructured travel narratives (meeting notes from Google Calendar, approval emails, Slack trip reports) and performs the entire pipeline in a single atomic call:
1. AI Parsing & Zero-Distance Departure Sanitization: Extracts stops, timestamps, vehicle modes, and free meals using PerDiemo Multi-Modal AI Engine, while enforcing `vzdalenost_km: 0.0` on departure nodes (`ODJEZD`, `NÁVRAT_ODJEZD`) and same-city layovers to prevent double-counting with subsequent OSRM segment distances.
2. OSRM, Flight Geodesics & Stay Duration Preservation: Automatically calculates precise driving distances per transit leg, durations, and inserts detected international border crossings (e.g. `"CZE -> AUT"`) and highway corridor transit stops (`"typ": "PREJEZD"`, `"_synthetic": true`) with 100% parity with the interactive web UI (for flights, applies the recommended 3-hour airport departure buffer). Whenever an overnight leg pushes arrival into a subsequent calendar day (`day_delta > 0`), the refiner shifts all subsequent legs by whole calendar days (`day_delta * 24h`), preserving exact `HH:MM` departure times and multi-day stay durations.
3. Statutory Calculation: Computes domestic and foreign per diems under Czech Labor Code (§§ 163, 170), applies free meal deductions, anchors decisive CNB exchange rates (§ 183 ZP), and generates SHA-256 audit signatures.
4. Optional PDF Report: Compiles an official vector PDF expense report with hybrid delivery.

TIP: > Credit Optimization on Make.com:
Standard multi-step scenarios (Parse ➔ Loop over stops ➔ Estimate legs ➔ Aggregate ➔ Calculate ➔ Export PDF) consume 8–15 Make operations per trip. With `complete-business-allowance-from-text`, your scenario uses only 1 Make operation, dramatically preserving your Make monthly budget!

* Method: `POST`
* URL: `https://api.perdiemo.eu/api/v1/complete-business-allowance-from-text`
* Query Parameters:
`format` (optional)*: `"json"` (default) or `"pdf"` (direct binary `application/pdf` stream).
* Headers:
* `Content-Type: application/json`
* `X-API-Key: pd_live_YOUR_API_KEY_HERE`

#### Request Body Example (JSON):
```json
{
"text": "Leaving Tuesday at 7:00 AM by car from Prague to Vienna for client meetings, returning Wednesday at 4:00 PM to Prague. Hotel breakfast included.",
"year": 2026,
"legislation": "CZ",
"vlastnictvi_vozidla": "SLUZEBNI",
"generate_pdf": true,
"pdf_options": {
"employee_name": "Ing. Jan Novák",
"company_name": "Firma s.r.o.",
"company_ico": "12345678",
"company_address": "Vymyšlená 123, 110 00 Prague 1",
"language": "en"
}
}
```

#### Hybrid Result Delivery — Examples for All 3 Scenarios:

##### Case 1: Standard JSON Response without PDF (`generate_pdf: false`)
Ideal for headless ERP synchronization (ABRA Flexi, Pohoda, iÚčto, CRM) when only statutory numbers and ledger accounts are required:
Returns stable `trip_id`, cryptographic `share_token` (enabling unauthenticated guest access for managers and audit reviewers), and direct URLs for reports and PDF downloads:
```json
{
"trip_id": "C-2026-EA16",
"share_token": "sec_mTULrzcBsh8JOEqINDZOgLfNjyLQtpty",
"report_url": "https://www.perdiemo.eu/en/app/trip/C-2026-EA16?token=sec_mTULrzcBsh8JOEqINDZOgLfNjyLQtpty",
"pdf_download_url": "https://api.perdiemo.eu/api/v1/trips/C-2026-EA16/pdf?token=sec_mTULrzcBsh8JOEqINDZOgLfNjyLQtpty",
"metadata": {
"year": 2026,
"total_trips": 1,
"total_stravne_czk": 2185.50,
"total_kapesne_czk": 0.0,
"total_kraceni_czk": 540.0,
"total_vzdalenost_km": 680.0,
"total_nahrada_vozidlo_czk": 0.0,
"verification_signature": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"trip_reports": [
{
"id_cesty": "CESTA-1",
"ucel_cesty": "Client Meeting in Vienna",
"souhrn_cesty": {
"stravne_zahrani_czk": 2185.50,
"exchange_rate_used": 25.12,
"verification_signature": "7d5a99f603f231d53e8b7ff68189420404e4a4293116a410873cb9e3fb8ebd54"
},
"denni_prehled": [
{
"datum": "2026-06-10",
"trasa": "PRAHA, CZ ➔ WIEN, AT",
"souhrn_dne_czk": { "stravne_po_kraceni_czk": 1130.40 }
}
]
}
],
"parsed_itinerary": [...],
"pdf_base64": null,
"pdf_filename": null
}
```

##### Case 2: JSON Response with Embedded Base64 PDF (`generate_pdf: true`)
Optimal for Make.com and Zapier to both map financial variables into your accounting system and attach the official PDF document in one single step:
```json
{
"trip_id": "C-2026-EA16",
"share_token": "sec_mTULrzcBsh8JOEqINDZOgLfNjyLQtpty",
"report_url": "https://www.perdiemo.eu/en/app/trip/C-2026-EA16?token=sec_mTULrzcBsh8JOEqINDZOgLfNjyLQtpty",
"pdf_download_url": "https://api.perdiemo.eu/api/v1/trips/C-2026-EA16/pdf?token=sec_mTULrzcBsh8JOEqINDZOgLfNjyLQtpty",
"metadata": {
"year": 2026,
"total_stravne_czk": 2185.50,
"verification_signature": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"trip_reports": [...],
"pdf_base64": "JVBERi0xLjQKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDw...",
"pdf_filename": "20261029120000_perdiemo_export_CESTA-1_EN.pdf"
}
```
In Make.com: Simply use `toBinary(pdf_base64; "base64")` to pass the PDF binary directly to Google Drive, Slack, or ERP attachments.

##### Case 3: Direct Binary File Download (`?format=pdf` or `Accept: application/pdf`)
Ideal for CLI tools, cURL scripts, or in-browser direct downloads:
```bash
curl -X POST "https://api.perdiemo.eu/api/v1/complete-business-allowance-from-text?format=pdf" \
-H "Content-Type: application/json" \
-H "X-API-Key: pd_live_YOUR_API_KEY_HERE" \
-d '{
"text": "Leaving Tuesday at 7:00 AM from Prague to Vienna by car, returning Wednesday at 4:00 PM.",
"pdf_options": { "company_name": "Firma s.r.o.", "company_ico": "12345678" }
}' \
--output vyuctovani.pdf
```
HTTP Response: `200 OK`, `Content-Type: application/pdf`, `Content-Disposition: attachment; filename="vyuctovani.pdf"`.

NOTE: > Free Tier Watermarking: In the Free tier, generated PDFs include a watermark (identical to the web UI), allowing integrators to test Make.com templates for free without `403 Forbidden` errors. Paid tiers (Solo, Business, Pro, Enterprise) receive clean vector PDFs.

---

2. Download Stored Trip PDF (`GET /api/v1/trips/{trip_id}/pdf`)

Downloads the official vector PDF travel expense report for a previously calculated and saved trip. Utilizes the unified server-side PDF enricher for 100% pixel-for-pixel visual parity with the web dashboard.

* Method: `GET`
* URL: `https://api.perdiemo.eu/api/v1/trips/{trip_id}/pdf`
* Authentication (Dual-Mode):
* Option A (API Key): Header `X-API-Key: pd_live_...` (or `Authorization: Bearer `).
* Option B (Capability Share Token): Query parameter `?token=sec_...` (No headers required; ideal for direct browser downloads, approval emails, and webhook payloads).
* Query Parameters:
`lang` (optional)*: `"en"` (default) or `"cs"`.
`token` (optional)*: Capability share token (e.g. `sec_mTULrzcBsh8JOEqINDZOgLfNjyLQtpty`). When provided, `X-API-Key` header is not required.
* Headers:
* `X-API-Key: pd_live_YOUR_API_KEY_HERE`

#### Call Example (cURL):
```bash

Option A: Download via API Key


curl -X GET "https://api.perdiemo.eu/api/v1/trips/C-2026-EA16/pdf?lang=en" \
-H "X-API-Key: pd_live_YOUR_API_KEY_HERE" \
-o expense_report_C-2026-EA16.pdf

Option B: Direct Download via Capability Share Token (No Headers Required)

curl -X GET "https://api.perdiemo.eu/api/v1/trips/C-2026-EA16/pdf?token=sec_mTULrzcBsh8JOEqINDZOgLfNjyLQtpty&lang=en" \ -o expense_report_C-2026-EA16.pdf ```

---

3. Statutory Allowance Calculation (`POST /api/v1/calculate`)

The universal calculation endpoint provides a unified JSON contract across international jurisdictions. Specify the target legislation via the optional `legislation` payload attribute:

`"legislation": "CZ"` (default)*: Czech Labor Code (Act No. 262/2006 Coll., § 163 domestic, § 170 foreign, official MPSV/MF decree rates).
* `"legislation": "SK"`: Slovak Travel Allowances Act No. 283/2002 Coll. (coming soon).
* `"legislation": "PL"`: Polish MPiPS per diem statutory decree (coming soon).

With the `legislation` attribute, integrations do not need distinct URLs or duplicate integrations across multi-national subsidiaries — simply pass the jurisdiction code in the request body.

Computes domestic and foreign per diem entitlements, applies legal deductions for employer-provided food (§ 163 / § 170), calculates private vehicle mileage reimbursements (§ 157), and anchors decisive CNB exchange rates.

IMPORTANT: > Zero-Distance Invariant on Departure & Layover Nodes (`vzdalenost_km`): In PerDiemo's itinerary data model, `vzdalenost_km` represents the distance traveled from the previous node to the current node. Driven distances belong strictly on transit, border, and arrival nodes (`HRANICE_PRECHOD`, `PREJEZD`, `ZASTAVKA`, `PRIJEZD`, `HRANICE_NAVRAT`, `KREUZ_NAVRAT`), whereas departure nodes (`ODJEZD`, `NÁVRAT_ODJEZD`) and same-city layovers must always have `vzdalenost_km: 0.0`. Both `/api/v1/parse-itinerary` and `/api/v1/complete-business-allowance-from-text` enforce this invariant automatically.

* Method: `POST`
* URL: `https://api.perdiemo.eu/api/v1/calculate`
* Headers:
* `Content-Type: application/json`
`X-API-Key: pd_live_...` (optional for basic calculations, recommended)*

#### Request Payload Schema (JSON):

```json
{
"year": 2025,
"include_routes": true,
"trips": [
{
"id_cesty": "TRIP-2025-001",
"ucel_cesty": "Client meeting in Vienna",
"vlastnictvi_vozidla": "SLUZEBNI",
"bezplatna_strava": {
"2025-06-11": ["snidane"]
},
"itinerar": [
{
"typ": "ODJEZD",
"datum": "2025-06-10T07:00",
"misto": "Praha",
"country_code": "CZE",
"transport_type": "company_car"
},
{
"typ": "HRANICE_PRECHOD",
"datum": "2025-06-10T09:30",
"misto": "CZE -> AUT",
"country_code": "CZE",
"transport_type": "company_car"
},
{
"typ": "PRIJEZD",
"datum": "2025-06-10T11:00",
"misto": "Wien",
"country_code": "AUT",
"transport_type": "company_car"
},
{
"typ": "NÁVRAT_ODJEZD",
"datum": "2025-06-11T16:00",
"misto": "Wien",
"country_code": "AUT",
"transport_type": "company_car"
},
{
"typ": "HRANICE_NAVRAT",
"datum": "2025-06-11T17:30",
"misto": "AUT -> CZE",
"country_code": "CZE",
"transport_type": "company_car"
},
{
"typ": "KREUZ_NAVRAT",
"datum": "2025-06-11T20:00",
"misto": "Praha",
"country_code": "CZE",
"transport_type": "company_car"
}
]
}
]
}
```

#### Response Example (JSON):

```json
{
"metadata": {
"year": 2025,
"total_trips": 1,
"total_stravne_czk": 2185.50,
"total_kapesne_czk": 0.0,
"total_kraceni_czk": 540.0,
"total_vzdalenost_km": 640.0,
"total_nahrada_vozidlo_czk": 0.0,
"verification_signature": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"trip_reports": [
{
"id_cesty": "TRIP-2025-001",
"stravne_po_kraceni_czk": 2185.50,
"verification_signature": "7d5a99f603f231d53e8b7ff68189420404e4a4293116a410873cb9e3fb8ebd54",
"daily_breakdown": [
{
"datum": "2025-06-10",
"trasa": "PRAHA, CZ ➔ WIEN, AT",
"mena": "EUR",
"narok": 45.0,
"kurz_cnb": 25.12
}
]
}
]
}
```

---

4. AI Magic Wand: Itinerary Parsing (`POST /api/v1/parse-itinerary`)

Extracts unstructured text into structured, chronological trip legs, automatically identifying transport types, border crossings, and free meals.

* Requires Authentication: Yes (`X-API-Key` or `Authorization: Bearer `)

```bash
curl -X POST https://api.perdiemo.eu/api/v1/parse-itinerary \
-H "Content-Type: application/json" \
-H "X-API-Key: pd_live_YOUR_API_KEY_HERE" \
-d '{
"text": "Departed Monday at 7:00 from Prague to Munich for client workshop. Returned Wednesday at 15:00. Hotel included breakfast."
}'
```

---

5. Route, Distance & Border Estimation (`GET /api/v1/estimate-route-leg`)

Estimates driving distance in kilometers, travel duration, and exact border crossing timestamps between two itinerary locations.
* For ground transport (car, bus, train), executes high-performance OSRM routing with border crossing detection (`"COUNTRY_FROM -> COUNTRY_TO"`, e.g. `"CZE -> AUT"`) and automatic highway corridor transit stop (`ZASTAVKA`) synthesis across multi-country routes.
* For air transport, automatically applies the recommended 3-hour airport transit buffer (departure from home/hotel at `takeoff - 3 hours`, border crossing at flight takeoff).

* Method: `GET`
* URL: `https://api.perdiemo.eu/api/v1/estimate-route-leg`
* Query Parameters:
* `origin` (required): Origin city, town, or IATA airport code (e.g. `Praha` or `VIE`).
* `destination` (required): Destination city, town, or IATA airport code (e.g. `Wien` or `TFS`).
* `departure_time` (required): ISO 8601 departure timestamp (e.g. `2026-06-10T07:00`).
* `origin_country` (required): Mandatory 3-letter ISO code of origin (e.g. `CZE`). Guarantees 100% precision for duplicate city names.
* `destination_country` (required): Mandatory 3-letter ISO code of destination (e.g. `AUT`).
* `transport_type` (optional): Transportation mode (`company_car`, `private_vehicle`, `plane`, `train`, `bus`, `ferry`).

#### Example cURL & Multi-Country Transit Response (`ZASTAVKA` Corridor Synthesis):
```bash
curl -X GET "https://api.perdiemo.eu/api/v1/estimate-route-leg?origin=Praha&destination=Wien&departure_time=2026-06-10T07:00&transport_type=company_car&origin_country=CZE&destination_country=AUT" \
-H "X-API-Key: pd_live_YOUR_API_KEY_HERE"
```

When a route transits through intermediate countries (e.g. Brno (`CZE`) ➔ Ghent (`BEL`) via Germany and the Netherlands), the endpoint automatically synthesizes border crossings (`"type": "border"`, `"misto": "CZE -> DEU"`) and highway corridor transit stops (`"type": "stop"`, `"country_code": "DEU"`), which map directly to `HRANICE_PRECHOD` and `PREJEZD` / `ZASTAVKA` (`"_synthetic": true`) itinerary nodes. For multi-day trips with overnight transit legs, the refiner automatically shifts subsequent departures by whole calendar days (`day_delta * 24h`) to preserve the user's intended stay duration:
```json
{
"distance_km": 990,
"duration_seconds": 34000.0,
"arrival_time": "2026-11-12T15:26:40",
"legs": [
{ "type": "border", "misto": "CZE -> DEU", "time": "2026-11-12T09:05:54", "distance_km": 325, "transport_type": "company_car" },
{ "type": "stop", "misto": "Nürnberg", "country_code": "DEU", "time": "2026-11-12T11:20:00", "distance_km": 245, "transport_type": "company_car" },
{ "type": "border", "misto": "DEU -> NLD", "time": "2026-11-12T13:39:49", "distance_km": 245, "transport_type": "company_car" },
{ "type": "stop", "misto": "Maastricht", "country_code": "NLD", "time": "2026-11-12T13:49:00", "distance_km": 18, "transport_type": "company_car" },
{ "type": "border", "misto": "NLD -> BEL", "time": "2026-11-12T13:59:35", "distance_km": 17, "transport_type": "company_car" },
{ "type": "stop", "misto": "Ghent", "country_code": "BEL", "time": "2026-11-12T15:26:40", "distance_km": 140, "transport_type": "company_car" }
]
}
```

---

6. PDF Travel Expense Report Generation (`POST /api/v1/export/pdf`)

Renders a compliant, print-ready travel order and expense settlement PDF report adhering to Czech Labor Code and tax reporting standards.

IMPORTANT: > Enterprise Tier Exclusive: Automated programmatic generation of PDF reports via the external API (`/api/v1/export/pdf`) is restricted to accounts with an active Enterprise subscription. Solo and Business tier subscribers can generate and download unlimited PDF reports interactively within the PerDiemo web dashboard. If you need automated API PDF generation for your ERP/accounting pipeline, please reach out to info@perdiemo.eu. Requests from non-Enterprise accounts receive `HTTP 403 Forbidden`.

* Method: `POST`
* URL: `https://api.perdiemo.eu/api/v1/export/pdf`
* Requires Authentication: Yes (`X-API-Key` or `Authorization: Bearer `, Enterprise tier required)
* Response Content-Type: `application/pdf` (binary file stream)

#### Request Headers:
* `Content-Type: application/json`
* `X-API-Key: pd_live_YOUR_API_KEY_HERE`

#### Request Payload Example (JSON):

```json
{
"language": "en",
"employee_name": "John Doe",
"company_name": "Acme Global s.r.o.",
"company_address": "Vymyšlená 123, 110 00 Prague 1",
"company_ico": "12345678",
"trips": [
{
"id_cesty": "TRIP-2026-001",
"ucel_cesty": "Client meeting in Vienna",
"total_stravne": 2185.50,
"trip_total": 2185.50,
"days": [
{
"datum": "2026-06-10",
"trasa": "PRAGUE, CZ ➔ VIENNA, AT",
"stravne": 1130.40,
"strava": "-",
"hodiny": 8.0
}
]
}
]
}
```

#### Example cURL Request with File Output:

```bash
curl -X POST https://api.perdiemo.eu/api/v1/export/pdf \
-H "Content-Type: application/json" \
-H "X-API-Key: pd_live_YOUR_API_KEY_HERE" \
-d @trip_export.json \
--output travel_expense_report.pdf
```

---

7. Account Quota & Usage Status (`GET /api/v1/user/usage`)

Programmatically inspects your active tier limits, consumed trip quotas, and AI OCR allocations for the current billing cycle.

* Method: `GET`
* URL: `https://api.perdiemo.eu/api/v1/user/usage`
* Requires Authentication: Yes (`X-API-Key` or `Authorization: Bearer `)

#### Example Request (cURL):

```bash
curl -X GET https://api.perdiemo.eu/api/v1/user/usage \
-H "X-API-Key: pd_live_YOUR_API_KEY_HERE"
```

#### Example Response (JSON):

```json
{
"tier": "solo",
"billing_cycle": "yearly",
"reset_date": "2027-01-15T00:00:00Z",
"trips_used_this_year": 12,
"max_trips_per_year": 36,
"ai_used_this_year": 5,
"max_ai_analyses_per_year": 40,
"max_users": 1,
"role": "user"
}
```

---

8. Statutory Country & Currency Mappings (`GET /api/v1/country-mappings`)

Returns statutory ISO 3166-1 alpha-3 and alpha-2 country codes, bilingual localized names, and default per diem currencies. Use this dataset to validate `country_code` values prior to submitting trips to the calculation engine.

* Method: `GET`
* URL: `https://api.perdiemo.eu/api/v1/country-mappings`
Requires Authentication: No (Public reference data)*

#### Example Request (cURL):

```bash
curl -X GET https://api.perdiemo.eu/api/v1/country-mappings
```

#### Example Response (JSON):

```json
{
"names": {
"CZE": "Česká republika",
"DEU": "Německo",
"AUT": "Rakousko",
"SVK": "Slovensko"
},
"names_en": {
"CZE": "Czechia",
"DEU": "Germany",
"AUT": "Austria",
"SVK": "Slovakia"
},
"three_to_two": {
"CZE": "CZ",
"DEU": "DE",
"AUT": "AT",
"SVK": "SK"
},
"two_to_three": {
"CZ": "CZE",
"DE": "DEU",
"AT": "AUT",
"SK": "SVK"
}
}
```

---

9. API Version & Health Check (`GET /api/v1/version` and `GET /version`)

Returns the current active version of the PerDiemo statutory engine. Suitable for automated health checks, uptime monitoring (UptimeRobot, Datadog), and client compatibility inspection.

* Method: `GET`
URL: `https://api.perdiemo.eu/api/v1/version` (or `https://api.perdiemo.eu/version`)*
Requires Authentication: No (Public health check)*

#### Example Request (cURL):

```bash
curl -X GET https://api.perdiemo.eu/api/v1/version
```

#### Example Response (JSON):

```json
{
"status": "online",
"version": "1.0.22",
"api_version": "v1",
"service": "perdiemo-backend"
}
```

---

💻 Code Integration Examples

Python (`requests`)

```python
import requests

API_KEY = "pd_live_YOUR_API_KEY_HERE"
BASE_URL = "https://api.perdiemo.eu/api/v1"

headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}

payload = {
"year": 2026,
"trips": [
{
"id_cesty": "TRIP-PY-01",
"ucel_cesty": "Branch Audit Brno",
"vlastnictvi_vozidla": "SLUZEBNI",
"itinerar": [
{"typ": "ODJEZD", "datum": "2026-03-01T08:00", "misto": "Praha", "country_code": "CZE"},
{"typ": "PRIJEZD", "datum": "2026-03-01T17:00", "misto": "Brno", "country_code": "CZE"}
]
}
]
}

response = requests.post(f"{BASE_URL}/calculate", json=payload, headers=headers)
data = response.json()
print("Allowances in CZK:", data["metadata"]["total_stravne_czk"])
print("Cryptographic Signature:", data["metadata"]["verification_signature"])
```

JavaScript / Node.js (`fetch`)

```javascript
const API_KEY = 'pd_live_YOUR_API_KEY_HERE';
const BASE_URL = 'https://api.perdiemo.eu/api/v1';

async function calculateTrip() {
const res = await fetch(`${BASE_URL}/calculate`, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
year: 2026,
trips: [{
id_cesty: 'TRIP-NODE-01',
ucel_cesty: 'Bratislava Conference with Return',
kapesne_procento: 40,
itinerar: [
{ typ: 'ODJEZD', datum: '2026-04-10T07:00', misto: 'Praha', country_code: 'CZE' },
{ typ: 'HRANICE_PRECHOD', datum: '2026-04-10T10:00', misto: 'Lanžhot', country_code: 'CZE' },
{ typ: 'PRIJEZD', datum: '2026-04-10T11:00', misto: 'Bratislava', country_code: 'SVK' },
{ typ: 'ODJEZD', datum: '2026-04-12T14:00', misto: 'Bratislava', country_code: 'SVK' },
{ typ: 'HRANICE_NAVRAT', datum: '2026-04-12T15:00', misto: 'Lanžhot', country_code: 'CZE' },
{ typ: 'PRIJEZD', datum: '2026-04-12T19:00', misto: 'Praha', country_code: 'CZE' }
]
}]
})
});

const result = await res.json();
const trip = result.trip_reports[0];

console.log('Total per diem (CZK):', trip.souhrn_cesty.stravne_po_kraceni_czk);
console.log('Pocket money (CZK):', trip.souhrn_cesty.kapesne_czk);
console.log('Foreign per diem (EUR):', trip.souhrn_cesty.stravne_zahrani_eur);
console.log('CNB exchange rates used:', trip.souhrn_cesty.exchange_rates_used);
console.log('Cryptographic audit signature:', result.metadata.verification_signature);
}
```

---

🔄 Make.com & Zapier Integration

1. Add a HTTP ➔ Make a request module in Make.com.
2. Target URL: `https://api.perdiemo.eu/api/v1/calculate`
3. Method: `POST`
4. Headers:
* `X-API-Key`: `pd_live_YOUR_KEY`
* `Content-Type`: `application/json`
5. Body type: `Raw` (JSON), mapping fields from Google Calendar, CRM, or form entries.
6. The response supplies itemized allowances and SHA-256 signatures ready to feed into accounting or trigger notifications.

---

❓ Developer Support & Enterprise Integrations

Need custom ERP integrations, volume packages, or telematics feeds?
* Support Email: info@perdiemo.eu
* Operator: DataQuo s.r.o., Rybná 716/24, Staré Město, 110 00 Praha 1, Czechia, ID: 08617139

---

⚠️ Error Codes & Troubleshooting

When an API request encounters an issue, the server responds with a descriptive JSON payload:

HTTP StatusError TypeRoot CauseRecommended Action
`400 Bad Request``JSON decode error`Malformed JSON syntax (e.g. unescaped quotes or single-quote stripping in PowerShell).Use proper JSON escaping, pass a `@file.json`, or use PowerShell `Invoke-RestMethod`.
`401 Unauthorized``Authentication required`Missing or invalid `X-API-Key` header on a protected endpoint.Verify your header `-H "X-API-Key: pd_live_..."` and ensure the key is active in Account Settings.
`422 Unprocessable Entity``Field required`Request payload schema mismatch (e.g. submitting raw `{"text": ...}` to `/calculate` instead of `{"trips": [...]}`).Check endpoint requirements: unstructured text belongs in `/parse-itinerary`, structured trips in `/calculate`.
`429 Too Many Requests``Rate limit exceeded`Sliding window rate limit exceeded (60 req/min for unauthenticated callers).Wait 60 seconds or supply an authenticated `X-API-Key` to enjoy higher throughput.
`402 Payment Required``Plan limit reached`Account reached its annual trip or AI volume quota under the active tier.Upgrade your subscription tier or await the start of the next billing cycle.

Recommended Links & Related Sections