Requests
The API follows a few conventions everywhere, so once you've used one resource you know how the rest behave.
IDs and fields
Every ID has a prefix that says what it is: site_, area_, ap_ for access points, per_ for people, and so on. Names are snake_case. Timestamps are RFC 3339, and Passway always returns UTC. Time zones are IANA names, such as America/New_York. Country codes are ISO 3166-1 alpha-2.
Every resource can carry labels, in Kubernetes label syntax:
{
"labels": {
"team": "facilities",
"example.com/cost-center": "4410"
}
}
Pagination
List endpoints take page_size and page_token, and return next_page_token. It's null on the last page (Google's AIP-158). Page sizes go from 1 to 200: 0 or none means 50, and anything over 200 means 200.
cURL
curl -G https://acme.ext.passway.com/v1/people \
-H "Authorization: Bearer $PASSWAY_TOKEN" \
-d page_size=200 \
-d page_token=eyJhZnRlciI6InBlcl8wMWpkOGszbTJ2OXg0cTdyNXQ2dzh5MHoxYSJ9
Response
{
"data": [
{ "id": "per_01jd8k3m2v9x4q7r5t6w8y0z1a", "display_name": "Ada Lovelace" }
],
"next_page_token": null
}
Treat page tokens as opaque. To pick up changes since you last looked, many lists also take updated_since.
Concurrency
Every resource has an etag. PATCH and DELETE need it back in an If-Match header, in double quotes (RFC 9110), so you never overwrite a change you haven't seen:
cURL
curl -X PATCH https://acme.ext.passway.com/v1/doors/door_01jd8k3m2v9x4q7r5t6w8y0z1a \
-H "Authorization: Bearer $PASSWAY_TOKEN" \
-H "Content-Type: application/merge-patch+json" \
-H 'If-Match: "3f9a"' \
-d '{ "name": "Lab 3, north door" }'
| You send | You get |
|---|---|
No If-Match | 428 Precondition Required |
An If-Match that names no entity tag | 400 Bad Request |
An etag that's no longer current | 412 Precondition Failed |
On 412, read the resource again, decide whether your change still makes sense, and send it with the new etag.
Safe retries
POST takes an Idempotency-Key, such as a UUID. If a request with that key succeeded in the last 24 hours, sending it again returns the original response instead of acting twice. So when a network error leaves you unsure whether something was created, send the same request with the same key.
- A request that failed changed nothing, and can be retried with the same key.
- The same key on a different request gets
422. - While the first request is still running, a repeat gets
409with/problems/idempotency-key-in-progressandRetry-After. Send it again after that.
Partial updates
PATCH bodies are JSON merge patches (RFC 7396), sent as application/merge-patch+json:
- Fields you send replace the current ones. Leave a field out to keep it.
nullremoves a field, where the schema allows it to be empty, such as a person'semail. Elsewhere, such asactiveorenabled,nullis refused rather than reset to a default.- Objects such as
labelsandaddressare merged, key by key. Lists are replaced whole.
The result is checked as a whole, as if you had sent the complete resource.
Actions
Operations other than create, read, update and delete are POST to {id}:verb (Google's AIP-136), such as /v1/credentials/{credential_id}:revoke. Actions on many resources at once go to collection:verb, such as /v1/agents:suspend.
Compatibility
Within /v1, changes only add things: new fields, new resources and new event types. Ignore fields and event types you don't know, and your code keeps working.
The whole API is described by an OpenAPI 3.1 document, generated from the server's own types. Generate a client from it in any language.