Authentication
Fine API uses Bearer token authentication. Include your API key in the Authorization header of all requests.
Getting Your API Key
- Log in to your dashboard
- Navigate to API Keys section
- Create a new API key or copy an existing one
Using Your API Key
Include the API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Example Request
curl -X POST https://api.example.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Security Best Practices
Never expose your API key in client-side code or public repositories.
- Store API keys in environment variables
- Use server-side code to make API calls
- Rotate keys regularly
- Use separate keys for development and production