Documentation Index
Fetch the complete documentation index at: https://docs.fim.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
FIM One API supports two authentication methods:- API Keys — Simple, long-lived tokens for service-to-service integration
- JWT Tokens — Short-lived tokens from user login (for SSE endpoints)
API Keys
API keys are long-lived credentials tied to your user account. They’re ideal for:- Server-to-server integrations
- Scheduled scripts and automation
- External applications accessing FIM One
Creating an API Key
- Log in to your FIM One portal
- Go to Settings → API Keys
- Click Create API Key
- Enter a name (e.g., “Production Integration”)
- (Optional) Set scopes to limit access
- (Optional) Set an expiration date
- Click Create
- Copy the key immediately — it’s only shown once
fim_your44characterkeystringhere (starts with fim_ prefix)
Using API Keys
Include the key in theAuthorization header as a Bearer token:
API Key Features
Visibility: Each key shows:- Key prefix (first 8 chars for identification)
- Creation date
- Last used timestamp
- Total request count
- Active status
- Expiration date (if set)
- Enable/disable keys without deleting them
- Set automatic expiration dates
- Delete keys permanently
- Track usage patterns
Scopes
Scopes limit what an API key can access. If no scopes are set, the key has full access. Available scopes:| Scope | Allows |
|---|---|
chat | POST /api/react, POST /api/dag, POST /api/chat/inject |
agents | GET /api/agents, GET /api/agents/{id} |
kb | GET /api/knowledge-bases, POST /api/knowledge-bases/{id}/retrieve |
connectors | Connector CRUD (connector_specific endpoints) |
admin | Administrative endpoints |
JWT Tokens
JWT tokens are short-lived and issued at login. They’re used for:- SSE Streaming Endpoints: Pass tokens in the request body for
/api/reactand/api/dag - Portal Session: Frontend authentication
Getting a JWT Token
JWT tokens are automatically issued when you log in through the web portal or call the authentication endpoint:Using JWT for Streaming
For SSE endpoints, include the token in the request body:fetch with a readable stream (the endpoint is POST-only, so native EventSource which only supports GET cannot be used):
Token Refresh
Access tokens expire after 2 hours. Use the refresh token to get a new access token without re-logging in:Security Best Practices
API Keys
-
Store in environment variables:
Then reference in code:
-
Use key rotation:
- Create a new key
- Update your application
- Delete the old key
- Repeat quarterly
-
Set expiration dates:
- Use short-lived keys for temporary integrations
- Require re-authentication periodically
-
Use scoped keys:
- Don’t use “full access” keys unless necessary
- Create separate keys for different services
- Limits damage if a key is compromised
-
Monitor usage:
- Check “last used” timestamps
- Review request counts
- Delete unused keys
JWT Tokens
- Keep short-lived: Access tokens expire after 2 hours
- Secure storage:
- In browsers: use HttpOnly cookies (safer than localStorage)
- In servers: use secure session storage
- Never expose in logs: Log only the token prefix, not the full token
- Use HTTPS only: Never send tokens over unencrypted connections
Rate Limits
Per-key rate limiting is planned for a future release. Currently there are no enforced per-key request limits.Troubleshooting
Invalid Token Error
- API key prefix is wrong (must start with
fim_) - JWT token has expired (refresh it)
- Token is malformed or corrupted
- API key has been deleted
Unauthorized Error
- No Authorization header provided
- Token is missing from request body (for SSE endpoints)
- API key is disabled
Forbidden Error
- API key has scoped access and lacks the required scope
- User account has restricted permissions
Expired Token
Environment Variable Setup
Python
Node.js
Bash
Support
For authentication issues:- Check the API Overview for response format details
- Review token expiration with
GET /api/auth/verify - Contact support if you believe a key has been compromised