3. Using the API
Overview of the JSONAir API.
The JSONAir API is a simple, read-only HTTP API. Agents use it to retrieve configuration data. There are no write endpoints on this API — it is intentionally uni-directional.
Configurations are changed by separate programs: jsonair-admin (a web interface, 2.8) and the optional, write-only jsonair-write API (2.9). The write API has its own base path (/api/v1/jsonair-write/), its own PATs and its own tokens, and a read PAT or JWT is not accepted by it (or the other way around).
Base URL
All endpoints are versioned under:
/api/v1/jsonair/Authentication Flow
The API uses a two-step authentication model:
Exchange your PAT for a short-lived JWT. Send your plain-text Personal Access Token (PAT) to the
/auth/tokenendpoint. The server hashes it, looks it up in the database, and returns a signed JWT.Use the JWT as a Bearer token. Include the JWT in the
Authorizationheader on all subsequent requests. When it expires, repeat step one.
This means your long-lived PAT is only ever sent once per session, and the short-lived JWT is what travels with every API call.
Endpoints at a Glance
POST
/api/v1/jsonair/auth/token
No
Exchange a PAT for a JWT
GET
/api/v1/jsonair/config
Yes
Retrieve configuration data
GET
/api/v1/jsonair/reload
Yes
Retrieve the reload key
GET
/api/v1/jsonair/debug
Yes
Retrieve the debug level
Content Type
All request bodies must be JSON. All responses are JSON or plain text depending on the endpoint.
Input Validation
The type and name fields in all requests are sanitized server-side. Only the following characters are accepted — any others are silently stripped:
Last updated