API overview
The Temprix API is GraphQL over the same schema the product runs on. Almost anything visible in the app can be read or changed through the API. A few operations expect a signed-in session instead of a key: key management, billing and subscription changes, and other actions where someone in the app is required.
Endpoints
Section titled “Endpoints”Each data region has its own endpoint. Send requests to the one your workspace lives in.
| Region | Endpoint |
|---|---|
| US East (N. Virginia) | https://graphql.use1.temprix.app/graphql |
| EU Central (Frankfurt) | https://graphql.euc1.temprix.app/graphql |
A workspace’s region is chosen when the workspace is created and cannot be changed. You can see it on Workspaces. Where data is stored and processed is described on Security.
Authentication
Section titled “Authentication”Send the key as the whole value of the Authorization header, with no Bearer prefix:
Authorization: tpx_eyJ2IjoxLCJrIjoi...A key acts as the member who created it, with that member’s permissions, narrowed by the key’s scope. A key is read-only unless it was created with write access. Creating, scoping and revoking keys is on API keys.
A first request
Section titled “A first request”- In the app, create a key under Settings → API keys and copy it. It is shown once.
- Send a query to your region’s endpoint:
curl https://graphql.euc1.temprix.app/graphql \ -H "Content-Type: application/json" \ -H "Authorization: $TEMPRIX_API_KEY" \ -d '{"query":"{ members { items { id displayName baselineAvailability } nextToken } }"}'- Read the response:
{ "data": { "members": { "items": [ { "id": "1024", "displayName": "Marieke Janssen", "baselineAvailability": 1.0 }, { "id": "1025", "displayName": "Tomás Ruiz", "baselineAvailability": 0.8 } ], "nextToken": null } }}Every list comes back in this shape: the records in items, and a nextToken that is null on
the last page. Keep requesting until it is null. The loop is on
Conventions.
Check for an errors array on every response, including ones with HTTP status 200. What each error
means, and what to do about it, is also on Conventions.
Where to go next
Section titled “Where to go next”- API keys: create, scope, send and revoke keys.
- Conventions: errors, rate limits, paged lists and date ranges.
- Schema: how the types fit together, and the full reference.
- Examples: worked integrations, such as who is out on a given day, or writing approved leave in from an HR system.