API tokens
Overview
An API token authenticates a script, a CI job or an integration with the Oxygen API, without anyone signing in. This guide covers creating one, choosing how far it reaches, and sending it.Older
oxy_… API keys have been removed. A request carrying one is
refused with a message naming its replacement. If something of yours stopped
working, mint a token below and set it where the key was — the header does not
change.Which kind to create
Every kind lives on one page: Settings → Organization → API tokens, which opens with the same guide as this table.
A personal token carries your reach, so it stops working when you do. An
integration that several people depend on belongs to a service account, which an
organization admin can see and end.
If the caller runs in GitHub Actions, prefer trusted access and store no secret
at all: Settings → Organization → API tokens → Service accounts → a
service account → Trusted access gives you the workflow block to paste.
If the caller is one of your custom apps, its token lives in one of the app’s
secrets. Create it there, without copying anything: see
A token for a custom app.
If it runs on a platform that signs identity tokens for its workloads, such as
AWS (ECS, Lambda, EC2) through IAM outbound identity federation, register that
issuer under Settings → Organization → API tokens → Service accounts →
Trusted access, then add a trust policy saying which of its tokens may act
as which service account. For AWS that is the IAM role the workload runs as.
The policy then shows the commands the workload runs: ask STS for a token for
this deployment, and trade it for a 15-minute token. Any other OIDC issuer works
the same way with Custom OIDC: you name the issuer, its keys, and the claims
a token must have.
Creating a personal access token
- Open Settings → Organization → API tokens → Personal access tokens.
- Create token, and name it after where it will live —
laptop,nightly-report— so you can tell later which one to revoke. - Choose its access: All access reaches everything you do, or pick the organizations it needs, and how much it may do in each. Pick the organizations.
- Choose when it expires. You can extend it later without changing the secret, so nothing needs redeploying.
Creating a service account token
- Open Settings → Organization → API tokens → Service accounts.
- New, and name it after the job rather than a person:
nightly-sync,bookkeeping-upload. - Give it the lowest role that works.
- Create a token on it. Again, the secret is shown once.
A token for a custom app
A custom app that calls the Oxygen API keeps a service account token in one of its secrets. You don’t need to create the token on one page and paste it on another:- Open Settings → Organization → Secrets, and the app’s secret under One app (or Create a new one for the app).
- Change value → Create API token.
- Pick the service account, or keep the new one named after the app, and choose its access and expiry.
- Create token, then save the secret.
Sending a token
Either header works, and both accept every kind of token:/api/{workspace_id}/…). Copy it from
Settings → Organization → API tokens, under ID for API calls.
Python
JavaScript (Node.js)
Finding and ending a token
Settings → Organization → API tokens → Personal access tokens lists your own, searchable by token, by organization and by the apps it reaches, and filterable by whether it still works or is about to expire. All tokens, on the same page, lists every token that reaches the organization, whoever owns it, and is where an admin can end a personal token’s access to that organization without touching what it does elsewhere.API reference
The live Swagger documentation at/apidoc on your Oxygen host browses every
endpoint, shows request and response schemas, and runs calls from the browser.
It reflects the version you are running.
The oxyc CLI reads the same catalog: oxyc routes lists the endpoints and
oxyc schema <path> prints one endpoint’s shape.