List challenges
Retrieve a paginated list of challenges in a community.
GET /v1/communities/:community_id/challenges
Query parameters:
| Parameter | Type | Description |
|---|
page | int | Page number (default: 1). |
per_page | int | Items per page (max 50). |
Get challenge
Retrieve the details of a specific challenge.
GET /v1/communities/:community_id/challenges/:id
Create challenge
Create a new challenge inside a community.
POST /v1/communities/:community_id/challenges
Request body:
{
"title": "30-Day Challenge",
"description": "A description of the challenge",
"duration_days": 30,
"challenge_type": "daily",
"access_type": "free",
"xp_reward": 100
}
| Field | Type | Required | Description |
|---|
title | string | Yes | Challenge title. |
description | string | No | Detailed description of the challenge. |
duration_days | int | Yes | Length of the challenge in days. |
challenge_type | string | Yes | Type of challenge: daily, weekly, or custom. |
access_type | string | Yes | Who can join: free, paid, or members_only. |
xp_reward | int | No | XP awarded to participants who complete the challenge. |
Enroll in challenge
Enroll the authenticated user in a challenge.
POST /v1/communities/:community_id/challenges/:id/enroll
Response: Returns the enrollment record with status active.
If the challenge has access_type: "paid", the user must have completed payment before enrollment succeeds.
Get progress
Retrieve the authenticated user’s progress in a specific challenge.
GET /v1/communities/:community_id/challenges/:id/progress
Response:
{
"data": {
"total_days": 30,
"completed_days": 5,
"progress_percent": 16.7,
"current_streak": 5,
"last_checkin_at": "2025-01-20T08:00:00Z"
}
}
Submit check-in
Submit a daily check-in for the authenticated user in a challenge.
POST /v1/communities/:community_id/challenges/:id/checkins
Request body:
{
"content": "Day 5 complete! I exercised for 30 minutes.",
"day_number": 5,
"tags": ["fitness", "morning"]
}
| Field | Type | Required | Description |
|---|
content | string | Yes | A description of what you accomplished. |
day_number | int | Yes | The day of the challenge you are checking in for. |
tags | string[] | No | Optional tags for categorizing the check-in. |
Leaderboard
Retrieve the leaderboard rankings for a challenge, sorted by progress and XP.
GET /v1/communities/:community_id/challenges/:id/leaderboard
Query parameters:
| Parameter | Type | Description |
|---|
page | int | Page number (default: 1). |
per_page | int | Items per page (max 50). |
Response: Returns an array of participants ordered by ranking position, including their display_name, completed_days, current_streak, and xp_earned.