Activity Repository
API Contract
REST
/api/v1/activities
5 endpoints
GET
/api/v1/activities/api/v1/activities
List activities with optional peer mentor and date range filters
Public
Response Example
{
"data": [
{
"id": "act_9f3a12bc",
"local_id": "local_7e2d1a",
"peer_mentor_id": "mentor_4b8c21",
"activity_type_id": "type_running",
"date": "2026-03-25",
"duration_minutes": 45,
"status": "confirmed",
"notes": "Morning run along the river",
"created_at": "2026-03-25T08:15:00Z",
"updated_at": "2026-03-25T08:16:42Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 47
}
}
GET
/api/v1/activities/api/v1/activities/:id
Get a single activity record by ID
Public
Response Example
{
"id": "act_9f3a12bc",
"local_id": "local_7e2d1a",
"peer_mentor_id": "mentor_4b8c21",
"activity_type_id": "type_running",
"date": "2026-03-25",
"duration_minutes": 45,
"status": "confirmed",
"notes": "Morning run along the river",
"created_at": "2026-03-25T08:15:00Z",
"updated_at": "2026-03-25T08:16:42Z"
}
POST
/api/v1/activities/api/v1/activities
Insert a new activity record (optimistic insert; local_id tracks pre-confirmation state)
Public
Request Example
{
"local_id": "local_7e2d1a",
"peer_mentor_id": "mentor_4b8c21",
"activity_type_id": "type_running",
"date": "2026-03-25",
"duration_minutes": 45,
"notes": "Morning run along the river"
}
Response Example
{
"id": "act_9f3a12bc",
"local_id": "local_7e2d1a",
"peer_mentor_id": "mentor_4b8c21",
"activity_type_id": "type_running",
"date": "2026-03-25",
"duration_minutes": 45,
"status": "pending",
"notes": "Morning run along the river",
"created_at": "2026-03-25T08:15:00Z",
"updated_at": "2026-03-25T08:15:00Z"
}
PUT
/api/v1/activities/api/v1/activities/:id
Update an activity record (also used to confirm optimistic inserts by mapping local_id → remote id)
Public
Request Example
{
"activity_type_id": "type_cycling",
"date": "2026-03-25",
"duration_minutes": 60,
"status": "confirmed",
"notes": "Switched to cycling session"
}
Response Example
{
"id": "act_9f3a12bc",
"local_id": "local_7e2d1a",
"peer_mentor_id": "mentor_4b8c21",
"activity_type_id": "type_cycling",
"date": "2026-03-25",
"duration_minutes": 60,
"status": "confirmed",
"notes": "Switched to cycling session",
"created_at": "2026-03-25T08:15:00Z",
"updated_at": "2026-03-25T09:02:11Z"
}
DELETE
/api/v1/activities/api/v1/activities/:id
Delete an activity record by ID
Public
Response Example
{
"deleted": true,
"id": "act_9f3a12bc"
}