Authentication

Authentication

All API requests require authentication using an API key. Learn how to generate and use your keys securely.

API Key Authentication

Include your API key in the Authorization header of every request.

Header Format

Authorization: Bearer YOUR_API_KEY

Example Request

curl -X POST https://api.nextcraftai.com/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{...}'

Security Note: Never expose your API key in client-side code or public repositories. Always use environment variables or secure key management systems.

Generating API Keys

Create and manage your API keys from the dashboard.

  1. 1.Navigate to the dashboard and sign in to your account
  2. 2.Go to the API Keys section
  3. 3.Click "Generate New Key" and give it a label
  4. 4.Copy the key immediately - you won't be able to see it again!

Error Responses

Common authentication errors and how to resolve them.

401 - AUTHENTICATION_ERROR

Invalid or missing API key. Check that your key is correct and included in the Authorization header.

403 - FORBIDDEN

Your API key doesn't have permission for this operation, or your account has been suspended.