Authentication Method
All API requests (except/api/v1/cron/{cliToken}) require authentication using OAuth2 bearer tokens.
Bearer Token Authentication
Include your access token in theAuthorization header:
OAuth2 with Laravel Passport
Firefly III implements OAuth2 using Laravel Passport.Supported Grant Types
- Personal Access Tokens - For user-owned API clients
- Authorization Code Grant - For third-party applications
- Client Credentials Grant - For machine-to-machine authentication
Personal Access Tokens
The easiest way to access the API is through Personal Access Tokens.Creating a Personal Access Token
- Log in to your Firefly III web interface
- Navigate to Options > Profile > OAuth
- Click Create New Token
- Give your token a name (e.g., “Mobile App”)
- Click Create
- Copy the generated token immediately (it won’t be shown again)
Using Personal Access Tokens
OAuth2 Authorization Code Flow
For third-party applications that need to access user data.Step 1: Register Your Application
- Log in to Firefly III
- Go to Options > Profile > OAuth
- Click Create New Client
- Enter your application name and redirect URL
- Save the Client ID and Client Secret
Step 2: Authorization Request
Redirect users to the authorization endpoint:Your OAuth client ID
The callback URL registered with your client
Must be
code for authorization code flowRequested scopes (use
* for full access)CSRF protection token (recommended)
Step 3: Exchange Code for Token
After user authorization, exchange the authorization code for an access token:The bearer token to use in API requests
Token to obtain a new access token when expired
Access token lifetime in seconds (default: 1 year)
Always “Bearer”
Refreshing Access Tokens
Use the refresh token to obtain a new access token:Client Credentials Grant
For machine-to-machine authentication without user interaction.OAuth2 Scopes
Firefly III currently uses a single scope:Full access to all API endpoints and user data
Future versions of Firefly III may implement granular scopes for fine-grained access control.
Authentication Guard
The API uses the authentication guard configured in your environment:config/passport.php and defaults to the web guard.
Encryption Keys
Passport uses RSA encryption keys for signing tokens. These are automatically generated during installation.Custom Keys (Optional)
You can provide custom encryption keys via environment variables:Security Best Practices
- Store tokens securely - Use secure storage mechanisms (keychain, encrypted storage)
- Use HTTPS only - Never transmit tokens over unencrypted connections
- Rotate tokens regularly - Revoke and recreate tokens periodically
- Implement token expiration - Use refresh tokens for long-lived applications
- Use state parameter - Protect against CSRF attacks in OAuth flows
Revoking Tokens
Revoke access tokens through the Firefly III web interface:- Navigate to Options > Profile > OAuth
- Find the token or client to revoke
- Click Revoke or Delete
Unauthenticated Endpoints
The following endpoint does not require authentication:GET /api/v1/cron/{cliToken}- Cron endpoint using CLI token instead of OAuth
The cron endpoint uses a different authentication method (CLI token) for scheduled tasks.
Testing Authentication
Verify your authentication is working:Common Authentication Errors
401 Unauthorized
- Missing Authorization header
- Invalid or expired token
- Malformed bearer token
403 Forbidden
- Insufficient permissions for the requested action
- Admin-only endpoint accessed by regular user
Next Steps
API Overview
Learn about API basics and response formats
Search API
Search transactions and accounts