Back to Documentation

API Authentication

Learn how to authenticate with the Wakestack API using API keys. All API requests require authentication.

Overview

The Wakestack API uses API keys to authenticate requests. You can create and manage API keys from your dashboard. API keys carry the same privileges as your user account, so keep them secure.

Important: Never share your API keys or commit them to version control. Use environment variables to store keys securely.

Creating API Keys

1

Navigate to API Keys

Go to Settings → API Keys in your dashboard.

2

Create New Key

Click "Create API Key" and give it a descriptive name (e.g., "Production Server").

3

Copy Your Key

Copy the key immediately. For security, the full key is only shown once.

API Key Format
Wakestack API keys follow a specific format for easy identification
wsk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6

wsk_

Wakestack prefix

live_

Production environment

The key prefix (wsk_live_) is visible in your dashboard, but the full key is only shown when first created.

Using API Keys

Bearer Token Authentication
Include your API key in the Authorization header of every request

Header Format

Authorization: Bearer wsk_live_your_api_key_here

cURL Example

curl -X GET https://wakestack.co.uk/api/monitors \
  -H "Authorization: Bearer wsk_live_your_api_key_here" \
  -H "Content-Type: application/json"

JavaScript Example

const response = await fetch('https://wakestack.co.uk/api/monitors', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer wsk_live_your_api_key_here',
    'Content-Type': 'application/json',
  },
});

const monitors = await response.json();

Python Example

import requests

headers = {
    'Authorization': 'Bearer wsk_live_your_api_key_here',
    'Content-Type': 'application/json',
}

response = requests.get('https://wakestack.co.uk/api/monitors', headers=headers)
monitors = response.json()
Rate Limits
API rate limits vary by plan to ensure fair usage
PlanRate LimitBurst Limit
Free60 requests/minute10 requests/second
Pro300 requests/minute30 requests/second
EnterpriseCustomCustom

Rate Limit Headers

Each response includes headers to help you track your usage:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1705312800

Handling Rate Limits

When you exceed the rate limit, the API returns a 429 Too Many Requests response. Implement exponential backoff and respect the X-RateLimit-Reset header.

Authentication Errors
Common authentication error responses
401Unauthorized
{
  "error": "Unauthorized",
  "message": "Invalid or missing API key"
}

The API key is missing, invalid, or has been revoked.

403Forbidden
{
  "error": "Forbidden",
  "message": "API key does not have permission for this action"
}

The API key is valid but lacks permission for the requested resource.

429Too Many Requests
{
  "error": "Too Many Requests",
  "message": "Rate limit exceeded. Try again in 60 seconds."
}

You've exceeded your rate limit. Wait and retry.

Security Best Practices

Use Environment Variables

Store API keys in environment variables, never in code.

WAKESTACK_API_KEY=wsk_live_...

Rotate Keys Regularly

Create new keys periodically and revoke old ones.

Use Separate Keys

Create different keys for different environments (dev, staging, prod).

Set Expiration Dates

Optionally set expiration dates on keys for temporary access.

Managing API Keys
List, create, and delete API keys programmatically

List Your API Keys

curl -X GET https://wakestack.co.uk/api/api-keys \
  -H "Authorization: Bearer wsk_live_your_api_key_here"

Create New API Key

curl -X POST https://wakestack.co.uk/api/api-keys \
  -H "Authorization: Bearer wsk_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name": "CI/CD Pipeline", "expiresAt": "2025-12-31T23:59:59Z"}'

Delete API Key

curl -X DELETE https://wakestack.co.uk/api/api-keys/key_id_here \
  -H "Authorization: Bearer wsk_live_your_api_key_here"

Need help? Check out our FAQ or contact support.