Content APIAuthentication

Authentication

Unbody makes it easy to handle content through APIs while ensuring security. To use the GraphQL API, you’ll need two authentication credentials:

  1. API Key: A secret token that authenticates your requests
  2. Project ID: Identifies which project you’re accessing

Getting Started

  1. Generate an API key in Unbody Dashboard:
  • Select your project
  • Navigate to SettingsDeveloper Settings
  1. Include both credentials in your API requests using these headers:
  • Authorization: Your API key
  • X-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.

©2024 Unbody