API

flight-compensation

Runs in your own browser on the page's rules of ten passenger-rights regimes (EU 261/2004, UK 261, Russia, Canada APPR, Turkey SHY, US DOT, Brazil, India, Korea, Montreal-convention fallbacks): the airports set the route and the great-circle distance, the operating carrier (taken from the flight number's airline code when one is given) and the route choose the regime, and the arrival delay, the stated cause and the number of passengers set the amount. Airports are found by IATA code or name (the first suggestion is taken). The result is the page's answer as text: the amount (in total for several passengers, with the per-person rate), the law it comes from, whether it is halved, the confidence, whether the stated cause frees the airline, the distance and the claim deadline. An estimate, not legal advice.

v1 beta browser · 1 tokens headless · 5 tokens

Price (browser): 1 token(s) per call. The exact figure for your file: POST /v1/tools/flight-compensation/estimate.

Price (headless): 1 token(s) + 0.61 tokens per second of our browser's time (billed by the second, at least 5 per call; quoted on the time limit, charged on the actual time and never above the quote); paid plans: −5%, rounded up. The exact figure for your file: POST /v1/tools/flight-compensation/estimate.

Call it

POST https://tembrica.com/v1/tools/flight-compensation/runs
Authorization: Bearer $TIMBRICA_KEY
Idempotency-Key: <your retry-safe key>
Content-Type: application/json

Input

FieldTypeRequiredNotes
from string yes Departure airport: IATA code or name.
max length: 80
to string yes FINAL destination airport (for a connection — the last one): IATA code or name.
max length: 80
arrival_delay_h number yes How late you ARRIVED at the final destination, hours (not the departure delay).
scenario string no `delay` — the flight arrived late; `missed` — a missed connection; `denied` — denied boarding (the delay is that of the replacement flight's arrival).
one of: delay, missed, denied
default: delay
cause string no The cause the airline named; `unknown` when it named none.
one of: unknown, technical, airline_strike, crew_shortage, overbooking, late_inbound, weather, atc_strike, airport_strike, security, bird_strike, medical, hidden_defect
default: unknown
passengers integer no Passengers on the booking.
default: 1
flight_number string no Flight number, e.g. «LH 400»: its airline code sets the operating carrier; `none` when unknown.
default: none
flight_date string no Flight date, YYYY-MM-DD — adds the claim deadline; `none` to leave it out.
default: none

Browser recipe

This tool runs in your own browser. The work order you receive carries this recipe with the placeholders filled in; the selectors below are a versioned contract, not implementation detail — they do not change without a version bump.

{
    "engine": "dom",
    "steps": [
        {
            "action": "click",
            "selector": "[data-tmb-api=\"scenario-{{scenario}}\"]",
            "timeout_s": 120
        },
        {
            "action": "fill",
            "selector": "[data-tmb-api=\"from\"]",
            "value": "{{from}}",
            "timeout_s": 120
        },
        {
            "action": "click",
            "selector": "[data-tmb-api=\"from-pick\"]",
            "timeout_s": 120,
            "appears": "after_run"
        },
        {
            "action": "fill",
            "selector": "[data-tmb-api=\"to\"]",
            "value": "{{to}}",
            "timeout_s": 120
        },
        {
            "action": "click",
            "selector": "[data-tmb-api=\"to-pick\"]",
            "timeout_s": 120,
            "appears": "after_run"
        },
        {
            "action": "fill",
            "selector": "[data-tmb-api=\"flight-no\"]",
            "value": "{{flight_number}}",
            "timeout_s": 120
        },
        {
            "action": "fill",
            "selector": "[data-tmb-api=\"date\"]",
            "value": "{{flight_date}}",
            "timeout_s": 3,
            "optional": true
        },
        {
            "action": "fill",
            "selector": "[data-tmb-api=\"pax\"]",
            "value": "{{passengers}}",
            "timeout_s": 120
        },
        {
            "action": "fill",
            "selector": "[data-tmb-api=\"delay\"]",
            "value": "{{arrival_delay_h}}",
            "timeout_s": 120
        },
        {
            "action": "select",
            "selector": "[data-tmb-api=\"cause\"]",
            "value": "{{cause}}",
            "timeout_s": 120
        },
        {
            "action": "wait",
            "selector": "[data-tmb-api=\"delivered\"]",
            "timeout_s": 60,
            "appears": "after_run"
        },
        {
            "action": "read",
            "selector": "[data-tmb-api=\"result\"]",
            "timeout_s": 30,
            "appears": "after_run"
        }
    ],
    "result": {
        "kind": "text",
        "selector": "[data-tmb-api=\"result\"]",
        "settles": "automatically"
    }
}

This tool shows its result on the page (text) instead of handing over a file. The recipe ends by waiting for the delivered marker — set only once the result of this run is on screen — and reading it. In your browser the result stays on your page; with "lane": "headless" the run returns it in output.text or output.data.

What each action obliges you to do — recipes use nothing else:

uploadPut the input file into the file input matched by `selector` (it may be visually hidden: set it directly, e.g. Playwright setInputFiles). The file must match `accept`.
clickClick the element once it is visible AND enabled. A control that stays disabled means an earlier step did not take effect.
fillReplace the value of a text input with `value`, firing input/change events as typing would.
selectChoose the option whose value is `value` in a <select>.
waitWait until the element is visible, up to `timeout_s` seconds (default 30).
readRead the RESULT shown on the page: the text of the element (a form field's value; the attribute named in `attribute` when the step has one; for `recipe.result.kind` `html_table`, the rows of the table). It is the last step, after the wait for the `delivered` marker, which the page sets only once THIS run's result is on screen. The result is read on your page; it is not returned here — the run reports only that it was delivered.

Race every step against the work order’s abort_when selector (html[data-tmb-run="failed"]). If it matches, the tool refused the job — for example a video that would not get any smaller. Stop, and GET the run: error.detail says why. Nothing is charged.

Errors it can return

validation_failed  insufficient_tokens 

History

  • v1 — 2026-11-26 — Initial release (browser lane, generic form recipe).

This contract cannot change without a new version and a line above: a test compares the published schema, pricing and limits against a committed lockfile and fails the build otherwise. Subscribe to /v1/changelog to be told when something moves.