Skip to main content

Authentication

The StagingSpaces API uses two authentication methods depending on the endpoint.

API Key Authentication

Used for: Staging, enhancement, credits, and all programmatic access. Pass your API key as a Bearer token in the Authorization header:
curl https://stagingspaces-production-6fb7.up.railway.app/api/v1/credits \
  -H "Authorization: Bearer sk_live_xxxxxxxxxxxxx"

Key format

EnvironmentFormatExample
Productionsk_live_...sk_live_a1b2c3d4e5f6g7h8
Testsk_test_...sk_test_x9y8z7w6v5u4t3s2

Getting a key

  1. Sign up at studio.stagingspaces.app
  2. Go to Settings → API
  3. Click Generate API Key
  4. Save the key — it’s only displayed once
Keep your API key secret. Anyone with your key can use your credits. If a key is compromised, revoke it immediately from your dashboard.

Key security

  • Keys are stored as SHA-256 hashes (we never store the plaintext)
  • Each key tracks last_used_at for audit
  • Revoked keys are immediately invalid
  • Test keys (sk_test_) work identically but are labeled for development

Firebase Authentication

Used for: Dashboard operations — key management, claims, usage stats, settings. These endpoints are designed for browser-based access from the StagingSpaces dashboard. If you’re building a server-to-server integration, you only need API key auth.
curl https://stagingspaces-production-6fb7.up.railway.app/api/v1/keys \
  -H "Authorization: Bearer <firebase-id-token>"

Endpoint Auth Summary

EndpointAuth Method
POST /api/v1/stageAPI Key
POST /api/v1/enhanceAPI Key
POST /api/v1/place-productsAPI Key
GET /api/v1/creditsAPI Key
POST /api/v1/keysFirebase
GET /api/v1/keysFirebase
DELETE /api/v1/keys/{id}Firebase
POST /api/v1/claimFirebase
GET /api/v1/usageFirebase
GET/PUT /api/v1/settings/*Firebase
GET/PUT /api/v1/keys/{id}/webhookFirebase
GET /api/healthNone

Error responses

401 — Unauthorized

{
  "error": "Authentication required",
  "message": "Provide an API key via Authorization: Bearer <key>"
}

402 — Payment Required

{
  "error": "No credits remaining",
  "message": "Add credits or a payment method at studio.stagingspaces.app/api-settings",
  "credits_remaining": 0
}