Documentation menu
Logs

API Keys

Create and manage API keys for log ingestion and API access.

API keys authenticate log and metric ingestion and deployment reports. Each project can have multiple keys, each optionally bound to an environment, limited to the scopes it needs, with an optional expiry and its own rate limit. Owners and admins create and manage keys; every project member sees the list (with shortened keys).

Key types

Type Prefix Use case Security
Public key pk_ Sending logs and metrics from servers, browsers and mobile apps Safe to expose
Secret key sk_ Reporting deployments from CI/CD and other server-side jobs Keep secret

Public keys only send logs and metrics to the ingest service (and read the project’s ingest counts); they cannot read logs or change settings. Use the public key for log shipping from servers too. Secret keys are for server-side calls from your servers and CI: they report deployments (/projects/{id}/deployments/webhook/). The ingest service refuses secret keys, and neither key works for the rest of the API, which needs a signed-in user (older heartbeat URLs by monitor id also accept either key; see Heartbeats). Regenerating a key needs a fresh confirmation of your password or two-factor code.

Create an API key

  1. Open Settings > API keys (web dashboard: Configure > Projects and keys, API keys)
  2. Tap +
  3. Name: Descriptive name (e.g., “Production Logger”)
  4. Environment (optional): Tag logs with this environment
  5. Scopes: what the key may do (all are ticked; untick what it does not need)
  6. Rate limit (optional): requests per minute at the ingest service (default 1,000)
  7. Expires (optional): the key stops working after that
  8. Tap Create key

Incidion generates both a public and a secret key. Copy and secure them immediately: the full keys are shown only once, afterwards only a shortened preview.

curl -X POST https://api.incidion.dev/api/v1/projects/$PROJECT_ID/api-keys/ \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Logger",
    "environment": "'$ENVIRONMENT_ID'",
    "scopes": ["logs:write", "metrics:write"],
    "rate_limit_per_minute": 500,
    "expires_at": "2027-06-30T00:00:00Z"
  }'

scopes, rate_limit_per_minute and expires_at are optional: without them a key gets every scope, 1,000 requests per minute and no expiry. The 201 answer is the only one that contains key (pk_...) and secret_key (sk_...).

Using public keys

Public keys are safe to embed in client-side code (anyone who has it can send logs to your project, counted against your quota):

// Frontend code (safe to expose)
const apiKey = 'pk_your_public_key';

fetch('https://ingest.incidion.dev/v1/logs', {
  method: 'POST',
  headers: {
    'X-API-Key': apiKey,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    logs: [{
      level: 'info',
      message: 'User clicked button',
      service: 'frontend'
    }]
  })
});

Or use an SDK: see SDKs.

Using secret keys

Secret keys report deployments from CI and other server-side jobs; they cannot send logs. Never commit them to code. Store them in your CI secrets or environment variables, under a different name than the public key:

# .env (don't commit this)
INCIDION_SECRET_KEY=sk_your_secret_key
import os

import requests

secret_key = os.environ["INCIDION_SECRET_KEY"]
project_id = os.environ["INCIDION_PROJECT_ID"]

requests.post(
    f"https://api.incidion.dev/api/v1/projects/{project_id}/deployments/webhook/",
    headers={"X-API-Key": secret_key},
    json={"version": "v1.2.3", "status": "in_progress", "environment_slug": "production"},
    timeout=10,
)

See Deployments for the full webhook.

Environments

Optional environment binding tags all logs from this key:

  1. Create a key and select the “Production” environment
  2. Logs and metrics sent with this key are tagged with that environment’s id (a request may name another environment_id)
  3. Filter logs by environment in Logs

Change or remove the environment later with PATCH .../api-keys/{id}/ and {"environment": "<id>"} or null.

Scopes

Each key has a list of scopes, and every request needs the scope of what it does. The part of the key still matters: the public key works at the ingest service only, the secret key for deployments.

Scope Allows Key
logs:write Send logs: /v1/logs, /v1/logs/single, OpenTelemetry logs Public (pk_)
metrics:write Send server metrics: /v1/metrics, /v1/metrics/single Public (pk_)
stats:read Read the project’s ingest counts: /v1/projects/{id}/stats Public (pk_)
deployments:write Report deployments: /projects/{id}/deployments/webhook/ Secret (sk_)
heartbeats:write Ping older heartbeat URLs by monitor id Either

New keys get every scope unless you choose fewer. Keys that existed before scopes were enforced were given every scope, so they keep working as before; a key whose list is empty also has every scope. A key needs at least one scope (to stop a key, deactivate it).

A request without the scope is refused with 403. At the ingest service:

{"detail": {"error": "insufficient_scope", "message": "This API key does not have the 'logs:write' scope. Add it to the key in the API key settings.", "required_scope": "logs:write"}}

At the deployment webhook and the older heartbeat URLs:

{"error": {"code": "insufficient_scope", "message": "This API key does not have the 'deployments:write' scope. ...", "status_code": 403, "required_scope": "deployments:write"}}

Change a key’s scopes in its Edit dialog (app: the key’s menu, Edit), or:

curl -X PATCH https://api.incidion.dev/api/v1/projects/$PROJECT_ID/api-keys/$KEY_ID/ \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"scopes": ["deployments:write"]}'

Unknown scope names and an empty list are refused with 400. The change applies within a few seconds, at the ingest service too.

A good split is one key per job: a log shipper with logs:write (and metrics:write on servers), a CI key with deployments:write.

Rate limiting

Each key has a rate limit at the ingest service, 1,000 requests per minute by default. Over it, the ingest answers 429 with Retry-After (seconds until the next minute):

{"detail": {"error": "rate_limited", "message": "This API key allows 1000 requests per minute.", "limit": 1000}}

Owners and admins can change it (rate_limit_per_minute) up to the plan’s maximum:

Plan Highest rate limit per key
Free 1,000 per minute
Pro 5,000 per minute
Business 20,000 per minute
Enterprise no maximum (0 = unlimited)
curl -X PATCH https://api.incidion.dev/api/v1/projects/$PROJECT_ID/api-keys/$KEY_ID/ \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"rate_limit_per_minute": 2500}'

A value above the plan’s maximum is refused with 403 and the error code PlanLimitExceeded (plan_limit.code is api_key_rate_limit, with the limit and the plan that allows it); a negative number or a non-number with 400. After a move to a smaller plan, a key keeps its value but the ingest service applies at most the new plan’s maximum. The key list shows all three: rate_limit_per_minute (what the key asks for), rate_limit_max (the plan’s maximum, null for none) and effective_rate_limit_per_minute (what the ingest applies).

Send more lines per request (up to 10,000) rather than more requests. The daily log quota of the plan applies on top; see Send logs.

Key rotation

Rotate keys regularly for security:

  1. Open the key’s menu
  2. Choose Regenerate keys and confirm it is you (password or two-factor code)
  3. New public and secret keys are shown once
  4. The old keys stop working immediately (the ingest service may accept them for a few more seconds)
  5. Update your code to use the new keys

Key expiration

Set an optional expiry when you create a key (expires_at). The key stops working after that date: the ingest service, the deployment webhook and the older heartbeat URLs answer 401 “API key has expired” (or “API key expired”). Use expiration for temporary keys (onboarding, contractors, etc.).

Owners and admins can change the expiry later, also to renew a key that has already expired. The new date must be in the future; null removes the expiry:

# Expire at the end of June
curl -X PATCH https://api.incidion.dev/api/v1/projects/$PROJECT_ID/api-keys/$KEY_ID/ \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"expires_at": "2027-06-30T00:00:00Z"}'

# Never expire
curl -X PATCH https://api.incidion.dev/api/v1/projects/$PROJECT_ID/api-keys/$KEY_ID/ \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"expires_at": null}'

A date in the past is refused with 400. In the dashboard and the app, the key’s Edit dialog offers 30 days, 90 days or 1 year from today, or never.

Disable/Enable

Temporarily disable a key without regenerating: choose Deactivate in its menu (PATCH .../api-keys/{id}/ with {"is_active": false}), and Activate to turn it on again. Requests with a disabled key get 401 “API key is disabled”.

Monitoring key usage

The key list shows when each key was last used (last_used_at). If a key hasn’t been used in weeks, consider deleting it.

Delete keys

Remove unused keys:

  1. Open the key’s menu
  2. Choose Delete key
  3. Key is revoked immediately

Deleted keys can’t be recovered.

Security best practices

  • Keep secrets secret: Never commit secret keys to git
  • Use environment variables: Store keys in your CI/CD secrets manager
  • Rotate regularly: Regenerate keys quarterly
  • Monitor usage: Check that keys are being used as expected
  • Delete unused keys: Remove old keys you no longer need
  • Principle of least privilege: Give each key only the scopes it needs, use the public key wherever you send logs and metrics, and the secret key only where you report deployments
  • Different keys per environment: Use separate keys for dev, staging, production

Leaked key recovery

If you leak a secret key:

  1. Immediately regenerate the key
  2. Check the project’s deployments and logs for entries you did not send
  3. Update your CI secrets and services with the new keys

API key endpoints

All log ingestion uses the same API:

curl -X POST https://ingest.incidion.dev/v1/logs \
  -H "X-API-Key: pk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "logs": [...]
  }'

See Send Logs for full documentation.

Programmatic access

Apart from the deployment webhook and older heartbeat URLs, the REST API does not accept API keys. Sign in and use the JWT access token from login (it expires after 30 minutes; renew it with the refresh token). See REST API.

Key discovery

Keep API keys out of version control:

# Add to .gitignore
.env
.env.local
config/secrets/

# Or use a tool like git-secrets to scan commits
git secrets --install

Example: Securing a Node.js app

require('dotenv').config();

const apiKey = process.env.INCIDION_API_KEY;

if (!apiKey) {
  throw new Error('INCIDION_API_KEY not set in environment');
}

async function sendLog(message, level = 'info') {
  const response = await fetch('https://ingest.incidion.dev/v1/logs', {
    method: 'POST',
    headers: {
      'X-API-Key': apiKey,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      logs: [{
        timestamp: new Date().toISOString(),
        level,
        message,
        service: 'my-app'
      }]
    })
  });

  return response.json();
}

Troubleshooting

401 Unauthorized: the detail says why: “API key required”, “Invalid API key format” (the ingest only takes pk_ keys), “Invalid API key”, “API key is disabled” or “API key has expired”

403 insufficient_scope: the key lacks the scope named in required_scope; add it to the key (see Scopes)

429 Too Many Requests: the key’s rate limit or the plan’s daily quota; the error field says which. Batch more logs per request, or raise the key’s rate limit within the plan

403 on regenerate: confirm it is you when asked (step-up), and check that you are an owner or admin

Contact support

For security issues, see Security.