X-API-Key header. API keys are the recommended way to call the API from scripts, CI/CD pipelines and backend services.
Two credential types are accepted by the endpoints in this reference:
If a request carries both headers, the
Authorization: Bearer token is used.
Some endpoints only accept a session token (JWT) and reject API keys. These include API key management, project management (create, rename, delete a project), billing, organization and team management, and the dashboard overview endpoints. Every page in this reference states when an endpoint is JWT-only.
Create an API key
1
Open the API Keys settings
Sign in at app.uptimeio.com and go to Settings > API Keys.
2
Create the key
Click Create API Key, give it a descriptive name (for example
CI/CD pipeline) and choose a scope (see below).3
Copy and store the key
Copy the key immediately. The full key is shown once; afterwards only a preview such as
uio_1a2b...9f3c is visible.Use an API key
Add the key to theX-API-Key header of every request:
uio_ followed by 64 hexadecimal characters.
Scopes
Each key has one scope, chosen when it is created. The default isread.
A
read key that sends POST, PUT, PATCH or DELETE receives 403 with code READ_ONLY_API_KEY:
Organization and project
An API key is issued for one organization and always acts on that organization. The key cannot be redirected to another organization with a header. Monitors, groups and incidents belong to a project. By default requests act on your organization’s default project. To target another project, send its ID in theX-Project-ID header:
- A project that does not exist returns
404with codePROJECT_NOT_FOUND. - A project that belongs to a different organization returns
403(for examplePROJECT_ORGANIZATION_MISMATCH, orAPI_KEY_ORGANIZATION_MISMATCHon project-scoped status page routes).
/api/projects/{projectId}/status-pages.
Manage API keys
These endpoints require a session token (JWT) and owner or admin role. They are what the Settings > API Keys screen uses.
A created or rotated key looks like this:
Security best practices
Keep keys out of code
Keep keys out of code
Store keys in environment variables or a secrets manager:
Rotate keys regularly
Rotate keys regularly
Rotate from Settings > API Keys (or
POST /api/auth/api-keys/{id}/rotate). The old key stops working immediately, so update your applications straight after rotating.Use one key per service
Use one key per service
Give CI/CD, background jobs and each integration their own key. If one leaks you can revoke it without affecting the others. The key list shows each key’s scope and when it was last used.
Code examples
- cURL
- JavaScript
- Python
Authentication errors
See Error Handling for the full list.
Troubleshooting
401 - the key works in curl but not in code
401 - the key works in curl but not in code
- The environment variable is not set in the runtime (
echo $UPTIMEIO_API_KEY). - The key has a trailing space or newline - trim it.
- The header name must be exactly
X-API-Key.
403 READ_ONLY_API_KEY
403 READ_ONLY_API_KEY
The key has
read scope. Create a read_write key in Settings > API Keys.403 on a project or status page route
403 on a project or status page route
The key was issued for a different organization than the project you are addressing. Use a key created in the owning organization.