Todos Resource Documentation

Read operations merge shared global todos with your session's overlay (newly created todos appear at the top, updates apply in-place, deletes are filtered). Each todo belongs to a user (`user_id` foreign key). Mutations are session-scoped and capped at 30 created records.

GET /todos

Retrieve a paginated list of todos. Results merge shared global todos with session sandbox overlays (newly created todos appear at the top).

Request Parameters
Name Type Location Description
page integer query Page number (1-indexed, default 1).
limit integer query Number of records per page (default 10, max 30).
curl -X GET 'http://localhost:3000/todos' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid"

Response Schema Example

{
  "data": [
    {
      "id": "local-d4e5f6a7-8901-bcde-f123-456789012345",
      "user_id": 1,
      "title": "delectus aut autem",
      "completed": true,
      "_sandbox": "created"
    },
    {
      "id": 1,
      "user_id": 1,
      "title": "delectus aut autem",
      "completed": false
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 126,
    "totalPages": 13,
    "hasNextPage": true,
    "hasPrevPage": false
  }
}
⚡ Try it out — Test endpoint live Run fetch
GET /todos/:id

Retrieve a single todo item by ID. Supports plain integer IDs for global records (e.g. 1) and string IDs formatted as local-<uuid> for session sandbox records.

Request Parameters
Name Type Location Description
id string | integer path Todo ID (e.g. 1 for global todo or local-<uuid> for sandbox todo).
curl -X GET 'http://localhost:3000/todos/:id' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid"

Response Schema Example

{
  "id": 1,
  "user_id": 1,
  "title": "delectus aut autem",
  "completed": false
}
⚡ Try it out — Test endpoint live Run fetch
POST /todos

Create a new session sandbox todo record. Returns a local-<uuid> formatted ID with _sandbox: 'created'. Each session identity is capped at 30 created records.

Request Parameters
Name Type Location Description
user_id integer body Owner user ID.
title string body Todo task title.
completed boolean body Completion status (true / false).
curl -X POST 'http://localhost:3000/todos' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid" \
  -d '{
  "user_id": 1,
  "title": "delectus aut autem",
  "completed": false
}'

Request Payload Example

{
  "user_id": 1,
  "title": "delectus aut autem",
  "completed": false
}

Response Schema Example

{
  "id": "local-d4e5f6a7-8901-bcde-f123-456789012345",
  "user_id": 1,
  "title": "delectus aut autem",
  "completed": false,
  "_sandbox": "created"
}
⚡ Try it out — Test endpoint live Run fetch
PUT /todos/:id

Replace an existing todo record in the session overlay. Global records remain untouched for other visitors and preserve original list position.

Request Parameters
Name Type Location Description
id string | integer path Todo ID to update (e.g. 1 or local-<uuid>).
curl -X PUT 'http://localhost:3000/todos/:id' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid" \
  -d '{
  "user_id": 1,
  "title": "delectus aut autem (Updated)",
  "completed": true
}'

Request Payload Example

{
  "user_id": 1,
  "title": "delectus aut autem (Updated)",
  "completed": true
}

Response Schema Example

{
  "id": 1,
  "user_id": 1,
  "title": "delectus aut autem (Updated)",
  "completed": true,
  "_sandbox": "updated"
}
⚡ Try it out — Test endpoint live Run fetch
PATCH /todos/:id

Partially update specific fields of a todo record in the session overlay.

Request Parameters
Name Type Location Description
id string | integer path Todo ID to patch (e.g. 1 or local-<uuid>).
curl -X PATCH 'http://localhost:3000/todos/:id' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid" \
  -d '{
  "completed": true
}'

Request Payload Example

{
  "completed": true
}

Response Schema Example

{
  "id": 1,
  "user_id": 1,
  "title": "delectus aut autem",
  "completed": true,
  "_sandbox": "updated"
}
⚡ Try it out — Test endpoint live Run fetch
DELETE /todos/:id

Remove a todo record from the requesting session view. The underlying global record is unaffected for other visitors.

Request Parameters
Name Type Location Description
id string | integer path Todo ID to delete (e.g. 1 or local-<uuid>).
curl -X DELETE 'http://localhost:3000/todos/:id' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid"

Response Schema Example

204 No Content
⚡ Try it out — Test endpoint live Run fetch