Todos
Overview
Section titled “Overview”The Todos resource provides fake todo data with titles, completion status, and user relationships.
Endpoints
Section titled “Endpoints”Available Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/todos | List all todos |
| GET | /v1/todos/:id | Get a specific todo |
Todo Object
Section titled “Todo Object”{ "id": 1, "userId": 1, "title": "Buy groceries", "completed": false, "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
userId |
number |
ID of the user |
title |
string |
Todo title |
completed |
boolean |
Completion status |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Todos
Section titled “List Todos”curl https://api.phantomjson.app/v1/todosQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
q |
string |
— | Search query |
fields |
string |
— | Fields to return |
userId |
number |
— | Filter by user ID |
completed |
boolean |
— | Filter by completion status |
Response
Section titled “Response”{ "data": [ { "id": 1, "userId": 1, "title": "Buy groceries", "completed": false } ], "meta": { "total": 300, "page": 1, "limit": 20, "totalPages": 15 }}Get Todo by ID
Section titled “Get Todo by ID”curl https://api.phantomjson.app/v1/todos/1Response
Section titled “Response”{ "data": { "id": 1, "userId": 1, "title": "Buy groceries", "completed": false }}Examples
Section titled “Examples”Search Todos
Section titled “Search Todos”curl "https://api.phantomjson.app/v1/todos?q=buy"Filter by User
Section titled “Filter by User”curl "https://api.phantomjson.app/v1/todos?userId=1"Filter by Status
Section titled “Filter by Status”# Get completed todoscurl "https://api.phantomjson.app/v1/todos?completed=true"
# Get incomplete todoscurl "https://api.phantomjson.app/v1/todos?completed=false"Sort by Title
Section titled “Sort by Title”curl "https://api.phantomjson.app/v1/todos?sort=title:asc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/todos?fields=id,title,completed"Relations
Section titled “Relations”- User — Each todo belongs to a user (
userId) - Access todos for a specific user via
/v1/users/:id/todos
