> ## 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.

# Organisation users API

> Add known users to an organisation in your Zapnito community, or remove them, through the API.

Add known users to an organisation and remove them. To get an organisation's ID, [list organisations](/api/v1/organisations#list-organisations).

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

## Add a user to an organisation

Add a known user to an organisation.

<ParamField path="organisation_id" type="string" required>
  The ID of the organisation to add the user to.
</ParamField>

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

<ParamField body="user.owner" type="boolean" default={false}>
  Whether the user owns the organisation. Owners can manage the organisation and add or remove other users.
</ParamField>

```bash title="Add a user to an organisation" theme={null}
curl -X POST "https://your-community.zapnito.com/api/v1/organisations/123/users" \
  -H "Authorization: Token token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{"user": {"email": "alex.smith@example.com", "owner": false}}'
```

`POST https://your-community.zapnito.com/api/v1/organisations/:organisation_id/users`

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "message": "User 'alex.smith@example.com' added to organisation with ID 123"
  }
  ```
</ResponseExample>

* `200 OK`: the user was added, or already belongs to the organisation. If they already belong, the response carries an `errors` message instead: `User 'alex.smith@example.com' already belongs to organisation with ID 123`.
* `401 Unauthorized`: your API token is invalid, expired or badly formatted. See [authentication](/api/v1/overview#authentication).
* `404 Not Found`: no organisation matches the ID, or no user matches the email address. The messages read `Organisation not found for ID: 123` and `User not found for email: '...'`.

## Remove a user from an organisation

Remove a known user from an organisation.

<ParamField path="organisation_id" type="string" required>
  The ID of the organisation to remove the user from.
</ParamField>

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

```bash title="Remove a user from an organisation" theme={null}
curl -X DELETE "https://your-community.zapnito.com/api/v1/organisations/123/users" \
  -H "Authorization: Token token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{"user": {"email": "jordan.lee@example.com"}}'
```

`DELETE https://your-community.zapnito.com/api/v1/organisations/:organisation_id/users`

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "message": "User 'jordan.lee@example.com' removed from organisation with ID 123"
  }
  ```
</ResponseExample>

* `200 OK`: the user was removed, or wasn't in the organisation. If they weren't in the organisation, the response carries an `errors` message instead: `User 'jordan.lee@example.com' does not currently belong to organisation with ID 123`.
* `401 Unauthorized`: your API token is incorrect or expired. See [authentication](/api/v1/overview#authentication).
* `404 Not Found`: no organisation matches the ID, or no user matches the email address. The messages read `Organisation not found for ID: 123` and `User not found for email: '...'`.


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