Quickstart
Quickstart
This guide takes you from a token to a working call. Every example is shown in curl, Python and TypeScript — pick your tab and paste.
Before you start
You'll need:
-
An AirTrack premium subscription on the owning account (premium is checked on every call).
-
A connection token (
aapk_…). See Authentication for the full pairing flow; the short version is to redeem a pairing code created in the AirTrack app:Code
Requests go to one base URL per environment:
| Environment | Base URL |
|---|---|
| Production | https://api.airawarelabs.com |
| Development | https://api.airawarelabs-dev.dev |
1. Set up an authenticated client
Every request carries your token in the Authorization header. Set it up once and
reuse it for every call below.
2. Score a location
Get the instantaneous Clean Air Score (100 = cleanest, 0 = worst) for a point.
Requires the aq:read scope; costs 1 credit.
Code
ttl is the number of seconds until it's worth polling again — the underlying data
updates hourly, so there's no value in polling faster.
3. Forecast a day
Hourly Clean Air Scores and pollutant concentrations for a date at a location.
Requires aq:read; costs 2 credits. Omit the coordinates to use the caller's
approximate IP location.
Code
timestamps is a shared time axis (epoch seconds); each list in measures runs
parallel to it.
4. Enrich a route
Score a route you supply — per-waypoint measures plus a route-level exposure summary.
Requires the aq:routes scope; costs 1 credit per waypoint. Provide a time on
every waypoint (a recorded track), or omit them all and set a start_time to have
the times estimated from the activity's speed.
Code
To plan a lower-exposure route (rather than score one you already have), see
POST /v1/routes in the API reference — it's an asynchronous
submit-then-poll workflow.
5. Check your remaining credits
Endpoints that compute air quality draw from one shared monthly credit pool, with a smaller daily burst cap — see Usage & credits for the full cost table. Reading your balance is itself free, as are redeeming a pairing code and polling for a route-plan result. Any valid token works, no particular scope required.
Code
Handling errors
Every handled error returns a JSON body with a single detail string, and rate
limits come back as 429 with a Retry-After header. See Errors for the
full status-code reference and a robust retry pattern in Python and TypeScript.
Next steps
- Read the Authentication guide for the full credential and scope model.
- Browse the complete API Reference for every endpoint, field and example.
- Point your tooling or AI assistant at
/openapi.jsonor/llms-full.txt.

