# Traffic

Get staff-reported road congestion and closures inside a box.

`GET /v2/traffic`. Auth: API key.

This call needs a key. There is no keyless trial for it.

## Parameters

| Parameter | Required | Description |
|---|---|---|
| `bbox` | Yes | `minLng,minLat,maxLng,maxLat`. At most 0.5° wide and 0.5° high. |

## Example

```bash
curl -s -H "X-API-Key: $QUADRUPER_KEY" \
  'https://quadruper.com/v2/traffic?bbox=122.50,10.65,122.62,10.75'
```

This is an example response:

```json schema=traffic-response
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "id": "5b0c1c9e-8d2f-4f7a-9a51-2f4f0f6d1a10",
      "geometry": { "type": "LineString", "coordinates": [[122.56, 10.7], [122.565, 10.702], [122.57, 10.704]] },
      "properties": {
        "level": "heavy",
        "source": "staff",
        "road_name": "Diversion Road",
        "updated_at": "2026-11-05T08:10:00Z",
        "expires_at": "2026-11-05T09:10:00Z"
      }
    }
  ],
  "generated_at": "2026-11-05T08:12:03Z",
  "attribution": [{ "source": "osm", "text": "© OpenStreetMap contributors", "license": "ODbL-1.0" }]
}
```

## Response fields

Each feature is one marked stretch of road. Its line runs in the direction of travel. An answer has at most 500
features, newest first, and may be cached for 30 seconds. A box with nothing marked in it returns an empty
`features` list.

| Field | Description |
|---|---|
| `properties.level` | How bad it is. See the levels below. |
| `properties.source` | `staff`: a person marked it by hand. This is the only value today; `gps` is reserved for a later phase. |
| `properties.road_name` | The road's name, or `null` |
| `properties.updated_at` | When staff last marked or changed it |
| `properties.expires_at` | When it stops showing unless staff extend it |

| Level | Meaning |
|---|---|
| `moderate` | Slower than usual |
| `heavy` | Slow going |
| `standstill` | Traffic is barely moving |
| `closed` | The road is shut |

Staff names and notes are never included.

## What it is not

Route times and route choice don't use traffic yet. Present it as a map layer. It covers Iloilo City only, and only
where staff have marked something.

## Errors

| Status | `code` | When |
|---|---|---|
| 400 | `invalid_request` | `bbox` is missing, malformed, has min above max, or is wider or higher than 0.5°. The last two carry `details.field` = `bbox`; a missing or malformed `bbox` has no `details`. |
| 501 | `capability_unavailable` | This deployment doesn't offer traffic (`details.capability` is `traffic`) |
| 503 | `traffic_unavailable` | "Traffic is unavailable right now." Retry later. Routes are not affected. |

A missing or wrong key, and the other gateway errors, are in [Errors](errors.md).
