Skip to main content

@dialstack/sdk-dev / server/src / DialStack

Class: DialStack

Defined in: sdk/server/src/index.ts:3115

Constructors​

Constructor​

TypeScript
new DialStack(apiKey, config?): DialStack;

Defined in: sdk/server/src/index.ts:3126

Parameters​

apiKey​

string | undefined

config?​

DialStackConfig

Returns​

DialStack

Properties​

accounts​

TypeScript
accounts: object;

Defined in: sdk/server/src/index.ts:3531

acceptTos​

TypeScript
acceptTos: (accountId, params, options?) => Promise<Tos>;

Record the account owner's acceptance of the agreement. Calling this with your secret key asserts that you presented the agreement to the owner and they accepted; the evidence (timestamp, IP, user agent) is derived from the request, never taken from the body.

version must match the current agreement (409 otherwise), and the account's pricing must already be set since the agreement embeds it (422 otherwise). Re-accepting the same version is idempotent.

Parameters​
accountId​

string

params​

TosAcceptParams

options?​

RequestOptions

Returns​

Promise<Tos>

create​

TypeScript
create: (params, options?) => Promise<Account>;
Parameters​
params​

AccountCreateParams

options?​

RequestOptions

Returns​

Promise<Account>

del​

TypeScript
del: (accountId, options?) => Promise<void>;
Parameters​
accountId​

string

options?​

RequestOptions

Returns​

Promise<void>

list​

TypeScript
list: (params?, options?) => PaginatedList<Account>;
Parameters​
params?​

AccountListParams

options?​

RequestOptions

Returns​

PaginatedList<Account>

portOutPin​

TypeScript
portOutPin: object;

The account's outbound porting PIN. Nested under its parent because it is a singleton sub-resource, not a field on the account: both reading and writing it are operations against the carrier that holds the value.

portOutPin.retrieve​
TypeScript
retrieve: (accountId, options?) => Promise<AccountPortOutPin>;

Retrieve the account's outbound porting PIN. pin is null when the account owns no phone numbers.

Treat the value like a password: anyone who has it can begin moving the account's phone numbers to another provider.

Parameters​
accountId​

string

options?​

RequestOptions

Returns​

Promise<AccountPortOutPin>

portOutPin.update​
TypeScript
update: (accountId, params, options?) => Promise<AccountPortOutPin>;

Replace the account's outbound porting PIN. Applied to every phone number on the account, asynchronously — a retrieve immediately afterwards may still report the previous value.

Parameters​
accountId​

string

params​

AccountPortOutPinUpdateParams

options?​

RequestOptions

Returns​

Promise<AccountPortOutPin>

retrieve​

TypeScript
retrieve: (accountId, options?) => Promise<Account>;
Parameters​
accountId​

string

options?​

RequestOptions

Returns​

Promise<Account>

retrieveEffectivePricing​

TypeScript
retrieveEffectivePricing: (accountId, options?) => Promise<EffectivePricing>;

Retrieve what an account is billed today, plus any agreed change that has not started yet. Use this rather than retrievePricing when quoting a price to a customer: rate changes take effect at the start of the next month, so the agreed pricing is not always what is being charged.

Parameters​
accountId​

string

options?​

RequestOptions

Returns​

Promise<EffectivePricing>

retrievePricing​

TypeScript
retrievePricing: (accountId, options?) => Promise<AccountPricing>;

Retrieve the agreed pricing singleton for an account. These are the latest agreed rates; see retrieveEffectivePricing for what is billed today.

Parameters​
accountId​

string

options?​

RequestOptions

Returns​

Promise<AccountPricing>

retrieveTos​

TypeScript
retrieveTos: (accountId, options?) => Promise<Tos>;

Retrieve the account's subscription agreement and its acceptance state. Pass expand: ['pricing'] to include the pricing the customer is accepting.

Parameters​
accountId​

string

options?​

RequestOptions & object

Returns​

Promise<Tos>

update​

TypeScript
update: (accountId, params, options?) => Promise<Account>;
Parameters​
accountId​

string

params​

AccountUpdateParams

options?​

RequestOptions

Returns​

Promise<Account>

updatePricing​

TypeScript
updatePricing: (accountId, params, options?) => Promise<AccountPricing>;

Create or replace the agreed pricing for an account. All three rates are required, in cents per month.

Parameters​
accountId​

string

params​

AccountPricingParams

options?​

RequestOptions

Returns​

Promise<AccountPricing>


accountSessions​

TypeScript
accountSessions: object;

Defined in: sdk/server/src/index.ts:3883

create​

TypeScript
create: (params, options?) => Promise<AccountSessionCreateResponse>;
Parameters​
params​

AccountSessionCreateParams

options?​

RequestOptions

Returns​

Promise<AccountSessionCreateResponse>


admin​

TypeScript
admin: object;

Defined in: sdk/server/src/index.ts:4760

Admin portal resources.

Distinct from the voice platform resources above: these describe who can administer an account in the portal, not who has phone service. Read-only — roles are granted in the portal itself.

users​

TypeScript
users: object;
users.list​
TypeScript
list: (params, options) => PaginatedList<AdminUser>;

List the people who can administer this account.

This is not a subset of users.list() — it is a different population. Someone listed here may have no voice user at all (an account owner typically does not), and most voice users are not administrators. Read both collections to cover everyone on the account, and use each admin user's user field to link them rather than matching on email.

Only explicit grants on this account are listed; platform-wide access does not appear. A role can be granted before its invitation is accepted, so someone listed may not yet have signed in.

Pass expand: ['user'] to inline the full voice user.

Parameters​
params​

| AdminUserListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<AdminUser>

users.retrieve​
TypeScript
retrieve: (adminUserId, params, options) => Promise<AdminUser>;

Retrieve one of this account's admin portal users.

Rejects with a 404 when no such person administers this account — including when they administer a different one.

Parameters​
adminUserId​

string

params​

| AdminUserRetrieveParams | undefined

options​

RequestOptions & object

Returns​

Promise<AdminUser>


aiAgents​

TypeScript
aiAgents: object;

Defined in: sdk/server/src/index.ts:4858

create​

TypeScript
create: (params, options) => Promise<AIAgent>;
Parameters​
params​

AIAgentCreateParams

options​

RequestOptions & object

Returns​

Promise<AIAgent>

del​

TypeScript
del: (aiAgentId, options) => Promise<void>;
Parameters​
aiAgentId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<AIAgent>;
Parameters​
params​

AIAgentListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<AIAgent>

retrieve​

TypeScript
retrieve: (aiAgentId, options) => Promise<AIAgent>;
Parameters​
aiAgentId​

string

options​

RequestOptions & object

Returns​

Promise<AIAgent>

update​

TypeScript
update: (aiAgentId, params, options) => Promise<AIAgent>;
Parameters​
aiAgentId​

string

params​

AIAgentUpdateParams

options​

RequestOptions & object

Returns​

Promise<AIAgent>


blockedNumbers​

TypeScript
blockedNumbers: object;

Defined in: sdk/server/src/index.ts:4946

create​

TypeScript
create: (params, options) => Promise<BlockedNumber>;
Parameters​
params​

BlockedNumberCreateParams

options​

RequestOptions & object

Returns​

Promise<BlockedNumber>

del​

TypeScript
del: (phoneNumber, options) => Promise<void>;
Parameters​
phoneNumber​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<BlockedNumber>;
Parameters​
params​

| BlockedNumberListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<BlockedNumber>

retrieve​

TypeScript
retrieve: (phoneNumber, options) => Promise<BlockedNumber>;

phoneNumber may be E.164 or a US/Canada number without a country code.

Parameters​
phoneNumber​

string

options​

RequestOptions & object

Returns​

Promise<BlockedNumber>

update​

TypeScript
update: (phoneNumber, params, options) => Promise<BlockedNumber>;
Parameters​
phoneNumber​

string

params​

BlockedNumberUpdateParams

options​

RequestOptions & object

Returns​

Promise<BlockedNumber>


buttonTemplates​

TypeScript
buttonTemplates: object;

Defined in: sdk/server/src/index.ts:4243

Reusable sets of programmable buttons for desk phones. A template is assigned to devices; per-device deviations live in the device's button overrides.

create​

TypeScript
create: (params, options) => Promise<ButtonTemplate>;
Parameters​
params​

CreateButtonTemplateRequest

options​

RequestOptions & object

Returns​

Promise<ButtonTemplate>

createButton​

TypeScript
createButton: (buttonTemplateId, params, options) => Promise<TemplateButton>;

Add a button to a template. type narrows the required target shape, so a mismatched payload is a compile-time error.

Parameters​
buttonTemplateId​

string

params​

CreateTemplateButtonRequest

options​

RequestOptions & object

Returns​

Promise<TemplateButton>

del​

TypeScript
del: (buttonTemplateId, options) => Promise<void>;
Parameters​
buttonTemplateId​

string

options​

RequestOptions & object

Returns​

Promise<void>

delButton​

TypeScript
delButton: (buttonTemplateId, buttonId, options) => Promise<void>;
Parameters​
buttonTemplateId​

string

buttonId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<ButtonTemplate>;
Parameters​
params​

| ButtonTemplateListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<ButtonTemplate>

listButtons​

TypeScript
listButtons: (buttonTemplateId, params, options) => PaginatedList<TemplateButton>;
Parameters​
buttonTemplateId​

string

params​

| TemplateButtonListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<TemplateButton>

retrieve​

TypeScript
retrieve: (buttonTemplateId, options) => Promise<ButtonTemplateWithDetails>;

Retrieve a template. Pass expand: ['buttons'] to embed its buttons, and for_device to have the response carry a compatibility summary for that device's vendor, model, and position range.

Parameters​
buttonTemplateId​

string

options​

RequestOptions & object & ButtonTemplateRetrieveOptions

Returns​

Promise<ButtonTemplateWithDetails>

update​

TypeScript
update: (buttonTemplateId, params, options) => Promise<ButtonTemplate>;
Parameters​
buttonTemplateId​

string

params​

UpdateButtonTemplateRequest

options​

RequestOptions & object

Returns​

Promise<ButtonTemplate>

updateButton​

TypeScript
updateButton: (buttonTemplateId, buttonId, params, options) => Promise<TemplateButton>;

Move a button. Position is the only updatable field.

Parameters​
buttonTemplateId​

string

buttonId​

string

params​

UpdateTemplateButtonRequest

options​

RequestOptions & object

Returns​

Promise<TemplateButton>


calls​

TypeScript
calls: object;

Defined in: sdk/server/src/index.ts:3901

create​

TypeScript
create: (params, options) => Promise<void>;

Place an outbound call. The user's endpoints ring first; when the user answers, dial_string is dialed. Accepted asynchronously — the call progresses over webhooks, so there is no response body.

Parameters​
params​

CallCreateParams

options​

RequestOptions & object

Returns​

Promise<void>

createListener​

TypeScript
createListener: (callId, params, options) => Promise<Listener>;

Start streaming live audio from an active call to your WebSocket server. Neither party is aware of the listener.

Parameters​
callId​

string

params​

ListenerCreateParams

options​

RequestOptions & object

Returns​

Promise<Listener>

delListener​

TypeScript
delListener: (callId, listenerId, options) => Promise<void>;

Stop a listener and close its WebSocket.

Parameters​
callId​

string

listenerId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<CallLog>;
Parameters​
params​

CallListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<CallLog>

listListeners​

TypeScript
listListeners: (callId, params, options) => PaginatedList<Listener>;
Parameters​
callId​

string

params​

ListenerListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<Listener>

pauseRecording​

TypeScript
pauseRecording: (callId, options) => Promise<void>;

Pause recording on an active call — e.g. while an agent collects a customer's payment card number so the sensitive audio is never captured. Recording stays paused until resumeRecording or the call ends; both parties hear a short confirmation tone.

Parameters​
callId​

string

options​

RequestOptions & object

Returns​

Promise<void>

resumeRecording​

TypeScript
resumeRecording: (callId, options) => Promise<void>;

Resume a recording previously paused with pauseRecording. Both parties hear a short confirmation tone.

Parameters​
callId​

string

options​

RequestOptions & object

Returns​

Promise<void>

retrieve​

TypeScript
retrieve: (callId, options) => Promise<CallLog>;

Retrieve a call log. Safe to call while the call is still live, in which case the completion-only fields are null — see CallLog.

Parameters​
callId​

string

options​

RequestOptions & object

Returns​

Promise<CallLog>

retrieveListener​

TypeScript
retrieveListener: (callId, listenerId, options) => Promise<Listener>;
Parameters​
callId​

string

listenerId​

string

options​

RequestOptions & object

Returns​

Promise<Listener>

retrieveRecording​

TypeScript
retrieveRecording: (callId, options) => Promise<Recording>;

Retrieve recording metadata with a signed download URL. The URL expires after 10 minutes, so fetch it when you are ready to download.

Parameters​
callId​

string

options​

RequestOptions & object

Returns​

Promise<Recording>

retrieveTranscript​

TypeScript
retrieveTranscript: (callId, options) => Promise<Transcript>;
Parameters​
callId​

string

options​

RequestOptions & object

Returns​

Promise<Transcript>

update​

TypeScript
update: (callId, params, options) => Promise<void>;
Parameters​
callId​

string

params​

CallUpdateParams

options​

RequestOptions & object

Returns​

Promise<void>


devices​

TypeScript
devices: object;

Defined in: sdk/server/src/index.ts:4376

Deskphones, DECT bases, and DECT handsets. This is the unified device surface — prefer it over the per-kind endpoints.

assignUser​

TypeScript
assignUser: (deviceId, params, options) => Promise<DeviceUserAssignment>;

Assign a user to the device. This provisions the endpoint's SIP credentials and the device line/extension server-side. Throws with a DeviceUserConflictResponse body on 409.

Parameters​
deviceId​

string

params​

DeviceAssignUserParams

options​

RequestOptions & object

Returns​

Promise<DeviceUserAssignment>

checkSync​

TypeScript
checkSync: (deviceId, params, options) => Promise<DeviceCheckSyncResponse>;

Tell the device to fetch and apply its latest configuration. On a DECT system one request reaches every handset paired with the base.

Call this when configuration actually changed, not on every admin interaction. With reboot: true the device drops active calls and goes offline for roughly 30–90 seconds.

Parameters​
deviceId​

string

params​

| DeviceCheckSyncParams | undefined

options​

RequestOptions & object

Returns​

Promise<DeviceCheckSyncResponse>

create​

TypeScript
create: (params, options) => Promise<CreateDeviceResponse>;

Register a device. type is optional for MAC-addressable devices: omit it and the kind is detected from mac_address via the vendor catalog. Returns only the new id and type — call retrieve for the rest.

Parameters​
params​

DeviceCreateParams

options​

RequestOptions & object

Returns​

Promise<CreateDeviceResponse>

createButtonOverride​

TypeScript
createButtonOverride: (deviceId, params, options) => Promise<DeviceButtonOverride>;

Override one position on this device: either suppress the template's button there, or replace it with a different one.

Parameters​
deviceId​

string

params​

CreateDeviceButtonOverrideRequest

options​

RequestOptions & object

Returns​

Promise<DeviceButtonOverride>

del​

TypeScript
del: (deviceId, options) => Promise<void>;
Parameters​
deviceId​

string

options​

RequestOptions & object

Returns​

Promise<void>

delButtonOverride​

TypeScript
delButtonOverride: (deviceId, overrideId, options) => Promise<void>;

Drop an override, restoring the template's button at that position.

Parameters​
deviceId​

string

overrideId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<Device>;
Parameters​
params​

DeviceListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<Device>

listButtonOverrides​

TypeScript
listButtonOverrides: (deviceId, params, options) => PaginatedList<DeviceButtonOverride>;
Parameters​
deviceId​

string

params​

| DeviceButtonListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<DeviceButtonOverride>

listButtons​

TypeScript
listButtons: (deviceId, options) => Promise<ListResponse<MaterializedButton>>;

The device's effective buttons — the bound template's buttons with this device's overrides applied, plus any model defaults. Not paginated.

Parameters​
deviceId​

string

options​

RequestOptions & object

Returns​

Promise<ListResponse<MaterializedButton>>

listCompatibleButtonTemplates​

TypeScript
listCompatibleButtonTemplates: (deviceId, params, options) => PaginatedList<ButtonTemplate>;

Button templates whose buttons all fit this device's vendor and model.

Parameters​
deviceId​

string

params​

| ButtonTemplateListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<ButtonTemplate>

listUsers​

TypeScript
listUsers: (deviceId, options) => Promise<ListResponse<DeviceUserAssignment>>;
Parameters​
deviceId​

string

options​

RequestOptions & object

Returns​

Promise<ListResponse<DeviceUserAssignment>>

removeUser​

TypeScript
removeUser: (deviceId, userId, options) => Promise<void>;
Parameters​
deviceId​

string

userId​

string

options​

RequestOptions & object

Returns​

Promise<void>

retrieve​

TypeScript
retrieve: (deviceId, options) => Promise<Device>;
Parameters​
deviceId​

string

options​

RequestOptions & object

Returns​

Promise<Device>

update​

TypeScript
update: (deviceId, params, options) => Promise<Device>;

Update a device. name, location, base, and button_template are tri-state: omit to leave unchanged, pass a string to set, or pass null to clear. Throws with a DeviceUserConflictResponse body on 409.

Parameters​
deviceId​

string

params​

DeviceUpdateParams

options​

RequestOptions & object

Returns​

Promise<Device>


dialPlans​

TypeScript
dialPlans: object;

Defined in: sdk/server/src/index.ts:5011

create​

TypeScript
create: (params, options) => Promise<DialPlan>;
Parameters​
params​

DialPlanCreateParams

options​

RequestOptions & object

Returns​

Promise<DialPlan>

list​

TypeScript
list: (params, options) => PaginatedList<DialPlan>;
Parameters​
params​

DialPlanListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<DialPlan>

retrieve​

TypeScript
retrieve: (dialPlanId, options) => Promise<DialPlan>;
Parameters​
dialPlanId​

string

options​

RequestOptions & object

Returns​

Promise<DialPlan>


extensions​

TypeScript
extensions: object;

Defined in: sdk/server/src/index.ts:5047

create​

TypeScript
create: (params, options) => Promise<Extension>;
Parameters​
params​

ExtensionCreateParams

options​

RequestOptions & object

Returns​

Promise<Extension>

del​

TypeScript
del: (number, options) => Promise<void>;
Parameters​
number​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<Extension>;
Parameters​
params​

| ExtensionListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<Extension>

retrieve​

TypeScript
retrieve: (number, options) => Promise<Extension>;
Parameters​
number​

string

options​

RequestOptions & object

Returns​

Promise<Extension>

update​

TypeScript
update: (number, params, options) => Promise<Extension>;
Parameters​
number​

string

params​

ExtensionUpdateParams

options​

RequestOptions & object

Returns​

Promise<Extension>


faxes​

TypeScript
faxes: object;

Defined in: sdk/server/src/index.ts:4176

del​

TypeScript
del: (faxId, options) => Promise<void>;

Delete the fax record. The referenced file keeps its own lifecycle.

Parameters​
faxId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<Fax>;
Parameters​
params​

FaxListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<Fax>

retrieve​

TypeScript
retrieve: (faxId, options) => Promise<Fax>;
Parameters​
faxId​

string

options​

RequestOptions & object

Returns​

Promise<Fax>

send​

TypeScript
send: (params, options) => Promise<Fax>;

Send an outbound fax. Upload the document first to the dedicated files host (POST https://files.dialstack.ai/v1/files, purpose fax_source), then reference the resulting file id here. The fax is created pending and progresses to delivered or failed; sends are rate-limited per account over a rolling hour.

Parameters​
params​

FaxSendParams

options​

RequestOptions & object

Returns​

Promise<Fax>

update​

TypeScript
update: (faxId, params, options) => Promise<Fax>;

Mark a received fax read or unread.

Parameters​
faxId​

string

params​

FaxUpdateParams

options​

RequestOptions & object

Returns​

Promise<Fax>


hardwareOrders​

TypeScript
hardwareOrders: object;

Defined in: sdk/server/src/index.ts:4573

Orders for physical hardware.

An order is built as a draft, then placed with hardwareOrders.checkout. It carries both what was ordered (lines, with the prices charged) and the physical units those expanded into (items), each of which can be pre-assigned to a user, location, or base before it is fulfilled into a device.

checkout​

TypeScript
checkout: (hardwareOrderId, options) => Promise<HardwareOrder>;

Place the order and charge for it. This is the moment its prices stop moving, an ACH debit is originated against the bank account the platform authorized, and the order enters the fulfillment queue.

payment_status becomes submitted. ACH has no real-time authorization, so that says the debit was handed to the network — not that the funds exist. Settlement follows days later and moves it to settled; a rejection inside that window moves it to failed.

Returns 409 if no carrier service has been chosen — an unquoted order is not a free-shipping one, so it cannot be completed — if the order has no recipient or shipping address, if the quote the service was chosen from has expired, if a debit already exists for the order, or if the platform has no verified bank account with a live ACH authorization to debit.

Safe to retry until a debit exists: an order that was placed but not yet charged is picked up where it left off, and the platform is never debited twice for the same order. That window is bounded — an order placed more than 12 hours ago is refused, because the guarantee against a duplicate charge does not outlive it, and the order then needs to be reconciled by hand.

Requires an account, like every other call on this resource — checkout acts on one account's order and the API rejects the request without it.

Refusals are 409 with a stable code — see HardwareOrderCheckoutConflictResponse, which says which precondition failed and therefore where to send the operator.

Parameters​
hardwareOrderId​

string

options​

RequestOptions & object

Returns​

Promise<HardwareOrder>

create​

TypeScript
create: (params, options) => Promise<HardwareOrder>;
Parameters​
params​

HardwareOrderParams

options​

RequestOptions & object

Returns​

Promise<HardwareOrder>

list​

TypeScript
list: (params, options) => Promise<ListResponse<HardwareOrder>>;

List the account's orders with their items embedded.

Not paginated: the API returns every order in one envelope with no page URLs, so this is a plain ListResponse rather than a PaginatedList.

Parameters​
params​

| HardwareOrderListParams | undefined

options​

RequestOptions & object

Returns​

Promise<ListResponse<HardwareOrder>>

retrieve​

TypeScript
retrieve: (hardwareOrderId, options) => Promise<HardwareOrder>;
Parameters​
hardwareOrderId​

string

options​

RequestOptions & object

Returns​

Promise<HardwareOrder>

shippingQuotes​

TypeScript
shippingQuotes: object;

Shipping quotes for a draft order. Each create is a live, billable round trip to the distributor, so request one once the cart and the destination have settled.

shippingQuotes.create​
TypeScript
create: (hardwareOrderId, options) => Promise<ShippingQuote>;

Price the order's contents to its ship_to_address and return every carrier service on offer. Changes nothing on the order.

Parameters​
hardwareOrderId​

string

options​

RequestOptions & object

Returns​

Promise<ShippingQuote>

shippingQuotes.retrieve​
TypeScript
retrieve: (hardwareOrderId, shippingQuoteId, options) => Promise<ShippingQuote>;
Parameters​
hardwareOrderId​

string

shippingQuoteId​

string

options​

RequestOptions & object

Returns​

Promise<ShippingQuote>

update​

TypeScript
update: (hardwareOrderId, params, options) => Promise<HardwareOrder>;

Update a draft order: its items, where it ships, or which carrier service carries it.

Only a draft — an order whose placed_at is null — can be changed; once checked out it is frozen and this returns 409. Replacing the items re-prices the order from the catalog. Changing the items or the address clears the chosen carrier service, since both decide the freight.

Parameters​
hardwareOrderId​

string

params​

HardwareOrderUpdateParams

options​

RequestOptions & object

Returns​

Promise<HardwareOrder>

updateItem​

TypeScript
updateItem: (hardwareOrderId, itemId, params, options) => Promise<HardwareOrderItem>;

Set or clear a single unit's user, location, or base pre-assignment.

Parameters​
hardwareOrderId​

string

itemId​

string

params​

HardwareOrderItemUpdateParams

options​

RequestOptions & object

Returns​

Promise<HardwareOrderItem>


phoneNumbers​

TypeScript
phoneNumbers: object;

Defined in: sdk/server/src/index.ts:3862

list​

TypeScript
list: (params, options) => PaginatedList<PhoneNumber>;
Parameters​
params​

| PhoneNumberListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<PhoneNumber>


presence​

TypeScript
presence: object;

Defined in: sdk/server/src/index.ts:3822

list​

TypeScript
list: (params, options) => Promise<ListResponse<PresenceItem>>;

Read presence for an explicit, bounded set of users in one request — the candidate set a caller already has in hand. A filtered list by id, not a paginated collection: results come back in request order in the standard list envelope (next_page_url/previous_page_url are always null). The set is capped per request; if any user cannot be resolved or read, the whole request fails rather than returning a partial result.

Parameters​
params​

PresenceListParams

options​

RequestOptions & object

Returns​

Promise<ListResponse<PresenceItem>>

subscribeParkSlots​

TypeScript
subscribeParkSlots: (handlers, options) => ParkSlotSubscription;

Subscribe to the account's park slots.

Every slot's current state arrives immediately via onSnapshot, then one onSlot call per change. Frames carry state, not transitions: a slot being freed arrives as parked_call: null. A frame always says what the slot is now, so there is no log of parks and unparks to reconcile.

Reconnects automatically, and every reconnect delivers a fresh snapshot — a complete resync, so there is no sequence number to track. If the server can no longer verify slot state it ends the subscription rather than let it drift silently; onTerminated reports why, and the reconnect that follows repairs it.

Users cannot be subscribed to — read their presence with list instead.

Parameters​
handlers​

ParkSlotSubscriptionHandlers

options​

RequestOptions & object & ParkSlotSubscriptionOptions

Returns​

ParkSlotSubscription


queues​

TypeScript
queues: object;

Defined in: sdk/server/src/index.ts:5169

addMember​

TypeScript
addMember: (queueId, params, options) => Promise<QueueMember>;
Parameters​
queueId​

string

params​

QueueAddMemberParams

options​

RequestOptions & object

Returns​

Promise<QueueMember>

create​

TypeScript
create: (params, options) => Promise<Queue>;
Parameters​
params​

QueueCreateParams

options​

RequestOptions & object

Returns​

Promise<Queue>

del​

TypeScript
del: (queueId, options) => Promise<void>;
Parameters​
queueId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<Queue>;
Parameters​
params​

QueueListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<Queue>

listMembers​

TypeScript
listMembers: (queueId, params, options) => PaginatedList<QueueMember>;
Parameters​
queueId​

string

params​

| QueueListMembersParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<QueueMember>

removeMember​

TypeScript
removeMember: (queueId, memberId, options) => Promise<void>;
Parameters​
queueId​

string

memberId​

string

options​

RequestOptions & object

Returns​

Promise<void>

retrieve​

TypeScript
retrieve: (queueId, options) => Promise<Queue>;
Parameters​
queueId​

string

options​

RequestOptions & object

Returns​

Promise<Queue>

update​

TypeScript
update: (queueId, params, options) => Promise<Queue>;
Parameters​
queueId​

string

params​

QueueUpdateParams

options​

RequestOptions & object

Returns​

Promise<Queue>


ringGroups​

TypeScript
ringGroups: object;

Defined in: sdk/server/src/index.ts:5097

addMember​

TypeScript
addMember: (ringGroupId, params, options) => Promise<RingGroupMember>;
Parameters​
ringGroupId​

string

params​

RingGroupAddMemberParams

options​

RequestOptions & object

Returns​

Promise<RingGroupMember>

create​

TypeScript
create: (params, options) => Promise<RingGroup>;
Parameters​
params​

RingGroupCreateParams

options​

RequestOptions & object

Returns​

Promise<RingGroup>

del​

TypeScript
del: (ringGroupId, options) => Promise<void>;
Parameters​
ringGroupId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<RingGroup>;
Parameters​
params​

| RingGroupListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<RingGroup>

removeMember​

TypeScript
removeMember: (ringGroupId, memberId, options) => Promise<void>;
Parameters​
ringGroupId​

string

memberId​

string

options​

RequestOptions & object

Returns​

Promise<void>

retrieve​

TypeScript
retrieve: (ringGroupId, options) => Promise<RingGroup>;
Parameters​
ringGroupId​

string

options​

RequestOptions & object

Returns​

Promise<RingGroup>

update​

TypeScript
update: (ringGroupId, params, options) => Promise<RingGroup>;
Parameters​
ringGroupId​

string

params​

RingGroupUpdateParams

options​

RequestOptions & object

Returns​

Promise<RingGroup>


schedules​

TypeScript
schedules: object;

Defined in: sdk/server/src/index.ts:4912

create​

TypeScript
create: (params, options) => Promise<Schedule>;
Parameters​
params​

ScheduleCreateParams

options​

RequestOptions & object

Returns​

Promise<Schedule>

list​

TypeScript
list: (params, options) => PaginatedList<Schedule>;
Parameters​
params​

ScheduleListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<Schedule>

retrieve​

TypeScript
retrieve: (scheduleId, options) => Promise<Schedule>;
Parameters​
scheduleId​

string

options​

RequestOptions & object

Returns​

Promise<Schedule>


testHelpers​

TypeScript
testHelpers: object;

Defined in: sdk/server/src/index.ts:4722

Test-mode helpers (sandbox only). Trigger simulated calls and emit canned webhook events to exercise your integration end to end without real telephony. Requires a test key (sk_test_...); a live key receives a 400. See the "Testing your integration" guide.

calls​

TypeScript
calls: object;
calls.create​
TypeScript
create: (params, options) => Promise<TestCallResponse>;

Trigger a simulated call — inbound (screen pop) or outbound — and drive its full event lifecycle on timers. This is the way to exercise your webhook handling: calls.create places a real click-to-call in every mode, so it rings the user's actual devices rather than simulating. Returns the started call's id + scenario so a test can assert on it.

Parameters​
params​

TestCallCreateParams

options​

RequestOptions & object

Returns​

Promise<TestCallResponse>

events​

TypeScript
events: object;
events.create​
TypeScript
create: (params, options) => Promise<TestEventResponse>;

Emit a single canned webhook event (fax., queue., recording.failed, call.mobile_push_wakeup, call.parked, call.unparked) for events the call simulator does not drive behaviorally.

Parameters​
params​

TestEventCreateParams

options​

RequestOptions & object

Returns​

Promise<TestEventResponse>


users​

TypeScript
users: object;

Defined in: sdk/server/src/index.ts:3722

create​

TypeScript
create: (params, options) => Promise<User>;
Parameters​
params​

UserCreateParams | undefined

options​

RequestOptions & object

Returns​

Promise<User>

del​

TypeScript
del: (userId, options) => Promise<void>;
Parameters​
userId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<User>;
Parameters​
params​

UserListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<User>

retrieve​

TypeScript
retrieve: (userId, options) => Promise<User>;
Parameters​
userId​

string

options​

RequestOptions & object

Returns​

Promise<User>

retrievePresence​

TypeScript
retrievePresence: (userId, options) => Promise<UserPresence>;

Retrieve a user's live presence — reachable / on a call right now. The value is always freshly verified; a read that cannot be confirmed fails with 503 rather than returning a stale or guessed value (no unknown).

Parameters​
userId​

string

options​

RequestOptions & object

Returns​

Promise<UserPresence>

retrieveQueueAgent​

TypeScript
retrieveQueueAgent: (userId, options) => Promise<QueueAgent>;

Retrieve the queue-agent singleton for a user. Throws on 404 when no queue-agent state has ever been written for the user.

Parameters​
userId​

string

options​

RequestOptions & object

Returns​

Promise<QueueAgent>

revokeSessions​

TypeScript
revokeSessions: (userId, options?) => Promise<UserSessionsRevokeResponse>;

Revoke every outstanding user-session token for a user and tear down their active WebRTC sessions (server-side kill switch). Platform-level, like userSessions.create() — no account header.

Parameters​
userId​

string

options?​

RequestOptions

Returns​

Promise<UserSessionsRevokeResponse>

update​

TypeScript
update: (userId, params, options) => Promise<User>;
Parameters​
userId​

string

params​

UserUpdateParams

options​

RequestOptions & object

Returns​

Promise<User>

updateQueueAgent​

TypeScript
updateQueueAgent: (userId, params, options) => Promise<QueueAgent>;

Update the queue-agent singleton for a user. Idempotent — re-sending the current status is a no-op. reason is only meaningful when status === "paused".

Parameters​
userId​

string

params​

QueueAgentUpdateParams

options​

RequestOptions & object

Returns​

Promise<QueueAgent>


userSessions​

TypeScript
userSessions: object;

Defined in: sdk/server/src/index.ts:3892

create​

TypeScript
create: (params, options?) => Promise<UserSessionCreateResponse>;
Parameters​
params​

UserSessionCreateParams

options?​

RequestOptions

Returns​

Promise<UserSessionCreateResponse>


voiceApps​

TypeScript
voiceApps: object;

Defined in: sdk/server/src/index.ts:4807

create​

TypeScript
create: (params, options) => Promise<VoiceApp>;
Parameters​
params​

VoiceAppCreateParams

options​

RequestOptions & object

Returns​

Promise<VoiceApp>

del​

TypeScript
del: (voiceAppId, options) => Promise<void>;
Parameters​
voiceAppId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<VoiceApp>;
Parameters​
params​

VoiceAppListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<VoiceApp>

retrieve​

TypeScript
retrieve: (voiceAppId, options) => Promise<VoiceApp>;
Parameters​
voiceAppId​

string

options​

RequestOptions & object

Returns​

Promise<VoiceApp>

update​

TypeScript
update: (voiceAppId, params, options) => Promise<VoiceApp>;
Parameters​
voiceAppId​

string

params​

VoiceAppUpdateParams

options​

RequestOptions & object

Returns​

Promise<VoiceApp>


voicemailGreetings​

TypeScript
voicemailGreetings: object;

Defined in: sdk/server/src/index.ts:4121

Custom greetings that replace the system-default prompts for a user mailbox or a shared voicemail box, keyed by owner and greeting type.

del​

TypeScript
del: (owner, greetingType, options) => Promise<void>;

Remove the custom greeting, reverting the mailbox to the system-default prompts. Idempotent — succeeds whether or not a greeting was set.

Parameters​
owner​

string

greetingType​

"unavailable"

options​

RequestOptions & object

Returns​

Promise<void>

retrieve​

TypeScript
retrieve: (owner, greetingType, options) => Promise<VoicemailGreeting>;

Throws 404 when no custom greeting is set for this owner and type.

Parameters​
owner​

string

greetingType​

"unavailable"

options​

RequestOptions & object

Returns​

Promise<VoicemailGreeting>

upload​

TypeScript
upload: (owner, greetingType, file, options) => Promise<VoicemailGreeting>;

Upload (or replace) the greeting for an owner. Audio is validated and transcoded server-side to mono µ-law 8 kHz WAV. Limits: 5 MB and 90 seconds; accepts WAV (PCM s16 / µ-law / A-law), MP3, AAC, Ogg Vorbis, and Opus. Re-uploading overwrites.

Parameters​
owner​

string

greetingType​

"unavailable"

file​

Blob

options​

RequestOptions & object

Returns​

Promise<VoicemailGreeting>


voicemails​

TypeScript
voicemails: object;

Defined in: sdk/server/src/index.ts:4062

del​

TypeScript
del: (voicemailId, options) => Promise<void>;
Parameters​
voicemailId​

string

options​

RequestOptions & object

Returns​

Promise<void>

list​

TypeScript
list: (params, options) => PaginatedList<Voicemail>;
Parameters​
params​

| VoicemailListParams | undefined

options​

RequestOptions & object

Returns​

PaginatedList<Voicemail>

retrieve​

TypeScript
retrieve: (voicemailId, options) => Promise<Voicemail>;
Parameters​
voicemailId​

string

options​

RequestOptions & object

Returns​

Promise<Voicemail>

retrieveTranscript​

TypeScript
retrieveTranscript: (voicemailId, options) => Promise<VoicemailTranscript>;
Parameters​
voicemailId​

string

options​

RequestOptions & object

Returns​

Promise<VoicemailTranscript>

update​

TypeScript
update: (voicemailId, params, options) => Promise<Voicemail>;

Mark a voicemail read or unread.

Parameters​
voicemailId​

string

params​

VoicemailUpdateParams

options​

RequestOptions & object

Returns​

Promise<Voicemail>


webhookEndpoints​

TypeScript
webhookEndpoints: object;

Defined in: sdk/server/src/index.ts:3674

Manage webhook endpoints. The mode of the endpoint (live vs sandbox) is determined by the API key used — a test key creates and lists sandbox endpoints, a live key creates and lists live endpoints.

create​

TypeScript
create: (params, options?) => Promise<WebhookEndpoint>;
Parameters​
params​

WebhookEndpointCreateParams

options?​

RequestOptions

Returns​

Promise<WebhookEndpoint>

del​

TypeScript
del: (webhookEndpointId, options?) => Promise<void>;
Parameters​
webhookEndpointId​

string

options?​

RequestOptions

Returns​

Promise<void>

list​

TypeScript
list: (params?, options?) => PaginatedList<WebhookEndpoint>;
Parameters​
params?​

WebhookEndpointListParams

options?​

RequestOptions

Returns​

PaginatedList<WebhookEndpoint>

retrieve​

TypeScript
retrieve: (webhookEndpointId, options?) => Promise<WebhookEndpoint>;
Parameters​
webhookEndpointId​

string

options?​

RequestOptions

Returns​

Promise<WebhookEndpoint>

update​

TypeScript
update: (webhookEndpointId, params, options?) => Promise<WebhookEndpoint>;
Parameters​
webhookEndpointId​

string

params​

WebhookEndpointUpdateParams

options?​

RequestOptions

Returns​

Promise<WebhookEndpoint>


webhooks​

TypeScript
static webhooks: object;

Defined in: sdk/server/src/index.ts:5287

Verify webhook signature and construct event

constructEvent​

TypeScript
constructEvent: <T>(payload, signature, secret, tolerance) => T;
Type Parameters​
T​

T = WebhookEvent

Parameters​
payload​

string | Buffer<ArrayBufferLike>

signature​

string

secret​

string

tolerance?​

number = 300

Returns​

T

Example​

TypeScript
// For call webhooks
const event = DialStack.webhooks.constructEvent(
req.body,
req.headers['x-dialstack-signature'],
process.env.DIALSTACK_WEBHOOK_SECRET
);

// For appointments webhooks (with type parameter)
const event = DialStack.webhooks.constructEvent<AvailabilitySearchWebhook>(
req.body,
req.headers['x-dialstack-signature'],
process.env.DIALSTACK_WEBHOOK_SECRET
);

Methods​

off()​

TypeScript
off<E>(event, callback): void;

Defined in: sdk/server/src/index.ts:3174

Unsubscribe from SDK events

Type Parameters​

E​

E extends EventType

Parameters​

event​

E

callback​

EventCallback<E extends "request" ? RequestEvent : ResponseEvent>

Returns​

void


on()​

TypeScript
on<E>(event, callback): void;

Defined in: sdk/server/src/index.ts:3160

Subscribe to SDK events

Type Parameters​

E​

E extends EventType

Parameters​

event​

E

callback​

EventCallback<E extends "request" ? RequestEvent : ResponseEvent>

Returns​

void

Example​

TypeScript
dialstack.on('request', (event) => {
console.log(`${event.method} ${event.path}`);
});

dialstack.on('response', (event) => {
console.log(`${event.statusCode} in ${event.elapsed}ms`);
});