To retrieve a list of all habits and their completion status, follow these steps:
- Get all habits: Call the
/api/v1/habits endpoint to retrieve the list of habits and their IDs. - Get completions: For each habit, call the
/api/v1/habits/{habit_id}/completions endpoint to get completion dates. Use the following query parameters:date_fmt: %25d-%25m-%25Y (for DD-MM-YYYY format)date_start: The start datedate_end: The end datelimit: 100sort: asc
Response Format: The completions endpoint returns an array of date strings, e.g., ["16-02-2026", "18-02-2026"].
Visualizing Results: It is recommended to render the results as an ASCII table where ✓ represents a completed habit and ✗ represents an incomplete one. Strip emojis from habit names to ensure proper table alignment.
# Step 1: Get all habits
curl -s -H "Authorization: Bearer $BEAVERHABITS_API_KEY" \
"${SERVER_URL:-https://beaverhabits.com}/api/v1/habits"
# Step 2: Get completions for a specific habit ID
curl -s -H "Authorization: Bearer $BEAVERHABITS_API_KEY" \
"${SERVER_URL:-https://beaverhabits.com}/api/v1/habits/{habit_id}/completions?date_fmt=%25d-%25m-%25Y&date_start={start}&date_end={end}&limit=100&sort=asc"