Skip to main content

Overview

The Chores API allows you to create, read, update, delete, and reorder household chores. Each chore can be assigned to a household member and includes optional descriptions.

Endpoints

Get All Chores

GET /api/chores
endpoint
Retrieves all chores for the authenticated user’s household, ordered by position.
Authentication: Required Response
chores
array
Array of chore objects
curl -X GET https://your-domain.com/api/chores \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"
Example Response
[
  {
    "id": "clx123abc",
    "householdId": "clx456def",
    "name": "Vacuum living room",
    "assignee": "John",
    "description": "Don't forget under the couch",
    "position": 0,
    "checked": false,
    "createdAt": "2024-03-15T10:00:00Z",
  },
  {
    "id": "clx789ghi",
    "householdId": "clx456def",
    "name": "Take out trash",
    "assignee": "Sarah",
    "description": "",
    "position": 1,
    "checked": false,
    "createdAt": "2024-03-15T11:00:00Z",
  }
]

Create or Reorder Chores

POST /api/chores
endpoint
Creates a new chore or reorders existing chores.
Authentication: Required Request Body (Create) Request Body (Reorder)
curl -X POST https://your-domain.com/api/chores \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Wash dishes",
    "assignee": "John",
    "description": "Include pots and pans"
  }'
Response (Create)
{
  "id": "clxnew123",
  "householdId": "clx456def",
  "name": "Wash dishes",
  "assignee": "John",
  "description": "Include pots and pans",
  "position": 2,
  "checked": false,
  "createdAt": "2024-03-15T12:00:00Z",
}
Response (Reorder)
Positions updated
Status: 200 OK

Update Chore

POST /api/chores/update
endpoint
Updates an existing chore’s details.
Authentication: Required Request Body
curl -X POST https://your-domain.com/api/chores/update \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "clx123abc",
    "name": "Deep clean living room",
    "assignee": "Sarah",
    "description": "Vacuum and dust all surfaces"
  }'
Response
{
  "count": 1
}
Returns the number of records updated (should be 1 if successful).

Delete Chore

POST /api/chores/delete
endpoint
Deletes a chore and creates a completion notification.
Authentication: Required Request Body
curl -X POST https://your-domain.com/api/chores/delete \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id": "clx123abc"}'
Response
{
  "id": "clx123abc",
  "householdId": "clx456def",
  "name": "Vacuum living room",
  "assignee": "John",
  "description": "Don't forget under the couch",
  "position": 0,
  "checked": false,
  "createdAt": "2024-03-15T10:00:00Z",
}
When a chore is deleted, a notification is automatically created with:
  • Type: “chores”
  • Title: “Chore Completed”
  • Body: “You completed: [chore name]“

Get Chores Count

GET /api/chores/count
endpoint
Returns the total number of chores for the household.
Authentication: Required
curl -X GET https://your-domain.com/api/chores/count \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"
Response
{
  "count": 5
}

Error Responses

All endpoints may return these error responses:
401 Unauthorized
User is not authenticated
Unauthorized
400 Bad Request
Missing required fields
Missing fields
or
Missing required fields
or
Missing or invalid ID
500 Internal Server Error
Unexpected server error
Internal Server Error

Source Code Reference

  • Main routes: ~/workspace/source/src/app/api/chores/route.ts:19
  • Count endpoint: ~/workspace/source/src/app/api/chores/count/route.ts:19
  • Delete endpoint: ~/workspace/source/src/app/api/chores/delete/route.ts:21
  • Update endpoint: ~/workspace/source/src/app/api/chores/update/route.ts:19

Build docs developers (and LLMs) love