Authentication
Unbody makes it easy to handle content through APIs while ensuring security. To use the GraphQL API, you’ll need two authentication credentials:
- API Key: A secret token that authenticates your requests
- Project ID: Identifies which project you’re accessing
Getting Started
- Generate an API key in Unbody Dashboard:
- Select your project
- Navigate to Settings → Developer Settings
- Include both credentials in your API requests using these headers:
Authorization
: Your API keyX-Project-Id
: Your project ID
Below are examples of how to authenticate in different environments:
import { Unbody } from 'unbody';
const unbody = new Unbody({
apiKey: "<API_KEY>",
projectId: "<PROJECT_ID>",
});
Important Notes
ℹ️
Do not forget to replace <API_KEY>
with your personal API key generated in the Unbody Dashboard.
ℹ️
You must also replace <PROJECT_ID>
with your specific project ID.
ℹ️
As a security measure, you must ensure to securely store your API key and never expose it in client-side code. You must use environment variables or server-side code to handle it safely.