API Reference
API Keys

API Keys

API keys authenticate every request to the oec.sh Public API. They are created and managed from the oec.sh dashboard — there is no programmatic endpoint for key management in the Public API itself.

Requires Starter plan or higher. API key access is not available on the Free plan. Upgrade at Settings → Billing to enable the Public API.


Creating an API Key

Open Settings

In your oec.sh dashboard, go to Settings → API Keys.

Click "Create API Key"

Fill in the form:

FieldDescription
NameA label for this key. Use something descriptive like github-actions-prod or monitoring-dashboard.
TierRead-only or Full access — see Key Tiers below.
ScopeOrganization or Project — see Key Scopes below.
ExpiryOptional. Leave blank for a non-expiring key.

Copy your key immediately

⚠️

The full key is shown only once. It is hashed before storage and cannot be retrieved again. Copy it to a secrets manager (GitHub Secrets, HashiCorp Vault, AWS Secrets Manager, 1Password) right now. If you lose it, revoke it and create a new one.

Your key will look like:

oec_live_rw_abc1def2ghi3jkl4mno5pqr6stu7vwx8yz90...   ← full access
oec_live_ro_xyz9wvu8tsr7qpo6nml5kji4hgf3edc2ba10...   ← read-only

Key Tiers

TierPrefixWhat it can do
Read-onlyoec_live_ro_GET requests only — list projects, environments, statuses, logs, webhook deliveries.
Full accessoec_live_rw_All operations — deploy, create, update, delete, manage webhooks.

Use read-only keys for monitoring dashboards, status checks, and audit tooling where write access would be a security risk.


Key Scopes

ScopeAccess
OrganizationAll projects and environments owned by your organisation. Use for CI/CD pipelines that span multiple projects.
ProjectA single named project only. All other projects return 404. Use for project-specific pipelines and least-privilege setups.

Project-scoped keys are recommended when you're giving a key to a third-party integration or a contractor who should only see one project.


Revoking a Key

Go to Settings → API Keys, find the key, and click Revoke.

⚠️

Revocation is immediate. Any service using the key will begin receiving 401 Unauthorized responses right away. Update your secrets before revoking a key that's in active use.


Key Naming Convention

We recommend naming keys to indicate their purpose and access level:

Example nameTierScopePurpose
github-actions-prodfull_accessorgGitHub Actions deploy workflow
monitoring-dashboardread_onlyorgStatus dashboard polling
staging-pipelinefull_accessprojectCI/CD for a single project
slack-bot-readonlyread_onlyorgSlack /status command
terraform-providerfull_accessorgInfrastructure-as-code automation

Storing Keys Securely

Never put API keys in source code, .env files committed to git, or log output.

Recommended storage:

PlatformWhere to store
GitHub ActionsRepository → Settings → Secrets → Actions secrets
GitLab CIProject → Settings → CI/CD → Variables (masked)
Docker / ComposePass as env var at runtime, not in docker-compose.yml
HashiCorp Vaultvault kv put secret/oecsh api_key=oec_live_rw_...
AWSSecrets Manager or Parameter Store (SecureString)
Kuberneteskubectl create secret generic oecsh --from-literal=api_key=...

Audit Log

Every API key has an audit log showing the last 100 requests made with it — method, endpoint, status code, client IP, and timestamp. View it in Settings → API Keys → (key) → Audit Log.

Use the audit log to:

  • Confirm a CI/CD pipeline is calling the correct endpoints
  • Investigate unexpected usage or 4xx errors
  • Verify a key is actually being used before rotation

Key Expiry and Rotation

For security, consider setting an expiry date on long-lived keys and rotating them regularly:

  1. Create a new key with the same tier and scope
  2. Update your secrets store with the new key
  3. Deploy your updated service
  4. Verify the new key is working (check audit log)
  5. Revoke the old key

If you suspect a key has been compromised, revoke it immediately — there is no delay.