Overview
The MediaMagic API uses API keys for authentication. Each API key is workspace-scoped, so it can only access resources within its associated workspace — you never send a workspace ID in the request body. The workspace is derived from the key. Live keys are prefixedsk_live_ and sandbox keys are prefixed sk_test_. Both use the same base URL and paths; the prefix alone selects the environment. See the Sandbox Guide for sandbox behavior.
Creating an API key
Copy your key
The API key will be displayed once. Copy it immediately — you won’t be able to see it again.
Using your API key
Include your API key in theX-API-Key header of every request:
Security best practices
- Store API keys in environment variables or a secrets manager (e.g., AWS Secrets Manager, Azure Key Vault)
- Rotate API keys regularly — we recommend monthly rotation
- Use different API keys for different environments (development, staging, production)
- Monitor API key usage in the control plane to detect suspicious activity
- Revoke API keys immediately if you suspect they’ve been compromised
Authentication errors
If your API key is missing, invalid, expired, or revoked, you’ll receive a401 Unauthorized response with a detail message:
detail message tells you exactly what went wrong. Common messages include:
Missing X-API-Key header— no key was sentInvalid API key— the key is not recognizedThis API key has expiredThis API key has been revoked
- The header name is exactly
X-API-Key(case-sensitive) - Your API key is correct and has not expired or been revoked
- You are using a key for the workspace whose resources you are trying to access