Troubleshooting and FAQ¶
Common issues, error codes, and solutions for the Fermi API.
Common Issues¶
Invalid API Key Errors¶
Error Message:
Solutions:
- Verify your API key is correct
- Check if the key has been revoked
- Check expiration date
- Ensure header format:
Authorization: Bearer <api-key>
Example:
# Wrong
curl -H "Authorization: fmk_live_abc123" ...
# Correct
curl -H "Authorization: Bearer fmk_live_abc123" ...
Missing Scope Errors¶
Error Message:
Solutions:
- Create a new API key with the required scope
- Rotate your existing API key to add the scope
- Update service actor capabilities
Token Expiration Issues¶
Error Message:
Solutions:
- Exchange for a new token using the token exchange endpoint
- Implement automatic token refresh
- Cache tokens until near expiration
Example:
import requests
def get_valid_token(api_key, service_actor_id):
"""Exchange for new token"""
response = requests.post(
"https://api.fermi.dev/public/v1/identity/auth/token/exchange",
headers={"Authorization": f"Bearer {api_key}"},
json={"serviceActorId": service_actor_id}
)
response.raise_for_status()
return response.json()["token"]
Rate Limiting¶
Error Message:
Solutions:
- Implement exponential backoff
- Cache responses when appropriate
- Reduce request frequency
- Monitor rate limit headers
Example:
import time
def make_request_with_backoff(url, headers, max_retries=3):
for attempt in range(max_retries):
response = requests.get(url, headers=headers)
if response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", 60))
wait_time = retry_after * (2 ** attempt)
time.sleep(wait_time)
continue
return response
Network Connectivity¶
Error Message:
Solutions:
- Check your internet connection
- Verify firewall rules allow outbound HTTPS
- Test DNS resolution:
nslookup api.fermi.dev
Service Actor Not Found¶
Error Message:
Solutions:
- Verify the service actor ID
- List service actors to find the correct ID
- Ensure service actor belongs to your organization
Organization Mismatch¶
Error Message:
{
"status": 403,
"message": "Service actor's parent organisation must match API key's organization"
}
Solutions:
- Verify organization IDs match
- Create service actor in the correct organization
- Use API key from the same organization
Error Codes Reference¶
| Status Code | Error Type | Common Causes | Solutions |
|---|---|---|---|
| 200 | Success | - | - |
| 201 | Created | - | - |
| 400 | Bad Request | Invalid parameters | Check request format and parameters |
| 401 | Unauthorized | Invalid API key, expired token | Verify credentials, refresh token |
| 403 | Forbidden | Missing scope, organization mismatch | Add required scope, verify organization |
| 404 | Not Found | Invalid endpoint, resource not found | Check endpoint URL, verify resource exists |
| 429 | Too Many Requests | Rate limit exceeded | Implement backoff, reduce request frequency |
| 500 | Server Error | Server error | Retry request, contact support |
Frequently Asked Questions¶
How do I reset my API key?¶
You cannot "reset" an API key, but you can:
- Rotate the key to get a new key value
- Create a new API key
- Revoke the old key if compromised
What scopes do I need?¶
Required scopes depend on what you want to do:
- Query analytics:
analytics:query - Read analytics:
analytics:read - Write analytics:
analytics:write - Create service actors:
provision:service:create - Exchange tokens:
provision:token:exchange
How long do tokens last?¶
Service actor tokens expire after 15 minutes (900 seconds).
How do I handle rate limits?¶
- Monitor rate limit headers in responses
- Implement exponential backoff when you hit limits
- Cache responses when appropriate
- Reduce request frequency if possible
- Use pagination for large data sets
Can I use multiple API keys?¶
Yes! You can create multiple API keys for different purposes:
- Different applications or use cases
- Different permission levels
How do I know if my API key is working?¶
List service actors (API key, not a service-actor token):
curl -X GET https://api.fermi.dev/public/v1/identity/service-actors \
-H "Authorization: Bearer fmk_live_your_api_key"
After token exchange, list chat sessions:
curl -X GET https://api.fermi.dev/agents-service/api/v1/agentcore/sessions \
-H "Authorization: Bearer <service-actor-token>"
There is no GET /public/v1/analytics/status endpoint (live 405).
What's the difference between API keys and tokens?¶
- API Keys: Credentials for creating organizations and service actors
- Tokens: Short-lived JWTs (15 minutes) for accessing data
Use API keys to create organizations and service actors. Use service actor tokens to access data.
How do I update my API key scopes?¶
You can update scopes by rotating your API key:
curl -X POST https://api.fermi.dev/public/v1/identity/api-keys/{key-id}/rotate \
-H "Authorization: Bearer <user-jwt>" \
-H "Content-Type: application/json" \
-d '{
"scopes": ["analytics:query", "analytics:read", "analytics:write"]
}'
What happens if I lose my API key?¶
If you lose your API key:
- Revoke the lost key immediately
- Create a new API key
- Update your applications with the new key
Important: API keys are only shown once when created. If you lose it, you must create a new one.
404 on /public/v1/analytics/query¶
That path does not exist. Ask Fermi with:
POST https://api.fermi.dev/agents-service/api/v1/agentcore/chat/stream and { "message", "session_id" }.
Token exchange is POST /public/v1/identity/auth/token/exchange (not tokens/exchange).
How do I test my integration?¶
- Test with simple endpoints first (
GET /public/v1/identity/service-actors, thenGET .../agentcore/sessions) - Verify authentication works
- Test error handling
- Test all endpoints before deploying
Getting Help¶
If you're still experiencing issues:
-
Check the documentation
-
Review error messages carefully
- Error messages often contain specific guidance
- Check status codes and error details
Next Steps¶
- API Reference - Complete endpoint documentation
- Authentication Guide - Authentication methods
- Code Examples - Working examples