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

# Users API

> Find users in your Zapnito community and update their profile details and custom field options through the API.

Find users on your community and update their profile data.

Before you start, read the [API overview](/api/v1/overview) for how authentication, headers, pagination and errors work.

## List users

Return the users in your community.

<ParamField query="page" type="integer">
  The page of results to return.
</ParamField>

<ParamField query="per_page" type="integer">
  The number of results to return per page.
</ParamField>

<ParamField query="query" type="string">
  A search term to reduce the number of results. Matches name, title or company.
</ParamField>

```bash title="List users" theme={null}
curl "https://your-community.zapnito.com/api/v1/users?page=1&per_page=20&query=smith" \
  -H "Authorization: Token token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json; charset=utf-8"
```

`GET https://your-community.zapnito.com/api/v1/users`

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "users": [
      {
        "id": 1,
        "email": "alex.smith@example.com",
        "name": "Alex Smith",
        "title": "Compliance Analyst",
        "company": "Harbour Capital",
        "professional_reg_number": "ABC123",
        "country_code": "GB",
        "custom_field_options": []
      },
      {
        "id": 2,
        "email": "sam.jones@example.com",
        "name": "Sam Jones",
        "title": "Community Manager",
        "company": "Fernhill Institute",
        "professional_reg_number": "XYZ345",
        "country_code": "GB",
        "custom_field_options": []
      }
    ]
  }
  ```
</ResponseExample>

## Get a user

Return a single user by email address.

<ParamField path="email" type="string" required>
  The email address of the user.
</ParamField>

```bash title="Get a user" theme={null}
curl "https://your-community.zapnito.com/api/v1/users/alex.smith@example.com" \
  -H "Authorization: Token token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json; charset=utf-8"
```

`GET https://your-community.zapnito.com/api/v1/users/:email`

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "user": {
      "id": 1,
      "email": "alex.smith@example.com",
      "name": "Alex Smith",
      "title": "Compliance Analyst",
      "company": "Harbour Capital",
      "professional_reg_number": "ABC123",
      "country_code": "GB",
      "custom_field_options": []
    }
  }
  ```
</ResponseExample>

* `200 OK`: the user was returned.
* `404 Not Found`: no user matches the email address. The message reads `User not found for email: 'jane.doe@example.com'`.

## Update a user

Update a user's profile information, such as their name, job title, company and country. You can also assign or remove their custom field options.

Send the attributes you want to change inside a `user` object. Attributes you leave out aren't modified.

<ParamField path="email" type="string" required>
  The email address of the user you want to update.
</ParamField>

<ParamField body="user.name" type="string">
  The user's name. If you provide it, the user's name changes to this value.
</ParamField>

<ParamField body="user.title" type="string">
  The user's job title. If you provide it, the user's job title changes to this value.
</ParamField>

<ParamField body="user.company" type="string">
  The name of the user's company.
</ParamField>

<ParamField body="user.country_code" type="string">
  The two-letter ISO country code of the user, for example `GB` or `US`.
</ParamField>

<ParamField body="user.custom_field_option_ids" type="integer[]">
  The IDs of the custom field options that the user is matched to.
</ParamField>

```bash title="Update a user" theme={null}
curl -X PUT "https://your-community.zapnito.com/api/v1/users/alex.smith@example.com" \
  -H "Authorization: Token token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{
    "user": {
      "name": "Alex Smith",
      "title": "Senior Compliance Analyst",
      "country_code": "GB",
      "company": "Harbour Capital",
      "custom_field_option_ids": [2508, 2509]
    }
  }'
```

`PUT https://your-community.zapnito.com/api/v1/users/:email`

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "user": {
      "name": "Alex Smith",
      "title": "Senior Compliance Analyst",
      "country_code": "GB",
      "company": "Harbour Capital",
      "custom_field_option_ids": [2508, 2509]
    }
  }
  ```
</ResponseExample>

* `200 OK`: the user was updated. The response confirms the saved attributes.
* `404 Not Found`: no user matches the email address. The message reads `User not found for email: 'jane.doe@example.com'`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.