All endpoints are prefixed with
/api/completions. Responses use
Content-Type: application/json. Endpoints that modify data require an
Authorization: Bearer <accessToken> header.POST /api/completions
Submit a completion for a challenge. The server verifies that the provided GPS coordinates are within an allowed distance of the challenge location before recording the completion. Aura points and streak are updated automatically inside a database transaction.Auth required: Yes — include
Authorization: Bearer <accessToken>.
This endpoint is rate-limited. Each challenge can only be completed once per
user; a duplicate submission returns 400.Request body
ID of the challenge being completed.
User’s current latitude (
-90 to 90).User’s current longitude (
-180 to 180).URL of the proof photo for this completion. Must be a valid URL.
Optional caption for the completion post. Maximum 500 characters.
Response — 201 Created
true on success."Challenge completed successfully!"Error responses
| Status | Condition |
|---|---|
400 | Invalid challengeId, missing imageUrl, GPS coordinates outside the allowed distance from the challenge location, or challenge already completed by this user |
401 | Missing or invalid Bearer token |
404 | Challenge not found |
429 | Rate limit exceeded |
Example
GET /api/completions
Return a paginated list of completions. Supports filtering by user, challenge, and date range. Each completion includes embeddeduser and challenge objects.
Query parameters
Filter completions by user ID.
Filter completions by challenge ID.
ISO 8601 date-time. Return only completions at or after this timestamp.
Must be before or equal to
endDate if both are supplied.ISO 8601 date-time. Return only completions at or before this timestamp.
Page number. Defaults to
1.Items per page. Defaults to
20, range 1–100.Sort order for
completedAt. One of asc or desc. Defaults to desc.Response — 200 OK
true on success.Error responses
| Status | Condition |
|---|---|
400 | Invalid query parameters (e.g. non-numeric ID, startDate after endDate, limit out of range) |
Example
GET /api/completions/:id
Return a single completion by its ID with fulluser and challenge details.
Path parameters
The numeric ID of the completion.
Response — 200 OK
true on success.Error responses
| Status | Condition |
|---|---|
400 | id is not a valid integer |
404 | Completion not found |
Example
PATCH /api/completions/:id
Update the caption of an existing completion. Only the owner of the completion may edit it.Auth required: Yes — include
Authorization: Bearer <accessToken>. The
authenticated user must own the completion.Path parameters
The numeric ID of the completion to update.
Request body
Updated caption text. Maximum 500 characters. Pass
null or omit to clear
the caption.Response — 200 OK
true on success.The updated completion, including embedded
user (id, name) and
challenge (id, title, pointsReward) objects.Error responses
| Status | Condition |
|---|---|
400 | id is not a valid integer, or caption exceeds 500 characters |
401 | Missing or invalid Bearer token |
403 | Authenticated user does not own this completion |
404 | Completion not found |
Example
POST /api/completions/:id/like
Increment the like count for a completion by 1.Auth required: Yes — include
Authorization: Bearer <accessToken>.Path parameters
The numeric ID of the completion to like.
Response — 200 OK
true on success.Error responses
| Status | Condition |
|---|---|
400 | id is not a valid integer |
401 | Missing or invalid Bearer token |
404 | Completion not found |
Example
DELETE /api/completions/:id/like
Decrement the like count for a completion by 1.Auth required: Yes — include
Authorization: Bearer <accessToken>.Path parameters
The numeric ID of the completion to unlike.
Response — 200 OK
true on success.Error responses
| Status | Condition |
|---|---|
400 | id is not a valid integer |
401 | Missing or invalid Bearer token |
404 | Completion not found |