Authentication
All Metabind API requests require authentication. The platform supports two authentication methods depending on your use case.API Key Authentication
For server-to-server communication and client applications consuming published content, use API key authentication.REST API
Include the API key in theAuthorization header with a Bearer prefix:
GraphQL API
For the GraphQL API, use thex-api-key header:
WebSocket Subscriptions
For real-time subscriptions, include the API key in the connection parameters:Bearer Token Authentication
For user-authenticated requests (typically from the CMS frontend), use JWT bearer tokens obtained through the authentication flow.Obtaining API Keys
API keys are created and managed through the Metabind CMS:- Navigate to your project settings
- Go to the API Keys section
- Click Create API Key
- Provide a name and optional description
- Copy the generated key (it won’t be shown again)
API Key Permissions
API keys inherit permissions from the project they belong to. By default, API keys have read-only access to published content.| Permission | Description |
|---|---|
content.read | Read published content |
packages.read | Read published packages |
assets.read | Read active assets |
Request Examples
cURL
JavaScript (Fetch)
JavaScript (GraphQL)
Security Best Practices
Never expose API keys in client-side code
Never expose API keys in client-side code
API keys should be kept on the server side. For mobile apps, use a backend proxy or the GraphQL API with appropriate rate limiting.
Use environment-specific keys
Use environment-specific keys
Create separate API keys for development, staging, and production environments.
Rotate keys regularly
Rotate keys regularly
Periodically revoke old API keys and create new ones, especially if you suspect a key may have been compromised.
Use minimum required permissions
Use minimum required permissions
Request only the permissions your application needs. Most client applications only need read access to published content.
Error Responses
Authentication failures return appropriate HTTP status codes:| Status | Description |
|---|---|
401 Unauthorized | Missing or invalid API key/token |
403 Forbidden | Valid authentication but insufficient permissions |
