@dialstack/sdk-dev / server/src / DialStack
Class: DialStack
Defined in: sdk/server/src/index.ts:3816
Constructors
Constructor
new DialStack(apiKey, config?): DialStack;
Defined in: sdk/server/src/index.ts:3827
Parameters
apiKey
string | undefined
config?
Returns
DialStack
Properties
accounts
accounts: object;
Defined in: sdk/server/src/index.ts:4232
acceptTos
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.
Pass tos_variant to move the account onto a different agreement in
the same call. It is refused while a re-signature of the current
agreement is pending (409 tos_resign_pending) and when your platform
is not cleared to offer that agreement (422).
Parameters
accountId
string
params
options?
Returns
Promise<Tos>
create
create: (params, options?) => Promise<Account>;
Parameters
params
options?
Returns
Promise<Account>
del
del: (accountId, options?) => Promise<void>;
Parameters
accountId
string
options?
Returns
Promise<void>
list
list: (params?, options?) => PaginatedList<Account>;
Parameters
params?
options?
Returns
portOutPin
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: writing it is an operation against the carrier that enforces the value.
portOutPin.retrieve
retrieve: (accountId, options?) => Promise<AccountPortOutPin>;
Retrieve the account's outbound porting PIN. pin is null when the
account owns no phone numbers and no PIN has been set.
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?
Returns
Promise<AccountPortOutPin>
portOutPin.update
update: (accountId, params, options?) => Promise<AccountPortOutPin>;
Replace the account's outbound porting PIN. Applied to every phone number on the account, asynchronously: for a few minutes a transfer request is still checked against the previous value. Numbers the account acquires later are given the new PIN.
Parameters
accountId
string
params
options?
Returns
Promise<AccountPortOutPin>
retrieve
retrieve: (accountId, options?) => Promise<Account>;
Parameters
accountId
string
options?
Returns
Promise<Account>
retrieveDeviceSettings
retrieveDeviceSettings: (accountId, options?) => Promise<DeviceSettingsResource>;
Retrieve the account's device settings: what the account sets itself,
the defaults it inherits and which level each comes from, and which
settings it can change (settable).
Parameters
accountId
string
options?
Returns
Promise<DeviceSettingsResource>
retrieveEffectivePricing
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?
Returns
Promise<EffectivePricing>
retrievePricing
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?
Returns
Promise<AccountPricing>
retrieveTos
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, and tos_variant to preview a different agreement before
moving the account onto it with acceptTos.
Parameters
accountId
string
options?
RequestOptions & object
Returns
Promise<Tos>
update
update: (accountId, params, options?) => Promise<Account>;
Parameters
accountId
string
params
options?
Returns
Promise<Account>
updateDeviceSettings
updateDeviceSettings: (accountId, params, options?) => Promise<DeviceSettingsResource>;
Change the account's device settings. settings is merged into what the
account already sets: send only what you change, null to clear a
setting back to its default. Choosing tls for the SIP transport makes
phones connect only over encrypted signaling and audio: a phone that
cannot connect securely stays offline rather than falling back.
Parameters
accountId
string
params
options?
Returns
Promise<DeviceSettingsResource>
updatePricing
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
options?
Returns
Promise<AccountPricing>
accountSessions
accountSessions: object;
Defined in: sdk/server/src/index.ts:4696
create
create: (params, options?) => Promise<AccountSessionCreateResponse>;
Parameters
params
options?
Returns
Promise<AccountSessionCreateResponse>
admin
admin: object;
Defined in: sdk/server/src/index.ts:5756
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
users: object;
users.list
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
users.retrieve
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
aiAgents: object;
Defined in: sdk/server/src/index.ts:5854
create
create: (params, options) => Promise<AIAgent>;
Parameters
params
options
RequestOptions & object
Returns
Promise<AIAgent>
del
del: (aiAgentId, options) => Promise<void>;
Parameters
aiAgentId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<AIAgent>;
Parameters
params
AIAgentListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (aiAgentId, options) => Promise<AIAgent>;
Parameters
aiAgentId
string
options
RequestOptions & object
Returns
Promise<AIAgent>
update
update: (aiAgentId, params, options) => Promise<AIAgent>;
Parameters
aiAgentId
string
params
options
RequestOptions & object
Returns
Promise<AIAgent>
blockedNumbers
blockedNumbers: object;
Defined in: sdk/server/src/index.ts:5942
create
create: (params, options) => Promise<BlockedNumber>;
Parameters
params
options
RequestOptions & object
Returns
Promise<BlockedNumber>
del
del: (phoneNumber, options) => Promise<void>;
Parameters
phoneNumber
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<BlockedNumber>;
Parameters
params
| BlockedNumberListParams
| undefined
options
RequestOptions & object
Returns
retrieve
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
update: (phoneNumber, params, options) => Promise<BlockedNumber>;
Parameters
phoneNumber
string
params
options
RequestOptions & object
Returns
Promise<BlockedNumber>
buttonTemplates
buttonTemplates: object;
Defined in: sdk/server/src/index.ts:5172
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
create: (params, options) => Promise<ButtonTemplateWithDetails>;
Create a template. Pass buttons to create the whole layout in one call
(omit it to start from a single line button), and expand: ['buttons']
to get the created buttons back.
Parameters
params
options
RequestOptions & object
Returns
Promise<ButtonTemplateWithDetails>
createButton
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
options
RequestOptions & object
Returns
Promise<TemplateButton>
del
del: (buttonTemplateId, options) => Promise<void>;
Parameters
buttonTemplateId
string
options
RequestOptions & object
Returns
Promise<void>
delButton
delButton: (buttonTemplateId, buttonId, options) => Promise<void>;
Parameters
buttonTemplateId
string
buttonId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<ButtonTemplate>;
Parameters
params
| ButtonTemplateListParams
| undefined
options
RequestOptions & object
Returns
listButtons
listButtons: (buttonTemplateId, params, options) => PaginatedList<TemplateButton>;
Parameters
buttonTemplateId
string
params
| TemplateButtonListParams
| undefined
options
RequestOptions & object
Returns
retrieve
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
update: (buttonTemplateId, params, options) => Promise<ButtonTemplate>;
Parameters
buttonTemplateId
string
params
options
RequestOptions & object
Returns
Promise<ButtonTemplate>
updateButton
updateButton: (buttonTemplateId, buttonId, params, options) => Promise<TemplateButton>;
Move a button. Position is the only updatable field.
Parameters
buttonTemplateId
string
buttonId
string
params
options
RequestOptions & object
Returns
Promise<TemplateButton>
calls
calls: object;
Defined in: sdk/server/src/index.ts:4714
create
create: (params, options) => Promise<CallCreateResponse>;
Place an outbound call. The user's endpoints ring first; when the user
answers, dial_string is dialed. Accepted asynchronously: match the
returned command_id to the request's outcome event to learn the call's
id, or why no call was placed.
Parameters
params
options
RequestOptions & object
Returns
Promise<CallCreateResponse>
createListener
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
options
RequestOptions & object
Returns
Promise<Listener>
delListener
delListener: (callId, listenerId, options) => Promise<void>;
Stop a listener and close its WebSocket.
Parameters
callId
string
listenerId
string
options
RequestOptions & object
Returns
Promise<void>
delRecording
delRecording: (callId, options) => Promise<void>;
Permanently delete a call's recorded audio. The transcript, summary and
sentiment are kept; delete them with delTranscript. The call stays
in the call log.
Parameters
callId
string
options
RequestOptions & object
Returns
Promise<void>
delTranscript
delTranscript: (callId, options) => Promise<void>;
Permanently delete a call's transcript, summary and sentiment. The
recording is kept; delete it with delRecording. The call stays in
the call log.
Parameters
callId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<CallLog>;
Parameters
params
CallListParams | undefined
options
RequestOptions & object
Returns
listListeners
listListeners: (callId, params, options) => PaginatedList<Listener>;
Parameters
callId
string
params
ListenerListParams | undefined
options
RequestOptions & object
Returns
pauseRecording
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
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
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
retrieveListener: (callId, listenerId, options) => Promise<Listener>;
Parameters
callId
string
listenerId
string
options
RequestOptions & object
Returns
Promise<Listener>
retrieveRecording
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
retrieveTranscript: (callId, options) => Promise<Transcript>;
Parameters
callId
string
options
RequestOptions & object
Returns
Promise<Transcript>
summary
summary: (params, options) => Promise<CallSummary>;
Aggregate counts over the calls list would return for the same
filters: by direction and status, and by sentiment on each side.
Parameters
params
options
RequestOptions & object
Returns
Promise<CallSummary>
update
update: (callId, params, options) => Promise<void>;
Parameters
callId
string
params
options
RequestOptions & object
Returns
Promise<void>
devices
devices: object;
Defined in: sdk/server/src/index.ts:5318
Deskphones, DECT bases, and DECT handsets. This is the unified device surface — prefer it over the per-kind endpoints.
assignUser
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
options
RequestOptions & object
Returns
Promise<DeviceUserAssignment>
checkSync
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
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
options
RequestOptions & object
Returns
Promise<CreateDeviceResponse>
createButtonOverride
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>
Deprecated
Use users.createButtonOverride. Still honoured.
del
del: (deviceId, options) => Promise<void>;
Parameters
deviceId
string
options
RequestOptions & object
Returns
Promise<void>
delButtonOverride
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>
Deprecated
Use users.delButtonOverride. Still honoured.
list
list: (params, options) => PaginatedList<Device>;
Parameters
params
DeviceListParams | undefined
options
RequestOptions & object
Returns
listButtonOverrides
listButtonOverrides: (deviceId, params, options) => PaginatedList<DeviceButtonOverride>;
Parameters
deviceId
string
params
| DeviceButtonListParams
| undefined
options
RequestOptions & object
Returns
PaginatedList<DeviceButtonOverride>
Deprecated
Use users.listButtonOverrides: a phone shows the layout of
the user it serves. Still honoured.
listButtons
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
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
listUsers
listUsers: (deviceId, options) => Promise<ListResponse<DeviceUserAssignment>>;
Parameters
deviceId
string
options
RequestOptions & object
Returns
Promise<ListResponse<DeviceUserAssignment>>
removeUser
removeUser: (deviceId, userId, options) => Promise<void>;
Parameters
deviceId
string
userId
string
options
RequestOptions & object
Returns
Promise<void>
retrieve
retrieve: (deviceId, options) => Promise<Device>;
Parameters
deviceId
string
options
RequestOptions & object
Returns
Promise<Device>
update
update: (deviceId, params, options) => Promise<Device>;
Update a device. name, base, and button_template are tri-state:
omit to leave unchanged, pass a string to set, or pass null to clear.
location can be changed but not cleared. Throws with a DeviceUserConflictResponse body on 409.
Parameters
deviceId
string
params
options
RequestOptions & object
Returns
Promise<Device>
dialPlans
dialPlans: object;
Defined in: sdk/server/src/index.ts:6007
create
create: (params, options) => Promise<DialPlan>;
Parameters
params
options
RequestOptions & object
Returns
Promise<DialPlan>
list
list: (params, options) => PaginatedList<DialPlan>;
Parameters
params
DialPlanListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (dialPlanId, options) => Promise<DialPlan>;
Parameters
dialPlanId
string
options
RequestOptions & object
Returns
Promise<DialPlan>
extensions
extensions: object;
Defined in: sdk/server/src/index.ts:6043
create
create: (params, options) => Promise<Extension>;
Parameters
params
options
RequestOptions & object
Returns
Promise<Extension>
del
del: (number, options) => Promise<void>;
Parameters
number
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<Extension>;
Parameters
params
| ExtensionListParams
| undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (number, options) => Promise<Extension>;
Parameters
number
string
options
RequestOptions & object
Returns
Promise<Extension>
update
update: (number, params, options) => Promise<Extension>;
Parameters
number
string
params
options
RequestOptions & object
Returns
Promise<Extension>
faxes
faxes: object;
Defined in: sdk/server/src/index.ts:5105
del
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
list: (params, options) => PaginatedList<Fax>;
Parameters
params
FaxListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (faxId, options) => Promise<Fax>;
Parameters
faxId
string
options
RequestOptions & object
Returns
Promise<Fax>
send
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
options
RequestOptions & object
Returns
Promise<Fax>
update
update: (faxId, params, options) => Promise<Fax>;
Mark a received fax read or unread.
Parameters
faxId
string
params
options
RequestOptions & object
Returns
Promise<Fax>
hardwareOrders
hardwareOrders: object;
Defined in: sdk/server/src/index.ts:5526
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
checkout: HardwareOrderPlaceCall;
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 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.
create
create: (params, options) => Promise<HardwareOrder>;
Parameters
params
options
RequestOptions & object
Returns
Promise<HardwareOrder>
del
del: (hardwareOrderId, options) => Promise<void>;
Delete a draft order, including a requested one, which withdraws the
request. Permanent. A placed order cannot be deleted: that returns 409
with the code order_not_draft.
Parameters
hardwareOrderId
string
options
RequestOptions & object
Returns
Promise<void>
list
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>>
request
request: HardwareOrderPlaceCall;
Ask DialStack to place a draft, for a platform that cannot check out
itself yet. Nothing is placed or charged: the order stays a draft with
requested_at set, and DialStack places it and arranges payment
separately.
The order must be placeable as it stands apart from payment and the
resale certificate. Refusals are 409 with the same code checkout
returns — see HardwareOrderCheckoutConflictResponse.
retrieve
retrieve: (hardwareOrderId, options) => Promise<HardwareOrder>;
Parameters
hardwareOrderId
string
options
RequestOptions & object
Returns
Promise<HardwareOrder>
shippingQuotes
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
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
retrieve: (hardwareOrderId, shippingQuoteId, options) => Promise<ShippingQuote>;
Parameters
hardwareOrderId
string
shippingQuoteId
string
options
RequestOptions & object
Returns
Promise<ShippingQuote>
update
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
options
RequestOptions & object
Returns
Promise<HardwareOrder>
updateItem
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
options
RequestOptions & object
Returns
Promise<HardwareOrderItem>
phoneNumbers
phoneNumbers: object;
Defined in: sdk/server/src/index.ts:4675
list
list: (params, options) => PaginatedList<PhoneNumber>;
Parameters
params
| PhoneNumberListParams
| undefined
options
RequestOptions & object
Returns
presence
presence: object;
Defined in: sdk/server/src/index.ts:4635
list
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
options
RequestOptions & object
Returns
Promise<ListResponse<PresenceItem>>
subscribeParkSlots
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
options
RequestOptions & object & ParkSlotSubscriptionOptions
Returns
queues
queues: object;
Defined in: sdk/server/src/index.ts:6165
addMember
addMember: (queueId, params, options) => Promise<QueueMember>;
Parameters
queueId
string
params
options
RequestOptions & object
Returns
Promise<QueueMember>
create
create: (params, options) => Promise<Queue>;
Parameters
params
options
RequestOptions & object
Returns
Promise<Queue>
del
del: (queueId, options) => Promise<void>;
Parameters
queueId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<Queue>;
Parameters
params
QueueListParams | undefined
options
RequestOptions & object
Returns
listMembers
listMembers: (queueId, params, options) => PaginatedList<QueueMember>;
Parameters
queueId
string
params
| QueueListMembersParams
| undefined
options
RequestOptions & object
Returns
removeMember
removeMember: (queueId, memberId, options) => Promise<void>;
Parameters
queueId
string
memberId
string
options
RequestOptions & object
Returns
Promise<void>
retrieve
retrieve: (queueId, options) => Promise<Queue>;
Parameters
queueId
string
options
RequestOptions & object
Returns
Promise<Queue>
update
update: (queueId, params, options) => Promise<Queue>;
Parameters
queueId
string
params
options
RequestOptions & object
Returns
Promise<Queue>
updateMember
updateMember: (queueId, memberId, params, options) => Promise<QueueMember>;
Parameters
queueId
string
memberId
string
params
options
RequestOptions & object
Returns
Promise<QueueMember>
remoteNumbers
remoteNumbers: object;
Defined in: sdk/server/src/index.ts:4925
External numbers the account has had calls with, and what has happened
with each. Callers still waiting to be reached today:
list({ unconnected_inbound_count: { gte: 1 }, unconnected_inbound_last_at: { gte: midnight } }).
list
list: (params, options) => PaginatedList<RemoteNumber>;
Parameters
params
options
RequestOptions & object
Returns
retrieve
retrieve: (phoneNumber, options) => Promise<RemoteNumber>;
One external number's facts, by the number in any spelling.
Parameters
phoneNumber
string
options
RequestOptions & object
Returns
Promise<RemoteNumber>
ringGroups
ringGroups: object;
Defined in: sdk/server/src/index.ts:6093
addMember
addMember: (ringGroupId, params, options) => Promise<RingGroupMember>;
Parameters
ringGroupId
string
params
options
RequestOptions & object
Returns
Promise<RingGroupMember>
create
create: (params, options) => Promise<RingGroup>;
Parameters
params
options
RequestOptions & object
Returns
Promise<RingGroup>
del
del: (ringGroupId, options) => Promise<void>;
Parameters
ringGroupId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<RingGroup>;
Parameters
params
| RingGroupListParams
| undefined
options
RequestOptions & object
Returns
removeMember
removeMember: (ringGroupId, memberId, options) => Promise<void>;
Parameters
ringGroupId
string
memberId
string
options
RequestOptions & object
Returns
Promise<void>
retrieve
retrieve: (ringGroupId, options) => Promise<RingGroup>;
Parameters
ringGroupId
string
options
RequestOptions & object
Returns
Promise<RingGroup>
update
update: (ringGroupId, params, options) => Promise<RingGroup>;
Parameters
ringGroupId
string
params
options
RequestOptions & object
Returns
Promise<RingGroup>
schedules
schedules: object;
Defined in: sdk/server/src/index.ts:5908
create
create: (params, options) => Promise<Schedule>;
Parameters
params
options
RequestOptions & object
Returns
Promise<Schedule>
list
list: (params, options) => PaginatedList<Schedule>;
Parameters
params
ScheduleListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (scheduleId, options) => Promise<Schedule>;
Parameters
scheduleId
string
options
RequestOptions & object
Returns
Promise<Schedule>
testHelpers
testHelpers: object;
Defined in: sdk/server/src/index.ts:5718
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
calls: object;
calls.create
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
options
RequestOptions & object
Returns
Promise<TestCallResponse>
events
events: object;
events.create
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
options
RequestOptions & object
Returns
Promise<TestEventResponse>
users
users: object;
Defined in: sdk/server/src/index.ts:4463
create
create: (params, options) => Promise<User>;
Parameters
params
UserCreateParams | undefined
options
RequestOptions & object
Returns
Promise<User>
createButtonOverride
createButtonOverride: (userId, params, options) => Promise<UserButtonOverride>;
Override one position for this user, on whichever phone serves them:
suppress the template's button there, or replace it. A target.user of
'self' is rejected; name the user.
Parameters
userId
string
params
CreateDeviceButtonOverrideRequest
options
RequestOptions & object
Returns
Promise<UserButtonOverride>
del
del: (userId, options) => Promise<void>;
Parameters
userId
string
options
RequestOptions & object
Returns
Promise<void>
delButtonOverride
delButtonOverride: (userId, overrideId, options) => Promise<void>;
Drop a user override, restoring the template's button at that position.
Parameters
userId
string
overrideId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<User>;
Parameters
params
UserListParams | undefined
options
RequestOptions & object
Returns
listButtonOverrides
listButtonOverrides: (userId, params, options) => PaginatedList<UserButtonOverride>;
List the buttons this user changed on top of their phone's template.
Parameters
userId
string
params
| DeviceButtonListParams
| undefined
options
RequestOptions & object
Returns
PaginatedList<UserButtonOverride>
retrieve
retrieve: (userId, options) => Promise<User>;
Parameters
userId
string
options
RequestOptions & object
Returns
Promise<User>
retrieveDeviceSettings
retrieveDeviceSettings: (userId, options) => Promise<DeviceSettingsResource>;
Retrieve the user's device settings: the phone preferences that follow
the user to whatever phone serves them, the defaults they inherit from
the account and above, and which settings a user can change (settable).
Parameters
userId
string
options
RequestOptions & object
Returns
Promise<DeviceSettingsResource>
retrievePresence
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
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
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?
Returns
Promise<UserSessionsRevokeResponse>
update
update: (userId, params, options) => Promise<User>;
Parameters
userId
string
params
options
RequestOptions & object
Returns
Promise<User>
updateDeviceSettings
updateDeviceSettings: (userId, params, options) => Promise<DeviceSettingsResource>;
Change the user's device settings. settings is merged into what the
user already sets: send only what you change, null to clear a setting
back to its default. A setting the user cannot change returns 400.
Parameters
userId
string
params
options
RequestOptions & object
Returns
Promise<DeviceSettingsResource>
updateQueueAgent
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
options
RequestOptions & object
Returns
Promise<QueueAgent>
userSessions
userSessions: object;
Defined in: sdk/server/src/index.ts:4705
create
create: (params, options?) => Promise<UserSessionCreateResponse>;
Parameters
params
options?
Returns
Promise<UserSessionCreateResponse>
voiceApps
voiceApps: object;
Defined in: sdk/server/src/index.ts:5803
create
create: (params, options) => Promise<VoiceApp>;
Parameters
params
options
RequestOptions & object
Returns
Promise<VoiceApp>
del
del: (voiceAppId, options) => Promise<void>;
Parameters
voiceAppId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<VoiceApp>;
Parameters
params
VoiceAppListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (voiceAppId, options) => Promise<VoiceApp>;
Parameters
voiceAppId
string
options
RequestOptions & object
Returns
Promise<VoiceApp>
update
update: (voiceAppId, params, options) => Promise<VoiceApp>;
Parameters
voiceAppId
string
params
options
RequestOptions & object
Returns
Promise<VoiceApp>
voicemailGreetings
voicemailGreetings: object;
Defined in: sdk/server/src/index.ts:5050
Custom greetings that replace the system-default prompts for a user mailbox or a shared voicemail box, keyed by owner and greeting type.
del
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
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
upload: (owner, greetingType, file, options) => Promise<VoicemailGreeting>;
Upload (or replace) the greeting for an owner. Audio is validated and transcoded server-side to mono 16-bit PCM 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
voicemails: object;
Defined in: sdk/server/src/index.ts:4972
del
del: (voicemailId, options) => Promise<void>;
Parameters
voicemailId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<Voicemail>;
Parameters
params
| VoicemailListParams
| undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (voicemailId, options) => Promise<Voicemail>;
Parameters
voicemailId
string
options
RequestOptions & object
Returns
Promise<Voicemail>
retrieveTranscript
retrieveTranscript: (voicemailId, options) => Promise<VoicemailTranscript>;
Parameters
voicemailId
string
options
RequestOptions & object
Returns
Promise<VoicemailTranscript>
summary
summary: (params, options) => Promise<VoicemailSummary>;
Voicemail counts per mailbox and read state over a window.
Parameters
params
options
RequestOptions & object
Returns
Promise<VoicemailSummary>
update
update: (voicemailId, params, options) => Promise<Voicemail>;
Mark a voicemail read or unread.
Parameters
voicemailId
string
params
options
RequestOptions & object
Returns
Promise<Voicemail>
webhookEndpoints
webhookEndpoints: object;
Defined in: sdk/server/src/index.ts:4415
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
create: (params, options?) => Promise<WebhookEndpoint>;
Parameters
params
options?
Returns
Promise<WebhookEndpoint>
del
del: (webhookEndpointId, options?) => Promise<void>;
Parameters
webhookEndpointId
string
options?
Returns
Promise<void>
list
list: (params?, options?) => PaginatedList<WebhookEndpoint>;
Parameters
params?
options?
Returns
PaginatedList<WebhookEndpoint>
retrieve
retrieve: (webhookEndpointId, options?) => Promise<WebhookEndpoint>;
Parameters
webhookEndpointId
string
options?
Returns
Promise<WebhookEndpoint>
update
update: (webhookEndpointId, params, options?) => Promise<WebhookEndpoint>;
Parameters
webhookEndpointId
string
params
options?
Returns
Promise<WebhookEndpoint>
webhooks
static webhooks: object;
Defined in: sdk/server/src/index.ts:6292
Verify webhook signature and construct event
constructEvent
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
// 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()
off<E>(event, callback): void;
Defined in: sdk/server/src/index.ts:3875
Unsubscribe from SDK events
Type Parameters
E
E extends EventType
Parameters
event
E
callback
EventCallback<E extends "request" ? RequestEvent : ResponseEvent>
Returns
void
on()
on<E>(event, callback): void;
Defined in: sdk/server/src/index.ts:3861
Subscribe to SDK events
Type Parameters
E
E extends EventType
Parameters
event
E
callback
EventCallback<E extends "request" ? RequestEvent : ResponseEvent>
Returns
void
Example
dialstack.on('request', (event) => {
console.log(`${event.method} ${event.path}`);
});
dialstack.on('response', (event) => {
console.log(`${event.statusCode} in ${event.elapsed}ms`);
});