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

# User Management Overview

> Add, re-role and remove your business's users from your own HR system or identity provider sync, and read who changed what 👥

The User Management API keeps your Connectly users in step with your own system of record. Add people when they join, change their role when their job changes, remove them when they leave, and read an audit log of every change.

It works with the same users and roles as the [Users page](https://docs.connectly.ai/business-hub/inbox/user-management.md) in the dashboard. A change made through the API shows up there at once, and the other way round.

## How it works

**1. Create a User Management key**

An Owner creates an API key with the **User Management** (`user.manage`) scope and nothing else. See [Get an API key](#get-an-api-key).

**2. Read your current users**

Call [List users](https://docs.connectly.ai/user-management-api/list-users.md) and compare the result with your system of record by email.

**3. Apply the differences**

[Add](https://docs.connectly.ai/user-management-api/add-user.md) the people who are missing, [change the role](https://docs.connectly.ai/user-management-api/update-user-role.md) of those whose job changed, and [remove](https://docs.connectly.ai/user-management-api/remove-user.md) those who left. Owners are read-only through the API, so skip them.

**4. Keep a record**

Read the [audit log](https://docs.connectly.ai/user-management-api/list-user-audit-events.md) to see every change, who made it, and the roles before and after.

> [!TIP]
>
> The calls are safe to repeat. Adding someone who is already a user returns `409` and changes nothing; removing someone already removed returns `404`.

***

## Get an API key

Follow [Authentication & API Keys](https://docs.connectly.ai/get-started/authentication-and-api-keys.md) with two differences:

* You must be an **Owner** of the business.
* Select the **User Management** (`user.manage`) scope **only**. It cannot be combined with other scopes; create a separate key for any other API.
* A key without scopes does not work here, even though it has full access to the other APIs. Create a User Management key for this integration.

Send the key in the `X-API-Key` header on every request.

What a User Management key can and cannot do:

| | |
| - | - |
| Reaches | The six endpoints in this section, for its own business only. Every other Connectly endpoint refuses it with `403`. |
| Can change | Users whose role is Marketing, Analytics or Agent. |
| Cannot change | Owners. The API can read them but never add, change or remove one. Owners are managed in the dashboard. |
| Recorded as | The key itself: each change appears in the audit log under the key's name. |

To stop an integration, revoke its key from **Settings → General → API Key and Webhook Secret**. A revoked key stops working within about a minute.

***

## Base URL

```text theme={null}
https://api.connectly.ai/external/v1/businesses/{businessId}
```

`businessId` is your Connectly business ID, shown in **Settings → General → Business Profile**.

| Method | Path | Page |
| - | - | - |
| `POST` | `/users` | [Add a user](https://docs.connectly.ai/user-management-api/add-user.md) |
| `GET` | `/users` | [List users](https://docs.connectly.ai/user-management-api/list-users.md) |
| `GET` | `/users/{userId}` | [Get a user](https://docs.connectly.ai/user-management-api/get-user.md) |
| `PATCH` | `/users/{userId}` | [Update a user's role](https://docs.connectly.ai/user-management-api/update-user-role.md) |
| `DELETE` | `/users/{userId}` | [Remove a user](https://docs.connectly.ai/user-management-api/remove-user.md) |
| `GET` | `/user_audit_events` | [List audit events](https://docs.connectly.ai/user-management-api/list-user-audit-events.md) |

***

## Users and roles

A user looks like this:

```json theme={null}
{
  "id": "2438ac3c-37eb-4902-adef-ed16b4431030",
  "email": "ana@example.com",
  "displayName": "Ana Souza",
  "role": "ROLE_AGENT"
}
```

| Role | Set through the API | Access |
| - | - | - |
| `ROLE_OWNER` | No, read only | Full access, including API keys and adding users |
| `ROLE_MARKETING` | Yes | Full access except API keys and adding users |
| `ROLE_ANALYTICS` | Yes | Analytics dashboards and reports only |
| `ROLE_AGENT` | Yes | Inbox only |
| `ROLE_UNSPECIFIED` | No, read only | A user with no role stored; the dashboard shows them as Agent |

Each user has one role in the API. An older account with several roles stored reads as the first of them in the order Owner, Marketing, Analytics, Agent, which is also the role the dashboard shows.

***

## Businesses with Enterprise SSO

If your business provisions users through [SCIM](https://docs.connectly.ai/enterprise-sso/overview.md), your identity provider stays in charge of the people it manages. Someone your identity provider removed cannot be added back through this API; restore them in the identity provider instead. Users you add through the API can sign in with SSO like anyone else.

***

## Errors

Errors return a JSON body that carries an `errorCode` and a `message`, among other fields:

```json theme={null}
{
  "errorCode": "PRFL.USR.OWNER_PROTECTED",
  "message": "owners are read-only here"
}
```

| HTTP status | `errorCode` | Meaning |
| - | - | - |
| `400` | `PRFL.USR.OWNER_PROTECTED` | The request gives, changes or removes the Owner role. |
| `400` | `PRFL.USR.MEMBERSHIP_REVOKED_BY_SSO` | Your identity provider removed this person. Restore them there. |
| `400` | | The request is malformed: a missing email, an unknown role, a bad page size or page token. |
| `401` | | Missing, invalid or revoked API key. |
| `403` | `ERROR_CODE_PERMISSION_DENIED` | The key lacks the `user.manage` scope, belongs to another business, or the endpoint is not one of these six. |
| `404` | `PRFL.NOT_FOUND` | The user is not a current user of the business. |
| `409` | | The email cannot be added. See [Add a user](https://docs.connectly.ai/user-management-api/add-user.md#error-responses). |
| `429` | | Rate limit exceeded. |

Match on the HTTP status and `errorCode`, not on `message`, which may change.

***

## Rate limiting

Each endpoint is limited per business:

* **Add, update and remove:** 60 requests per minute each.
* **List users, get a user and list audit events:** 120 requests per minute each.

Exceeding a limit returns HTTP `429 Too Many Requests`.


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