Authentication

All API requests require authentication via Bearer token in the Authorization header.

Bearer Token Authentication

Include your API key in the Authorization header as a Bearer token:

bash
Authorization: Bearer pk_live_YOUR_API_KEY

Example Request

bash
curl "text-cyan-400">-X GET "https://localstitch.co/api/v1/credits" \
  "text-cyan-400">-H "Authorization: Bearer pk_live_abc123def456..."

Creating API Keys

API keys can be created and managed in the API Console. Each key is scoped to your workspace and grants access to all data within it.

2

Click Create API Key

3

Copy and securely store your key (it won't be shown again)

API Key Format

LocalStitch API keys use the following format:

text
pk_live_[64 character hex string]

The pk_live_ prefix identifies production API keys.

Security Best Practices

Keep your API keys secure

API keys grant full access to your workspace data. Treat them like passwords.

Do store keys in environment variables or a secrets manager

Do rotate keys periodically

Do revoke compromised keys immediately

Don't expose keys in client-side JavaScript

Don't commit keys to version control

Don't share keys via unencrypted channels

Authentication Errors

If your API key is invalid or missing, you'll receive a 401 Unauthorized response:

json
{
  "error": "unauthorized",
  "message": "Invalid or missing API key"
}

Plan Requirements

API access requires a paid plan (Starter, Growth, or Professional). Free plans will receive a 403 Forbidden response with:

json
{
  "error": "api_access_denied",
  "message": "API access requires a paid plan"
}

View pricing to upgrade your plan.