> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usertour.io/llms.txt
> Use this file to discover all available pages before exploring further.

# List users

> Retrieve a paginated list of users. You can filter the results using various query parameters.

## Query parameters

<ParamField query="email" type="string">
  Filter users by their email address. The search is case-insensitive and must match the exact email value stored in the user's attributes.
</ParamField>

<ParamField query="segmentId" type="string">
  Filter users by segment membership. You can find the segment ID in the Usertour UI by clicking the three-dot menu in the top right corner of the segment page.
</ParamField>

<ParamField query="companyId" type="string">
  Filter users by company membership. Only returns users who are members of the specified company.
</ParamField>

<ParamField query="limit" type="number" default="20">
  Specifies the maximum number of items to return in a single response. The value must be between 1 and 100. If not specified, defaults to 20 items per page.
</ParamField>

<ParamField query="cursor" type="string">
  Specifies the starting point for the next page of results. The response will include items that come after (but not including) the object with this ID. To get the next page, use the ID of the last item from your previous request. The easiest way is to use the [list object's](#the-list-object) cursor field. If not provided, the API will return items from the beginning of the list.
</ParamField>

<ParamField path="expand" type="string | string[]">
  See [Expanding objects](/api-reference/expanding-objects). Available options:

  * `memberships`: Include basic membership data for each user
  * `memberships.company`: Include both membership and associated company details
  * `companies`: Include all companies associated with the user
  * You can request multiple expansions: `expand[]=memberships&expand[]=companies`
</ParamField>

## Response

Returns a [list object](/api-reference/pagination#the-list-object) containing an array of [user objects](/api-reference/users/model) in the `results` property. The response includes pagination information in the `next` and `previous` fields.

<RequestExample>
  ```bash Request theme={null}
  curl https://api.usertour.io/v1/users \
  -H 'Authorization: Bearer ak_123456789' \
  -H 'Content-Type: application/json'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "results": [
      {
        "id": "usr_123456789",
        "object": "user",
        "attributes": {
          "name": "John Doe",
          "email": "john.doe@example.com",
          "role": "admin",
          "department": "engineering",
          "last_login_at": "2024-03-20T08:30:00.000Z"
        },
        "createdAt": "2024-03-20T08:30:00.000Z",
        "companies": null,
        "memberships": null
      },
      {
        "id": "usr_987654321",
        "object": "user",
        "attributes": {
          "name": "Jane Smith",
          "email": "jane.smith@example.com",
          "role": "user",
          "department": "marketing",
          "last_login_at": "2024-03-19T15:45:00.000Z"
        },
        "createdAt": "2024-03-19T15:45:00.000Z",
        "companies": null,
        "memberships": null
      }
    ],
    "next": "/v1/users?limit=2&cursor=usr_987654321",
    "previous": null
  }
  ```
</ResponseExample>
