Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header.

Getting Your API Key

  1. Log in to your Stack0 Dashboard
  2. Navigate to Settings API Keys
  3. Click Create New Key
  4. Copy your API key and store it securely

Using Your API Key

Include your API key in the Authorization header of every request:

Request Header
Authorization: Bearer sk_live_your_api_key

Example Request

cURL
curl -X POST https://api.stack0.dev/mail/send \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"from": "you@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello",
"html": "<p>Hello World</p>"
}'

API Key Types

PrefixEnvironmentUsage
ProductionFor live production traffic
TestFor development and testing

Security Best Practices

  • Never expose your API key in client-side code or public repositories
  • Use environment variables to store your API keys
  • Rotate your keys periodically and immediately if compromised
  • Use separate keys for development and production environments

Using with the SDK

When using the Stack0 SDK, pass your API key during initialization:

TypeScript
import { Stack0 } from '@stack0/sdk'
const stack0 = new Stack0({
apiKey: process.env.STACK0_API_KEY!
})