Users Users API

The users endpoint provides a versatile dataset of sample user information, making it ideal for testing and prototyping user management functionalities in web applications.

Get all users

By default you will get 30 items, use limit and skip to paginate through all items.
fetch('https://axomock.fauzantaslim.biz.id/api/users')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/users')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/users
200 OK
{
  "users": [
    {
      "id": 1,
      "firstName": "Liam",
      "lastName": "Johnson",
      "email": "liam.johnson@example.com",
      "username": "liamj",
      "age": 28,
      "gender": "male",
      "phone": "+1-555-0101",
      "image": "https://i.pravatar.cc/150?u=1",
      "address": {
        "city": "Austin",
        "state": "Texas",
        "country": "United States"
      }
    },
    ... // 29 more items
  ],
  "total": 30,
  "skip": 0,
  "limit": 30
}

Get a single user

Fetch a specific user by their ID.
fetch('https://axomock.fauzantaslim.biz.id/api/users/1')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/users/1')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/users/1
200 OK
{
  "id": 1,
  "firstName": "Liam",
  "lastName": "Johnson",
  "email": "liam.johnson@example.com",
  "username": "liamj",
  "age": 28,
  "gender": "male",
  "phone": "+1-555-0101",
  "image": "https://i.pravatar.cc/150?u=1",
  "address": {
    "city": "Austin",
    "state": "Texas",
    "country": "United States"
  }
}

Search users

Search users by firstName, lastName, email, or username.
fetch('https://axomock.fauzantaslim.biz.id/api/users/search?q=John')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/users/search?q=John')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/users/search?q=John
200 OK
{
  "users": [
    ... // array of matched users
  ],
  "total": 2,
  "skip": 0,
  "limit": 30
}

Get user posts

Fetch all posts created by a specific user.
fetch('https://axomock.fauzantaslim.biz.id/api/users/1/posts')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/users/1/posts')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/users/1/posts
200 OK
{
  "posts": [
    ... // array of user's posts
  ],
  "total": 5,
  "skip": 0,
  "limit": 30
}

Get user todos

Fetch all todos assigned to a specific user.
fetch('https://axomock.fauzantaslim.biz.id/api/users/1/todos')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/users/1/todos')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/users/1/todos
200 OK
{
  "todos": [
    ... // array of user's todos
  ],
  "total": 5,
  "skip": 0,
  "limit": 30
}

Limit and skip users

Pass limit and skip params to paginate through items.
fetch('https://axomock.fauzantaslim.biz.id/api/users?limit=5&skip=10')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/users?limit=5&skip=10')
  .then(res => console.log(res.data));
curl "https://axomock.fauzantaslim.biz.id/api/users?limit=5&skip=10"
200 OK
{
  "users": [
    ... // 5 items starting from index 10
  ],
  "total": 30,
  "skip": 10,
  "limit": 5
}

Sort users

Sort users by any key in asc or desc order.
fetch('https://axomock.fauzantaslim.biz.id/api/users?sortBy=firstName&order=asc')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/users?sortBy=firstName&order=asc')
  .then(res => console.log(res.data));
curl "https://axomock.fauzantaslim.biz.id/api/users?sortBy=firstName&order=asc"
200 OK
{
  "users": [
    ... // sorted items
  ],
  "total": 30,
  "skip": 0,
  "limit": 30
}

Add a new user

Adding a new user will not add it into the server. It will simulate a POST request and will return the new created user with a new id.
fetch('https://axomock.fauzantaslim.biz.id/api/users', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    firstName: 'Axo',
    lastName: 'Lotl',
    age: 25,
  })
})
.then(res => res.json())
.then(console.log);
axios.post('https://axomock.fauzantaslim.biz.id/api/users', {
  firstName: 'Axo',
  lastName: 'Lotl',
  age: 25
})
.then(res => console.log(res.data));
curl -X POST https://axomock.fauzantaslim.biz.id/api/users \
-H "Content-Type: application/json" \
-d '{"firstName":"Axo","lastName":"Lotl","age":25}'
201 Created
{
  "id": 31,
  "firstName": "Axo",
  "lastName": "Lotl",
  "age": 25,
  "createdAt": "2026-07-08T11:49:12.000Z"
}

Update a user

Updating a user will not update it into the server. It will simulate a PUT/PATCH request and will return the user with modified data.
fetch('https://axomock.fauzantaslim.biz.id/api/users/1', {
  method: 'PUT', /* or PATCH */
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    lastName: 'Owol'
  })
})
.then(res => res.json())
.then(console.log);
axios.put('https://axomock.fauzantaslim.biz.id/api/users/1', {
  lastName: 'Owol'
})
.then(res => console.log(res.data));
curl -X PUT https://axomock.fauzantaslim.biz.id/api/users/1 \
-H "Content-Type: application/json" \
-d '{"lastName":"Owol"}'
200 OK
{
  "id": 1,
  "firstName": "Liam",
  "lastName": "Owol", // updated
  "age": 28,
  ... // other properties
}

Delete a user

Deleting a user will not delete it into the server. It will simulate a DELETE request and will return the deleted user.
fetch('https://axomock.fauzantaslim.biz.id/api/users/1', {
  method: 'DELETE',
})
.then(res => res.json())
.then(console.log);
axios.delete('https://axomock.fauzantaslim.biz.id/api/users/1')
.then(res => console.log(res.data));
curl -X DELETE https://axomock.fauzantaslim.biz.id/api/users/1
200 OK
{
  "id": 1,
  "firstName": "Liam",
  "lastName": "Johnson",
  ... // other properties
  "isDeleted": true,
  "deletedOn": "2026-07-08T12:20:16.000Z"
}