Documentation/Integration guide/Authentication and API keys
Integration guide

Authentication and API keys

Bearer token authorization, development vs production keys, and tenant scope enforcement.

4 min read
•Updated October 21, 2026

Authorization Header Specification

Send Authorization: Bearer YOUR_API_KEY on server-to-server generation requests. Production keys begin sk_live_; development keys begin sk_test_. A test prefix is not a promise of free or simulated generation.

Dashboard Key Management & Session Tokens

Create and revoke keys in Dashboard → API keys. Key management API routes require a dashboard access token from POST /v1/auth/login; an API key cannot mint another key.

Tenant Scope & Browser Bundle Isolation

API-key tenant scope comes from the stored key, not caller-supplied organization or project IDs. Keep keys out of browser bundles. Revoked or expired keys are rejected.

Code Implementation

import os
import requests

BASE = "https://api.apimarketplace.com"
api_key = os.environ.get("API_KEY", "sk_live_sample_key")
headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

# Verify API key credentials and tenant capability access
response = requests.get(f"{BASE}/v1/models", headers=headers)
if response.status_code == 401:
    raise PermissionError("Invalid, suspended, or revoked API key.")

response.raise_for_status()
models = response.json()
print(f"Successfully authenticated with tenant scope. Available models: {len(models)}")