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.
Retrieve a paginated list of todos. Results merge shared global todos with session sandbox overlays (newly created todos appear at the top).
| 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"
fetch('http://localhost:3000/todos', {
method: 'GET',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.get('http://localhost:3000/todos', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.get('http://localhost:3000/todos')
print(response.json())
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
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.
| 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"
fetch('http://localhost:3000/todos/:id', {
method: 'GET',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.get('http://localhost:3000/todos/:id', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.get('http://localhost:3000/todos/:id')
print(response.json())
Response Schema Example
{
"id": 1,
"user_id": 1,
"title": "delectus aut autem",
"completed": false
}
⚡ Try it out — Test endpoint live Run fetch
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.
| 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
}'
fetch('http://localhost:3000/todos', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "user_id": 1, "title": "delectus aut autem", "completed": false })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.post('http://localhost:3000/todos', { "user_id": 1, "title": "delectus aut autem", "completed": false }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "user_id": 1, "title": "delectus aut autem", "completed": false }
response = requests.post('http://localhost:3000/todos', json=payload)
print(response.json())
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
Replace an existing todo record in the session overlay. Global records remain untouched for other visitors and preserve original list position.
| 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
}'
fetch('http://localhost:3000/todos/:id', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "user_id": 1, "title": "delectus aut autem (Updated)", "completed": true })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.put('http://localhost:3000/todos/:id', { "user_id": 1, "title": "delectus aut autem (Updated)", "completed": true }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "user_id": 1, "title": "delectus aut autem (Updated)", "completed": true }
response = requests.put('http://localhost:3000/todos/:id', json=payload)
print(response.json())
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
Partially update specific fields of a todo record in the session overlay.
| 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
}'
fetch('http://localhost:3000/todos/:id', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "completed": true })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.patch('http://localhost:3000/todos/:id', { "completed": true }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "completed": true }
response = requests.patch('http://localhost:3000/todos/:id', json=payload)
print(response.json())
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
Remove a todo record from the requesting session view. The underlying global record is unaffected for other visitors.
| 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"
fetch('http://localhost:3000/todos/:id', {
method: 'DELETE',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.delete('http://localhost:3000/todos/:id', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.delete('http://localhost:3000/todos/:id')
print(response.status_code)
Response Schema Example
204 No Content