Authentication

Learn how to authenticate with the Arkangel AI API using API keys

by Arkangel AI Team•1 min read

The Arkangel AI API uses API keys to authenticate requests. You can view and manage your API keys in your account dashboard.

Getting Your API Key

  1. Log in to your Arkangel AI account
  2. Go to Settings > API
  3. Click Generate New API Key
  4. Copy and store your key securely

Important: Your API key is secret. Do not share it or expose it in client-side code.

Using Your API Key

Include your API key in the Authorization header of all requests:

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

JavaScript Example

const response = await fetch('https://api.arkangelai.com/v1/chat', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'Hello'
  })
});

Python Example

import requests

headers = {
    'Authorization': 'Bearer your_api_key',
    'Content-Type': 'application/json'
}

response = requests.post(
    'https://api.arkangelai.com/v1/chat',
    headers=headers,
    json={'message': 'Hello'}
)

API Key Security

  • Never expose your API key in client-side code
  • Use environment variables to store your keys
  • Rotate your keys regularly
  • Revoke any compromised keys immediately

Environment Variables

# .env
ARKANGEL_API_KEY=your_api_key
// Use the environment variable
const apiKey = process.env.ARKANGEL_API_KEY;

Authentication Errors

Code Message Description
401 invalid_api_key The provided API key is invalid
401 missing_api_key No API key was provided
403 api_key_revoked The API key has been revoked
429 rate_limit_exceeded You have exceeded the request limit

Next Steps