Authentication
BalanceSheet Pro uses JWT (JSON Web Token) authentication.
Register
curl -X POST http://localhost:8000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securepass123",
"first_name": "John",
"last_name": "Doe",
"company_code": "MYCO",
"company_name": "My Company"
}'
Response:
{
"access_token": "eyJ...",
"refresh_token": "eyJ...",
"token_type": "bearer"
}
Login
curl -X POST http://localhost:8000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securepass123"
}'
Using the Token
Include the access token in the Authorization header:
curl http://localhost:8000/api/v1/accounts/?company_id=YOUR_COMPANY_ID \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Refresh Token
Access tokens expire in 30 minutes. Use the refresh token to get a new one:
curl -X POST http://localhost:8000/api/v1/auth/refresh \
-H "Content-Type: application/json" \
-d '{"refresh_token": "YOUR_REFRESH_TOKEN"}'
Roles
| Role | Permissions |
|---|---|
| ADMIN | Full access, manage users, close fiscal years |
| ACCOUNTANT | Create/post journals, generate reports |
| AP_CLERK | Manage accounts payable |
| AR_CLERK | Manage accounts receivable |
| VIEWER | Read-only access |