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.
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. |
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. |
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. |
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. |
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.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. |
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);