REST API reference: Authentication
Every request authenticates with an API key sent as a Bearer token. The key decides which organisation and projects you reach and whether you may start runs.
API keys
Owners and admins create keys in Settings → Integrations → API keys; every active member can see the list. A key starts with opk_, followed by an 8-character key id, an underscore and a 32-character secret. The full key is shown once, right after it is created, so store it as a secret at once. If you lose it, revoke it and create a new one.
Access levels
A read key lists and reads projects, tests, runs and their evidence. A run key can do the same and also starts runs with POST /tests/{id}/runs. A manage key can also create, change and delete tests with POST /projects/{id}/tests, PATCH /tests/{id} and DELETE /tests/{id}. Each level includes the one before it, and a key whose level is too low gets 403 forbidden.
Project scope
A key can be limited to one project when it is created. A project-scoped key sees only that project, its tests and its runs; without a project, the key covers every project of the organisation. Anything outside the scope answers 404 not_found, exactly like something that does not exist.
A key acts as its creator
A key acts as the member who created it, and the server checks that membership on every request. When that member leaves the organisation or is removed, their keys stop working at once and answer 401 unauthorized. Create CI keys from an account that will stay in the organisation.
Expiry and revocation
A key expires after 30, 90 or 365 days, or never; you choose when you create it. An expired or revoked key answers 401 unauthorized from the next request on. Each organisation can have up to 20 active keys; revoked keys do not count, expired keys count until you revoke them.
IP allow-lists and rotation
When you create a key you can limit it to up to 20 IPv4 or IPv6 addresses or CIDR ranges, such as 203.0.113.7 or 198.51.100.0/24. A request from any other address answers 401 unauthorized, exactly like an unknown key, so a leaked key is useless elsewhere.
To replace a key's secret, rotate it in Settings → Integrations → API keys: the key keeps its name, scope, access, allow-list and expiry, the old secret stops working at once and the new one is shown once. Only the member who created a key can rotate it. Settings also shows how many requests each key sent in the last 30 days and how many of them failed.
Sending the key
Send the key in the Authorization header of every request: Authorization: Bearer opk_…. In the examples the key comes from the OPTISWAY_API_KEY environment variable. The API ignores cookies and sends no CORS headers, so keys belong in servers, scripts and CI jobs only. Send requests over HTTPS only, and never put a key in a URL, browser code or a public repository.
Who am I
GET /me
An object with key, organisation and project (null for a key that covers every project).
{
"key": {
"id": "17",
"name": "GitHub Actions",
"keyId": "7hx2k9mq",
"access": "run",
"createdAt": "2026-10-19T08:00:00.000Z",
"expiresAt": null
},
"organisation": {
"id": "7",
"name": "Acme"
},
"project": null
}