Documentation menu

Resource reference

Users

People with contact, address, and company data. Users own posts and todos.

10 records after each resetView live JSON

Data model

Users schema

Responses include the following fields. Read-only values are generated by the API.

FieldTypeRequiredDescription
idintegerRead onlyAuto-incrementing resource identifier.
namestringRequiredDisplay name, 1 to 100 characters.
usernamestringRequiredUnique username, 3 to 50 letters, numbers, or underscores.
emailemail stringRequiredUnique valid email address.
phonestringOptionalValid phone number.
websiteURL stringOptionalValid website URL.
addressobjectOptionalNested street, city, zipcode, and geo data.
companyobjectOptionalNested company name, catch phrase, and business text.
createdAtISO 8601 stringRead onlyTime the record was created.
updatedAtISO 8601 stringRead onlyTime the record was last updated.

Example object

A complete user

JSON
{
  "id": 1,
  "name": "John Doe",
  "username": "johndoe",
  "email": "john.doe@example.com",
  "phone": "+1-555-0123",
  "website": "https://johndoe.dev",
  "address": {
    "street": "123 Main St",
    "suite": "Apt 4B",
    "city": "New York",
    "zipcode": "10001",
    "geo": {
      "lat": "40.7128",
      "lng": "-74.0060"
    }
  },
  "company": {
    "name": "Tech Solutions Inc",
    "catchPhrase": "Innovating the future",
    "bs": "harness real-time e-markets"
  },
  "createdAt": "2026-07-22T00:00:03.599Z",
  "updatedAt": "2026-07-22T00:00:03.599Z"
}

Endpoints

Read and write users

Every example uses the shared free API. Replace :id with a numeric record ID.

GET/users

List users

Returns a paginated user collection.

cURL request
curl 'https://api.apimocker.com/users'

Parameters

ParameterTypeRequiredDescription
_page or pageintegerOptionalPage number. Defaults to 1.
_limit or limitintegerOptionalItems per page. Defaults to 10 and is capped at 100.
_sortstringOptionalField used for sorting. Defaults to id.
_orderasc | descOptionalSort direction. Defaults to asc.
_delayintegerOptionalArtificial response delay in milliseconds.
name_likestringOptionalPartial, case-insensitive name match.
usernamestringOptionalExact username match.
emailstringOptionalExact email match.

Example response

JSON
{
  "data": [
    {
      "id": 1,
      "name": "John Doe",
      "username": "johndoe",
      "email": "john.doe@example.com",
      "phone": "+1-555-0123",
      "website": "https://johndoe.dev",
      "address": {
        "street": "123 Main St",
        "suite": "Apt 4B",
        "city": "New York",
        "zipcode": "10001",
        "geo": {
          "lat": "40.7128",
          "lng": "-74.0060"
        }
      },
      "company": {
        "name": "Tech Solutions Inc",
        "catchPhrase": "Innovating the future",
        "bs": "harness real-time e-markets"
      },
      "createdAt": "2026-07-22T00:00:03.599Z",
      "updatedAt": "2026-07-22T00:00:03.599Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 10,
    "totalPages": 1,
    "hasNext": false,
    "hasPrev": false
  }
}

GET/users/search?q=john

Search users

Searches name, username, and email and returns up to 10 matches.

cURL request
curl 'https://api.apimocker.com/users/search?q=john'

Parameters

ParameterTypeRequiredDescription
qstringRequiredCase-insensitive search text.
_delayintegerOptionalArtificial response delay in milliseconds.

Example response

JSON
{
  "query": "john",
  "total": 1,
  "results": [
    {
      "id": 1,
      "name": "John Doe",
      "username": "johndoe",
      "email": "john.doe@example.com"
    }
  ]
}

GET/users/:id

Get one user

Returns a user directly, without the list response envelope.

cURL request
curl 'https://api.apimocker.com/users/1'

Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe resource ID from the URL path.
_delayintegerOptionalArtificial response delay in milliseconds.

Example response

JSON
{
  "id": 1,
  "name": "John Doe",
  "username": "johndoe",
  "email": "john.doe@example.com",
  "phone": "+1-555-0123",
  "website": "https://johndoe.dev",
  "address": {
    "street": "123 Main St",
    "suite": "Apt 4B",
    "city": "New York",
    "zipcode": "10001",
    "geo": {
      "lat": "40.7128",
      "lng": "-74.0060"
    }
  },
  "company": {
    "name": "Tech Solutions Inc",
    "catchPhrase": "Innovating the future",
    "bs": "harness real-time e-markets"
  },
  "createdAt": "2026-07-22T00:00:03.599Z",
  "updatedAt": "2026-07-22T00:00:03.599Z"
}

GET/users/:id/posts

List a user's posts

Returns the posts owned by a user in the standard paginated envelope.

cURL request
curl 'https://api.apimocker.com/users/1/posts'

Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe resource ID from the URL path.
_page or pageintegerOptionalPage number. Defaults to 1.
_limit or limitintegerOptionalItems per page. Defaults to 10 and is capped at 100.

Example response

JSON
{
  "data": [
    {
      "id": 1,
      "title": "Getting Started with Modern Web Development: A Practical First Project",
      "body": "This is a comprehensive article about getting started with modern web development.",
      "userId": 1,
      "createdAt": "2026-07-22T00:00:03.599Z",
      "updatedAt": "2026-07-22T00:00:03.599Z",
      "user": {
        "id": 1,
        "name": "John Doe",
        "username": "johndoe",
        "email": "john.doe@example.com"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 10,
    "totalPages": 1,
    "hasNext": false,
    "hasPrev": false
  }
}

GET/users/:id/todos

List a user's todos

Returns the todos owned by a user in the standard paginated envelope.

cURL request
curl 'https://api.apimocker.com/users/1/todos'

Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe resource ID from the URL path.
_page or pageintegerOptionalPage number. Defaults to 1.
_limit or limitintegerOptionalItems per page. Defaults to 10 and is capped at 100.

Example response

JSON
{
  "data": [
    {
      "id": 1,
      "title": "Review the component architecture",
      "description": "Check the loading and empty states before the next release.",
      "completed": false,
      "userId": 1,
      "createdAt": "2026-07-22T00:00:03.599Z",
      "updatedAt": "2026-07-22T00:00:03.599Z",
      "user": {
        "id": 1,
        "name": "John Doe",
        "username": "johndoe",
        "email": "john.doe@example.com"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 20,
    "totalPages": 2,
    "hasNext": true,
    "hasPrev": false
  }
}

POST/users

Create a user

201 Created

Creates a shared user and returns the new resource with status 201.

cURL request
curl -X POST 'https://api.apimocker.com/users' \
  -H 'Content-Type: application/json' \
  -d '{   "name": "Jane Smith",   "username": "janesmith",   "email": "jane@example.com" }'

Request body

JSON
{
  "name": "Jane Smith",
  "username": "janesmith",
  "email": "jane@example.com"
}

Example response

JSON
{
  "id": 11,
  "name": "Jane Smith",
  "username": "janesmith",
  "email": "jane@example.com",
  "phone": "+1-555-0123",
  "website": "https://johndoe.dev",
  "address": {
    "street": "123 Main St",
    "suite": "Apt 4B",
    "city": "New York",
    "zipcode": "10001",
    "geo": {
      "lat": "40.7128",
      "lng": "-74.0060"
    }
  },
  "company": {
    "name": "Tech Solutions Inc",
    "catchPhrase": "Innovating the future",
    "bs": "harness real-time e-markets"
  },
  "createdAt": "2026-07-22T00:00:03.599Z",
  "updatedAt": "2026-07-22T00:00:03.599Z"
}

  • Writes affect the shared dataset until the next daily reset.
  • Unknown fields are rejected by the database layer.

PUT/users/:id

Replace a user

200 OK

Updates a user. Name, username, and email are required.

cURL request
curl -X PUT 'https://api.apimocker.com/users/1' \
  -H 'Content-Type: application/json' \
  -d '{   "name": "Jane Smith",   "username": "janesmith",   "email": "jane@example.com" }'

Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe resource ID from the URL path.

Request body

JSON
{
  "name": "Jane Smith",
  "username": "janesmith",
  "email": "jane@example.com"
}

Example response

JSON
{
  "id": 1,
  "name": "John Doe",
  "username": "johndoe",
  "email": "john.doe@example.com",
  "phone": "+1-555-0123",
  "website": "https://johndoe.dev",
  "address": {
    "street": "123 Main St",
    "suite": "Apt 4B",
    "city": "New York",
    "zipcode": "10001",
    "geo": {
      "lat": "40.7128",
      "lng": "-74.0060"
    }
  },
  "company": {
    "name": "Tech Solutions Inc",
    "catchPhrase": "Innovating the future",
    "bs": "harness real-time e-markets"
  },
  "createdAt": "2026-07-22T00:00:03.599Z",
  "updatedAt": "2026-07-22T00:00:03.599Z"
}

  • Writes affect the shared dataset until the next daily reset.
  • Unknown fields are rejected by the database layer.

PATCH/users/:id

Update selected user fields

200 OK

Updates only the provided fields.

cURL request
curl -X PATCH 'https://api.apimocker.com/users/1' \
  -H 'Content-Type: application/json' \
  -d '{   "website": "https://jane.dev" }'

Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe resource ID from the URL path.

Request body

JSON
{
  "website": "https://jane.dev"
}

Example response

JSON
{
  "id": 1,
  "name": "John Doe",
  "username": "johndoe",
  "email": "john.doe@example.com",
  "phone": "+1-555-0123",
  "website": "https://johndoe.dev",
  "address": {
    "street": "123 Main St",
    "suite": "Apt 4B",
    "city": "New York",
    "zipcode": "10001",
    "geo": {
      "lat": "40.7128",
      "lng": "-74.0060"
    }
  },
  "company": {
    "name": "Tech Solutions Inc",
    "catchPhrase": "Innovating the future",
    "bs": "harness real-time e-markets"
  },
  "createdAt": "2026-07-22T00:00:03.599Z",
  "updatedAt": "2026-07-22T00:00:03.599Z"
}

  • Writes affect the shared dataset until the next daily reset.
  • Unknown fields are rejected by the database layer.

DELETE/users/:id

Delete a user

204 No Content

Deletes the user and cascades to that user's posts, todos, comments, and likes.

cURL request
curl -X DELETE 'https://api.apimocker.com/users/1'

Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe resource ID from the URL path.
  • Writes affect the shared dataset until the next daily reset.
  • Unknown fields are rejected by the database layer.