mv.secrets
Secret names available to tools and flows (values are never returned). These methods are on mv.secrets, 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()”Delete a secret. Flows that still reference {{secret.NAME}} then get an empty value. Needs a live key.
mv.secrets.delete(name: SecretsDeleteData["path"]["name"], options?: RequestOptions): Promise<SecretsDeleteResponse>DELETE /secrets/{name} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
name |
string |
yes | The secret’s name. |
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”DeletedSecret:
| Field | Type | Description |
|---|---|---|
object |
"secret" |
Always secret. |
name |
string |
— |
deleted |
true |
— |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const deletedSecret = await mv.secrets.delete("name_123");console.log(deletedSecret);list()
Section titled “list()”List secrets. Names and update times only, most recently changed first: values are never returned.
mv.secrets.list(query?: NonNullable<SecretsListData["query"]>, options?: RequestOptions): PagedList<SecretsListResponse["data"][number], NonNullable<SecretsListData["query"]>>GET /secrets · 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). |
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 secret of mv.secrets.list()) { console.log(secret);}Create or replace a secret. Sets the value of {{secret.NAME}} (creating it, or replacing the value). Write-only: the value is encrypted at rest and never returned. Flows and providers pick the new value up within seconds. Needs a live key.
mv.secrets.set(name: SecretsSetData["path"]["name"], body: SecretsSetData["body"], options?: RequestOptions): Promise<SecretsSetResponse>PUT /secrets/{name} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
name |
string |
yes | The secret’s name. |
body.value |
string |
yes | The value (up to 8 KB). Write-only: it is encrypted at rest and never returned. |
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”Secret:
| Field | Type | Description |
|---|---|---|
object |
"secret" |
Always secret. |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
Referenced as {{secret.NAME}} in flow API nodes and messaging settings. |
updated |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const secret = await mv.secrets.set("name_123", { value: "sk_live_…",});console.log(secret);