Skip to main content

Overview

The Finance Agent API uses JWT (JSON Web Tokens) for authentication. After obtaining a token, include it in the Authorization header for all authenticated requests.

Register User

Create a new user account.
curl -X POST https://api.financeagent.com/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "username": "johndoe",
    "password": "SecurePass123!",
    "full_name": "John Doe",
    "company": "Acme Corp"
  }'
email
string
required
User email address (must be unique)
username
string
required
Username (must be unique)
password
string
required
Password (minimum 8 characters)
full_name
string
User’s full name
company
string
Company name
success
boolean
Whether registration was successful
message
string
Success or error message
user
object
Created user information

Login

Authenticate and receive a JWT token.
curl -X POST https://api.financeagent.com/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "SecurePass123!"
  }'
email
string
required
User email address
password
string
required
User password
success
boolean
Whether login was successful
access_token
string
JWT access token (valid for 24 hours)
token_type
string
Token type (always “bearer”)
user
object
Authenticated user information

Using the Token

Include the JWT token in the Authorization header for all authenticated requests:
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  https://api.financeagent.com/user/profile

Get User Profile

Retrieve the current user’s profile information.
cURL
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  https://api.financeagent.com/user/profile
Requires Authentication: Yes
id
string
User UUID
username
string
Username
email
string
Email address
full_name
string
Full name
company
string
Company name
is_admin
boolean
Admin status
created_at
string
Account creation timestamp (ISO 8601)

Get Usage Statistics

Retrieve usage statistics for rate limiting and billing.
cURL
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  https://api.financeagent.com/user/usage
Requires Authentication: Yes
total_requests
integer
Total lifetime requests
monthly_requests
integer
Requests this month
total_cost
number
Total lifetime cost ($0.02 per request)
monthly_cost
number
Cost this month
rate_limit_remaining
integer
Remaining requests this minute
monthly_limit_remaining
integer
Remaining requests this month

Token Expiration

JWT tokens expire after 24 hours. When a token expires, you’ll receive a 401 Unauthorized response. Simply log in again to obtain a new token.

Security Best Practices

Never expose your JWT token in client-side code or public repositories.
  • Store tokens securely (e.g., in environment variables or secure storage)
  • Use HTTPS for all API requests
  • Implement token refresh logic before expiration
  • Rotate tokens regularly in production environments

Build docs developers (and LLMs) love