Skip to main content

Overview

FIM One API supports two authentication methods:
  1. API Keys — Simple, long-lived tokens for service-to-service integration
  2. JWT Tokens — Short-lived tokens from user login (for SSE endpoints)
Most integrations should use API Keys.

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

  1. Log in to your FIM One portal
  2. Go to Settings → API Keys
  3. Click Create API Key
  4. Enter a name (e.g., “Production Integration”)
  5. (Optional) Set scopes to limit access
  6. (Optional) Set an expiration date
  7. Click Create
  8. Copy the key immediately — it’s only shown once
The full key looks like: fim_your44characterkeystringhere (starts with fim_ prefix)

Using API Keys

Include the key in the Authorization header as a Bearer token:
Or in Python:

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)
Management: You can:
  • 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: Create a key with scopes:

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/react and /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:
Response:

Using JWT for Streaming

For SSE endpoints, include the token in the request body:
Or from JavaScript using 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

Never commit API keys to version control. They provide full access to your data.
  1. Store in environment variables:
    Then reference in code:
  2. Use key rotation:
    • Create a new key
    • Update your application
    • Delete the old key
    • Repeat quarterly
  3. Set expiration dates:
    • Use short-lived keys for temporary integrations
    • Require re-authentication periodically
  4. Use scoped keys:
    • Don’t use “full access” keys unless necessary
    • Create separate keys for different services
    • Limits damage if a key is compromised
  5. Monitor usage:
    • Check “last used” timestamps
    • Review request counts
    • Delete unused keys

JWT Tokens

  1. Keep short-lived: Access tokens expire after 2 hours
  2. Secure storage:
    • In browsers: use HttpOnly cookies (safer than localStorage)
    • In servers: use secure session storage
  3. Never expose in logs: Log only the token prefix, not the full token
  4. 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

Causes:
  • 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
Solution: Verify your token format and re-generate if necessary

Unauthorized Error

Causes:
  • No Authorization header provided
  • Token is missing from request body (for SSE endpoints)
  • API key is disabled
Solution: Include a valid token in every request

Forbidden Error

Causes:
  • API key has scoped access and lacks the required scope
  • User account has restricted permissions
Solution: Use a key with the appropriate scope or increase key privileges

Expired Token

Solution: Use the refresh token to get a new access 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