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:
type | What it does |
|---|---|
transfer | Hand the call to a phone number (US, Canadian or Australian numbers only) or SIP address. |
sms | Text 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. |
book | Book an appointment through the workspace's Cal.com account. |
info | Collect one value from the caller (yes/no, text, a choice, a number or an email) and record it on the call. |
evaluate | Record whether the call met its goal: success, failed or unknown. Send config: {} on create. |
custom | Call 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:
- The token must match the type. A
bookfunction takes a Cal.com token. Acustomfunction takes a Custom Authentication token. The other types take no token. A mismatch answersINVALID_TOKEN_SERVICE. A token that is revoked, or not in the workspace, answersTOKEN_NOT_FOUND_OR_UNAUTHORIZED. - Only an ADMIN or OWNER attaches a token to a
customfunction. This covers atokenIdon create, and a new or differenttokenIdon update. A MEMBER getsCUSTOM_FUNCTION_TOKEN_ADMIN_ONLY. Abookfunction stays open to members: leave outtokenId, and create attaches the workspace's Cal.com token. - A MEMBER cannot change the URL of a
customfunction that has a token. The assistant sends the token only to that URL, so a MEMBER who changesconfig.endpointgetsCUSTOM_FUNCTION_TOKEN_ADMIN_ONLY. The otherconfigfields stay open. A MEMBER may send the storedtokenIdagain. A MEMBER may also remove the token withtokenId: null, and that request may change the URL. - 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
| Field | Type | Notes |
|---|---|---|
| limit | integer 1–100 | Rows per page. Default 20. |
| cursor | string | The nextCursor from the previous page. |
Responses
200 JSON body:
| Field | Type | Notes |
|---|---|---|
| functions | object[] | config is returned as stored. For a custom function it holds the request headers you configured, so treat the response as sensitive. |
| functions[].id | string | |
| functions[].type | enum: transfer | book | sms | info | evaluate | custom | |
| functions[].name | string | |
| functions[].prompt | string | |
| functions[].config | json | |
| functions[].createdAt | datetime | |
| functions[].updatedAt | datetime | |
| functions[].token | object | null when the function has no integration token attached. |
| functions[].token.id | string | |
| functions[].token.service | enum: calcom | custom | twilio | elevenlabs | |
| functions[].token.maskedToken | string | null | |
| functions[].token.revoked | boolean | |
| hasMore | boolean | |
| nextCursor | string | null |
Errors
Problem Details (RFC 9457). Each code links to its reference page.
- 400 INVALID_REQUEST_QUERY — The request query is invalid.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 500 UNKNOWN_ERROR — An unexpected server error occurred. Please try again later.
Plus the auth-layer codes every endpoint can return
- 401 UNAUTHENTICATED — Authentication required.
- 403 EMAIL_NOT_VERIFIED — Your email address is not verified.
- 401 INVALID_USER — The authenticated user is invalid or missing.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 404 WORKSPACE_NOT_FOUND_OR_UNAUTHORIZED — Workspace not found or you do not have access.
- 403 FORBIDDEN — You do not have permission to access this resource.
- 429 RATE_LIMIT_EXCEEDED — Too many requests. Please wait.
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":
| Field | Type | Notes |
|---|---|---|
| type * | "transfer" | |
| name * | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt * | string | min 1 |
| tokenId | string | min 1 |
| config * | object | |
| config.destinationType | enum: phone | sip | |
| config.transferNumber | string | min 1 |
| config.sipUri | string | matches ^sips?:[^\s@]+@[^\s@]+$ |
| config.availabilityWindow | object | |
| 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 * | string | matches ^([01]\d|2[0-3]):[0-5]\d$ |
| config.availabilityWindow.end * | string | matches ^([01]\d|2[0-3]):[0-5]\d$ |
When type = "sms":
| Field | Type | Notes |
|---|---|---|
| type * | "sms" | |
| name * | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt * | string | min 1 |
| tokenId | string | min 1 |
| config * | object | |
| config.smsContent * | string | |
| config.eventId | string | |
| config.eventTitle | string | |
| config.bookingUrl | string | URL, max 2048 |
When type = "info":
| Field | Type | Notes |
|---|---|---|
| type * | "info" | |
| name * | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt * | string | min 1 |
| tokenId | string | min 1 |
| config * | object | |
| config.dataType * | enum: boolean | string | choice | float | integer | email | |
| config.choice | string[] |
When type = "book":
| Field | Type | Notes |
|---|---|---|
| type * | "book" | |
| name * | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt * | string | min 1 |
| tokenId | string | min 1 |
| config * | object | |
| config.eventId * | string | min 1 |
| config.eventTitle | string | |
| config.smsSend | boolean | |
| config.smsContent | string | |
| config.bookingSlots | integer | min 1, max 5 |
| config.proactive | boolean | |
| config.offerPrompt | string | |
| config.qualifyingQuestions | object[] | |
| config.qualifyingQuestions[].id * | string | min 1 |
| config.qualifyingQuestions[].question * | string | min 1 |
| config.qualifyingQuestions[].dataType * | enum: boolean | string | choice | float | integer | email | |
| config.qualifyingQuestions[].choices | string[] | |
| config.qualifyingQuestions[].gate * | object | |
| config.qualifyingQuestions[].gate.mustBe | boolean | |
| config.qualifyingQuestions[].gate.allowed | string[] | |
| config.qualifyingQuestions[].gate.min | number | |
| config.qualifyingQuestions[].gate.max | number | |
| config.qualifyingQuestions[].gate.nonEmpty | boolean | |
| config.onGateFail | object | |
| config.onGateFail.action * | "decline" | |
| config.onGateFail.message * | string | min 1 |
When type = "custom":
| Field | Type | Notes |
|---|---|---|
| type * | "custom" | |
| name * | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt * | string | min 1 |
| tokenId | string | min 1 |
| config * | object | |
| config.method * | enum: GET | POST | PUT | PATCH | DELETE | |
| config.endpoint * | string | URL |
| config.headers | object[] | |
| config.headers[].key * | string | |
| config.headers[].value * | string | |
| config.contentType | enum: application/json | text/plain | application/x-www-form-urlencoded | |
| config.body | object of string → any | string | |
| config.startPhrase | string | |
| config.failPhrase | string | |
| config.relayResponse | boolean |
When type = "evaluate":
| Field | Type | Notes |
|---|---|---|
| type * | "evaluate" | |
| name * | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt * | string | min 1 |
| tokenId | string | min 1 |
| config * | object |
Responses
201 JSON body:
| Field | Type | Notes |
|---|---|---|
| function | object | |
| function.id | string | |
| function.type | enum: transfer | book | sms | info | evaluate | custom | |
| function.name | string | |
| function.prompt | string | |
| function.config | json | |
| function.createdAt | datetime | |
| function.updatedAt | datetime |
Errors
Problem Details (RFC 9457). Each code links to its reference page.
- 403 CUSTOM_FUNCTION_TOKEN_ADMIN_ONLY — Only a workspace admin or owner can attach a token to a custom function or change the endpoint of a custom function that has one.
- 402 FREE_PLAN_RESTRICTED — This action is not available on the free plan.
- 400 INVALID_REQUEST_BODY — The request body is invalid.
- 400 INVALID_TOKEN_SERVICE — The token service doesn't match the required service for this function.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 400 MISSING_CALCOM_TOKEN — Please integrate with Cal.com before creating a booking function
- 402 PLAN_FEATURE_RESTRICTED — This feature is not available on your current plan. Please upgrade.
- 404 TOKEN_NOT_FOUND_OR_UNAUTHORIZED — Token not found or you do not have access.
- 500 UNKNOWN_ERROR — An unexpected server error occurred. Please try again later.
Plus the auth-layer codes every endpoint can return
- 401 UNAUTHENTICATED — Authentication required.
- 403 EMAIL_NOT_VERIFIED — Your email address is not verified.
- 401 INVALID_USER — The authenticated user is invalid or missing.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 404 WORKSPACE_NOT_FOUND_OR_UNAUTHORIZED — Workspace not found or you do not have access.
- 403 FORBIDDEN — You do not have permission to access this resource.
- 429 RATE_LIMIT_EXCEEDED — Too many requests. Please wait.
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:
| Field | Type | Notes |
|---|---|---|
| function | object | |
| function.id | string | |
| function.type | enum: transfer | book | sms | info | evaluate | custom | |
| function.name | string | |
| function.prompt | string | |
| function.config | json | |
| function.createdAt | datetime | |
| function.updatedAt | datetime | |
| function.token | object | null when the function has no integration token attached. |
| function.token.id | string | |
| function.token.service | enum: calcom | custom | twilio | elevenlabs | |
| function.token.maskedToken | string | null | |
| function.token.revoked | boolean | |
| function.assistantIds | string[] |
Errors
Problem Details (RFC 9457). Each code links to its reference page.
- 404 FUNCTION_NOT_FOUND_OR_UNAUTHORIZED — Function not found or you do not have access.
- 400 INVALID_REQUEST_BODY — The request body is invalid.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 500 UNKNOWN_ERROR — An unexpected server error occurred. Please try again later.
Plus the auth-layer codes every endpoint can return
- 401 UNAUTHENTICATED — Authentication required.
- 403 EMAIL_NOT_VERIFIED — Your email address is not verified.
- 401 INVALID_USER — The authenticated user is invalid or missing.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 404 WORKSPACE_NOT_FOUND_OR_UNAUTHORIZED — Workspace not found or you do not have access.
- 403 FORBIDDEN — You do not have permission to access this resource.
- 429 RATE_LIMIT_EXCEEDED — Too many requests. Please wait.
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":
| Field | Type | Notes |
|---|---|---|
| type * | "transfer" | |
| name | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt | string | min 1 |
| tokenId | string | null | min 1 |
| config | object | |
| config.destinationType | enum: phone | sip | |
| config.transferNumber | string | min 1 |
| config.sipUri | string | matches ^sips?:[^\s@]+@[^\s@]+$ |
| config.availabilityWindow | object | |
| 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 * | string | matches ^([01]\d|2[0-3]):[0-5]\d$ |
| config.availabilityWindow.end * | string | matches ^([01]\d|2[0-3]):[0-5]\d$ |
When type = "sms":
| Field | Type | Notes |
|---|---|---|
| type * | "sms" | |
| name | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt | string | min 1 |
| tokenId | string | null | min 1 |
| config | object | |
| config.smsContent * | string | |
| config.eventId | string | |
| config.eventTitle | string | |
| config.bookingUrl | string | URL, max 2048 |
When type = "info":
| Field | Type | Notes |
|---|---|---|
| type * | "info" | |
| name | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt | string | min 1 |
| tokenId | string | null | min 1 |
| config | object | |
| config.dataType * | enum: boolean | string | choice | float | integer | email | |
| config.choice | string[] |
When type = "book":
| Field | Type | Notes |
|---|---|---|
| type * | "book" | |
| name | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt | string | min 1 |
| tokenId | string | null | min 1 |
| config | object | |
| config.eventId * | string | min 1 |
| config.eventTitle | string | |
| config.smsSend | boolean | |
| config.smsContent | string | |
| config.bookingSlots | integer | min 1, max 5 |
| config.proactive | boolean | |
| config.offerPrompt | string | |
| config.qualifyingQuestions | object[] | |
| config.qualifyingQuestions[].id * | string | min 1 |
| config.qualifyingQuestions[].question * | string | min 1 |
| config.qualifyingQuestions[].dataType * | enum: boolean | string | choice | float | integer | email | |
| config.qualifyingQuestions[].choices | string[] | |
| config.qualifyingQuestions[].gate * | object | |
| config.qualifyingQuestions[].gate.mustBe | boolean | |
| config.qualifyingQuestions[].gate.allowed | string[] | |
| config.qualifyingQuestions[].gate.min | number | |
| config.qualifyingQuestions[].gate.max | number | |
| config.qualifyingQuestions[].gate.nonEmpty | boolean | |
| config.onGateFail | object | |
| config.onGateFail.action * | "decline" | |
| config.onGateFail.message * | string | min 1 |
When type = "custom":
| Field | Type | Notes |
|---|---|---|
| type * | "custom" | |
| name | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt | string | min 1 |
| tokenId | string | null | min 1 |
| config | object | |
| config.method * | enum: GET | POST | PUT | PATCH | DELETE | |
| config.endpoint * | string | URL |
| config.headers | object[] | |
| config.headers[].key * | string | |
| config.headers[].value * | string | |
| config.contentType | enum: application/json | text/plain | application/x-www-form-urlencoded | |
| config.body | object of string → any | string | |
| config.startPhrase | string | |
| config.failPhrase | string | |
| config.relayResponse | boolean |
When type = "evaluate":
| Field | Type | Notes |
|---|---|---|
| type * | "evaluate" | |
| name | string | max 64, matches ^[A-Za-z0-9_]+$ |
| prompt | string | min 1 |
| tokenId | string | null | min 1 |
| config | object |
Responses
200 JSON body:
| Field | Type | Notes |
|---|---|---|
| function | object | |
| function.id | string | |
| function.type | enum: transfer | book | sms | info | evaluate | custom | |
| function.name | string | |
| function.prompt | string | |
| function.config | json | |
| function.createdAt | datetime | |
| function.updatedAt | datetime | |
| function.token | object | null when the function has no integration token attached. |
| function.token.id | string | |
| function.token.service | enum: calcom | custom | twilio | elevenlabs | |
| function.token.maskedToken | string | null | |
| function.token.revoked | boolean |
Errors
Problem Details (RFC 9457). Each code links to its reference page.
- 403 CUSTOM_FUNCTION_TOKEN_ADMIN_ONLY — Only a workspace admin or owner can attach a token to a custom function or change the endpoint of a custom function that has one.
- 402 FREE_PLAN_RESTRICTED — This action is not available on the free plan.
- 404 FUNCTION_NOT_FOUND_OR_UNAUTHORIZED — Function not found or you do not have access.
- 403 INSUFFICIENT_PRIVILEGES — You do not have sufficient privileges to edit this resource.
- 400 INVALID_REQUEST_BODY — The request body is invalid.
- 400 INVALID_TOKEN_SERVICE — The token service doesn't match the required service for this function.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 400 MISSING_CALCOM_TOKEN — Please integrate with Cal.com before creating a booking function
- 402 PLAN_FEATURE_RESTRICTED — This feature is not available on your current plan. Please upgrade.
- 409 RESOURCE_CONFLICT — The request conflicts with the current state of the target resource.
- 404 TOKEN_NOT_FOUND_OR_UNAUTHORIZED — Token not found or you do not have access.
- 500 UNKNOWN_ERROR — An unexpected server error occurred. Please try again later.
Plus the auth-layer codes every endpoint can return
- 401 UNAUTHENTICATED — Authentication required.
- 403 EMAIL_NOT_VERIFIED — Your email address is not verified.
- 401 INVALID_USER — The authenticated user is invalid or missing.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 404 WORKSPACE_NOT_FOUND_OR_UNAUTHORIZED — Workspace not found or you do not have access.
- 403 FORBIDDEN — You do not have permission to access this resource.
- 429 RATE_LIMIT_EXCEEDED — Too many requests. Please wait.
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.
- 404 FUNCTION_NOT_FOUND_OR_UNAUTHORIZED — Function not found or you do not have access.
- 403 INSUFFICIENT_PRIVILEGES — You do not have sufficient privileges to edit this resource.
- 400 INVALID_REQUEST_BODY — The request body is invalid.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 500 UNKNOWN_ERROR — An unexpected server error occurred. Please try again later.
Plus the auth-layer codes every endpoint can return
- 401 UNAUTHENTICATED — Authentication required.
- 403 EMAIL_NOT_VERIFIED — Your email address is not verified.
- 401 INVALID_USER — The authenticated user is invalid or missing.
- 400 INVALID_WORKSPACE_ID — The workspace is missing or invalid.
- 404 WORKSPACE_NOT_FOUND_OR_UNAUTHORIZED — Workspace not found or you do not have access.
- 403 FORBIDDEN — You do not have permission to access this resource.
- 429 RATE_LIMIT_EXCEEDED — Too many requests. Please wait.