Skip to content

mv.inboundRoutes

How inbound calls to your numbers are routed. These methods are on mv.inboundRoutes, 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 an inbound route.

mv.inboundRoutes.create(body: InboundRoutesCreateData["body"], options?: RequestOptions): Promise<InboundRoutesCreateResponse>

POST /inbound_routes · API reference

Name Type Required Description
body.target RouteTargetParamsInput yes Where a matching call goes: type, and the ID in <type>_id.
body.connection_id string | null no conn_… ID.
body.enabled boolean no
body.fallback_assistant_id string | null no asst_… ID.
body.match_caller string no The caller’s number: exact, a prefix ending in *, or empty for any.
body.match_did string no The dialled number: exact, a prefix ending in *, or empty for any.
body.name string no
body.priority integer no
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.

InboundRoute:

Field Type Description
id string The route’s ID.
object "inbound_route" Always inbound_route.
livemode boolean true in live mode, false in test mode.
name string —
enabled boolean —
priority integer Lower runs first; the first matching route wins.
connection_id string | null conn_… ID.
match_did string The dialled number: exact, a prefix ending in *, or empty for any.
match_caller string The caller’s number: exact, a prefix ending in *, or empty for any.
target RouteTarget | null Where matching calls go (null: the connection’s inbound assistant answers).
fallback_assistant_id string | null asst_… ID.
created string An ISO-8601 timestamp in UTC.
import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({
client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),
});
const inboundRoute = await mv.inboundRoutes.create({
fallback_assistant_id: "asst_3cYbE6uYvGkH8w4ZK1rTqd",
match_did: "+97231234567",
name: "Sales line",
target: {
queue_id: "q_4Gk2LmN9pQ4rS6tV8wX0yZ",
type: "queue",
},
});
console.log(inboundRoute);

Delete an inbound route.

mv.inboundRoutes.delete(id: InboundRoutesDeleteData["path"]["id"], options?: RequestOptions): Promise<InboundRoutesDeleteResponse>

DELETE /inbound_routes/{id} · API reference

Name Type Required Description
id string yes A inbound route ID (rte_…).
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.

DeletedInboundRoute:

Field Type Description
id string A inbound route ID (prefix rte_).
object "inbound_route" Always inbound_route.
deleted true —
import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({
client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),
});
const deletedInboundRoute = await mv.inboundRoutes.delete("rte_Hz9XLopCXuVC77SlkVsLAz");
console.log(deletedInboundRoute);

List inbound routes. Your routes in evaluation order: priority, then age. The first enabled route that matches a call wins.

mv.inboundRoutes.list(query?: NonNullable<InboundRoutesListData["query"]>, options?: RequestOptions): PagedList<InboundRoutesListResponse["data"][number], NonNullable<InboundRoutesListData["query"]>>

GET /inbound_routes · API reference

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.

A PagedList: await it for the first page, for await it for every item.

import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({
client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),
});
for await (const inboundRoute of mv.inboundRoutes.list()) {
console.log(inboundRoute);
}

Retrieve an inbound route.

mv.inboundRoutes.retrieve(id: InboundRoutesRetrieveData["path"]["id"], options?: RequestOptions): Promise<InboundRoutesRetrieveResponse>

GET /inbound_routes/{id} · API reference

Name Type Required Description
id string yes A inbound route ID (rte_…).
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.

InboundRoute:

Field Type Description
id string The route’s ID.
object "inbound_route" Always inbound_route.
livemode boolean true in live mode, false in test mode.
name string —
enabled boolean —
priority integer Lower runs first; the first matching route wins.
connection_id string | null conn_… ID.
match_did string The dialled number: exact, a prefix ending in *, or empty for any.
match_caller string The caller’s number: exact, a prefix ending in *, or empty for any.
target RouteTarget | null Where matching calls go (null: the connection’s inbound assistant answers).
fallback_assistant_id string | null asst_… ID.
created string An ISO-8601 timestamp in UTC.
import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({
client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),
});
const inboundRoute = await mv.inboundRoutes.retrieve("rte_Hz9XLopCXuVC77SlkVsLAz");
console.log(inboundRoute);

Update an inbound route. Changes the fields you send. A new target replaces the old one (and drops fallback_assistant_id when the new target is an assistant).

mv.inboundRoutes.update(id: InboundRoutesUpdateData["path"]["id"], body?: InboundRoutesUpdateData["body"], options?: RequestOptions): Promise<InboundRoutesUpdateResponse>

PATCH /inbound_routes/{id} · API reference

Name Type Required Description
id string yes A inbound route ID (rte_…).
body.connection_id string | null no conn_… ID.
body.enabled boolean no
body.fallback_assistant_id string | null no asst_… ID.
body.match_caller string no The caller’s number: exact, a prefix ending in *, or empty for any.
body.match_did string no The dialled number: exact, a prefix ending in *, or empty for any.
body.name string no
body.priority integer no
body.target RouteTargetParamsInput no Where a matching call goes: type, and the ID in <type>_id.
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.

InboundRoute:

Field Type Description
id string The route’s ID.
object "inbound_route" Always inbound_route.
livemode boolean true in live mode, false in test mode.
name string —
enabled boolean —
priority integer Lower runs first; the first matching route wins.
connection_id string | null conn_… ID.
match_did string The dialled number: exact, a prefix ending in *, or empty for any.
match_caller string The caller’s number: exact, a prefix ending in *, or empty for any.
target RouteTarget | null Where matching calls go (null: the connection’s inbound assistant answers).
fallback_assistant_id string | null asst_… ID.
created string An ISO-8601 timestamp in UTC.
import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({
client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),
});
const inboundRoute = await mv.inboundRoutes.update("rte_Hz9XLopCXuVC77SlkVsLAz", {
enabled: false,
});
console.log(inboundRoute);