> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truckaurbus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Nazar

> Your fleet's own record, through your key.

Nazar is the fleet desk's eyes: the phone in the cab sends a position every ten minutes, the box grades it, and the record it forms is yours. Every key, on every tier, reads its owner's fleet with the `nazar:read` scope; nobody reads anyone else's.

| Resource                               | What it returns                                                                                                                                                                                                   |
| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /v1/nazar/fleet`                  | Every truck's status (`moving`, `stopped`, `silent`, `never`), last fix with its grade, kilometres today, the holder; the people and their keys (never the pairing code); open alerts; the cadence and thresholds |
| `GET /v1/nazar/vehicles/{id}?hours=24` | One truck's day: the track with a grade per point, stops with places, trips, alerts, the corridor ahead with weather and traffic, company (your own phones heard nearby), the clock and place counts              |
| `GET /v1/nazar/corridors`              | The runs your fleet makes, routed, with the weather ahead and traffic where enabled                                                                                                                               |
| `GET /v1/nazar/anchors`                | Each day's chain head digested and anchored to Bitcoin through OpenTimestamps, with its status                                                                                                                    |
| `GET /v1/nazar/anchors/{day}/proof`    | One day's `.ots` proof, base64, with the heads and the digest                                                                                                                                                     |

Every figure carries its grade, and the grade is the point. A fix is `seen` (the phone's word), `checked` (no mock provider reported, within 100 m, a plausible speed from the previous fix, the clock not disputed) or `witnessed` (another phone's checked fix vouches for it). A fix's time is `anchored` (bound between a public randomness pulse and our receipt), `disputed` (the phone's own clock contradicts the pulse) or `self`. Trips, stops, corridors and ETAs are `MODELLED`; alerts are evidence, never verdicts. Show the grade beside the number.

Keys, assignments and the pairing code stay on the desk: the API reads, it does not drive.

## Verify a truck at the roadside

For mechanics, tyre shops, fuel pumps and breakdown desks. The driver's Pinger shows six digits that change every thirty seconds. Type the registration and the code into `POST /v1/nazar/verify` with your own key (`nazar:verify`, every tier):

```json theme={"system"}
{ "reg_no": "MH 12 NZ 4471", "code": "772 217", "kind": "tyre", "note": "rear left, Chakan bypass" }
```

If the code opens, the answer carries `valid: true`, the registration and variant, the fleet's name, who is driving, the truck's last position with its age and grade, the owner's phone where the fleet allows it, and `job_id`: a job now sits on the truck's ledger under your key's name, and the owner sees it. A wrong code, an unknown truck or a truck with no live key answers `valid: false` and nothing else; the code proves presence, and only the driver can give it. Kinds: `breakdown`, `tyre`, `fuel`, `service`, `other`. Owners can switch providers off for their fleet, in which case the code still opens and the job is kept, but the position and phone are withheld.

## Webhooks for your fleet

Any key may subscribe an https URL to its own fleet's events with `POST /v1/webhooks`: `nazar.alert.opened`, `nazar.alert.cleared`, `nazar.mock.reported`, `nazar.trip.ended`, `nazar.day.anchored`, `nazar.job.opened`. Deliveries carry `X-Truckaurbus-Event` and `X-Truckaurbus-Signature` (HMAC-SHA256 of the body with the secret returned once at creation), and are retried on failure; a URL that fails ten times in a row is switched off. Market events (`variant.*`, `price.changed`) remain an enterprise feature.

## Verify a day yourself

The daily digest is `sha256("nazar-day-v1|<fleet>|<day>|" + "key:hash|..." sorted by key)` over the last chained hash per key. Save the `.ots` bytes from the proof endpoint and run `ots verify` against the digest with any OpenTimestamps client; once the calendars' attestation reaches a Bitcoin block, the proof needs nothing from us.
