Docs
Functions

Functions

The actions an assistant can take mid-call — transfer, SMS, booking, capturing caller details, evaluation, and custom HTTP calls.

A function is one action an assistant can take during a call. Its type decides what it does and what its config must contain:

typeWhat it does
transferHand the call to a phone number (US, Canadian or Australian numbers only) or SIP address.
smsText the person on the call from the assistant's number. Phone calls only; the number must be able to send SMS, and only to a caller with a US, Canadian or Australian number.
bookBook an appointment through the workspace's Cal.com account.
infoCollect one value from the caller (yes/no, text, a choice, a number or an email) and record it on the call.
evaluateRecord whether the call met its goal: success, failed or unknown. Send config: {} on create.
customCall an HTTP endpoint you control, with your own headers.

Attach a function to an assistant with connectFunctionIds on the assistant. One function can serve many assistants; the detail response lists them in assistantIds.

Beta. This API is documented but not yet frozen. Response fields and error codes may change without a version bump. Pin your integration to the fields you use, and expect additions.

Body shape depends on type

Create and update bodies are a discriminated union: send type, and the config fields for that type apply. The tables below list one variant per type. On update, the stored type always applies — a type in the body is ignored, so you cannot turn a transfer into an SMS.

On update, config is optional. Leave it out and the stored config stays as it is. Send it and it replaces the stored config whole: send every field the type needs. A field you leave out goes back to its default if it has one (for example bookingSlots to 3), and is cleared if it has none. It must pass the same checks as a create, or the update answers INVALID_REQUEST_BODY.

Plan gates

sms and book functions need the workspace owner to be on a paid plan (Seed or higher). On the Free plan, creating or updating one answers FREE_PLAN_RESTRICTED. PLAN_FEATURE_RESTRICTED would answer a paid plan without the feature; every paid plan has both today. The other types have no plan gate.

Tokens and custom functions

A custom function calls a URL you control. Its config holds the request method, URL and headers exactly as you set them — so a response that returns config returns those headers too. Treat the response as sensitive.

For a secret, prefer a workspace integration token over an inline header. A workspace ADMIN or OWNER creates the token in the dashboard, under Integrations → Custom Authentication (paid plans); the API cannot create one. On a call, the assistant sends the token's value as a header named by the token's Key (for example Authorization or X-API-Key), replacing an inline header of the same name in any letter case. Store the full header value (for example Bearer sk_…). Pass the token's id as tokenId. No endpoint lists integration tokens. The list, detail and update responses show a function's token as token, with its id in token.id.

Four rules apply to a token on a function:

  1. The token must match the type. A book function takes a Cal.com token. A custom function takes a Custom Authentication token. The other types take no token. A mismatch answers INVALID_TOKEN_SERVICE. A token that is revoked, or not in the workspace, answers TOKEN_NOT_FOUND_OR_UNAUTHORIZED.
  2. Only an ADMIN or OWNER attaches a token to a custom function. This covers a tokenId on create, and a new or different tokenId on update. A MEMBER gets CUSTOM_FUNCTION_TOKEN_ADMIN_ONLY. A book function stays open to members: leave out tokenId, and create attaches the workspace's Cal.com token.
  3. A MEMBER cannot change the URL of a custom function that has a token. The assistant sends the token only to that URL, so a MEMBER who changes config.endpoint gets CUSTOM_FUNCTION_TOKEN_ADMIN_ONLY. The other config fields stay open. A MEMBER may send the stored tokenId again. A MEMBER may also remove the token with tokenId: null, and that request may change the URL.
  4. Deleting a function leaves its token in place. To stop a token working, an ADMIN or OWNER revokes it under Integrations. The revoke also removes the token from every function that uses it.

The URL is checked twice. When you save it, a non-http(s) URL, a private or loopback IP address, or a cloud metadata host answers INVALID_REQUEST_BODY. A hostname is not resolved at save, so localhost or an internal name still saves. When the assistant calls the URL, dBel resolves the hostname and blocks a private address, so the function fails on that call.

Example — a transfer function

curl -X POST https://dbel.ai/api/functions \
  -H "Authorization: Bearer $DBEL_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "transfer",
    "name": "to_reception",
    "prompt": "Transfer when the caller asks for a human.",
    "config": { "destinationType": "phone", "transferNumber": "+14155550100" }
  }'

See the transfer variant below for the full config field list.

Endpoints

GET/api/functions

List the workspace's functions, newest first.

Auth: Bearer token · any workspace member

Query parameters

FieldTypeNotes
limitinteger 1–100Rows per page. Default 20.
cursorstringThe nextCursor from the previous page.

Responses

200 JSON body:

FieldTypeNotes
functionsobject[]config is returned as stored. For a custom function it holds the request headers you configured, so treat the response as sensitive.
functions[].idstring
functions[].typeenum: transfer | book | sms | info | evaluate | custom
functions[].namestring
functions[].promptstring
functions[].configjson
functions[].createdAtdatetime
functions[].updatedAtdatetime
functions[].tokenobjectnull when the function has no integration token attached.
functions[].token.idstring
functions[].token.serviceenum: calcom | custom | twilio | elevenlabs
functions[].token.maskedTokenstring | null
functions[].token.revokedboolean
hasMoreboolean
nextCursorstring | null

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

POST/api/functions

Create a function. The body shape depends on type.

Only an ADMIN or OWNER may send a tokenId on a custom function; a MEMBER gets CUSTOM_FUNCTION_TOKEN_ADMIN_ONLY.

Auth: Bearer token · any workspace member · plan: sms and book types need the plan feature; other types have no plan gate

Request body

application/json

transfer: transferNumber is required when destinationType is phone (the default), sipUri when it is sip. info: choice needs at least 2 entries when dataType is choice. book: leave out tokenId and the workspace's active Cal.com token is used; with none, the answer is MISSING_CALCOM_TOKEN. A sent tokenId must be a token of the service the type needs: Cal.com for book, Custom Authentication for custom. The other types take no token.

When type = "transfer":

FieldTypeNotes
type *"transfer"
name *stringmax 64, matches ^[A-Za-z0-9_]+$
prompt *stringmin 1
tokenIdstringmin 1
config *object
config.destinationTypeenum: phone | sip
config.transferNumberstringmin 1
config.sipUristringmatches ^sips?:[^\s@]+@[^\s@]+$
config.availabilityWindowobject
config.availabilityWindow.timezone *enum: MINUS_12_00 | MINUS_11_00 | MINUS_10_00 | MINUS_09_00 | MINUS_08_00 | MINUS_07_00 | MINUS_06_00 | MINUS_05_00 | MINUS_04_00 | MINUS_03_00 | MINUS_02_00 | MINUS_01_00 | Z | PLUS_01_00 | PLUS_02_00 | PLUS_03_00 | PLUS_03_30 | PLUS_04_00 | PLUS_04_30 | PLUS_05_00 | PLUS_05_30 | PLUS_05_45 | PLUS_06_00 | PLUS_06_30 | PLUS_07_00 | PLUS_08_00 | PLUS_08_45 | PLUS_09_00 | PLUS_09_30 | PLUS_10_00 | PLUS_10_30 | PLUS_11_00 | PLUS_12_00 | PLUS_12_45 | PLUS_13_00 | PLUS_14_00
config.availabilityWindow.days *integer[]
config.availabilityWindow.start *stringmatches ^([01]\d|2[0-3]):[0-5]\d$
config.availabilityWindow.end *stringmatches ^([01]\d|2[0-3]):[0-5]\d$

When type = "sms":

FieldTypeNotes
type *"sms"
name *stringmax 64, matches ^[A-Za-z0-9_]+$
prompt *stringmin 1
tokenIdstringmin 1
config *object
config.smsContent *string
config.eventIdstring
config.eventTitlestring
config.bookingUrlstringURL, max 2048

When type = "info":

FieldTypeNotes
type *"info"
name *stringmax 64, matches ^[A-Za-z0-9_]+$
prompt *stringmin 1
tokenIdstringmin 1
config *object
config.dataType *enum: boolean | string | choice | float | integer | email
config.choicestring[]

When type = "book":

FieldTypeNotes
type *"book"
name *stringmax 64, matches ^[A-Za-z0-9_]+$
prompt *stringmin 1
tokenIdstringmin 1
config *object
config.eventId *stringmin 1
config.eventTitlestring
config.smsSendboolean
config.smsContentstring
config.bookingSlotsintegermin 1, max 5
config.proactiveboolean
config.offerPromptstring
config.qualifyingQuestionsobject[]
config.qualifyingQuestions[].id *stringmin 1
config.qualifyingQuestions[].question *stringmin 1
config.qualifyingQuestions[].dataType *enum: boolean | string | choice | float | integer | email
config.qualifyingQuestions[].choicesstring[]
config.qualifyingQuestions[].gate *object
config.qualifyingQuestions[].gate.mustBeboolean
config.qualifyingQuestions[].gate.allowedstring[]
config.qualifyingQuestions[].gate.minnumber
config.qualifyingQuestions[].gate.maxnumber
config.qualifyingQuestions[].gate.nonEmptyboolean
config.onGateFailobject
config.onGateFail.action *"decline"
config.onGateFail.message *stringmin 1

When type = "custom":

FieldTypeNotes
type *"custom"
name *stringmax 64, matches ^[A-Za-z0-9_]+$
prompt *stringmin 1
tokenIdstringmin 1
config *object
config.method *enum: GET | POST | PUT | PATCH | DELETE
config.endpoint *stringURL
config.headersobject[]
config.headers[].key *string
config.headers[].value *string
config.contentTypeenum: application/json | text/plain | application/x-www-form-urlencoded
config.bodyobject of string → any | string
config.startPhrasestring
config.failPhrasestring
config.relayResponseboolean

When type = "evaluate":

FieldTypeNotes
type *"evaluate"
name *stringmax 64, matches ^[A-Za-z0-9_]+$
prompt *stringmin 1
tokenIdstringmin 1
config *object

Responses

201 JSON body:

FieldTypeNotes
functionobject
function.idstring
function.typeenum: transfer | book | sms | info | evaluate | custom
function.namestring
function.promptstring
function.configjson
function.createdAtdatetime
function.updatedAtdatetime

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/functions/{functionId}

Fetch one function and the ids of the assistants using it.

An empty functionId answers INVALID_REQUEST_BODY, not an INVALID_*_ID code.

Auth: Bearer token · any workspace member

Responses

200 JSON body:

FieldTypeNotes
functionobject
function.idstring
function.typeenum: transfer | book | sms | info | evaluate | custom
function.namestring
function.promptstring
function.configjson
function.createdAtdatetime
function.updatedAtdatetime
function.tokenobjectnull when the function has no integration token attached.
function.token.idstring
function.token.serviceenum: calcom | custom | twilio | elevenlabs
function.token.maskedTokenstring | null
function.token.revokedboolean
function.assistantIdsstring[]

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

PATCH/api/functions/{functionId}

Update a function. The stored type always applies; a type in the body is ignored.

On a custom function, a MEMBER who attaches or swaps a token, or changes config.endpoint while the function keeps a token, gets CUSTOM_FUNCTION_TOKEN_ADMIN_ONLY; sending the stored tokenId again is allowed. If another edit of the same function lands first, the update answers RESOURCE_CONFLICT and writes nothing: fetch the function again and retry.

Auth: Bearer token · any workspace member · a MEMBER may act only on rows they created (ADMIN/OWNER on any) · plan: sms and book types need the plan feature

Request body

application/json

type is optional: the stored type always applies. The tables list one variant per type, so they show type as required. A sent config meets the same per-type rules as on create. A sent tokenId meets the same token rules as on create. tokenId: null removes the token, except on book, where it answers MISSING_CALCOM_TOKEN.

When type = "transfer":

FieldTypeNotes
type *"transfer"
namestringmax 64, matches ^[A-Za-z0-9_]+$
promptstringmin 1
tokenIdstring | nullmin 1
configobject
config.destinationTypeenum: phone | sip
config.transferNumberstringmin 1
config.sipUristringmatches ^sips?:[^\s@]+@[^\s@]+$
config.availabilityWindowobject
config.availabilityWindow.timezone *enum: MINUS_12_00 | MINUS_11_00 | MINUS_10_00 | MINUS_09_00 | MINUS_08_00 | MINUS_07_00 | MINUS_06_00 | MINUS_05_00 | MINUS_04_00 | MINUS_03_00 | MINUS_02_00 | MINUS_01_00 | Z | PLUS_01_00 | PLUS_02_00 | PLUS_03_00 | PLUS_03_30 | PLUS_04_00 | PLUS_04_30 | PLUS_05_00 | PLUS_05_30 | PLUS_05_45 | PLUS_06_00 | PLUS_06_30 | PLUS_07_00 | PLUS_08_00 | PLUS_08_45 | PLUS_09_00 | PLUS_09_30 | PLUS_10_00 | PLUS_10_30 | PLUS_11_00 | PLUS_12_00 | PLUS_12_45 | PLUS_13_00 | PLUS_14_00
config.availabilityWindow.days *integer[]
config.availabilityWindow.start *stringmatches ^([01]\d|2[0-3]):[0-5]\d$
config.availabilityWindow.end *stringmatches ^([01]\d|2[0-3]):[0-5]\d$

When type = "sms":

FieldTypeNotes
type *"sms"
namestringmax 64, matches ^[A-Za-z0-9_]+$
promptstringmin 1
tokenIdstring | nullmin 1
configobject
config.smsContent *string
config.eventIdstring
config.eventTitlestring
config.bookingUrlstringURL, max 2048

When type = "info":

FieldTypeNotes
type *"info"
namestringmax 64, matches ^[A-Za-z0-9_]+$
promptstringmin 1
tokenIdstring | nullmin 1
configobject
config.dataType *enum: boolean | string | choice | float | integer | email
config.choicestring[]

When type = "book":

FieldTypeNotes
type *"book"
namestringmax 64, matches ^[A-Za-z0-9_]+$
promptstringmin 1
tokenIdstring | nullmin 1
configobject
config.eventId *stringmin 1
config.eventTitlestring
config.smsSendboolean
config.smsContentstring
config.bookingSlotsintegermin 1, max 5
config.proactiveboolean
config.offerPromptstring
config.qualifyingQuestionsobject[]
config.qualifyingQuestions[].id *stringmin 1
config.qualifyingQuestions[].question *stringmin 1
config.qualifyingQuestions[].dataType *enum: boolean | string | choice | float | integer | email
config.qualifyingQuestions[].choicesstring[]
config.qualifyingQuestions[].gate *object
config.qualifyingQuestions[].gate.mustBeboolean
config.qualifyingQuestions[].gate.allowedstring[]
config.qualifyingQuestions[].gate.minnumber
config.qualifyingQuestions[].gate.maxnumber
config.qualifyingQuestions[].gate.nonEmptyboolean
config.onGateFailobject
config.onGateFail.action *"decline"
config.onGateFail.message *stringmin 1

When type = "custom":

FieldTypeNotes
type *"custom"
namestringmax 64, matches ^[A-Za-z0-9_]+$
promptstringmin 1
tokenIdstring | nullmin 1
configobject
config.method *enum: GET | POST | PUT | PATCH | DELETE
config.endpoint *stringURL
config.headersobject[]
config.headers[].key *string
config.headers[].value *string
config.contentTypeenum: application/json | text/plain | application/x-www-form-urlencoded
config.bodyobject of string → any | string
config.startPhrasestring
config.failPhrasestring
config.relayResponseboolean

When type = "evaluate":

FieldTypeNotes
type *"evaluate"
namestringmax 64, matches ^[A-Za-z0-9_]+$
promptstringmin 1
tokenIdstring | nullmin 1
configobject

Responses

200 JSON body:

FieldTypeNotes
functionobject
function.idstring
function.typeenum: transfer | book | sms | info | evaluate | custom
function.namestring
function.promptstring
function.configjson
function.createdAtdatetime
function.updatedAtdatetime
function.tokenobjectnull when the function has no integration token attached.
function.token.idstring
function.token.serviceenum: calcom | custom | twilio | elevenlabs
function.token.maskedTokenstring | null
function.token.revokedboolean

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

DELETE/api/functions/{functionId}

Delete a function.

A delete never revokes the function's integration token; an ADMIN or OWNER revokes it under Integrations.

Auth: Bearer token · any workspace member · a MEMBER may act only on rows they created (ADMIN/OWNER on any)

Responses

204 No body.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return