Todos API
50 developer-themed todos.
Get all todos
Get all todos (paginated).
fetch('https://axomock.fauzantaslim.biz.id/api/todos')
.then(res => res.json())
.then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/todos')
.then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/todos
200 OK
{
"todos": [
{
"id": 1,
"todo": "Complete the project proposal document",
"completed": false,
"userId": 1
},
... // 29 more items
],
"total": 50,
"skip": 0,
"limit": 30
}
Get a single todo
Get a single todo by ID.
fetch('https://axomock.fauzantaslim.biz.id/api/todos/1')
.then(res => res.json())
.then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/todos/1')
.then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/todos/1
200 OK
{
"id": 1,
"todo": "Complete the project proposal document",
"completed": false,
"userId": 1
}
Search todos
Search todos by task content.
fetch('https://axomock.fauzantaslim.biz.id/api/todos/search?q=project')
.then(res => res.json())
.then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/todos/search?q=project')
.then(res => console.log(res.data));
curl "https://axomock.fauzantaslim.biz.id/api/todos/search?q=project"
200 OK
{
"todos": [
... // array of matched todos
],
"total": 3,
"skip": 0,
"limit": 30
}
Get a random todo
Get a random todo item.
fetch('https://axomock.fauzantaslim.biz.id/api/todos/random')
.then(res => res.json())
.then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/todos/random')
.then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/todos/random
200 OK
{
"id": 14,
"todo": "Set up staging environment",
"completed": true,
"userId": 7
}
Limit and skip todos
You can pass
limit and skip params to limit and skip the results for pagination.fetch('https://axomock.fauzantaslim.biz.id/api/todos?limit=10&skip=10')
.then(res => res.json())
.then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/todos?limit=10&skip=10')
.then(res => console.log(res.data));
curl "https://axomock.fauzantaslim.biz.id/api/todos?limit=10&skip=10"
200 OK
{
"todos": [
...
],
"total": 50,
"skip": 10,
"limit": 10
}
Create a todo
Adding a new todo will not add it into the server. It will simulate a POST request and will return the new created todo with a new id.
fetch('https://axomock.fauzantaslim.biz.id/api/todos', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
todo: 'Learn Next.js 14',
completed: false,
userId: 5
})
})
.then(res => res.json())
.then(console.log);
axios.post('https://axomock.fauzantaslim.biz.id/api/todos', {
todo: 'Learn Next.js 14',
completed: false,
userId: 5
})
.then(res => console.log(res.data));
curl -X POST https://axomock.fauzantaslim.biz.id/api/todos \
-H "Content-Type: application/json" \
-d '{"todo":"Learn Next.js 14","completed":false,"userId":5}'
201 Created
{
"id": 51,
"todo": "Learn Next.js 14",
"completed": false,
"userId": 5
}
Update a todo
Updating a todo will not update it into the server. It will simulate a PUT/PATCH request and will return the updated todo.
fetch('https://axomock.fauzantaslim.biz.id/api/todos/1', {
method: 'PUT', /* or PATCH */
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
completed: true
})
})
.then(res => res.json())
.then(console.log);
axios.put('https://axomock.fauzantaslim.biz.id/api/todos/1', {
completed: true
})
.then(res => console.log(res.data));
curl -X PUT https://axomock.fauzantaslim.biz.id/api/todos/1 \
-H "Content-Type: application/json" \
-d '{"completed":true}'
200 OK
{
"id": 1,
"todo": "Complete the project proposal document",
"completed": true,
...
}
Delete a todo
Deleting a todo will not delete it into the server. It will simulate a DELETE request and will return deleted todo.
fetch('https://axomock.fauzantaslim.biz.id/api/todos/1', {
method: 'DELETE',
})
.then(res => res.json())
.then(console.log);
axios.delete('https://axomock.fauzantaslim.biz.id/api/todos/1')
.then(res => console.log(res.data));
curl -X DELETE https://axomock.fauzantaslim.biz.id/api/todos/1
200 OK
{
"id": 1,
"todo": "Complete the project proposal document",
...,
"isDeleted": true,
"deletedOn": "2026-07-08T05:42:00.000Z"
}