# Create or update a managed user

`POST https://api.morevoice.ai/v1/users`

Creates — or, for an `external_id` you sent before, updates — a managed user: an agent or supervisor your app signs in with agent sessions (`POST /v1/agent_sessions`). No invitation, password or email: they never sign in to the dashboard themselves. A new user takes a seat (402 plan_limit when none is free). An update changes the name, email, role, team, extension and language you send; it never reactivates a deactivated user (`POST /v1/users/{id}/reactivate`). Your organisation must have managed users enabled (403 feature_unavailable).

Authenticate with a secret API key: `Authorization: Bearer $MOREVOICE_API_KEY`.

Operation ID: `users_create`.

## Parameters

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `MoreVoice-Version` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `Idempotency-Key` | `string` | no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |

## Request body

Required, `application/json`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `external_id` | `string` | yes | Your own id for this person: the upsert key. The same id updates the same user. |
| `name` | `string` | yes | Their name, as colleagues and reports show it. |
| `email` | `string \| null` | no | Optional. Used when no account has it yet; otherwise the user gets a private address of ours (`…@users.invalid`, never emailed). Nothing is ever sent to it by this call. |
| `extension` | `string \| null` | no | Their extension (digits), or null / empty for none. Omitted on an update: unchanged. |
| `locale` | `"he" \| "en"` | no | Their language for the agent desk. |
| `role` | `"agent" \| "supervisor"` | no | Default `agent`. Managed users are agents or supervisors. |
| `team_id` | `string \| null` | no | Their team, or null for none. Omitted on an update: unchanged. |

Example:

```json
{
  "email": "dana@example.com",
  "extension": "204",
  "external_id": "agent-1042",
  "locale": "he",
  "name": "Dana Levi",
  "role": "agent",
  "team_id": "team_7Hj2Kl4Mn6Pq8Rs0Tu2Vw"
}
```

## Responses

### 200 OK

The managed user (created or updated). Returns `User`.

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The user's ID. |
| `object` | `"user"` | — |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `email` | `string` | — |
| `role` | `"owner" \| "admin" \| "supervisor" \| "agent"` | Their role in the organisation: what they can see and change. |
| `billing` | `boolean` | They may manage billing (granted by owners only). |
| `team_id` | `string \| null` | `team_…` ID. |
| `extension` | `string \| null` | Their internal extension, unique in the organisation. |
| `status` | `"active" \| "deactivated" \| "invited"` | `active`; `deactivated` (cannot sign in here, keeps no seat); `invited` (added, has not set a password yet). |
| `takes_seat` | `boolean` | Counts towards the plan's seats. |
| `email_verified` | `boolean` | — |
| `last_login` | `string \| null` | — |
| `created` | `string` | When they joined the organisation. |
| `skills` | `object[]` | Their skills, used by queues that route by skill. Empty unless skills routing is on for your organisation. |
| `external_id` | `string \| null` | Your own id for this person (managed users, `POST /v1/users`); null for members who joined by invitation. |
| `managed` | `boolean` | Managed by your app through the API: no password or invitation of ours; they sign in through agent sessions (`POST /v1/agent_sessions`). |

Example:

```json
{
  "billing": false,
  "created": "2026-10-01T12:00:00.000Z",
  "email": "dana@example.com",
  "email_verified": true,
  "extension": "204",
  "external_id": null,
  "id": "usr_2Lm8Pq4Rt6Vx0Zb3Nd5Fh7",
  "last_login": "2026-11-03T08:01:10.000Z",
  "livemode": true,
  "managed": false,
  "name": "Dana Levi",
  "object": "user",
  "role": "agent",
  "skills": [
    {
      "level": 5,
      "skill": "lang:he"
    },
    {
      "level": 4,
      "skill": "lang:ru"
    },
    {
      "level": 3,
      "skill": "Billing"
    }
  ],
  "status": "active",
  "takes_seat": true,
  "team_id": "team_7Hj2Kl4Mn6Pq8Rs0Tu2Vw"
}
```

### 400 Bad Request

The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown. Returns `ErrorEnvelope`.

### 401 Unauthorized

No valid API key was sent. Returns `ErrorEnvelope`.

### 403 Forbidden

The key may not do this (a missing scope, a plan limit, or a compliance block). Returns `ErrorEnvelope`.

### 404 Not Found

No object with this ID (in the path or the body) exists in this organisation and mode. Returns `ErrorEnvelope`.

### 409 Conflict

The request conflicts with the object's state, or the Idempotency-Key was reused with other parameters. Returns `ErrorEnvelope`.

### 413 Payload Too Large

The request body is larger than the endpoint accepts, or has more parts or files than it takes. Returns `ErrorEnvelope`.

### 415 Unsupported Media Type

The request body's Content-Type is not one the endpoint takes. Returns `ErrorEnvelope`.

### 429 Too Many Requests

Too many requests, or no call capacity right now. Retry after the Retry-After delay. Returns `ErrorEnvelope`.

### 500 Internal Server Error

Something went wrong on MoreVoice's side. Retry with the same Idempotency-Key. Returns `ErrorEnvelope`.

## Code samples

**TypeScript**

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const user = await mv.users.create({
	email: "dana@example.com",
	extension: "204",
	external_id: "agent-1042",
	locale: "he",
	name: "Dana Levi",
	role: "agent",
	team_id: "team_7Hj2Kl4Mn6Pq8Rs0Tu2Vw",
});
console.log(user);
```

**Python**

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

user = client.users.create({
    "email": "dana@example.com",
    "extension": "204",
    "external_id": "agent-1042",
    "locale": "he",
    "name": "Dana Levi",
    "role": "agent",
    "team_id": "team_7Hj2Kl4Mn6Pq8Rs0Tu2Vw",
})
print(user)
```

**cURL**

```sh
curl -X POST https://api.morevoice.ai/v1/users \
  -H "Authorization: Bearer $MOREVOICE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "email": "dana@example.com",
  "extension": "204",
  "external_id": "agent-1042",
  "locale": "he",
  "name": "Dana Levi",
  "role": "agent",
  "team_id": "team_7Hj2Kl4Mn6Pq8Rs0Tu2Vw"
}'
```
