Documentation Index
Fetch the complete documentation index at: https://docs.withleaf.io/llms.txt
Use this file to discover all available pages before exploring further.
Leaf uses JWT (JSON Web Token) authentication. You exchange your API owner credentials for a token, then pass that token in the Authorization header of every request.
For conceptual background — multiple environments, token usage patterns — see Authentication.
Base URL
https://api.withleaf.io/api
Endpoints
| Action | Method | Path |
|---|
| Get a token | POST | /authenticate |
Get a token
POST /authenticate
Exchanges API owner credentials for a JWT token.
Request body
| Field | Type | Required | Description |
|---|
username | string | Yes | Your API owner email address. |
password | string | Yes | Your API owner password. |
rememberMe | string | No | "true" for a 30-day token, "false" for a 24-hour token. Defaults to "false". |
Token duration
rememberMe | Token duration |
|---|
"true" | 30 days |
"false" | 24 hours |
When a token expires, request a new one from the same endpoint. There is no refresh token flow.
Request
curl -X POST \
-H 'Content-Type: application/json' \
-d '{"username":"your-email@example.com","password":"your-password","rememberMe":"true"}' \
'https://api.withleaf.io/api/authenticate'
Response
{
"id_token": "eyJhbGciOi..."
}
Using the token
Include the token in the Authorization header of every API request:
Authorization: Bearer eyJhbGciOi...
Error responses
| Status | Meaning |
|---|
401 Unauthorized | Credentials are invalid, or the token is missing, expired, or malformed. |