Stationworks developers

Getting started

Getting started

You need two values from your Stationworks contact: your district's id (a UUID) and a key (starts with pk_live_). The key identifies your site; it grants nothing and is safe in page source. The district's console will show both on its API card.

One request

Code
GET https://api.stationworks.app/v1/permits/agencies/<id>/status?key=<key>
JavascriptCode
const id = "00000000-0000-0000-0000-000000000000"; const key = "pk_live_yourKeyHere"; const res = await fetch( `https://api.stationworks.app/v1/permits/agencies/${id}/status?key=${key}`, ); if (!res.ok) throw new Error(`status ${res.status}`); const status = await res.json();

Three fields

JavascriptCode
document.querySelector("#verdict").textContent = status.verdict.label; document.querySelector("#danger").textContent = status.fireDanger ?? "not set"; document.querySelector("#more").href = status.agency.url;

verdict answers "can I have a fire today?" for the whole district. fireDanger is null when the district has not set a level. agency.url is the district's own site, where the full rules live.

What comes back

The response also carries statuses (one row per thing you might burn), permits (what the district sells, with prices), season, airQuality and fireWeather. The reference documents every field. Two rules keep your page working as the API grows: ignore fields you do not recognise, and treat an enum value you do not recognise as "unknown". The contract explains why.

Responses you will see

StatusMeaning
200The district's status.
401No key, or a key we do not recognise. Check ?key=.
404Not a UUID, or a district that is not active.
429Too many requests. Wait for Retry-After seconds.
500Our fault. Show your last good response.

Errors are JSON: { "error": { "code": "invalid_api_key", "message": "…" } }.

Last modified on