mv.users
Users in the organisation. These methods are on mv.users, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.
create()
Section titled “create()”Create or update a managed user. 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).
mv.users.create(body: UsersCreateData["body"], options?: RequestOptions): Promise<UsersCreateResponse>POST /users · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
body.external_id |
string |
yes | Your own id for this person: the upsert key. The same id updates the same user. |
body.name |
string |
yes | Their name, as colleagues and reports show it. |
body.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. |
body.extension |
string | null |
no | Their extension (digits), or null / empty for none. Omitted on an update: unchanged. |
body.locale |
"he" | "en" |
no | Their language for the agent desk. |
body.role |
"agent" | "supervisor" |
no | Default agent. Managed users are agents or supervisors. |
body.team_id |
string | null |
no | Their team, or null for none. Omitted on an update: unchanged. |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["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. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”User:
| Field | Type | Description |
|---|---|---|
id |
string |
The user’s ID. |
object |
"user" |
Always 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
Section titled “Example”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);delete()
Section titled “delete()”Deactivate a user. Deactivates the membership: they are signed out of this organisation, free their seat, and their open callbacks go back to their queue. They keep their account (and other organisations); POST /v1/users/{id}/reactivate undoes it.
mv.users.delete(id: UsersDeleteData["path"]["id"], options?: RequestOptions): Promise<UsersDeleteResponse>DELETE /users/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A user ID (usr_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["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. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”User:
| Field | Type | Description |
|---|---|---|
id |
string |
The user’s ID. |
object |
"user" |
Always 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
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const user = await mv.users.delete("usr_7Hk2Lm9Qp");console.log(user);list()
Section titled “list()”List users. Your organisation’s members (deactivated ones included), newest first.
mv.users.list(query?: NonNullable<UsersListData["query"]>, options?: RequestOptions): PagedList<UsersListResponse["data"][number], NonNullable<UsersListData["query"]>>GET /users · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.limit |
integer |
no | How many objects to return, 1–100 (default 20). |
query.starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
query.ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
query.role |
string |
no | Only members with this role. |
query.status |
string |
no | Only members in this status. |
query.team_id |
string |
no | Only members of this team. |
query.external_id |
string |
no | Only the managed user with this id of yours (at most one). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”A PagedList: await it for the first page, for await it for every item.
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const user of mv.users.list()) { console.log(user);}reactivate()
Section titled “reactivate()”Reactivate a user. Reactivates a deactivated member. They take a seat again (402 plan_limit when none is free).
mv.users.reactivate(id: UsersReactivateData["path"]["id"], options?: RequestOptions): Promise<UsersReactivateResponse>POST /users/{id}/reactivate · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A user ID (usr_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["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. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”User:
| Field | Type | Description |
|---|---|---|
id |
string |
The user’s ID. |
object |
"user" |
Always 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
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const user = await mv.users.reactivate("usr_7Hk2Lm9Qp");console.log(user);retrieve()
Section titled “retrieve()”Retrieve a user. Returns the User object. Answers 404 with the code resource_missing when nothing has this ID in this organisation and mode.
mv.users.retrieve(id: UsersRetrieveData["path"]["id"], options?: RequestOptions): Promise<UsersRetrieveResponse>GET /users/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A user ID (usr_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”User:
| Field | Type | Description |
|---|---|---|
id |
string |
The user’s ID. |
object |
"user" |
Always 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
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const user = await mv.users.retrieve("usr_7Hk2Lm9Qp");console.log(user);update()
Section titled “update()”Update a user. Changes a member’s role, team or extension. A role change signs them in again in this organisation. API keys manage agents and supervisors: granting owner or admin, or changing an owner or admin, answers 403 — an owner does that in the dashboard.
mv.users.update(id: UsersUpdateData["path"]["id"], body?: UsersUpdateData["body"], options?: RequestOptions): Promise<UsersUpdateResponse>PATCH /users/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A user ID (usr_…). |
body.extension |
string | null |
no | Their extension (digits), or null / empty for none. |
body.role |
"owner" | "admin" | "supervisor" | "agent" |
no | A new role. API keys manage agents and supervisors; owner and admin are granted by an owner, in the dashboard. |
body.skills |
object[] |
no | Their skills: replaces the list (an empty list removes them all). Needs skills routing on for your organisation. |
body.team_id |
string | null |
no | Their team, or null for none. |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”User:
| Field | Type | Description |
|---|---|---|
id |
string |
The user’s ID. |
object |
"user" |
Always 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
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const user = await mv.users.update("usr_7Hk2Lm9Qp", { role: "supervisor", team_id: "team_7Hj2Kl4Mn6Pq8Rs0Tu2Vw",});console.log(user);