Skip to main content

API Keys

All requests to ModelStack require authentication via an API key. Keys are passed in the Authorization header using the Bearer token format.

Header Format

Key Format

ModelStack API keys follow this format:
All keys are prefixed with sk_ followed by a random alphanumeric string.

Getting an API Key

  1. Sign in to your dashboard
  2. Navigate to API Keys
  3. Click Create API Key
  4. Give your key a descriptive name
  5. Copy the key immediately — it won’t be shown again
Treat your API key like a password. Do not expose it in client-side code, public repositories, or logs. If a key is compromised, revoke it immediately from your dashboard.

Example Request

API Key Limits

The number of API keys you can create depends on your plan:

Security Best Practices

Store your API key in environment variables rather than hardcoding it:
Create distinct API keys for development, staging, and production. This lets you revoke a compromised key without affecting other environments.
Rotate your API keys regularly. Create a new key, update your applications, then revoke the old key.
Add .env files to .gitignore and use secret management tools for production deployments.

Error Responses

If authentication fails, the API returns a 401 Unauthorized error: