Authentication
Authenticate with the Finetuning.ai API using your API key
All requests to the Finetuning.ai API must include a valid API key.
API Key
API access is available on Pro and Lifetime plans.
Include your key in the X-API-Key header:
curl https://pub.finetuning.ai/v1/me \
-H "X-API-Key: ft_live_your_key_here"Keys start with ft_live_ followed by 32 hex characters.
Getting your API key
- Log in to your account at finetuning.ai
- Go to Profile > API tab
- Click Create Key and give it a name
- Copy the key immediately — it is shown only once and cannot be retrieved later
You can have up to 5 active API keys per account. Each key shows its name, prefix, and last used date in the key list.
Revoking a key
Revoke a key from the Profile > API tab. Revoked keys are permanently deactivated and cannot be restored.
Security best practices
Never expose your API key in client-side code, public repositories, or browser requests.
- Use environment variables — Store your key in
.envfiles, not in source code - Server-side only — Make API calls from your backend, never from the browser
- Rotate regularly — If a key is compromised, revoke it immediately and create a new one
- Limit scope — Use separate keys for development and production
Example: Using environment variables
FINETUNING_API_KEY=ft_live_your_key_hereconst apiKey = process.env.FINETUNING_API_KEY;
const response = await fetch('https://pub.finetuning.ai/v1/me', {
headers: { 'X-API-Key': apiKey },
});Authentication errors
| Status Code | Meaning |
|---|---|
401 | Missing or invalid API key |
403 | API key valid but insufficient permissions |
429 | Rate limit exceeded — slow down |
See the Errors page for a full list of error codes.