Developers
Outturn API
Push the records your systems already produce into Outturn, and read the findings Outturn detects. A new finding can also be delivered to your own endpoint as a signed webhook. Version 1.0.0.
Quick start
- In Outturn open Settings, Developers and create an API key. Choose what it may do:
ingest:writeto send records,findings:readto read findings. The key is shown once. - Check the key works:
curl https://outturn.eu/api/public/v1/ping \
-H "Authorization: Bearer $OUTTURN_API_KEY"Then send a record. Every request that writes needs an Idempotency-Key:
curl -X POST https://outturn.eu/api/public/v1/records \
-H "Authorization: Bearer $OUTTURN_API_KEY" \
-H "Idempotency-Key: erp-2026-10-08-batch-1" \
-H "Content-Type: application/json" \
-d '{
"record_type": "weighbridge_ticket",
"records": [{
"external_id": "WB-2026-000123",
"ticket_no": "000123",
"measured_at": "2026-10-08T07:30:00+03:00",
"gross_kg": "41250",
"tare_kg": "15310",
"net_kg": "25940",
"tractor_plate": "ABC123"
}]
}'{
"request_id": "5d0a6c1e-2f0e-4c58-9a57-0d6a5e4f2b11",
"record_type": "weighbridge_ticket",
"accepted": 1,
"facts_written": { "measurements": 3 },
"note": "Records are in the ledger. Checks run within about two minutes and new findings are delivered to your webhook endpoints."
}Prefer Python?
import os
import uuid
import requests
response = requests.post(
"https://outturn.eu/api/public/v1/records",
headers={
"Authorization": f"Bearer {os.environ['OUTTURN_API_KEY']}",
"Idempotency-Key": "erp-2026-10-08-batch-1", # reuse the SAME key when you retry
},
json={"record_type": "weighbridge_ticket", "records": [{"external_id": "WB-1", "ticket_no": "1",
"measured_at": "2026-10-08T07:30:00+03:00", "net_kg": "25940"}]},
timeout=30,
)
response.raise_for_status()Authentication
Every call carries Authorization: Bearer otk_.... Keys belong to one workspace: a key can only ever read or write that workspace's data. Keep it on your server; never put it in a browser or a mobile app. A wrong, revoked or expired key always gets the same 401. Rotate a key from Settings; the old key can stay valid for a grace period (default 24 hours) so you can deploy the new one without a gap.
Sending records
- One record type per request, up to 500 records and 2 MB. Every record has your own
external_id. - Checked before anything is written. If any record is invalid the whole request is refused with
422and a list of every problem; nothing is stored. Timestamps need a UTC offset (2026-10-08T07:30:00+03:00), numbers are exact decimals, unknown fields are refused. - Retries are safe. Repeat a request with the same
Idempotency-Keyand body and you get the first answer back (headerIdempotent-Replayed: true). Keys are remembered for 30 days. The same key with a different body is409. Independently, sending the sameexternal_idagain never duplicates a fact. - Corrections. To change a record you sent earlier, send it again with
correction_reason. The earlier version is kept and superseded, never overwritten, so the history stays provable. - Checks run for you. Within about two minutes the deterministic checks run on the new data; findings appear in Outturn and are pushed to your webhooks.
A rejected batch looks like this:
{
"error": { "code": "validation_failed", "message": "2 problem(s) found; nothing was written" },
"errors": [
{ "index": 0, "external_id": "WB-1", "field": "measured_at", "code": "invalid_timestamp",
"message": "measured_at must be an RFC 3339 timestamp with a UTC offset, e.g. 2026-10-08T07:30:00+03:00" },
{ "index": 3, "external_id": "WB-4", "field": null, "code": "missing_one_of",
"message": "at least one of gross_kg, tare_kg, net_kg is required" }
],
"errors_truncated": false
}Record types
Each type maps to the same ledger tables as a file upload, with provenance "API" and your key's name in the audit trail.
Weighbridge ticket weighbridge_ticket
One weighing ticket. Send the gross, tare and/or net weight you have. At least one of: gross_kg, tare_kg, net_kg.
| Field | Type | Required | Meaning |
|---|---|---|---|
| external_id | string | yes | Your own unique id for this record. |
| ticket_no | string | yes | Ticket number as printed by the scale software. |
| measured_at | string (date-time) | yes | When the weighing happened (RFC 3339, with offset). |
| gross_kg | number or string | Gross weight in kilograms. | |
| tare_kg | number or string | Tare weight in kilograms. | |
| net_kg | number or string | Net weight in kilograms. | |
| tractor_plate | string | Tractor plate as read at the gate. | |
| trailer_plate | string | Trailer plate. | |
| lot_code | string | Cargo lot the weighing belongs to. | |
| booking_no | string | Booking or order number. | |
| instrument | string | Scale identifier. | |
| contractual_status | string | CONTRACTUAL if this is the terminal's billing weight, otherwise INFORMATION_ONLY. One of: CONTRACTUAL, INFORMATION_ONLY. |
{
"external_id": "WB-2026-000123",
"ticket_no": "000123",
"measured_at": "2026-10-08T07:30:00+03:00",
"gross_kg": "41250",
"tare_kg": "15310",
"net_kg": "25940",
"tractor_plate": "ABC123",
"lot_code": "LOT-WHEAT-0007"
}Wagon visit wagon_visit
One wagon on a train: identity, arrival and the rail-desk milestones.
| Field | Type | Required | Meaning |
|---|---|---|---|
| external_id | string | yes | Your own unique id for this record. |
| wagon_no | string | yes | 12-digit UIC (check digit validated) or 8-digit 1520 wagon number. |
| train_ref | string | Train number or reference. | |
| consignment_note_no | string | Consignment note (CIM/SMGS) number. | |
| lot_code | string | Cargo lot carried. | |
| arrived_at | string (date-time) | Arrival at the terminal. | |
| departed_at | string (date-time) | Departure. | |
| placement_at | string (date-time) | Placement of the train at the loading/unloading track. | |
| acceptance_at | string (date-time) | Acceptance of the train by the terminal. | |
| completed_at | string (date-time) | Completion of loading or unloading. | |
| documents_handed_over_at | string (date-time) | Documents handed over to the carrier. | |
| waybill_mass_kg | number or string | Mass declared on the waybill, kilograms. |
{
"external_id": "WAGON-2026-10-08-0001",
"wagon_no": "315600270120",
"train_ref": "T-4412",
"arrived_at": "2026-10-08T05:10:00+03:00",
"placement_at": "2026-10-08T06:00:00+03:00"
}Truck visit truck_visit
One truck passing the gate.
| Field | Type | Required | Meaning |
|---|---|---|---|
| external_id | string | yes | Your own unique id for this record. |
| booking_no | string | Booking or order number. | |
| tractor_plate | string | Tractor plate. | |
| trailer_plate | string | Trailer plate. | |
| cmr_no | string | CMR number. | |
| lot_code | string | Cargo lot. | |
| arrived_at | string (date-time) | Gate-in time. | |
| departed_at | string (date-time) | Gate-out time. |
{
"external_id": "GATE-2026-10-08-0042",
"booking_no": "BK-77123",
"tractor_plate": "ABC123",
"arrived_at": "2026-10-08T07:05:00+03:00"
}Vessel call vessel_call
One vessel call with its operational timestamps.
| Field | Type | Required | Meaning |
|---|---|---|---|
| external_id | string | yes | Your own unique id for this record. |
| imo | string | yes | IMO number (7 digits, check digit validated). |
| vessel_name | string | yes | Vessel name. |
| call_ref | string | Your port-call reference. | |
| voyage_no | string | Voyage number. | |
| berth | string | Berth code. | |
| lot_code | string | Cargo lot discharged or loaded. | |
| eta_at | string (date-time) | Estimated arrival. | |
| ata_at | string (date-time) | Actual arrival. | |
| nor_tendered_at | string (date-time) | Notice of readiness tendered. | |
| all_fast_at | string (date-time) | All fast. | |
| discharge_completed_at | string (date-time) | Discharge completed. | |
| loading_completed_at | string (date-time) | Loading completed. | |
| planned_sailing_at | string (date-time) | Planned sailing. | |
| sailing_at | string (date-time) | Actual sailing. |
{
"external_id": "CALL-2026-0921",
"imo": "9074729",
"vessel_name": "MV EXAMPLE",
"call_ref": "KLP-2026-0921-VC07",
"ata_at": "2026-10-08T04:20:00+03:00"
}Stock movement stock_movement
One receipt into or issue out of stock for a cargo lot. At least one of: receipt_t, issue_t, receipt_kg, issue_kg.
| Field | Type | Required | Meaning |
|---|---|---|---|
| external_id | string | yes | Your own unique id for this record. |
| lot_code | string | yes | Cargo lot. |
| moved_at | string (date-time) | yes | When the movement happened. |
| receipt_t | number or string | Received, tonnes. | |
| issue_t | number or string | Issued, tonnes. | |
| receipt_kg | number or string | Received, kilograms. | |
| issue_kg | number or string | Issued, kilograms. | |
| location_code | string | Storage location. | |
| reason | string | Reason or document reference. |
{
"external_id": "STK-2026-10-08-0007",
"lot_code": "LOT-WHEAT-0007",
"moved_at": "2026-10-08T09:00:00+03:00",
"issue_t": "25.94",
"location_code": "SILO-3"
}Invoice line invoice_line
One line of an issued invoice, already billed.
| Field | Type | Required | Meaning |
|---|---|---|---|
| external_id | string | yes | Your own unique id for this record. |
| service_code | string | yes | Service code of the line (e.g. storage, handling). |
| amount | number or string | yes | Line amount. |
| invoice_date | string (date) | yes | Invoice date (YYYY-MM-DD). |
| invoice_ref | string | Invoice number. | |
| quantity | number or string | Quantity billed. | |
| unit | string | Unit of the quantity. | |
| rate | number or string | Rate per unit. | |
| currency | string | ISO 4217 currency code (default EUR). | |
| reference | string | Vessel call, wagon or booking the line bills for. | |
| lot_code | string | Cargo lot. | |
| payer_code | string | Payer party code. |
{
"external_id": "INV-2026-0451-L2",
"service_code": "storage",
"amount": "1840.50",
"invoice_date": "2026-10-08",
"invoice_ref": "INV-2026-0451",
"currency": "EUR",
"reference": "KLP-2026-0921-VC07"
}Carrier statement line carrier_statement_line
One line of a railway carrier's wagon-use or storage statement.
| Field | Type | Required | Meaning |
|---|---|---|---|
| external_id | string | yes | Your own unique id for this record. |
| wagon_no | string | yes | Wagon number (12-digit UIC or 8-digit 1520). |
| service_code | string | yes | wagon-use or storage-organisation. |
| billed_qty | number or string | Hours or days billed. | |
| rate_eur | number or string | Rate in EUR. | |
| amount_eur | number or string | Line amount in EUR. | |
| period_start | string (date) | Start of the billed period. | |
| period_end | string (date) | End of the billed period. | |
| invoice_no | string | Statement or invoice number. | |
| line_no | string | Line number on the statement. | |
| station | string | Station. |
{
"external_id": "LTG-2026-10-L0001",
"wagon_no": "315600270120",
"service_code": "wagon-use",
"billed_qty": "36",
"rate_eur": "1.15",
"amount_eur": "41.40"
}Reading findings
GET /findings returns the findings of your workspace, oldest detection first, with next_cursor for paging. Filter with status, severity, department and detected_since. Each finding carries the rule, the inputs, the tolerance and the money at stake, so you can show the proof next to it.
curl "https://outturn.eu/api/public/v1/findings?severity=HIGH&limit=50" \
-H "Authorization: Bearer $OUTTURN_API_KEY"Webhooks
Add an HTTPS endpoint in Settings, Developers. Each new finding is sent once as a POST with a JSON body. The signing secret (whsec_...) is shown once when you add the endpoint.
{
"id": "evt_9b1c0f2e7d4a4c11a5d3c2b1f0e9d8c7",
"type": "finding.created",
"api_version": "v1",
"created_at": "2026-10-08T07:41:12+00:00",
"data": {
"id": "0b9f7a42-1c5e-4f0b-8d86-4d3a7e5c9a10",
"rule_id": "RAIL-01",
"title": "Wagon use charged beyond free time",
"severity": "HIGH",
"department": "RAIL",
"money_at_stake": { "amount": "1840.50", "currency": "EUR" },
"explanation": "...",
"url": "https://outturn.eu/findings/0b9f7a42-1c5e-4f0b-8d86-4d3a7e5c9a10"
}
}- Verify the signature.
Outturn-Signature: t=<unix seconds>,v1=<hex>, wherev1is HMAC-SHA256 of"<t>." + raw bodywith your secret. Compare in constant time and reject atolder than five minutes: that is your replay protection. - Answer with any 2xx within 10 seconds. Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2, 6, 12 and 24 hours (eight attempts), then marked as given up. Redirects are not followed.
- De-duplicate on
id. It is the same on every retry and on a manual replay. HeadersOutturn-Event-Id,Outturn-Delivery-IdandOutturn-Delivery-Attempthelp with logging. - Delivery log and replay. Settings shows every delivery with its result; Replay sends an event again at any time.
Verification, Node.js:
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyOutturnSignature(secret, header, rawBody, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
const t = Number(parts.t);
if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
const expected = createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest();
const given = Buffer.from(parts.v1 ?? "", "hex");
return given.length === expected.length && timingSafeEqual(given, expected);
}
// Express: use express.raw({ type: "application/json" }) so rawBody is the exact bytes received.
// if (!verifyOutturnSignature(process.env.OUTTURN_WEBHOOK_SECRET, req.get("Outturn-Signature") ?? "", req.body)) return res.sendStatus(400);Verification, Python:
import hashlib
import hmac
import time
def verify_outturn_signature(secret: str, header: str, raw_body: bytes, tolerance: int = 300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
try:
t = int(parts["t"])
except (KeyError, ValueError):
return False
if abs(time.time() - t) > tolerance:
return False
expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))Limits and errors
- Rate limit per key (default 120 requests per minute, set when you create the key). Every response carries
X-RateLimit-LimitandX-RateLimit-Remaining;429comes withRetry-After. - Errors are always
{"error": {"code": "...", "message": "..."}}. Codes you may meet:unauthorized,forbidden,rate_limited,validation_failed,idempotency_key_reused,workspace_read_only,plan_does_not_include_api. - Versioning: the version is in the path (
/api/public/v1). Additive changes (new fields, new record types) do not change the version; anything else would be a new version announced here first. - Every key and webhook action is written to your workspace's audit trail. Keys are stored only as a one-way fingerprint.
Endpoint reference
Base URL https://outturn.eu/api/public/v1. The machine-readable description is the OpenAPI file above.
get/ping
Check your key
Returns the workspace and the scopes of the key you are calling with.
get/record-types
List the record types you can send
post/records
Send records (idempotent)
Send a batch of records of one documented type. The whole batch is checked first: if any record is invalid the response is 422 with every problem and nothing is written.
Idempotency-Key(header) Required. 1-128 characters from A-Z a-z 0-9 . _ : -. A retry with the same key and body returns the first response.
get/findings
List findings
Findings of your workspace, oldest detection first. Page with ``next_cursor``.
status(query) One of OPEN, ACKNOWLEDGED, RESOLVED, DISMISSED, CHECKED_OK.severity(query) One of INFO, LOW, MEDIUM, HIGH, CRITICAL.department(query) One of VESSEL, GATE, WEIGHBRIDGE, RAIL, WAREHOUSE, LAB, CUSTOMS, COMMERCIAL, FINANCE, HSE, MANAGEMENT.detected_since(query) Only findings detected at or after this instant (RFC 3339).cursor(query) Opaque value from next_cursor.limit(query)
get/findings/{finding_id}
Get one finding
finding_id(path, required)