# Delete a registered phone number for the team.
Source: https://docs.usebrainbase.com/api-reference/assets/delete-a-registered-phone-number-for-the-team
/openapi-specs/brainbase-openapi.documented.json delete /api/team/assets/phone_numbers/{phoneNumberId}/delete
# Get all registered phone numbers for the team, optionally filtered by integration id.
Source: https://docs.usebrainbase.com/api-reference/assets/get-all-registered-phone-numbers-for-the-team-optionally-filtered-by-integration-id
/openapi-specs/brainbase-openapi.documented.json get /api/team/assets/phone_numbers
# Get the status of a WhatsApp sender.
Source: https://docs.usebrainbase.com/api-reference/assets/get-the-status-of-a-whatsapp-sender
/openapi-specs/brainbase-openapi.documented.json get /api/team/assets/whatsapp_sender_status/{senderSid}
# Purchase a phone number and register it as a WhatsApp sender.
Source: https://docs.usebrainbase.com/api-reference/assets/purchase-a-phone-number-and-register-it-as-a-whatsapp-sender
/openapi-specs/brainbase-openapi.documented.json post /api/team/assets/purchase_whatsapp_sender
# Purchase phone numbers via Brainbase Twilio account.
Source: https://docs.usebrainbase.com/api-reference/assets/purchase-phone-numbers-via-brainbase-twilio-account
/openapi-specs/brainbase-openapi.documented.json post /api/team/assets/purchase_phone_numbers
# Register a phone number for the team via Twilio integration.
Source: https://docs.usebrainbase.com/api-reference/assets/register-a-phone-number-for-the-team-via-twilio-integration
/openapi-specs/brainbase-openapi.documented.json post /api/team/assets/register_phone_number
# Search for available phone numbers to purchase via Brainbase.
Source: https://docs.usebrainbase.com/api-reference/assets/search-for-available-phone-numbers-to-purchase-via-brainbase
/openapi-specs/brainbase-openapi.documented.json get /api/team/assets/available_phone_numbers
# Check if a phone number is callable at a given time
Source: https://docs.usebrainbase.com/api-reference/businesshours/check-if-a-phone-number-is-callable-at-a-given-time
/openapi-specs/brainbase-openapi.documented.json post /api/workers/check-callable
Checks if a phone number is callable at a specific timestamp by:
1. Taking a UTC Unix timestamp
2. Converting it to the business hours timezone (from BusinessHours table)
3. Checking if the local time falls within the business hours for that day
# Create new business hours
Source: https://docs.usebrainbase.com/api-reference/businesshours/create-new-business-hours
/openapi-specs/brainbase-openapi.documented.json post /api/workers/business-hours
# Delete business hours
Source: https://docs.usebrainbase.com/api-reference/businesshours/delete-business-hours
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/business-hours/{id}
# Get all business hours
Source: https://docs.usebrainbase.com/api-reference/businesshours/get-all-business-hours
/openapi-specs/brainbase-openapi.documented.json get /api/workers/business-hours
# Get business hours by ID
Source: https://docs.usebrainbase.com/api-reference/businesshours/get-business-hours-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/business-hours/{id}
# Update business hours
Source: https://docs.usebrainbase.com/api-reference/businesshours/update-business-hours
/openapi-specs/brainbase-openapi.documented.json put /api/workers/business-hours/{id}
# List chat deployment logs for a worker with optional filtering
Source: https://docs.usebrainbase.com/api-reference/chat-deployment-logs/list-chat-deployment-logs-for-a-worker-with-optional-filtering
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/chat
Retrieves all chat deployment logs for the worker. Optionally, logs can be filtered by deploymentId and/or flowId by providing corresponding query parameters.
# Retrieve a single chat deployment log record
Source: https://docs.usebrainbase.com/api-reference/chat-deployment-logs/retrieve-a-single-chat-deployment-log-record
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/chat/{logId}
# Create a new chat deployment
Source: https://docs.usebrainbase.com/api-reference/chat-deployments/create-a-new-chat-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/chat
# Delete a chat deployment
Source: https://docs.usebrainbase.com/api-reference/chat-deployments/delete-a-chat-deployment
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/chat/{deploymentId}
# Get a single chat deployment by chat agent ID
Source: https://docs.usebrainbase.com/api-reference/chat-deployments/get-a-single-chat-deployment-by-chat-agent-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat/agent/{chatAgentId}
# Get a single chat deployment by ID
Source: https://docs.usebrainbase.com/api-reference/chat-deployments/get-a-single-chat-deployment-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat/{deploymentId}
# Get all chat deployments for a worker
Source: https://docs.usebrainbase.com/api-reference/chat-deployments/get-all-chat-deployments-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat
# Update a chat deployment
Source: https://docs.usebrainbase.com/api-reference/chat-deployments/update-a-chat-deployment
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/chat/{deploymentId}
# List chat embed deployment logs for a worker with optional filtering
Source: https://docs.usebrainbase.com/api-reference/chat-embed-deployment-logs/list-chat-embed-deployment-logs-for-a-worker-with-optional-filtering
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/chat-embed
Retrieves all chat embed deployment logs for the worker. Optionally, logs can be filtered by deploymentId and/or flowId by providing corresponding query parameters.
# Retrieve a single chat embed deployment log record
Source: https://docs.usebrainbase.com/api-reference/chat-embed-deployment-logs/retrieve-a-single-chat-embed-deployment-log-record
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/chat-embed/{logId}
# Create a new chat embed deployment
Source: https://docs.usebrainbase.com/api-reference/chat-embed-deployments/create-a-new-chat-embed-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/chat-embed
# Delete a chat embed deployment
Source: https://docs.usebrainbase.com/api-reference/chat-embed-deployments/delete-a-chat-embed-deployment
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/chat-embed/{deploymentId}
# Get a single chat embed deployment by embed ID
Source: https://docs.usebrainbase.com/api-reference/chat-embed-deployments/get-a-single-chat-embed-deployment-by-embed-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/deployments/chat-embed/by-embed/{embedId}
# Get a single chat embed deployment by ID
Source: https://docs.usebrainbase.com/api-reference/chat-embed-deployments/get-a-single-chat-embed-deployment-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat-embed/{deploymentId}
# Get all chat embed deployments for a worker
Source: https://docs.usebrainbase.com/api-reference/chat-embed-deployments/get-all-chat-embed-deployments-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat-embed
# Update a chat embed deployment
Source: https://docs.usebrainbase.com/api-reference/chat-embed-deployments/update-a-chat-embed-deployment
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/chat-embed/{deploymentId}
# Create or update deployment-level default checks overrides
Source: https://docs.usebrainbase.com/api-reference/default-checks/create-or-update-deployment-level-default-checks-overrides
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/deployments/{deploymentId}/default-checks
# Create or update team default checks configuration
Source: https://docs.usebrainbase.com/api-reference/default-checks/create-or-update-team-default-checks-configuration
/openapi-specs/brainbase-openapi.documented.json put /api/team/default-checks
# Get resolved default checks configuration for a deployment
Source: https://docs.usebrainbase.com/api-reference/default-checks/get-resolved-default-checks-configuration-for-a-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/default-checks
# Get team default checks configuration
Source: https://docs.usebrainbase.com/api-reference/default-checks/get-team-default-checks-configuration
/openapi-specs/brainbase-openapi.documented.json get /api/team/default-checks
# Initialize team default checks with default values
Source: https://docs.usebrainbase.com/api-reference/default-checks/initialize-team-default-checks-with-default-values
/openapi-specs/brainbase-openapi.documented.json post /api/team/default-checks
# Remove deployment-level overrides (revert to team defaults)
Source: https://docs.usebrainbase.com/api-reference/default-checks/remove-deployment-level-overrides-revert-to-team-defaults
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/{deploymentId}/default-checks
# List deployment history
Source: https://docs.usebrainbase.com/api-reference/deployment-history/list-deployment-history
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/history
Returns paginated change history for a deployment
# Create a deployment parameter
Source: https://docs.usebrainbase.com/api-reference/deployment-parameters/create-a-deployment-parameter
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/{deploymentId}/params
# Delete a deployment parameter
Source: https://docs.usebrainbase.com/api-reference/deployment-parameters/delete-a-deployment-parameter
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/{deploymentId}/params/{paramId}
# List deployment parameters
Source: https://docs.usebrainbase.com/api-reference/deployment-parameters/list-deployment-parameters
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/params
# Update a deployment parameter
Source: https://docs.usebrainbase.com/api-reference/deployment-parameters/update-a-deployment-parameter
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/{deploymentId}/params/{paramId}
# Retrieve a deployment by ID
Source: https://docs.usebrainbase.com/api-reference/deployments/retrieve-a-deployment-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/deployments/{deploymentId}
Fetches a single deployment record by its ID, without requiring the worker ID. Works for all deployment types: Voice, VoiceV1, Chat, ChatEmbed, Whatsapp, SMS, Email, Slack, and API. Delegate-specific fields are flattened into the response automatically.
# Create a test agent
Source: https://docs.usebrainbase.com/api-reference/echo/create-a-test-agent
/openapi-specs/brainbase-openapi.documented.json post /api/echo/agents
# Create a test suite
Source: https://docs.usebrainbase.com/api-reference/echo/create-a-test-suite
/openapi-specs/brainbase-openapi.documented.json post /api/echo/suites
# Create an Echo scorecard
Source: https://docs.usebrainbase.com/api-reference/echo/create-an-echo-scorecard
/openapi-specs/brainbase-openapi.documented.json post /api/echo/scorecards
# Delete a test agent
Source: https://docs.usebrainbase.com/api-reference/echo/delete-a-test-agent
/openapi-specs/brainbase-openapi.documented.json delete /api/echo/agents/{id}
# Delete a test suite
Source: https://docs.usebrainbase.com/api-reference/echo/delete-a-test-suite
/openapi-specs/brainbase-openapi.documented.json delete /api/echo/suites/{id}
# Delete an Echo scorecard
Source: https://docs.usebrainbase.com/api-reference/echo/delete-an-echo-scorecard
/openapi-specs/brainbase-openapi.documented.json delete /api/echo/scorecards/{id}
# Get a single Echo scorecard
Source: https://docs.usebrainbase.com/api-reference/echo/get-a-single-echo-scorecard
/openapi-specs/brainbase-openapi.documented.json get /api/echo/scorecards/{id}
# List Echo scorecards for the team
Source: https://docs.usebrainbase.com/api-reference/echo/list-echo-scorecards-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/echo/scorecards
# List test agents for the team
Source: https://docs.usebrainbase.com/api-reference/echo/list-test-agents-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/echo/agents
# List test suites for the team
Source: https://docs.usebrainbase.com/api-reference/echo/list-test-suites-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/echo/suites
# Submit an Echo test run (agent or suite) to Redis queue
Source: https://docs.usebrainbase.com/api-reference/echo/submit-an-echo-test-run-agent-or-suite-to-redis-queue
/openapi-specs/brainbase-openapi.documented.json post /api/echo/run
# Update a test agent
Source: https://docs.usebrainbase.com/api-reference/echo/update-a-test-agent
/openapi-specs/brainbase-openapi.documented.json put /api/echo/agents/{id}
# Update a test suite
Source: https://docs.usebrainbase.com/api-reference/echo/update-a-test-suite
/openapi-specs/brainbase-openapi.documented.json put /api/echo/suites/{id}
# Update an Echo scorecard
Source: https://docs.usebrainbase.com/api-reference/echo/update-an-echo-scorecard
/openapi-specs/brainbase-openapi.documented.json put /api/echo/scorecards/{id}
# Create a new file resource
Source: https://docs.usebrainbase.com/api-reference/file-resources/create-a-new-file-resource
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/file
# Get all file resources for a worker
Source: https://docs.usebrainbase.com/api-reference/file-resources/get-all-file-resources-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/resources/file
# Commit a flow version
Source: https://docs.usebrainbase.com/api-reference/flow-versions/commit-a-flow-version
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/flows/{flowId}/versions
Creates a snapshot of the current flow code and variables as a new version
# Get a single flow version
Source: https://docs.usebrainbase.com/api-reference/flow-versions/get-a-single-flow-version
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/flows/{flowId}/versions/{versionId}
# List flow versions
Source: https://docs.usebrainbase.com/api-reference/flow-versions/list-flow-versions
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/flows/{flowId}/versions
Returns paginated list of versions for a flow, ordered by version number descending
# Create a new flow
Source: https://docs.usebrainbase.com/api-reference/flows/create-a-new-flow
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/flows
# Delete a flow
Source: https://docs.usebrainbase.com/api-reference/flows/delete-a-flow
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/flows/{flowId}
# Get a single flow
Source: https://docs.usebrainbase.com/api-reference/flows/get-a-single-flow
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/flows/{flowId}
# Get all flows for a worker
Source: https://docs.usebrainbase.com/api-reference/flows/get-all-flows-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/flows
# Retrieve a flow by ID
Source: https://docs.usebrainbase.com/api-reference/flows/retrieve-a-flow-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/flows/{flowId}
Fetches a single flow record by its ID, without requiring the worker ID. Supports the same `versionId` and `deploymentId` query parameters as the worker-scoped endpoint for version pinning and parameter merging.
# Update a flow
Source: https://docs.usebrainbase.com/api-reference/flows/update-a-flow
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/flows/{flowId}
# Create a new folder
Source: https://docs.usebrainbase.com/api-reference/folders/create-a-new-folder
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/folders
# Delete a folder
Source: https://docs.usebrainbase.com/api-reference/folders/delete-a-folder
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/folders/{folderId}
# Get a folder by ID
Source: https://docs.usebrainbase.com/api-reference/folders/get-a-folder-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/folders/{folderId}
# Get all folders for a worker
Source: https://docs.usebrainbase.com/api-reference/folders/get-all-folders-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/folders
# Get all resources in a folder
Source: https://docs.usebrainbase.com/api-reference/folders/get-all-resources-in-a-folder
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/folders/{folderId}/resources
# Update a folder
Source: https://docs.usebrainbase.com/api-reference/folders/update-a-folder
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/folders/{folderId}
# Create a new Twilio integration for the authenticated team.
Source: https://docs.usebrainbase.com/api-reference/integrations/create-a-new-twilio-integration-for-the-authenticated-team
/openapi-specs/brainbase-openapi.documented.json post /api/team/integrations/twilio/create
# Delete an existing Twilio integration.
Source: https://docs.usebrainbase.com/api-reference/integrations/delete-an-existing-twilio-integration
/openapi-specs/brainbase-openapi.documented.json delete /api/team/integrations/twilio/{integrationId}/delete
# Get a specific integration by ID.
Source: https://docs.usebrainbase.com/api-reference/integrations/get-a-specific-integration-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/team/integrations/{integrationId}
# Get all integrations for the authenticated team.
Source: https://docs.usebrainbase.com/api-reference/integrations/get-all-integrations-for-the-authenticated-team
/openapi-specs/brainbase-openapi.documented.json get /api/team/integrations
# Get Twilio subaccount credentials for the authenticated team.
Source: https://docs.usebrainbase.com/api-reference/integrations/get-twilio-subaccount-credentials-for-the-authenticated-team
/openapi-specs/brainbase-openapi.documented.json get /api/team/subaccount-credentials
Returns the team's Twilio subaccount SID and auth token. Used by workers for Brainbase-purchased phone numbers (integrationId is null).
# Update an existing integration's name and description.
Source: https://docs.usebrainbase.com/api-reference/integrations/update-an-existing-integrations-name-and-description
/openapi-specs/brainbase-openapi.documented.json patch /api/team/integrations/{integrationId}
# Create a new link resource
Source: https://docs.usebrainbase.com/api-reference/link-resources/create-a-new-link-resource
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/link
# Get all link resources for a worker
Source: https://docs.usebrainbase.com/api-reference/link-resources/get-all-link-resources-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/resources/link
# Delete all LLM logs for a specific call
Source: https://docs.usebrainbase.com/api-reference/llm-logs/delete-all-llm-logs-for-a-specific-call
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/llm-logs/by-call/{callId}
# Delete an LLM log
Source: https://docs.usebrainbase.com/api-reference/llm-logs/delete-an-llm-log
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/llm-logs/{logId}
# Get a specific LLM log
Source: https://docs.usebrainbase.com/api-reference/llm-logs/get-a-specific-llm-log
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/llm-logs/{logId}
# Get all LLM logs for a specific call
Source: https://docs.usebrainbase.com/api-reference/llm-logs/get-all-llm-logs-for-a-specific-call
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/llm-logs/by-call/{callId}
# Get all LLM logs for a specific session
Source: https://docs.usebrainbase.com/api-reference/llm-logs/get-all-llm-logs-for-a-specific-session
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/llm-logs/by-session/{sessionId}
# List LLM logs for a team
Source: https://docs.usebrainbase.com/api-reference/llm-logs/list-llm-logs-for-a-team
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/llm-logs
# Create a new log export job
Source: https://docs.usebrainbase.com/api-reference/log-exports/create-a-new-log-export-job
/openapi-specs/brainbase-openapi.documented.json post /api/team/exports
Queues an async export of deployment logs to CSV or JSON. The export is processed in the background and uploaded to S3. Poll GET /api/team/exports/{exportId} for status and download URL. Max one active export per team. Max 90-day date range.
# Get export status and download URL
Source: https://docs.usebrainbase.com/api-reference/log-exports/get-export-status-and-download-url
/openapi-specs/brainbase-openapi.documented.json get /api/team/exports/{exportId}
Poll the status of a log export. When status is COMPLETED, the response includes a presigned S3 download URL valid for 24 hours.
# List recent log exports
Source: https://docs.usebrainbase.com/api-reference/log-exports/list-recent-log-exports
/openapi-specs/brainbase-openapi.documented.json get /api/team/exports
Returns the 20 most recent log exports for the authenticated team.
# Retrieve a deployment log by ID
Source: https://docs.usebrainbase.com/api-reference/logs/retrieve-a-deployment-log-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/logs/{logId}
Fetches a single deployment log record by its ID, without requiring the worker or deployment ID. Works for all log types: Voice, Chat, ChatEmbed, Whatsapp, SMS, API, and Email. Delegate-specific fields (e.g. transcription for voice, messages for chat) are flattened into the response automatically.
# Create a new outbound campaign
Source: https://docs.usebrainbase.com/api-reference/outbound-campaigns/create-a-new-outbound-campaign
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns
# Delete an outbound campaign
Source: https://docs.usebrainbase.com/api-reference/outbound-campaigns/delete-an-outbound-campaign
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns/{campaignId}
# Get a specific outbound campaign by ID
Source: https://docs.usebrainbase.com/api-reference/outbound-campaigns/get-a-specific-outbound-campaign-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns/{campaignId}
# Get all outbound campaigns for a voice deployment
Source: https://docs.usebrainbase.com/api-reference/outbound-campaigns/get-all-outbound-campaigns-for-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns
# Update an outbound campaign
Source: https://docs.usebrainbase.com/api-reference/outbound-campaigns/update-an-outbound-campaign
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns/{campaignId}
# Receive logs from Portkey webhook
Source: https://docs.usebrainbase.com/api-reference/portkey/receive-logs-from-portkey-webhook
/openapi-specs/brainbase-openapi.documented.json post /portkey-logs
# Delete a resource (link or file)
Source: https://docs.usebrainbase.com/api-reference/resources/delete-a-resource-link-or-file
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/resources/{resourceId}
# Get a single resource (link or file) details
Source: https://docs.usebrainbase.com/api-reference/resources/get-a-single-resource-link-or-file-details
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/resources/{resourceId}
# Move a resource to a different folder
Source: https://docs.usebrainbase.com/api-reference/resources/move-a-resource-to-a-different-folder
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/{resourceId}/move
# Query RAG resources using vector search
Source: https://docs.usebrainbase.com/api-reference/resources/query-rag-resources-using-vector-search
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/query
# Get a specific runtime error
Source: https://docs.usebrainbase.com/api-reference/runtime-errors/get-a-specific-runtime-error
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/runtime-errors/{errorId}
# List runtime errors for a worker
Source: https://docs.usebrainbase.com/api-reference/runtime-errors/list-runtime-errors-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/runtime-errors
# Record a runtime error from the Based engine
Source: https://docs.usebrainbase.com/api-reference/runtime-errors/record-a-runtime-error-from-the-based-engine
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/runtime-errors
# Get session data for a specific session
Source: https://docs.usebrainbase.com/api-reference/sessions/get-session-data-for-a-specific-session
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/sessions/{sessionId}
# List SMS deployment logs for a worker
Source: https://docs.usebrainbase.com/api-reference/sms-deployment-logs/list-sms-deployment-logs-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/sms
# Retrieve a single SMS deployment log
Source: https://docs.usebrainbase.com/api-reference/sms-deployment-logs/retrieve-a-single-sms-deployment-log
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/sms/{logId}
# Assign a tag to a worker
Source: https://docs.usebrainbase.com/api-reference/tags/assign-a-tag-to-a-worker
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/tags
# Create a new tag
Source: https://docs.usebrainbase.com/api-reference/tags/create-a-new-tag
/openapi-specs/brainbase-openapi.documented.json post /api/team/tags
# Delete a tag
Source: https://docs.usebrainbase.com/api-reference/tags/delete-a-tag
/openapi-specs/brainbase-openapi.documented.json delete /api/team/tags/{tagId}
# List all tags for the team
Source: https://docs.usebrainbase.com/api-reference/tags/list-all-tags-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/team/tags
# List tags assigned to a worker
Source: https://docs.usebrainbase.com/api-reference/tags/list-tags-assigned-to-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/tags
# Remove a tag from a worker
Source: https://docs.usebrainbase.com/api-reference/tags/remove-a-tag-from-a-worker
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/tags/{tagId}
# Update a tag
Source: https://docs.usebrainbase.com/api-reference/tags/update-a-tag
/openapi-specs/brainbase-openapi.documented.json patch /api/team/tags/{tagId}
# Add a custom ElevenLabs voice for the team
Source: https://docs.usebrainbase.com/api-reference/team/add-a-custom-elevenlabs-voice-for-the-team
/openapi-specs/brainbase-openapi.documented.json post /api/team/customVoices
# Delete a custom voice
Source: https://docs.usebrainbase.com/api-reference/team/delete-a-custom-voice
/openapi-specs/brainbase-openapi.documented.json delete /api/team/customVoices/{id}
# Get all custom voices for the team
Source: https://docs.usebrainbase.com/api-reference/team/get-all-custom-voices-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/team/customVoices
# Get the team associated with the provided API key
Source: https://docs.usebrainbase.com/api-reference/team/get-the-team-associated-with-the-provided-api-key
/openapi-specs/brainbase-openapi.documented.json get /api/team
# Create new team phone hours
Source: https://docs.usebrainbase.com/api-reference/teamphonehours/create-new-team-phone-hours
/openapi-specs/brainbase-openapi.documented.json post /api/workers/team-phone-hours
# Delete team phone hours
Source: https://docs.usebrainbase.com/api-reference/teamphonehours/delete-team-phone-hours
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/team-phone-hours/{id}
# Get all team phone hours
Source: https://docs.usebrainbase.com/api-reference/teamphonehours/get-all-team-phone-hours
/openapi-specs/brainbase-openapi.documented.json get /api/workers/team-phone-hours
# Get team phone hours by ID
Source: https://docs.usebrainbase.com/api-reference/teamphonehours/get-team-phone-hours-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/team-phone-hours/{id}
# Update team phone hours
Source: https://docs.usebrainbase.com/api-reference/teamphonehours/update-team-phone-hours
/openapi-specs/brainbase-openapi.documented.json put /api/workers/team-phone-hours/{id}
# Create a new test
Source: https://docs.usebrainbase.com/api-reference/tests/create-a-new-test
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/tests
# Delete a test
Source: https://docs.usebrainbase.com/api-reference/tests/delete-a-test
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/tests/{testId}
# Get test runs for a specific test
Source: https://docs.usebrainbase.com/api-reference/tests/get-test-runs-for-a-specific-test
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/tests/{testId}/runs
# Run a test
Source: https://docs.usebrainbase.com/api-reference/tests/run-a-test
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/tests/{testId}/run
# Update a test
Source: https://docs.usebrainbase.com/api-reference/tests/update-a-test
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/tests/{testId}
# Get detailed voice deployment analysis with billing breakdown
Source: https://docs.usebrainbase.com/api-reference/voice-analysis/get-detailed-voice-deployment-analysis-with-billing-breakdown
/openapi-specs/brainbase-openapi.documented.json post /api/voice-analysis
# List voice deployment logs for a worker with optional filtering and pagination
Source: https://docs.usebrainbase.com/api-reference/voice-deployment-logs/list-voice-deployment-logs-for-a-worker-with-optional-filtering-and-pagination
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/voice
Retrieves voice deployment logs for the worker with pagination support. Optionally, logs can be filtered by deploymentId and/or flowId by providing corresponding query parameters.
# Retrieve a single voice deployment log record
Source: https://docs.usebrainbase.com/api-reference/voice-deployment-logs/retrieve-a-single-voice-deployment-log-record
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/voice/{logId}
# Create a new custom webhook for voice deployment
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/create-a-new-custom-webhook-for-voice-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks
# Create a new voice deployment
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/create-a-new-voice-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice
# Delete a custom webhook
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/delete-a-custom-webhook
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks/{webhookId}
# Delete a voice deployment
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/delete-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/voice/{deploymentId}
# Get a single voice deployment
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/get-a-single-voice-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voice/{deploymentId}
# Get a specific custom webhook
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/get-a-specific-custom-webhook
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks/{webhookId}
# Get all voice deployments for a worker
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/get-all-voice-deployments-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voice
# List custom webhooks for a deployment
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/list-custom-webhooks-for-a-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks
# Make batch calls for a voice deployment
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/make-batch-calls-for-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice/{deploymentId}/make-batch-calls
# Stop a specific campaign by removing its calls from the queue
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/stop-a-specific-campaign-by-removing-its-calls-from-the-queue
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice/{deploymentId}/stop-campaign
Removes all scheduled calls for a specific campaign from the Redis queue
# Stop batch calls for a voice deployment
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/stop-batch-calls-for-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice/{deploymentId}/stop-batch-calls
Removes all scheduled batch calls for the specified deployment from the queue and returns the removed items
# Update a custom webhook
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/update-a-custom-webhook
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks/{webhookId}
# Update a voice deployment
Source: https://docs.usebrainbase.com/api-reference/voice-deployments/update-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/voice/{deploymentId}
# Create a new campaign for a voice v1 deployment
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/create-a-new-campaign-for-a-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns
# Create a new voice v1 deployment
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/create-a-new-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voicev1
# Delete a voice v1 deployment
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/delete-a-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/voicev1/{deploymentId}
# Get a campaign by ID
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/get-a-campaign-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns/{campaignId}
# Get a single voice v1 deployment
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/get-a-single-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voicev1/{deploymentId}
# Get all voice v1 deployments for a worker
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/get-all-voice-v1-deployments-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voicev1
# Get specific campaign data by ID
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/get-specific-campaign-data-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns/{campaignId}/data/{dataId}
# Make batch calls for a voice v1 deployment
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/make-batch-calls-for-a-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voicev1/{deploymentId}/make-batch-calls
# Run a campaign with provided data
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/run-a-campaign-with-provided-data
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns/{campaignId}/run
# Update a voice v1 deployment
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/update-a-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/deployments/voicev1/{deploymentId}
# Update specific campaign data by ID
Source: https://docs.usebrainbase.com/api-reference/voice-v1-deployments/update-specific-campaign-data-by-id
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns/{campaignId}/data/{dataId}
# List WhatsApp deployment logs for a worker
Source: https://docs.usebrainbase.com/api-reference/whatsapp-deployment-logs/list-whatsapp-deployment-logs-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/whatsapp
# Retrieve a single WhatsApp deployment log
Source: https://docs.usebrainbase.com/api-reference/whatsapp-deployment-logs/retrieve-a-single-whatsapp-deployment-log
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/whatsapp/{logId}
# Create a new worker
Source: https://docs.usebrainbase.com/api-reference/workers/create-a-new-worker
/openapi-specs/brainbase-openapi.documented.json post /api/workers
# Delete a worker
Source: https://docs.usebrainbase.com/api-reference/workers/delete-a-worker
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{id}
# Get a single worker
Source: https://docs.usebrainbase.com/api-reference/workers/get-a-single-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{id}
# Get all workers for the team
Source: https://docs.usebrainbase.com/api-reference/workers/get-all-workers-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/workers
# Update a worker
Source: https://docs.usebrainbase.com/api-reference/workers/update-a-worker
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{id}
# Based Crash Course - Build Platform Agnostic Conversational Agents
Source: https://docs.usebrainbase.com/based-crash-course
# Based Crash Course
Welcome to the **Based Crash Course**! This guide introduces you to **Based**, a powerful, domain-specific programming language designed to build platform agnostic conversational agents. Deploy conversational workflows on chat, voice, email, SMS, and more with ease, enabling seamless data exchange and a unified user experience across platforms.
## What Is Based?
Based is a high-level AI instruction language crafted to design dynamic conversational agents that operate flawlessly across multiple communication channels. It provides developers with an elegant, high-level syntax to build interactive workflows quickly and reliably.
Key features of Based include:
* **Intuitive and Expressive Syntax:** Develop complex conversational logic with clarity and brevity.
* **Specialized Constructs:** Utilize built-in keywords like `talk`, `loop`, `until`, and `ask` to manage conversation flow and state effortlessly.
* **Cross-Platform Flexibility:** Create agents deployable on chat, voice, email, SMS, and more—all while sharing data seamlessly across channels.
## Core Conversation Flow Constructs
Based scripts use a trio of keywords to build interactive conversations:
1. **`talk`**: Sends a message or prompt to the user and waits for a response (or specify **False** as the second argument to wait for the user to send a message first).
2. **`loop`**: Begins a conversational block that allows for repeated prompting.
3. **`until`**: Specifies the condition under which the loop should end.
In practice, the `talk` keyword is not used in isolation. It is usually enclosed in a `loop`/`until` structure. This pattern keeps the conversation repeating until valid input is obtained.
**Example Usage:**
```python theme={null}
loop:
# Send a prompt to the user asking for their preferred contact method.
response = talk(
"Hi there! What's your preferred contact method (email, phone, or SMS)?",
True,
{"preferred_contact": "email"} // Example default value
)
until "User provides a valid contact method":
contactInfo = response.ask(
question="Extract and validate the contact method from the response.",
example={"preferred_contact": "email"}
)
# Validate the contact method; if invalid, the prompt repeats.
if contactInfo["preferred_contact"] not in ["email", "phone", "SMS"]:
print("Invalid contact method provided. Re-prompting...")
else:
print("Valid contact method received!")
```
## Core Language Constructs
### The `ask` Method
The `ask` method is used to extract structured data from a response. By providing an example object, you can ensure that the output is formatted predictably for further processing.
**Example:**
```python theme={null}
# Extract structured details (full name and email) from a user response.
userDetails = response.ask(
question="Return the user's full name and email address.",
example={"full_name": "John Doe", "email": "john.doe@example.com"}
)
```
## Tool Schema Until Conditions
Beyond string conditions, Based supports **tool schema until conditions** that extract structured parameters when a condition matches:
```python theme={null}
# Define a tool schema
get_appointment = {
"name": "get_appointment",
"description": "Book an appointment when user provides date and time",
"parameters": {
"type": "object",
"properties": {
"date": {"type": "string", "description": "Appointment date"},
"time": {"type": "string", "description": "Appointment time"}
},
"required": ["date", "time"]
}
}
# Use with parameter binding
loop:
response = talk("When would you like to schedule your appointment?", True)
until "user wants to cancel":
say("No problem, cancelled.")
until get_appointment as appointment:
# appointment contains: {"date": "...", "time": "..."}
say(f"Booked for {appointment['date']} at {appointment['time']}!", exact=True)
```
For full details, see [Tool Schema Until Conditions](/based-language-fundamentals#tool-schema-until-conditions).
## State Persistence
Variables persist across conversation turns using the `state` dictionary:
```python theme={null}
state = {}
# Store data during conversation
state["user_name"] = "John"
state["order_items"] = []
# Access later in the flow
say(f"Hello again, {state['user_name']}!", exact=True)
```
## Built-in Utilities
### Print Line Debugging
Use `print()` for debugging—outputs appear in the session trace:
```python theme={null}
print("Processing order...")
print(f"Order data: {order_data}")
```
### Sending SMS
Send SMS messages programmatically with `send_sms`:
```python theme={null}
result = await send_sms(
to="+12025551234",
content="Your order is confirmed!",
from_number="+15551234567" # From your phone library
)
if result.success:
say("Confirmation sent!", exact=True)
```
### HTTP Requests
Use the standard [requests](https://requests.readthedocs.io/) module for API calls:
```python theme={null}
response = requests.get(
url="https://api.example.com/users/123",
headers={"Authorization": "Bearer token"}
)
if response.ok:
user = response.json()
say(f"Found user: {user['name']}", exact=True)
# POST requests
response = requests.post(
url="https://api.example.com/orders",
headers={"Content-Type": "application/json"},
json={"items": order_items}
)
```
## Full Example: An Interactive Workflow
Below is a complete example that combines `talk`, `loop`, `until`, and `ask` to build a seamless interactive conversation:
```python theme={null}
state = {}
meta_prompt = "You're an assistant that helps the user book shifts."
res = say("Hello, I'm a chatbot. Let's start by gathering your details.")
loop:
# Initiate conversation to collect user details.
phone_response = talk(
f"{meta_prompt} Please provide your phone number, full name, and facility name. Confirm these details once provided.",
True,
{"phone_number": "+16179011508", "full_name": "John Doe", "facility_name": "Facility A"}
)
until "User has provided phone number, full name, and facility name and confirmed them":
# Extract the user details.
info = phone_response.ask(
question="Extract the user's phone number, full name, and facility name.",
example={"phone_number": "+16179011508", "full_name": "John Doe", "facility_name": "Facility A"}
)
# Verify details via API
response = requests.get(
url='https://apigateway.example.com/api/facilities',
headers={
'authorization': 'Bearer 123',
'cbh-facility-user-phone-number-auth': info["phone_number"]
}
)
answer_ = response.json().ask(
question="Verify the provided details. If successful, return the user's name, facility name, and email; otherwise, return 'ERROR'.",
example={"name": "John Doe", "facility_name": "Facility A", "email": "john.doe@example.com", "success": true}
)
print("Answer:", answer_)
if not answer_["success"]:
loop:
phone_response = talk("Sorry, we couldn't verify your details. Please re-enter your information.", True)
until "User confirms corrected details":
info = phone_response.ask(
question="Return the user's phone number, full name, and facility name.",
example={"phone_number": "+16179011508", "full_name": "John Doe", "facility_name": "Facility A"}
)
state["info"] = info
else:
print("Verification successful:", answer_)
```
## Voice Deployment Functions
When deploying Based agents for voice conversations, you have access to special functions for call control:
### `transfer(phone_number, options?)`
Transfers the current call to another phone number, with optional extension dialing support.
```python theme={null}
# Basic transfer
transfer("+1-800-123-4567")
# Transfer with extension (dials extension after call connects)
transfer("5302321272", "123")
# Transfer with extension and custom pause time
transfer("5302321272", {"extension": "123", "pauseSeconds": 2})
```
### `end_call()`
Ends the current call gracefully.
```python theme={null}
say("Thank you for calling. Goodbye!", exact=True)
end_call()
```
For more details on voice functions and their parameters, see the [Language Fundamentals](/based-language-fundamentals#voice-deployment-functions) guide.
## Additional Notes
* Based's design abstracts away complexity while providing powerful control over conversational flows.
* The constructs `loop`, `talk`, `until`, and `ask` empower you to design robust, interactive workflows.
* **Tool schema until conditions** enable structured parameter extraction directly from user intents.
* **State persistence** automatically maintains variables across conversation turns.
* **Print line debugging** helps troubleshoot flows via session traces.
* **HTTP requests** use the standard `requests` module for full API compatibility.
* **SMS sending** is available via `send_sms()` for notifications and confirmations.
* For voice deployments, use `transfer()` and `end_call()` to control call flow.
For comprehensive documentation on all constructs, see the [Language Fundamentals](/based-language-fundamentals) guide.
## Conclusion
Armed with these constructs, you can build dynamic, platform-agnostic conversational agents using Based. This guide has provided enhanced examples that showcase how to structure interactive conversations effectively. Happy coding!
# Webhooks
Source: https://docs.usebrainbase.com/docs/webhooks
# Webhooks
Webhooks allow your Brainbase agents to send real-time notifications to your systems when events occur. When a call ends or other events happen, Brainbase sends an HTTP POST request to your configured webhook endpoint with detailed information about the interaction.
## Webhook Payload Schema
When a webhook is triggered, your endpoint receives a POST request with the following JSON payload:
```typescript theme={null}
{
extractions: object,
call_type?: string,
from_number?: string,
to_number?: string,
direction?: string,
call_id: string,
agent_id?: string,
call_status?: string,
metadata?: object,
start_timestamp?: number,
end_timestamp?: number,
disconnection_reason?: string,
transcript?: string,
transcript_object?: array,
transcript_with_tool_calls?: array,
recording_url?: string,
api_logs?: ApiLogEntry[],
webhook_id: string,
log_id: string,
deployment_id: string,
raw_data: object,
log: object
}
```
***
## Extraction Results
The `extractions` object contains AI-extracted data based on your deployment's extraction configuration.
```typescript theme={null}
extractions: {
// Dynamic fields based on your deployment's extraction config
customer_name: "John Smith",
appointment_date: "2024-01-15",
interested: true,
// ... any fields you configured
}
```
The fields in `extractions` are entirely defined by your extraction configuration. You can extract any structured data from the conversation.
***
## Call Data
These fields contain information about the call itself, spread at the top level of the payload.
| Field | Type | Description |
| -------------------------------- | ------- | ------------------------------------------------- |
| `call_type` | string | Type of call (e.g., `"web_call"`, `"phone_call"`) |
| `from_number` | string | Caller's phone number |
| `to_number` | string | Called phone number |
| `direction` | string | `"inbound"` or `"outbound"` |
| `call_id` | string | External provider's call ID |
| `agent_id` | string | External agent ID |
| `call_status` | string | External provider status |
| `metadata` | object | Custom metadata from the call |
| `start_timestamp` | number | Unix timestamp in milliseconds |
| `end_timestamp` | number | Unix timestamp in milliseconds |
| `disconnection_reason` | string | Why the call ended |
| `recording_url` | string | URL to the call recording |
| `opt_out_sensitive_data_storage` | boolean | Whether sensitive data storage is opted out |
### Transcript Fields
| Field | Type | Description |
| ---------------------------- | ------ | ------------------------------------------- |
| `transcript` | string | Plain text transcript of the conversation |
| `transcript_object` | array | Structured transcript with roles and timing |
| `transcript_with_tool_calls` | array | Transcript including tool/function calls |
### External API Logs
For voice deployments that make external API calls, webhook payloads can include `api_logs` as a top-level field. This field is derived from the call trace and exposes request/response details in a reporting-friendly shape.
```typescript theme={null}
api_logs: [
{
event: "external_api_call",
timestamp: "2026-07-21T15:30:10.000Z",
details: {
url: "https://api.example.com/resource",
method: "POST",
payload: {},
headers: {
Authorization: "[REDACTED]"
},
has_auth: true,
trace_id: "trace_..."
}
},
{
event: "external_api_response",
timestamp: "2026-07-21T15:30:11.000Z",
details: {
url: "https://api.example.com/resource",
method: "POST",
status: 200,
success: true,
response: {},
duration_ms: 1234,
trace_id: "trace_..."
}
}
]
```
`api_logs` is included when API trace events are available for the call. Sensitive values in headers, request payloads, response payloads, URL query parameters, and URL fragments are redacted when their keys look like credentials, tokens, passwords, cookies, or secrets.
If you are retrieving the same data through the Logs Export API instead of webhook delivery, include `api_logs` in the export `fields` array. For voice logs, the `logType` value is `VoiceDeploymentLog`. Each exported log row includes `api_logs` as a top-level field when requested.
```json theme={null}
{
"format": "JSON",
"logType": "VoiceDeploymentLog",
"startDate": "2026-07-21T00:00:00.000Z",
"endDate": "2026-07-22T00:00:00.000Z",
"fields": ["id", "createdAt", "externalCallId", "api_logs"]
}
```
**Transcript Object Structure:**
```typescript theme={null}
transcript_object: [
{
role: "agent", // "agent" or "user"
content: "Hello, how can I help you today?",
words: [
{
word: "Hello",
start: 0.0, // Start time in seconds
end: 0.5 // End time in seconds
},
// ... more words
]
},
{
role: "user",
content: "I'd like to schedule an appointment.",
words: [...]
}
// ... more messages
]
```
***
## Metadata Fields
| Field | Type | Description |
| --------------- | ------ | --------------------------- |
| `webhook_id` | string | Your custom webhook's ID |
| `log_id` | string | Brainbase deployment log ID |
| `deployment_id` | string | Brainbase deployment ID |
***
## Raw Data
The `raw_data` object contains the original data from batch/outbound calls. This is your `outbound_data` that was passed when initiating the call.
```typescript theme={null}
raw_data: {
// Your original data from CSV or API
id: "row_123",
phoneNumber: "+15551234567",
firstName: "John",
lastName: "Smith",
email: "john@example.com",
customField1: "value1"
// ... any fields from your data source
}
```
For inbound calls, `raw_data` may be empty or contain minimal data. For outbound batch calls, this contains the full row data you provided.
***
## Full Log Object
The `log` object contains the complete `VoiceDeploymentLog` from the database with all session details.
```typescript theme={null}
log: {
// Identifiers
id: "log_abc123...",
workerId: string,
deploymentId: string,
flowId: string,
bbEngineSessionId: string,
externalCallId: string,
call_sid: string, // Twilio call SID
// Timestamps
createdAt: "2024-01-15T10:30:00Z",
updatedAt: "2024-01-15T10:35:00Z",
startTime: "2024-01-15T10:30:00Z",
endTime: "2024-01-15T10:35:00Z",
// Call details
direction: "inbound" | "outbound",
fromNumber: string,
toNumber: string,
status: "queued" | "ongoing" | "completed" | "failed",
duration: 300, // Duration in seconds
Telephony_source: "twilio",
// Content
transcription: string, // Plain text transcript
messages: [ // Structured transcript
{ role: "agent", content: "..." },
{ role: "user", content: "..." }
],
recordingUrl: string,
// Stored data
extractionsData: object, // Stored extraction results
metadata: object,
flowSnapshot: string, // Flow code at time of call
sessionLogData: object, // Session data from engine
// Nested data object
data: {
event: "call_ended",
call_ended: object, // Full call_ended event payload
outbound_data: {
// Same as raw_data
},
extraction: {
status: "processing" | "completed",
queuedAt: "2024-01-15T10:35:00Z"
}
}
}
```
### Log Status Values
| Status | Description |
| ----------- | --------------------------------------------- |
| `initiated` | Call has been initiated but not yet connected |
| `queued` | Call is queued but not yet started |
| `ongoing` | Call is currently in progress |
| `completed` | Call has ended successfully |
| `failed` | Call failed to complete |
| `voicemail` | Call went to voicemail |
***
## Example Payload
Here's a complete example of a webhook payload:
```json theme={null}
{
"extractions": {
"customer_name": "John Smith",
"appointment_confirmed": true,
"preferred_date": "2024-01-20",
"notes": "Prefers morning appointments"
},
"call_type": "phone_call",
"from_number": "+14154650216",
"to_number": "+14158738252",
"direction": "inbound",
"call_id": "call_abc123",
"call_status": "completed",
"start_timestamp": 1705312200000,
"end_timestamp": 1705312500000,
"disconnection_reason": "customer_ended_call",
"transcript": "Agent: Hello, how can I help you today?\nUser: I'd like to schedule an appointment...",
"recording_url": "https://storage.example.com/recordings/call_abc123.mp3",
"api_logs": [
{
"event": "external_api_call",
"timestamp": "2026-07-21T15:30:10.000Z",
"details": {
"url": "https://api.example.com/resource",
"method": "POST",
"payload": {},
"headers": {
"Authorization": "[REDACTED]"
},
"has_auth": true,
"trace_id": "trace_abc123"
}
},
{
"event": "external_api_response",
"timestamp": "2026-07-21T15:30:11.000Z",
"details": {
"url": "https://api.example.com/resource",
"method": "POST",
"status": 200,
"success": true,
"response": {},
"duration_ms": 1234,
"trace_id": "trace_abc123"
}
}
],
"webhook_id": "wh_xyz789",
"log_id": "log_def456",
"deployment_id": "deploy_a05e0b20-87ed-440b-9cd4-0427cc812c41",
"raw_data": {
"firstName": "John",
"lastName": "Smith",
"phoneNumber": "+14154650216",
"email": "john@example.com"
},
"log": {
"id": "log_def456",
"createdAt": "2024-01-15T10:30:00Z",
"status": "completed",
"duration": 300,
"direction": "inbound",
"fromNumber": "+14154650216",
"toNumber": "+14158738252"
}
}
```
***
## Handling Webhooks
When processing webhook payloads, we recommend:
1. **Validate the payload** - Check that required fields like `webhook_id` and `deployment_id` are present
2. **Respond quickly** - Return a 200 status code promptly; process data asynchronously if needed
3. **Handle duplicates** - Use `log_id` or `call_id` to deduplicate if your endpoint receives the same event twice
4. **Store raw payloads** - Consider logging the full payload for debugging purposes
```python theme={null}
# Example webhook handler (Python/Flask)
@app.route('/webhook', methods=['POST'])
def handle_webhook():
payload = request.json
# Extract key fields
extractions = payload.get('extractions', {})
log_id = payload.get('log_id')
direction = payload.get('direction')
# Process the data
if extractions.get('appointment_confirmed'):
schedule_appointment(
customer=extractions.get('customer_name'),
date=extractions.get('preferred_date')
)
return {'status': 'ok'}, 200
```
# Answer
Source: https://docs.usebrainbase.com/integrations/answer/actions/answer
Answer a question.
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | ---------------------------------------------------------------- |
| obj | JSON | Yes | The object to extract information from. |
| question | LONG\_TEXT | Yes | The question to answer. |
| model | SHORT\_TEXT | No | The model to use for the request. Defaults to gpt-3.5-turbo-16k. |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/answer/auth
This integration does not require authentication.
# GET Request
Source: https://docs.usebrainbase.com/integrations/api/actions/get_req
Send a GET request to an API endpoint.
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | ------------------------------------------------------- |
| url | SHORT\_TEXT | Yes | The URL of the API endpoint to send the GET request to. |
| params | OBJECT | No | The query parameters to include in the GET request. |
| headers | OBJECT | No | The headers to include in the GET request. |
## Sample Output
```json theme={null}
{
"response": "Sample response"
}
```
# POST Request
Source: https://docs.usebrainbase.com/integrations/api/actions/post_req
Send a POST request to an API endpoint.
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | -------------------------------------------------------- |
| url | SHORT\_TEXT | Yes | The URL of the API endpoint to send the POST request to. |
| data | OBJECT | Yes | The JSON data to send in the POST request. |
| headers | OBJECT | No | The headers to include in the POST request. |
## Sample Output
```json theme={null}
{
"response": "Sample response"
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/api/auth
This integration does not require authentication.
# Form Fill In
Source: https://docs.usebrainbase.com/integrations/brainbase_forms/actions/fill_in
Fill in a form with data.
## Input
| Property | Type | Required | Description |
| -------------- | ----------- | -------- | -------------------------------------- |
| data | JSON | Yes | The data to be filled in the form. |
| formTemplateId | SHORT\_TEXT | Yes | The ID of the Brainbase form template. |
| fontSize | NUMBER | No | The font size for the text. |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/brainbase_forms/auth
This integration does not require authentication.
# Delete Row
Source: https://docs.usebrainbase.com/integrations/brainbase_table/actions/delete_row
Deletes one or more rows from a table
## Input
| Property | Type | Required | Description |
| -------------- | ----------- | -------- | ------------------------------------ |
| timezone | SHORT\_TEXT | No | Timezone for the mysql server to use |
| table | DROPDOWN | Yes | The name of the table |
| search\_column | SHORT\_TEXT | Yes | - |
| search\_value | SHORT\_TEXT | Yes | - |
## Sample Output
```json theme={null}
{}
```
# Execute Query
Source: https://docs.usebrainbase.com/integrations/brainbase_table/actions/execute_query
Executes a query on the mysql database and returns the results
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | ------------------------------------------------ |
| timezone | SHORT\_TEXT | No | Timezone for the mysql server to use |
| query | SHORT\_TEXT | Yes | The query string to execute, use ? for arguments |
| args | ARRAY | No | Can inserted in the query string using ? |
## Sample Output
```json theme={null}
{}
```
# Find Rows
Source: https://docs.usebrainbase.com/integrations/brainbase_table/actions/find_rows
Reads rows from a table
## Input
| Property | Type | Required | Description |
| --------- | ----------- | -------- | ----------------------------------------------------- |
| timezone | SHORT\_TEXT | No | Timezone for the mysql server to use |
| table | DROPDOWN | Yes | The name of the table |
| condition | SHORT\_TEXT | Yes | SQL condition, can also include logic operators, etc. |
| args | ARRAY | No | Arguments can be used using ? in the condition |
| columns | ARRAY | No | Specify the columns you want to select |
## Sample Output
```json theme={null}
{}
```
# Get Tables
Source: https://docs.usebrainbase.com/integrations/brainbase_table/actions/get_tables
Returns a list of tables in the database
## Input
| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |
## Sample Output
```json theme={null}
{}
```
# Insert Row
Source: https://docs.usebrainbase.com/integrations/brainbase_table/actions/insert_row
Inserts a new row into a table
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | ------------------------------------ |
| timezone | SHORT\_TEXT | No | Timezone for the mysql server to use |
| table | DROPDOWN | Yes | The name of the table |
| values | OBJECT | Yes | Values to be inserted into the row |
## Sample Output
```json theme={null}
{}
```
# Update Row
Source: https://docs.usebrainbase.com/integrations/brainbase_table/actions/update_row
Updates one or more rows in a table
## Input
| Property | Type | Required | Description |
| -------------- | ----------- | -------- | ------------------------------------ |
| timezone | SHORT\_TEXT | No | Timezone for the mysql server to use |
| table | DROPDOWN | Yes | The name of the table |
| values | OBJECT | Yes | Values to be updated |
| search\_column | SHORT\_TEXT | Yes | - |
| search\_value | SHORT\_TEXT | Yes | - |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/brainbase_table/auth
This integration does not require authentication.
# Go back
Source: https://docs.usebrainbase.com/integrations/browser/actions/back
Go back to previous page
## Input
| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |
## Sample Output
```json theme={null}
{
"success": true,
"page_content": "
...
..."
}
```
# Click on component
Source: https://docs.usebrainbase.com/integrations/browser/actions/click
Click on a component on the screen.
## Input
| Property | Type | Required | Description |
| ----------- | ----------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| xpath | SHORT\_TEXT | Yes | The XPath of the component to click on. |
| instruction | SHORT\_TEXT | Yes | What is this action for? A wholistic and detailed description of what is the command for taking this action. If the action is in a loop, make sure to say its the xth row, or item, etc. (e.g. "Click on the search bar", "Type a greeting message into the body input box" , "Click the button to send the message on the side panel", "Click on the member in the list of members") |
## Sample Output
```json theme={null}
{
"success": true,
"page_content": "...
..."
}
```
# Go to link
Source: https://docs.usebrainbase.com/integrations/browser/actions/goto
Go to given url
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | ------------ |
| url | SHORT\_TEXT | Yes | URL to go to |
## Sample Output
```json theme={null}
{
"success": true,
"page_content": "...
..."
}
```
# Input text on component
Source: https://docs.usebrainbase.com/integrations/browser/actions/input
Input text on a component on the screen.
## Input
| Property | Type | Required | Description |
| ----------- | ----------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| xpath | SHORT\_TEXT | Yes | The XPath of the component to Input on. |
| text | LONG\_TEXT | Yes | The text to Input. |
| instruction | SHORT\_TEXT | Yes | What is this action for? A wholistic and detailed description of what is the command for taking this action. If the action is in a loop, make sure to say its the xth row, or item, etc. (e.g. "Click on the search bar", "Type a greeting message into the body input box" , "Click the button to send the message on the side panel", "Click on the member in the list of members") |
## Sample Output
```json theme={null}
{
"success": true,
"page_content": "...
..."
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/browser/auth
This integration does not require authentication.
# Run code
Source: https://docs.usebrainbase.com/integrations/code/actions/run
Run code.
## Input
| Property | Type | Required | Description |
| --------------- | ---------- | -------- | -------------------------------- |
| globalVariables | LONG\_TEXT | Yes | The dictionary of all variables. |
| code | LONG\_TEXT | Yes | The code to be executed. |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/code/auth
This integration does not require authentication.
# Extract information
Source: https://docs.usebrainbase.com/integrations/extract/actions/extract
Extract information from text.
## Input
| Property | Type | Required | Description |
| ------------ | ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| text | LONG\_TEXT | Yes | The text from which the information needs to be extracted. |
| titles | SHORT\_TEXT | Yes | Titles for the information to be extracted, separated by commas. For example, "Name, Interest in position, Job experience"." |
| descriptions | SHORT\_TEXT | Yes | Descriptions for the information to be extracted, separated by commas. For example, "The name of the person on the page, The person's interest in the position from 1 (least) to 5 (most), The person's last companies in bullet point list". |
| enums | SHORT\_TEXT | Yes | Enums for the information to be extracted, separated by commas. For example, "1, 2, 3, 4, 5, 6, 7, 8, 9, 10". |
| temperature | NUMBER | No | The temperature of the model. Higher values mean the model will take more risks. Try 0.9 for more creative applications, and 0 (default) for ones with a well-defined answer. |
| model | SHORT\_TEXT | No | The model to use for the request. Defaults to gpt-3.5-turbo-16k. |
## Sample Output
```json theme={null}
{}
```
# Extract information
Source: https://docs.usebrainbase.com/integrations/extract/actions/extract_from_features
Extract information from text.
## Input
| Property | Type | Required | Description |
| ----------------- | ----------- | -------- | ---------------------------------------------------------------- |
| obj | JSON | Yes | The object to extract information from. |
| features | ARRAY | Yes | The features to extract. |
| featuresToExtract | ARRAY | No | The features to extract. |
| featuresToLookAt | ARRAY | No | The features to look at. |
| model | SHORT\_TEXT | No | The model to use for the request. Defaults to gpt-3.5-turbo-16k. |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/extract/auth
This integration does not require authentication.
# Save File
Source: https://docs.usebrainbase.com/integrations/file/actions/save_file
Save a file to the file system.
## Input
| Property | Type | Required | Description |
| --------- | ---------------- | -------- | -------------------------------------------------------------------------------------- |
| name | SHORT\_TEXT | Yes | The name of the file to save. |
| content | LONG\_TEXT | Yes | The content of the file to save. (x, y, z, etc. for csv), (x y z. etc. for text), etc. |
| extension | STATIC\_DROPDOWN | Yes | The extension of the file to save. |
## Sample Output
```json theme={null}
{
"filePath": "test_file.txt"
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/file/auth
This integration does not require authentication.
# Find Email
Source: https://docs.usebrainbase.com/integrations/gmail/actions/gmail_search_mail
Find for an email in your Gmail account
## Input
| Property | Type | Required | Description |
| ----------- | ---------------- | -------- | ---------------------------------- |
| subject | SHORT\_TEXT | No | The email subject |
| fromAddress | SHORT\_TEXT | No | The address sending the new mail |
| to | SHORT\_TEXT | No | The address receiving the new mail |
| label | DROPDOWN | No | The label tagged to the mail |
| category | STATIC\_DROPDOWN | No | category of the mail |
## Sample Output
```json theme={null}
[
{
"messages": [
{
"thread": {
"id": "382baac18543beg8",
"historyId": "183baac185",
"messages": [
{
"id": "183baac18543bef8",
"threadId": "382baac18543beg8",
"labelIds": [
"UNREAD",
"CATEGORY_SOCIAL",
"INBOX"
],
"snippet": "",
"payload": {
"partId": "",
"mimeType": "multipart/alternative",
"filename": "",
"headers": [
[
null
]
],
"body": {
"size": 0
},
"parts": [
[
null
]
]
},
"sizeEstimate": 107643,
"historyId": "99742",
"internalDate": "1665284181000"
}
]
},
"message": {
"id": "183baac18543bef8",
"threadId": "382baac18543beg8",
"labelIds": [
"UNREAD",
"CATEGORY_SOCIAL",
"INBOX"
],
"snippet": "",
"payload": {
"partId": "",
"mimeType": "multipart/alternative",
"filename": "",
"headers": [
[
null
]
],
"body": {
"size": 0
},
"parts": [
[
null
]
]
},
"sizeEstimate": 107643,
"historyId": "99742",
"internalDate": "1665284181000"
}
}
],
"resultSizeEstimate": 1
}
]
```
# Send Email
Source: https://docs.usebrainbase.com/integrations/gmail/actions/send_email
Send an email through a Gmail account
## Input
| Property | Type | Required | Description |
| ---------- | ----------- | -------- | ------------------------------------------------------------------------ |
| receiver | SHORT\_TEXT | Yes | Email address of the receiver, or multiple addresses separated by commas |
| subject | SHORT\_TEXT | Yes | - |
| body\_text | SHORT\_TEXT | Yes | Text version of the body for the email you want to send |
| reply\_to | ARRAY | No | Email address to set as the "Reply-To" header |
| body\_html | SHORT\_TEXT | No | HTML version of the body for the email you want to send |
| attachment | FILE | No | File to attach to the email you want to send |
## Sample Output
```json theme={null}
{
"status": 200,
"headers": {
"content-type": "application/json; charset=UTF-8",
"vary": "Origin, X-Origin, Referer",
"date": "Mon, 17 Jul 2023 08:34:57 GMT",
"server": "ESF",
"cache-control": "private",
"x-xss-protection": "0",
"x-frame-options": "SAMEORIGIN",
"x-content-type-options": "nosniff",
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"connection": "close",
"transfer-encoding": "chunked"
},
"body": {
"id": "17862bf0653c7e4f",
"threadId": "17862bf0653c7e4f",
"labelIds": [
"SENT"
]
}
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/gmail/auth
| Property | Value |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Display Name | Gmail |
| Required | Yes |
| Type | OAUTH2 |
| Authentication URL | [https://accounts.google.com/o/oauth2/auth?access\_type=offline\&prompt=consent](https://accounts.google.com/o/oauth2/auth?access_type=offline\&prompt=consent) |
| Token URL | [https://oauth2.googleapis.com/token](https://oauth2.googleapis.com/token) |
| Scope | [https://www.googleapis.com/auth/gmail.modify](https://www.googleapis.com/auth/gmail.modify) |
# New Email
Source: https://docs.usebrainbase.com/integrations/gmail/triggers/gmail_new_email_received
Triggers when new mail is found in your Gmail inbox
## Input
| Property | Type | Required | Description |
| ----------- | ---------------- | -------- | ---------------------------------- |
| subject | SHORT\_TEXT | No | The email subject |
| fromAddress | SHORT\_TEXT | No | The address sending the new mail |
| to | SHORT\_TEXT | No | The address receiving the new mail |
| label | DROPDOWN | No | The label tagged to the mail |
| category | STATIC\_DROPDOWN | No | category of the mail |
## Sample Output
```json theme={null}
{
"message": {
"id": "183baac18543bef8",
"threadId": "183baac18543bef8",
"labelIds": [
"UNREAD",
"CATEGORY_SOCIAL",
"INBOX"
],
"snippet": "",
"payload": {
"partId": "",
"mimeType": "multipart/alternative",
"filename": "",
"body": {
"size": 0
}
},
"sizeEstimate": 107643,
"historyId": "99742",
"internalDate": "1665284181000"
},
"body_html": "Hello World
",
"body_plain": "Hello World",
"subject": "Hello World",
"thread": {
"id": "382baac18543beg8",
"historyId": "183baac185",
"messages": [
{
"id": "183baac18543bef8",
"threadId": "382baac18543beg8",
"labelIds": [
"UNREAD",
"CATEGORY_SOCIAL",
"INBOX"
],
"snippet": "",
"payload": {
"partId": "",
"mimeType": "multipart/alternative",
"filename": "",
"body": {
"size": 0
}
},
"sizeEstimate": 107643,
"historyId": "99742",
"internalDate": "1665284181000"
}
]
}
}
```
# Update Event
Source: https://docs.usebrainbase.com/integrations/google_calendar/actions/update_event
Updates an event in Google Calendar.
## Input
| Property | Type | Required | Description |
| ----------------- | ----------- | -------- | ----------- |
| calendar\_id | SHORT\_TEXT | Yes | - |
| eventId | SHORT\_TEXT | Yes | - |
| title | SHORT\_TEXT | No | - |
| start\_date\_time | DATE\_TIME | No | - |
| end\_date\_time | DATE\_TIME | No | - |
| summary | LONG\_TEXT | No | - |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/google_calendar/auth
| Property | Value |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Display Name | Google Calendar |
| Required | Yes |
| Type | OAUTH2 |
| Authentication URL | [https://accounts.google.com/o/oauth2/auth?access\_type=offline\&prompt=consent](https://accounts.google.com/o/oauth2/auth?access_type=offline\&prompt=consent) |
| Token URL | [https://oauth2.googleapis.com/token](https://oauth2.googleapis.com/token) |
| Scope | [https://www.googleapis.com/auth/calendar.events](https://www.googleapis.com/auth/calendar.events), [https://www.googleapis.com/auth/calendar.readonly](https://www.googleapis.com/auth/calendar.readonly) |
# New or Updated Event
Source: https://docs.usebrainbase.com/integrations/google_calendar/triggers/new_or_updated_event
Triggers when an event is added or updated
## Input
| Property | Type | Required | Description |
| ------------ | ----------- | -------- | --------------------------------- |
| calendar\_id | SHORT\_TEXT | Yes | The calendar to watch for changes |
## Sample Output
```json theme={null}
{
"kind": "calendar#event",
"etag": "3350849506974000",
"id": "0nsfi5ttd2b17ac76ma2f37oi9",
"htmlLink": "https://www.google.com/calendar/event?eid=kgjb90uioj4klrgfmdsnjsjvlgkm",
"summary": "ap-event-test",
"created": "2023-02-03T11:36:36.000Z",
"updated": "2023-02-03T11:45:53.487Z",
"description": "Sample description",
"status": "canceled",
"creator": {
"email": "test@test.com",
"self": true
},
"organizer": {
"email": "test@test.com",
"self": true
},
"start": {
"dateTime": "2023-02-02T22:30:00+03:00",
"timeZone": "Asia/Amman"
},
"end": {
"dateTime": "2023-02-02T23:30:00+03:00",
"timeZone": "Asia/Amman"
},
"transparency": "transparent",
"iCalUID": "0nsfi5ttd2b17ac76ma2f37oi9@google.com",
"sequence": 1,
"attendees": [
{
"email": "attende@test.com",
"responseStatus": "needsAction"
},
{
"email": "test@test.com",
"organizer": true,
"self": true,
"responseStatus": "accepted"
}
],
"reminders": {
"useDefault": true
},
"eventType": "default"
}
```
# Add Contact
Source: https://docs.usebrainbase.com/integrations/google_contacts/actions/add_contact
Add a contact to a Google Contacts account
## Input
| Property | Type | Required | Description |
| ----------- | ----------- | -------- | -------------------------------- |
| firstName | SHORT\_TEXT | Yes | The first name of the contact |
| middleName | SHORT\_TEXT | No | The middle name of the contact |
| lastName | SHORT\_TEXT | Yes | The last name of the contact |
| jobTitle | SHORT\_TEXT | No | The job title of the contact |
| company | SHORT\_TEXT | No | The company of the contact |
| email | SHORT\_TEXT | No | The email address of the contact |
| phoneNumber | SHORT\_TEXT | No | The phone number of the contact |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/google_contacts/auth
| Property | Value |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Display Name | Google Contacts |
| Required | Yes |
| Type | OAUTH2 |
| Authentication URL | [https://accounts.google.com/o/oauth2/auth?access\_type=offline\&prompt=consent](https://accounts.google.com/o/oauth2/auth?access_type=offline\&prompt=consent) |
| Token URL | [https://oauth2.googleapis.com/token](https://oauth2.googleapis.com/token) |
| Scope | [https://www.googleapis.com/auth/contacts](https://www.googleapis.com/auth/contacts) |
# New Or Updated Contact
Source: https://docs.usebrainbase.com/integrations/google_contacts/triggers/new_or_updated_contact
Triggers when there is a new or updated contact
## Input
| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |
## Sample Output
```json theme={null}
{
"resourceName": "people/c4278485694217203807",
"etag": "%EiMBAgMFBgcICQoLDA0ODxATFBUWGSEiIyQlJicuNDU3PT4/QBoEAQIFByIMZFVwNlJPNEVKUzg9",
"metadata": {
"sources": [
{
"type": "CONTACT",
"id": "3b603c120c68305f",
"etag": "#dUp6RO4EJS8=",
"updateTime": "2023-01-30T14:35:18.142565Z"
}
],
"objectType": "PERSON"
},
"names": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "3b603c120c68305f"
}
},
"displayName": "Shahed Mashni",
"familyName": "Mashni",
"givenName": "Shahed",
"displayNameLastFirst": "Mashni, Shahed",
"unstructuredName": "Shahed Mashni"
}
],
"photos": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "3b603c120c68305f"
}
},
"url": "https://lh3.googleusercontent.com/cm/AAkddurmZojs4vCcxrpkfSxH9tnqcH-hI82ESDnwv6eq86nZeLStcjYEIe_TCx8r8g5Y=s100",
"default": true
}
],
"memberships": [
{
"metadata": {
"source": {
"type": "CONTACT",
"id": "3b603c120c68305f"
}
},
"contactGroupMembership": {
"contactGroupId": "myContacts",
"contactGroupResourceName": "contactGroups/myContacts"
}
}
]
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/google_forms/auth
| Property | Value |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Display Name | Google Forms |
| Required | Yes |
| Type | OAUTH2 |
| Authentication URL | [https://accounts.google.com/o/oauth2/auth?access\_type=offline\&prompt=consent](https://accounts.google.com/o/oauth2/auth?access_type=offline\&prompt=consent) |
| Token URL | [https://oauth2.googleapis.com/token](https://oauth2.googleapis.com/token) |
| Scope | [https://www.googleapis.com/auth/forms.responses.readonly](https://www.googleapis.com/auth/forms.responses.readonly), [https://www.googleapis.com/auth/drive.readonly](https://www.googleapis.com/auth/drive.readonly) |
# New Response
Source: https://docs.usebrainbase.com/integrations/google_forms/triggers/new_response
Triggers when there is new response
## Input
| Property | Type | Required | Description |
| -------- | -------- | -------- | ----------- |
| form\_id | DROPDOWN | Yes | - |
## Sample Output
```json theme={null}
{
"responseId": "ACYDBNhZI4SENjOwT4QIcXOhgco3JhuLftjpLspxETYljVZofOWuqH7bxKQqJWDwGw2IFqE",
"createTime": "2023-04-01T03:19:28.889Z",
"lastSubmittedTime": "2023-04-01T03:19:28.889881Z",
"answers": {
"5bdc4001": {
"questionId": "5bdc4001",
"textAnswers": {
"answers": [
{
"value": "test"
}
]
}
},
"283d759e": {
"questionId": "283d759e",
"textAnswers": {
"answers": [
{
"value": "نعم"
}
]
}
},
"46f3e9cf": {
"questionId": "46f3e9cf",
"textAnswers": {
"answers": [
{
"value": "test"
}
]
}
}
}
}
```
# Google Search
Source: https://docs.usebrainbase.com/integrations/google_search/actions/search
Search for the top results on Google given the query.
## Input
| Property | Type | Required | Description |
| -------- | ---------------- | -------- | ---------------------------------- |
| query | SHORT\_TEXT | Yes | The query to search for on Google. |
| type | STATIC\_DROPDOWN | No | The type of search to perform. |
## Sample Output
```json theme={null}
{
"resultObject": {
"results": []
},
"resultText": "This is the textified search object."
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/google_search/auth
This integration does not require authentication.
# Clear Sheet
Source: https://docs.usebrainbase.com/integrations/google_sheets/actions/clear_sheet
Clears all rows on an existing sheet
## Input
| Property | Type | Required | Description |
| ----------------------- | -------- | -------- | ------------------------------------------------------------------------ |
| spreadsheet\_id | DROPDOWN | Yes | - |
| include\_team\_drives | CHECKBOX | Yes | Determines if sheets from Team Drives should be included in the results. |
| sheet\_id | DROPDOWN | Yes | - |
| is\_first\_row\_headers | CHECKBOX | Yes | If the first row is headers |
## Sample Output
```json theme={null}
{}
```
# Delete Row
Source: https://docs.usebrainbase.com/integrations/google_sheets/actions/delete_row
Delete a row on an existing sheet you have access to
## Input
| Property | Type | Required | Description |
| --------------------- | -------- | -------- | ------------------------------------------------------------------------ |
| spreadsheet\_id | DROPDOWN | Yes | - |
| include\_team\_drives | CHECKBOX | Yes | Determines if sheets from Team Drives should be included in the results. |
| sheet\_id | DROPDOWN | Yes | - |
| row\_id | NUMBER | Yes | The row number to remove |
## Sample Output
```json theme={null}
{}
```
# Find Rows
Source: https://docs.usebrainbase.com/integrations/google_sheets/actions/find_rows
Find rows in a Google Sheet
## Input
| Property | Type | Required | Description |
| --------------------- | ----------- | -------- | ------------------------------------------------------------------------ |
| spreadsheet\_id | DROPDOWN | Yes | - |
| include\_team\_drives | CHECKBOX | Yes | Determines if sheets from Team Drives should be included in the results. |
| sheet\_id | DROPDOWN | Yes | - |
| column\_name | DROPDOWN | Yes | Column Name |
| search\_value | SHORT\_TEXT | Yes | The value to search for |
## Sample Output
```json theme={null}
{}
```
# Insert Row
Source: https://docs.usebrainbase.com/integrations/google_sheets/actions/insert_row
Append a row of values to an existing sheet
## Input
| Property | Type | Required | Description |
| --------------------- | -------- | -------- | -------------------------------------------------------------------------------------- |
| spreadsheet\_id | DROPDOWN | Yes | - |
| include\_team\_drives | CHECKBOX | Yes | Determines if sheets from Team Drives should be included in the results. |
| sheet\_id | DROPDOWN | Yes | - |
| as\_string | CHECKBOX | No | Inserted values that are dates and formulas will be entered strings and have no effect |
| first\_row\_headers | CHECKBOX | Yes | If the first row is headers |
| values | DYNAMIC | Yes | The values to insert |
## Sample Output
```json theme={null}
{}
```
# Update Row
Source: https://docs.usebrainbase.com/integrations/google_sheets/actions/update_row
Overwrite values in an existing row
## Input
| Property | Type | Required | Description |
| --------------------- | -------- | -------- | ------------------------------------------------------------------------ |
| spreadsheet\_id | DROPDOWN | Yes | - |
| include\_team\_drives | CHECKBOX | Yes | Determines if sheets from Team Drives should be included in the results. |
| sheet\_id | DROPDOWN | Yes | - |
| row\_id | NUMBER | Yes | The row number to update |
| first\_row\_headers | CHECKBOX | Yes | If the first row is headers |
| values | DYNAMIC | Yes | The values to insert |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/google_sheets/auth
| Property | Value |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Display Name | Google Sheets |
| Required | Yes |
| Type | OAUTH2 |
| Authentication URL | [https://accounts.google.com/o/oauth2/auth?access\_type=offline\&prompt=consent](https://accounts.google.com/o/oauth2/auth?access_type=offline\&prompt=consent) |
| Token URL | [https://oauth2.googleapis.com/token](https://oauth2.googleapis.com/token) |
| Scope | [https://www.googleapis.com/auth/spreadsheets](https://www.googleapis.com/auth/spreadsheets), [https://www.googleapis.com/auth/drive.readonly](https://www.googleapis.com/auth/drive.readonly) |
# New Row
Source: https://docs.usebrainbase.com/integrations/google_sheets/triggers/new_row
Trigger when a new row is added, and it can include existing rows as well.
## Input
| Property | Type | Required | Description |
| --------------------- | -------- | -------- | --------------------------------------------------------------------------- |
| spreadsheet\_id | DROPDOWN | Yes | - |
| include\_team\_drives | CHECKBOX | Yes | Determines if sheets from Team Drives should be included in the results. |
| sheet\_id | DROPDOWN | Yes | - |
| max\_rows\_to\_poll | NUMBER | No | The maximum number of rows to poll, the rest will be polled on the next run |
## Sample Output
```json theme={null}
{}
```
# Read text from a link
Source: https://docs.usebrainbase.com/integrations/link/actions/read_link
Read the text content from a link.
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | ------------------------------ |
| link | SHORT\_TEXT | Yes | The URL to read the text from. |
## Sample Output
```json theme={null}
{
"text": "In this essay, I will be..."
}
```
# Read text from a link using vision
Source: https://docs.usebrainbase.com/integrations/link/actions/read_link_vision
Read the text content from a link (vision).
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | ---------------------------------- |
| link | SHORT\_TEXT | Yes | The URL to read the text from. |
| schema | LONG\_TEXT | Yes | The schema to use for the request. |
## Sample Output
```json theme={null}
{
"text": "In this essay, I will be..."
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/link/auth
This integration does not require authentication.
# Get Own Profile
Source: https://docs.usebrainbase.com/integrations/linkedin/actions/get_own_profile
Get own profile
## Input
| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |
## Sample Output
```json theme={null}
{}
```
# Search People on LinkedIn
Source: https://docs.usebrainbase.com/integrations/linkedin/actions/search_people
Search people on LinkedIn
## Input
| Property | Type | Required | Description |
| ----------------- | ------------------------------- | -------- | ------------------------------------ |
| keywords | SHORT\_TEXT | No | Keywords to search for |
| keywordsFirstName | SHORT\_TEXT | No | Keywords to search for in first name |
| keywordsLastName | SHORT\_TEXT | No | Keywords to search for in last name |
| keywordsTitle | SHORT\_TEXT | No | Keywords to search for in title |
| keywordsCompany | SHORT\_TEXT | No | Keywords to search for in company |
| keywordsSchool | SHORT\_TEXT | No | Keywords to search for in school |
| networkDepths | STATIC\_MULTI\_SELECT\_DROPDOWN | No | Depth of connection |
| limit | NUMBER | No | Limit |
## Sample Output
```json theme={null}
{}
```
# Send Invite
Source: https://docs.usebrainbase.com/integrations/linkedin/actions/send_invite
Send an invite to a LinkedIn user
## Input
| Property | Type | Required | Description |
| --------- | ----------- | -------- | ------------------------------- |
| profileId | SHORT\_TEXT | Yes | The profile ID of the user |
| message | SHORT\_TEXT | No | The message to send to the user |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/linkedin/auth
| Property | Value |
| ---------------------- | ----------------- |
| Display Name | LinkedIn |
| Required | Yes |
| Type | CUSTOM\_AUTH |
| JSESSIONID Description | JSESSIONID cookie |
| li\_at Description | li\_at cookie |
# Mapping
Source: https://docs.usebrainbase.com/integrations/mapping/actions/mapping
Mapping information.
## Input
| Property | Type | Required | Description |
| -------- | ---------- | -------- | -------------------------------------- |
| mapping | LONG\_TEXT | Yes | The mapping dictionary in JSON format. |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/mapping/auth
This integration does not require authentication.
# Create Item
Source: https://docs.usebrainbase.com/integrations/monday/actions/monday_create_an_item
Create a new item inside a board.
## Input
| Property | Type | Required | Description |
| --------------------------- | ----------- | -------- | ----------------------------------------------------------------------------------------------------------- |
| workspace\_id | DROPDOWN | Yes | The workspace's unique identifier. |
| board\_id | DROPDOWN | Yes | The board's unique identifier. |
| group\_id | DROPDOWN | No | Board Group |
| item\_name | SHORT\_TEXT | Yes | Item Name |
| column\_values | OBJECT | No | The column values of the new item. |
| create\_labels\_if\_missing | CHECKBOX | No | Creates status/dropdown labels if they are missing. This requires permission to change the board structure. |
## Sample Output
```json theme={null}
{
"data": {
"create_item": {
"id": "1175651821"
}
},
"account_id": 16284131
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/monday/auth
| Property | Value |
| ------------------ | ------------------------------------------------------------------------------------ |
| Display Name | Monday |
| Required | Yes |
| Type | OAUTH2 |
| Authentication URL | [https://auth.monday.com/oauth2/authorize](https://auth.monday.com/oauth2/authorize) |
| Token URL | [https://auth.monday.com/oauth2/token](https://auth.monday.com/oauth2/token) |
| Scope | workspaces:read, boards:read, boards:write, updates:read, updates:write |
# New Item Created
Source: https://docs.usebrainbase.com/integrations/monday/triggers/monday_item_created
Triggered when a new item is created
## Input
| Property | Type | Required | Description |
| ------------- | -------- | -------- | ---------------------------------- |
| workspace\_id | DROPDOWN | Yes | The workspace's unique identifier. |
| board\_id | DROPDOWN | Yes | The board's unique identifier. |
## Sample Output
```json theme={null}
{
"id": "22222",
"name": "Project"
}
```
# New Update
Source: https://docs.usebrainbase.com/integrations/monday/triggers/monday_new_updates
Triggered when a new update is created
## Input
| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |
## Sample Output
```json theme={null}
{
"id": "22222",
"name": "Project"
}
```
# Send Email
Source: https://docs.usebrainbase.com/integrations/outlook/actions/send_email
Send an email using Outlook.
## Input
| Property | Type | Required | Description |
| ----------- | ----------- | -------- | ----------- |
| fromAddress | SHORT\_TEXT | No | - |
| to | ARRAY | Yes | - |
| cc | ARRAY | No | - |
| replyTo | SHORT\_TEXT | No | - |
| bcc | ARRAY | No | - |
| subject | SHORT\_TEXT | Yes | - |
| body | LONG\_TEXT | Yes | - |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/outlook/auth
| Property | Value |
| -------------------- | ------------------------------- |
| Display Name | Outlook |
| Required | Yes |
| Type | CUSTOM\_AUTH |
| Username Description | The username of the IMAP server |
| Password Description | The password of the IMAP server |
# New Email
Source: https://docs.usebrainbase.com/integrations/outlook/triggers/new_email
Trigger when a new email is received in Outlook.
## Input
| Property | Type | Required | Description |
| ----------- | ----------- | -------- | ------------------------------------------------ |
| subject | SHORT\_TEXT | No | Search for a specific value in the Subject field |
| to | SHORT\_TEXT | No | Search for a specific value in the To field |
| fromAddress | SHORT\_TEXT | No | Search for a specific value in the From field |
## Sample Output
```json theme={null}
{
"html": "My email body",
"text": "My email body",
"textAsHtml": "My email body
",
"subject": "Email Subject",
"date": "2023-06-18T11:30:09.000Z",
"to": {
"value": [
{
"address": "email@address.com",
"name": "Name"
}
]
},
"from": {
"value": [
{
"address": "email@address.com",
"name": "Name"
}
]
},
"cc": {
"value": [
{
"address": "email@address.com",
"name": "Name"
}
]
},
"messageId": ""
}
```
# Create Object (Advanced)
Source: https://docs.usebrainbase.com/integrations/salesforce/actions/create_new_object
Create new object
## Input
| Property | Type | Required | Description |
| -------- | -------- | -------- | -------------------- |
| object | DROPDOWN | Yes | Select the Object |
| data | JSON | Yes | Select mapped object |
## Sample Output
```json theme={null}
{}
```
# Run Query (Advanced)
Source: https://docs.usebrainbase.com/integrations/salesforce/actions/run_query
Run a salesforce query
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | --------------- |
| query | SHORT\_TEXT | Yes | Enter the query |
## Sample Output
```json theme={null}
{}
```
# Update Object (Advanced)
Source: https://docs.usebrainbase.com/integrations/salesforce/actions/update_object_by_id
Update object by Id
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | -------------------- |
| object | DROPDOWN | Yes | Select the Object |
| id | SHORT\_TEXT | Yes | Select the Id |
| data | JSON | Yes | Select mapped object |
## Sample Output
```json theme={null}
{}
```
# Batch Upsert (Advanced)
Source: https://docs.usebrainbase.com/integrations/salesforce/actions/upsert_by_external_id
Batch upsert a record by external id
## Input
| Property | Type | Required | Description |
| --------------- | ----------- | -------- | ------------------------- |
| object | DROPDOWN | Yes | Select the Object |
| external\_field | SHORT\_TEXT | Yes | Select the External Field |
| records | JSON | Yes | Select the Records |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/salesforce/auth
| Property | Value |
| ------------------ | ---------------------------------------------------------------------------------------------------------------- |
| Display Name | Salesforce |
| Required | Yes |
| Type | OAUTH2 |
| Authentication URL | [https://login.salesforce.com/services/oauth2/authorize](https://login.salesforce.com/services/oauth2/authorize) |
| Token URL | [https://login.salesforce.com/services/oauth2/token](https://login.salesforce.com/services/oauth2/token) |
| Scope | refresh\_token full |
# New or Updated Record
Source: https://docs.usebrainbase.com/integrations/salesforce/triggers/new_or_updated_record
Triggers when there is new or updated record
## Input
| Property | Type | Required | Description |
| -------- | -------- | -------- | ----------------- |
| object | DROPDOWN | Yes | Select the Object |
## Sample Output
```json theme={null}
{}
```
# New Record
Source: https://docs.usebrainbase.com/integrations/salesforce/triggers/new_record
Triggers when there is new record
## Input
| Property | Type | Required | Description |
| -------- | -------- | -------- | ----------------- |
| object | DROPDOWN | Yes | Select the Object |
## Sample Output
```json theme={null}
{}
```
# Request Approval from A User
Source: https://docs.usebrainbase.com/integrations/slack/actions/request_approval_direct_message
Send approval message to a user and then wait until the message is approved or disapproved
## Input
| Property | Type | Required | Description |
| -------------- | ----------- | -------- | ------------------------------ |
| userId | DROPDOWN | Yes | Message receiver |
| text | LONG\_TEXT | Yes | The text of your message |
| username | SHORT\_TEXT | No | The username of the bot |
| profilePicture | SHORT\_TEXT | No | The profile picture of the bot |
## Sample Output
```json theme={null}
{
"approved": true
}
```
# Request Approval in a Channel
Source: https://docs.usebrainbase.com/integrations/slack/actions/request_approval_message
Send approval message to a channel and then wait until the message is approved or disapproved
## Input
| Property | Type | Required | Description |
| -------------- | ----------- | -------- | --------------------------------------------------------- |
| channel | DROPDOWN | Yes | Channel, private group, or IM channel to send message to. |
| text | LONG\_TEXT | Yes | The text of your message |
| username | SHORT\_TEXT | No | The username of the bot |
| profilePicture | SHORT\_TEXT | No | The profile picture of the bot |
## Sample Output
```json theme={null}
{
"approved": true
}
```
# Send Message To A Channel
Source: https://docs.usebrainbase.com/integrations/slack/actions/send_channel_message
Send message to a channel
## Input
| Property | Type | Required | Description |
| -------------- | ----------- | -------- | --------------------------------------------------------- |
| channel | DROPDOWN | Yes | Channel, private group, or IM channel to send message to. |
| text | LONG\_TEXT | Yes | The text of your message |
| username | SHORT\_TEXT | No | The username of the bot |
| profilePicture | SHORT\_TEXT | No | The profile picture of the bot |
## Sample Output
```json theme={null}
{
"success": true,
"message": "sample message",
"results": [
1,
2,
3,
4
]
}
```
# Send Message To A User
Source: https://docs.usebrainbase.com/integrations/slack/actions/send_direct_message
Send message to a user
## Input
| Property | Type | Required | Description |
| -------------- | ----------- | -------- | ------------------------------ |
| userId | DROPDOWN | Yes | Message receiver |
| text | LONG\_TEXT | Yes | The text of your message |
| username | SHORT\_TEXT | No | The username of the bot |
| profilePicture | SHORT\_TEXT | No | The profile picture of the bot |
## Sample Output
```json theme={null}
{
"success": true,
"message": "sample message",
"results": [
1,
2,
3,
4
]
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/slack/auth
| Property | Value |
| ------------------ | ------------------------------------------------------------------------------------------------------------------- |
| Display Name | Slack |
| Required | Yes |
| Type | OAUTH2 |
| Authentication URL | [https://slack.com/oauth/authorize](https://slack.com/oauth/authorize) |
| Token URL | [https://slack.com/api/oauth.access](https://slack.com/api/oauth.access) |
| Scope | channels:read, channels:write, channels:history, chat:write:bot, groups:read, reactions:read, mpim:read, users:read |
# New Message
Source: https://docs.usebrainbase.com/integrations/slack/triggers/new_message
Triggers when a new message is received
## Input
| Property | Type | Required | Description |
| -------- | -------- | -------- | --------------------------------------------------------- |
| channel | DROPDOWN | Yes | Channel, private group, or IM channel to send message to. |
## Sample Output
```json theme={null}
{
"client_msg_id": "2767cf34-0651-44e0-b9c8-1b167ce9b7a9",
"type": "message",
"text": "f",
"user": "U037UG6FKPU",
"ts": "1678231735.586539",
"blocks": [
{
"type": "rich_text",
"block_id": "4CM",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "f"
}
]
}
]
}
],
"team": "T037MS4FGDC",
"channel": "C037RTX2ZDM",
"event_ts": "1678231735.586539",
"channel_type": "channel"
}
```
# New Reaction
Source: https://docs.usebrainbase.com/integrations/slack/triggers/new_reaction_added
Triggers when a new reaction is added to a message
## Input
| Property | Type | Required | Description |
| -------- | ----- | -------- | -------------------------- |
| emoj | ARRAY | No | Select emojs to trigger on |
## Sample Output
```json theme={null}
{
"client_msg_id": "2767cf34-0651-44e0-b9c8-1b167ce9b7a9",
"type": "message",
"text": "f",
"user": "U037UG6FKPU",
"ts": "1678231735.586539",
"blocks": [
{
"type": "rich_text",
"block_id": "4CM",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "f"
}
]
}
]
}
],
"team": "T037MS4FGDC",
"channel": "C037RTX2ZDM",
"event_ts": "1678231735.586539",
"channel_type": "channel"
}
```
# Send SMS
Source: https://docs.usebrainbase.com/integrations/twilio/actions/send_sms
Send a new SMS message
## Input
| Property | Type | Required | Description |
| ---------- | ----------- | -------- | ----------------------------------------- |
| fromNumber | DROPDOWN | Yes | The phone number to send the message from |
| body | SHORT\_TEXT | Yes | The body of the message to send |
| toNumber | SHORT\_TEXT | Yes | The phone number to send the message to |
## Sample Output
```json theme={null}
{}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/twilio/auth
| Property | Value |
| ---------------------- | ----------------------- |
| Display Name | Twilio |
| Required | Yes |
| Type | CUSTOM\_AUTH |
| Account ID Description | Your Twilio account ID. |
| Auth Token Description | Your Twilio auth token. |
# New Incoming SMS
Source: https://docs.usebrainbase.com/integrations/twilio/triggers/new_incoming_sms
Triggers when a new SMS message is received
## Input
| Property | Type | Required | Description |
| ------------- | -------- | -------- | ----------------------------------------- |
| phone\_number | DROPDOWN | Yes | The phone number to send the message from |
## Sample Output
```json theme={null}
{
"body": "Hello",
"num_segments": "1",
"direction": "inbound",
"from": "+12184191735",
"date_updated": "Wed, 08 Feb 2023 01:40:51 +0000",
"price": null,
"error_message": null,
"uri": "/2010-04-01/Accounts/ACc0ea1238d61fe90d78a69a3de71d45619/Messages/SM8c3920d3f2ac481ba83e639a69dadd63.json",
"account_sid": "ACc0ea716d61fe90d78a123a3de71d45619",
"num_media": "0",
"to": "+12184191735",
"date_created": "Wed, 08 Feb 2023 01:40:50 +0000",
"status": "failed",
"sid": "SM8c3920d3f2ac481ba83e639a69dadd63",
"date_sent": "Wed, 08 Feb 2023 01:40:51 +0000",
"messaging_service_sid": "MG88e323e6a88ce67ba3bf12e1bcb7e0b8",
"error_code": 21211,
"price_unit": "USD",
"api_version": "2010-04-01",
"subresource_uris": {
"media": "/2010-04-01/Accounts/ACc0ea716d61fe90d78a69a3de71d45619/Messages/SM8c3920d3f2ac481ba83e639a69dadd63/Media.json",
"feedback": "/2010-04-01/Accounts/ACc0ea716d61fe90d78a69a3de71d45619/Messages/SM8c3920d3f2ac481ba83e639a69dadd63/Feedback.json"
}
}
```
# Make a phone call
Source: https://docs.usebrainbase.com/integrations/voice/actions/call
Make a phone call to a phone number.
## Input
| Property | Type | Required | Description |
| --------------- | ----------- | -------- | ---------------------------------------------------------------- |
| fromNumber | SHORT\_TEXT | Yes | The phone number to call from. |
| toNumber | SHORT\_TEXT | Yes | The phone number to call. |
| info | JSON | Yes | The information to use for the call. |
| objective | LONG\_TEXT | Yes | The objective of the call. |
| start\_sentence | LONG\_TEXT | No | The start sentence of the call. |
| voiceId | SHORT\_TEXT | No | The voice ID to use for the call. |
| language | SHORT\_TEXT | No | The language to use for the call. |
| callId | SHORT\_TEXT | No | The ID of the caller. |
| model | SHORT\_TEXT | No | The model to use for the request. Defaults to gpt-3.5-turbo-16k. |
| wsBaseUrl | SHORT\_TEXT | No | The base URL for the websocket. |
## Voices
| Voice ID | Accent | Age Group | |
| -------------------- | ------------------ | ----------- | ------------- |
| Name | Service | Accent | Age |
| -------------------- | ------------------ | ----------- | ------------- |
| Adrian | 11labs-Adrian | American | Young |
| Alloy | openai-Alloy | American | Young |
| Amritanshu (en-IN) | 11labs-Amritanshu | Indian | Middle Aged |
| Amy(UK) | 11labs-Amy | British | Young |
| Andrew | 11labs-Andrew | American | Young |
| Angus | deepgram-Angus | Irish | Middle Aged |
| Anna | 11labs-Anna | American | Young |
| Anthony | 11labs-Anthony | British | Middle Aged |
| Asteria | deepgram-Asteria | American | Middle Aged |
| Athena | deepgram-Athena | British | Middle Aged |
| Billy | 11labs-Billy | American | Young |
| Bing | 11labs-Bing | American | Young |
| Brian | 11labs-Brian | American | Young |
| Carola (de-DE) | 11labs-Carola | German | Middle Aged |
| Charlie (en-Au) | 11labs-charlie | Australian | Middle Aged |
| Chloe | 11labs-Chloe | American | Young |
| Cimo | 11labs-Cimo | American | Middle Aged |
| Dorothy | 11labs-Dorothy | British | Young |
| Echo | openai-Echo | American | Middle Aged |
| Emily | 11labs-Emily | American | Middle Aged |
| Emily (en-AU) | custom-Emily | Australian | Middle Aged |
| Ethan | 11labs-Ethan | American | Young |
| Evie | 11labs-Evie | American | Young |
| Fable | openai-Fable | British | Young |
| Gilfoy | 11labs-Gilfoy | American | Middle Aged |
| Grace | 11labs-Grace | American | Middle Aged |
| Helios | deepgram-Helios | British | Young |
| Hera | deepgram-Hera | American | Old |
| James | 11labs-James | American | Old |
| Jason | 11labs-Jason | American | Young |
| Joe | 11labs-Joe | American | Middle Aged |
| John | 11labs-John | American | Middle Aged |
| Julia | 11labs-Julia | American | Middle Aged |
| Kate | 11labs-Kate | American | Middle Aged |
| Kathrine | 11labs-Kathrine | American | Middle Aged |
| Liani | custom-Liani | British | Middle Aged |
| Lily | 11labs-Lily | American | Young |
| Lucas | 11labs-Lucas | American | Middle Aged |
| Luna | deepgram-Luna | American | Middle Aged |
| Marissa | 11labs-Marissa | American | Young |
| Max | 11labs-Max | American | Middle Aged |
| Mia | 11labs-Mia | American | Middle Aged |
| Monika (en-IN) | 11labs-Monika | Indian | Middle Aged |
| Myra | 11labs-Myra | American | Young |
| Natasha (en-IN) | custom-Natasha | Indian | Middle Aged |
| Nina | 11labs-Nina | American | Middle Aged |
| Noah (en-AU) | 11labs-Noah | Australian | Middle Aged |
| Nova | openai-Nova | American | Old |
| Onyx | openai-Onyx | American | Middle Aged |
| Paola | 11labs-Paola | American | Young |
| Paul | 11labs-Paul | American | Old |
| Perseus | deepgram-Perseus | American | Middle Aged |
| Ryan | 11labs-Ryan | American | Young |
| Samad (en-IN) | 11labs-Samad | Indian | Middle Aged |
| Santiago (es-ES) | 11labs-Santiago | Spanish | Middle Aged |
| Shimmer | openai-Shimmer | American | Old |
| Steve | 11labs-Steve | American | Old |
| Susan | 11labs-Susan | American | Middle Aged |
| Sweetie | custom-Sweetie | Indian | Young |
| Test | playht-Test | | |
| Varun | deepgram-Varun | American | Middle Aged |
| Zuri | 11labs-Zuri | American | Old |
## Sample Output
```json theme={null}
{
"transcript": "Hello, this is a test call."
}
```
# Authentication
Source: https://docs.usebrainbase.com/integrations/voice/auth
| Property | Value |
| ---------------------- | ----------------------- |
| Display Name | Voice |
| Required | Yes |
| Type | CUSTOM\_AUTH |
| Account ID Description | Your Twilio account ID. |
| Auth Token Description | Your Twilio auth token. |
# Call Ended
Source: https://docs.usebrainbase.com/integrations/voice/triggers/call_ended
Triggers when a call ends
## Input
| Property | Type | Required | Description |
| -------- | ----------- | -------- | ------------------ |
| callId | SHORT\_TEXT | No | The ID of the call |
## Sample Output
```json theme={null}
{
"client_msg_id": "2767cf34-0651-44e0-b9c8-1b167ce9b7a9",
"type": "message",
"text": "f",
"user": "U037UG6FKPU",
"ts": "1678231735.586539",
"blocks": [
{
"type": "rich_text",
"block_id": "4CM",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "f"
}
]
}
]
}
],
"team": "T037MS4FGDC",
"channel": "C037RTX2ZDM",
"event_ts": "1678231735.586539",
"channel_type": "channel"
}
```
# Call Received
Source: https://docs.usebrainbase.com/integrations/voice/triggers/call_received
Triggers when an inbound call is received.
## Input
| Property | Type | Required | Description |
| --------------- | ----------- | -------- | ---------------------------------------------------------------- |
| phoneNumber | SHORT\_TEXT | Yes | The phone number to receive the call |
| objective | LONG\_TEXT | Yes | The objective of the call. |
| start\_sentence | LONG\_TEXT | No | The start sentence of the call. |
| voiceId | SHORT\_TEXT | No | The voice ID to use for the call. |
| language | SHORT\_TEXT | No | The language to use for the call. |
| model | SHORT\_TEXT | No | The model to use for the request. Defaults to gpt-3.5-turbo-16k. |
| wsBaseUrl | SHORT\_TEXT | No | The base URL for the websocket. |
## Sample Output
```json theme={null}
{
"client_msg_id": "2767cf34-0651-44e0-b9c8-1b167ce9b7a9",
"type": "message",
"text": "f",
"user": "U037UG6FKPU",
"ts": "1678231735.586539",
"blocks": [
{
"type": "rich_text",
"block_id": "4CM",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "f"
}
]
}
]
}
],
"team": "T037MS4FGDC",
"channel": "C037RTX2ZDM",
"event_ts": "1678231735.586539",
"channel_type": "channel"
}
```
# Introduction – What is Brainbase?
Source: https://docs.usebrainbase.com/introduction
Brainbase is a first of its kind Enterprise Agent Platform (EAP) that gives large enterprise IT teams a single place to build, deploy and test their company’s AI workforce. Companies like Toyota and NBC use us to build agents across sales, marketing, customer support and deploy them over phone calls, SMS, email, chat and more. Our core technology is the Based agent framework which lets enterprises create fully reliable, deterministic behaviour agents, making us feasible for mission-critical customer facing use cases in banking, hospitals and more where our competitors fail to deliver.
## What Is Based?
Based is a high-level AI instruction language crafted to design dynamic conversational agents that operate flawlessly across multiple communication channels. It provides developers with an elegant, high-level syntax to build interactive workflows quickly and reliably.
Key features of Based include:
* **Intuitive and Expressive Syntax:** Develop complex conversational logic with clarity and brevity.
* **Specialized Constructs:** Utilize built-in keywords like `talk`, `loop`, `until`, and `ask` to manage conversation flow and state effortlessly.
* **Cross-Platform Flexibility:** Create agents deployable on chat, voice, email, SMS, and more—all while sharing data seamlessly across channels.
# Advanced Patterns
Source: https://docs.usebrainbase.com/language-fundamentals/advanced-patterns
# Advanced Patterns
## Multiple `until` Statements
Based allows for sophisticated conversation flows by supporting multiple `until` statements. Each `until` block represents a different condition and can trigger different handling paths.
```python theme={null}
# Multi-condition conversation handler example
loop:
response = talk(
"Welcome to our customer service bot. What can I help you with today?",
True
)
until "User wants to check order status":
order_query = response.ask(
question="Is the user asking about checking their order status? Extract order number if mentioned.",
example={"is_order_status": true, "order_number": "ABC123"}
)
if order_query["is_order_status"]:
# Handle order status request
if "order_number" in order_query and order_query["order_number"]:
order_details = get_order_details(order_query["order_number"])
say(f"Your order {order_query['order_number']} is {order_details['status']}. Expected delivery: {order_details['delivery_date']}", exact=True)
else:
say("I'd be happy to check your order status. Could you please provide your order number?", exact=True)
break
until "User wants to make a return":
return_query = response.ask(
question="Is the user asking about making a return? Extract product details if mentioned.",
example={"is_return": true, "product": "Wireless Headphones"}
)
if return_query["is_return"]:
# Handle return request
say("I can help you process a return. Let me guide you through our return policy and steps.", exact=True)
# Additional return handling logic
break
until "User wants to speak to human agent":
agent_query = response.ask(
question="Does the user want to speak to a human agent?",
example={"wants_human": true}
)
if agent_query["wants_human"]:
say("I'll connect you with a customer service representative right away. Please hold for a moment.", exact=True)
transfer_to_agent()
break
```
## Tool Schema Until Conditions
Beyond simple string conditions, Based supports **tool schema until conditions** that allow you to define structured data extraction directly in the `until` clause. This enables the LLM to extract typed parameters when a condition matches, providing structured data for your flow logic.
### Defining Tool Schemas
Tool schemas can be defined using either a **simplified format** or the **full OpenAI tool format**:
**Simplified Format:**
```python theme={null}
# Define a tool schema for collecting user information
get_user_info = {
"name": "get_user_info",
"description": "Get user contact information",
"parameters": {
"type": "object",
"properties": {
"name": {"type": "string", "description": "User's name"},
"email": {"type": "string", "description": "User's email address"},
"phone": {"type": "string", "description": "User's phone number"}
},
"required": ["name"]
}
}
```
**Full OpenAI Tool Format:**
```python theme={null}
# Define using full OpenAI tool format
schedule_appointment = {
"type": "function",
"function": {
"name": "schedule_appointment",
"description": "Schedule an appointment for the user",
"parameters": {
"type": "object",
"properties": {
"date": {"type": "string", "description": "Appointment date (YYYY-MM-DD)"},
"time": {"type": "string", "description": "Appointment time (HH:MM)"},
"notes": {"type": "string", "description": "Optional appointment notes"}
},
"required": ["date", "time"]
}
}
}
```
### Using Tool Schemas in Until Conditions
Once you've defined a tool schema, you can use it in an `until` clause. The AI will match user intent to the tool's description and extract the specified parameters.
**Basic Syntax (without binding):**
```python theme={null}
until tool_schema_variable:
# The condition matched, but parameters aren't captured
say("Action triggered!")
```
**With Parameter Binding (using `as`):**
```python theme={null}
until tool_schema_variable as extracted_params:
# extracted_params contains the parameters extracted by the LLM
print(extracted_params) # {"name": "John", "email": "john@example.com"}
```
### Complete Example: Mixed Conditions
You can mix string conditions with tool schema conditions in the same loop. The first matching condition is triggered:
```python theme={null}
# Define tool schemas
get_contact_info = {
"name": "get_contact_info",
"description": "Collect user's contact information when they provide their name and email",
"parameters": {
"type": "object",
"properties": {
"name": {"type": "string", "description": "User's full name"},
"email": {"type": "string", "description": "User's email address"}
},
"required": ["name", "email"]
}
}
book_meeting = {
"name": "book_meeting",
"description": "Book a meeting when user wants to schedule a call or appointment",
"parameters": {
"type": "object",
"properties": {
"date": {"type": "string", "description": "Meeting date"},
"time": {"type": "string", "description": "Meeting time"},
"topic": {"type": "string", "description": "Meeting topic or agenda"}
},
"required": ["date", "time"]
}
}
# Use in conversation flow
say("Hello! I can help you with contact info or scheduling meetings.")
loop:
response = talk("How can I help you today?", True)
until "user wants to end the conversation":
say("Goodbye! Have a great day.")
until get_contact_info as contact:
# contact contains: {"name": "...", "email": "..."}
say(f"Thanks {contact['name']}! I've noted your email as {contact['email']}.", exact=True)
until book_meeting as meeting:
# meeting contains: {"date": "...", "time": "...", "topic": "..."}
say(f"Meeting booked for {meeting['date']} at {meeting['time']}.", exact=True)
if meeting.get("topic"):
say(f"Topic: {meeting['topic']}", exact=True)
```
Tool schema conditions provide type-safe parameter extraction. The LLM will attempt to extract all specified parameters based on the conversation context. Required parameters should be marked in the schema's `required` array.
## Conditional Flow Control
Based scripts can implement conditional flow control using standard Python syntax, allowing for dynamic conversation paths based on user responses.
```python theme={null}
# Determine recommendation approach based on user expertise and preferences
loop:
expertise_response = talk("How familiar are you with this book genre?", True)
until "User indicates their expertise level and reading preferences":
user_profile = expertise_response.ask(
question="Determine the user's expertise level and reading preferences.",
example={
"level": "beginner",
"prefers_series": true,
"likes_long_books": false
}
)
# Create a personalized recommendation strategy
if user_profile["level"] == "beginner":
if user_profile["prefers_series"]:
recommendations = get_beginner_series_recommendations(preferences["genre"])
say(f"Since you're new to {preferences['genre']} and enjoy series, I recommend starting with these accessible series:", exact=True)
else:
recommendations = get_beginner_standalone_recommendations(preferences["genre"])
say(f"For someone new to {preferences['genre']}, these standalone books are perfect introductions:", exact=True)
elif user_profile["level"] == "intermediate":
if user_profile["likes_long_books"]:
recommendations = get_intermediate_long_recommendations(preferences["genre"])
else:
recommendations = get_intermediate_short_recommendations(preferences["genre"])
else:
# Expert reader
recommendations = get_expert_recommendations(preferences["genre"])
say(f"For an expert reader like yourself, these critically acclaimed {preferences['genre']} books offer complex narratives:", exact=True)
# Display the recommendations
for i, book in enumerate(recommendations[:3]):
say(f"{i+1}. '{book['title']}' by {book['author']} - {book['description']}", exact=True)
```
# Core Language Constructs
Source: https://docs.usebrainbase.com/language-fundamentals/core-constructs
# Core Language Constructs
Based is built around a set of specialized constructs designed specifically for conversational AI workflows. These constructs provide a high-level abstraction that makes it easy to build complex interactions without getting lost in implementation details.
## The `say` Function
The `say` function generates a response from the AI to the user without expecting a reply. It's typically used to provide information, instructions, or acknowledgments.
**Syntax:**
```python theme={null}
say(message, exact=False, model=None)
```
**Parameters:**
* `message` (string): The content to be processed and presented to the user
* `exact` (boolean, optional): Controls how the message is processed
* `True`: Outputs exactly what's provided in the message parameter, verbatim
* `False` (default): Allows the AI to rephrase the message while maintaining its meaning
* `model` (string, optional): Specifies which AI model to use for processing the message (when exact=False)
**Return Value:**
* Returns the response text, which can be stored in a variable for later use or simply executed for its side effect
**Example:**
```python theme={null}
# Greet the user with an exact message
say("Welcome to BookBot! I'm here to help you find and reserve books.", exact=True)
# Generate a dynamic welcome based on intent
say("Generate a friendly welcome for a user looking for book recommendations")
# Store the response for later use
intro = say("Introduce yourself as a helpful assistant", model="anthropic/claude-3.7-sonnet")
```
## The `loop`, `talk`, and `until` Pattern
In Based, the `loop`, `talk`, and `until` constructs form an essential pattern that must be used together. This pattern creates interactive conversation flows that can repeat until specific conditions are met. The `talk` function is not meant to be used in isolation.
**Syntax:**
```python theme={null}
loop:
response = talk(
system_prompt,
first_prompt=True,
default_values={},
info={}
)
until "Description of the completion condition":
# Validation code that determines if the condition is met
# The loop continues until this code completes successfully
```
**Parameters for `talk`:**
* `system_prompt` (string): Instruction or prompt that guides the conversation
* `first_prompt` (boolean, optional): Controls conversation initiation
* `True` (default): AI starts by sending the prompt message to the user
* `False`: AI waits for the user to send a message first
* `default_values` (dict, optional): Example values to structure expected responses
* `info` (dict, optional): Additional context for the conversation
**The Loop-Until Pattern:**
* The `loop` keyword begins a repeatable conversation block
* The `talk` function within the loop handles the conversation exchange
* The `until` clause specifies a condition (in natural language) under which the loop should end
* The code block after `until` validates whether the condition has been met
* If the condition is met (the code executes successfully), the loop exits
* If the condition is not met, the loop repeats from the beginning
**Example:**
```python theme={null}
loop:
book_preference = talk(
"What genre of books do you enjoy reading?",
True,
{"genre": "mystery", "format": "paperback"}
)
until "User provides a valid book genre and format":
preference_data = book_preference.ask(
question="Extract the user's book genre and preferred format.",
example={"genre": "mystery", "format": "paperback"}
)
# Validate the genre and format
if preference_data["genre"] not in ["mystery", "sci-fi", "romance", "non-fiction"]:
print("Invalid genre provided. Re-prompting...")
continue
if preference_data["format"] not in ["paperback", "hardcover", "e-book", "audiobook"]:
print("Invalid format provided. Re-prompting...")
continue
# If we reach here, both genre and format are valid
print("Valid preferences received!")
```
## Data Processing Methods
Based provides powerful methods to transform and extract information from data objects. These methods can be applied to any data object, not just conversation responses.
### The `.ask` Method
The `.ask` method extracts structured data from any data object, transforming unstructured content into well-formed data that can be used programmatically. This method can be used with API responses, conversation results, or any other data.
**Syntax:**
```python theme={null}
data_object.ask(question, example=None, schema=None, model=None)
```
**Parameters:**
* `question` (string): Instruction for extracting specific information from the data
* `example` (dict, optional): Example object showing the expected output format
* `schema` (dict, optional): JSON schema defining the expected structure
* `model` (string, optional): AI model to use for extraction
**Return Value:**
* Returns structured data according to the example or schema provided
**Example:**
```python theme={null}
# Extract structured book preferences from a conversation response
preferences = response.ask(
question="Extract the user's preferred book genre, format, and any specific authors they mentioned.",
example={
"genre": "mystery",
"format": "audiobook",
"authors": ["Agatha Christie", "Arthur Conan Doyle"]
}
)
# Use .ask on an API response
response = requests.get(
url='https://bookstore-api.example.com/books',
headers={'Authorization': 'Bearer ' + auth_token},
params={'genre': 'mystery'}
)
api_results = response.json().ask(
question="Extract the book titles, authors, and prices from the API response.",
example={"books": [{"title": "The Mystery", "author": "A. Writer", "price": "$12.99"}]}
)
```
# Full Example: Book Recommendation Agent
Source: https://docs.usebrainbase.com/language-fundamentals/full-example
# Full Example: Book Recommendation Agent
Here's a complete example that demonstrates the various language constructs working together, including multiple `until` statements:
```python theme={null}
state = {}
meta_prompt = "You're a book recommendation assistant helping users find their next great read."
res = say("Hello! I'm BookBot, your personal book recommendation assistant.", exact=True)
# Introduce the service and set expectations
say("I can help you find books based on your preferences, including genre, format, and reading level.")
# Collect initial user preferences with multiple until paths
loop:
initial_response = talk(
f"{meta_prompt} Ask the user what they're looking for today, offering to recommend books, find new releases, or check book availability.",
True
)
until "User wants book recommendations":
recommendation_request = initial_response.ask(
question="Is the user asking for book recommendations?",
example={"wants_recommendations": true}
)
if recommendation_request["wants_recommendations"]:
# Handle recommendation path
state["intent"] = "recommendations"
# Collect genre preferences
loop:
genre_response = talk(
"What genre of books do you enjoy reading?",
True,
{"genre": "fantasy", "format": "e-book"}
)
until "User provides valid genre and format preferences":
preferences = genre_response.ask(
question="Extract the user's preferred book genre and format.",
example={"genre": "fantasy", "format": "e-book"}
)
if preferences["genre"] and preferences["format"]:
state["preferences"] = preferences
break
# Generate recommendations
response = requests.get(
url='https://bookstore-api.example.com/recommendations',
params=state["preferences"]
)
recommendations = response.json().ask(
question="Extract the top 3 book recommendations with title, author, and description.",
example={"books": [{"title": "Book Title", "author": "Author Name", "description": "Brief description"}]}
)
# Present recommendations
say(f"Based on your interest in {state['preferences']['genre']} books, here are 3 titles I think you'll love:", exact=True)
for i, book in enumerate(recommendations["books"]):
say(f"{i+1}. '{book['title']}' by {book['author']}: {book['description']}", exact=True)
break
until "User wants to check new releases":
new_release_request = initial_response.ask(
question="Is the user asking about new or upcoming book releases?",
example={"wants_new_releases": true, "genre": "thriller"}
)
if new_release_request["wants_new_releases"]:
# Handle new releases path
state["intent"] = "new_releases"
genre = new_release_request.get("genre", "")
# Get new releases, optionally filtered by genre
response = requests.get(
url='https://bookstore-api.example.com/new-releases',
params={"genre": genre} if genre else {}
)
new_releases = response.json().ask(
question="Extract the latest 5 book releases with title, author, and release date.",
example={"books": [{"title": "New Book", "author": "Author Name", "release_date": "2023-10-15"}]}
)
# Present new releases
header = f"Here are the latest releases in {genre}:" if genre else "Here are the latest book releases:"
say(header, exact=True)
for i, book in enumerate(new_releases["books"]):
say(f"{i+1}. '{book['title']}' by {book['author']} - Released: {book['release_date']}", exact=True)
break
until "User wants to check book availability":
availability_request = initial_response.ask(
question="Is the user asking about checking if a specific book is available?",
example={"checking_availability": true, "book_title": "The Great Novel", "author": "Famous Writer"}
)
if availability_request["checking_availability"]:
# Handle availability check path
state["intent"] = "check_availability"
book_info = {}
if "book_title" in availability_request:
book_info["title"] = availability_request["book_title"]
if "author" in availability_request:
book_info["author"] = availability_request["author"]
# If we have complete information, check availability
if "title" in book_info and "author" in book_info:
availability = check_book_availability(book_info["title"], book_info["author"])
if availability["available"]:
say(f"Good news! '{book_info['title']}' by {book_info['author']} is available in these formats: {', '.join(availability['formats'])}", exact=True)
else:
say(f"I'm sorry, '{book_info['title']}' by {book_info['author']} is currently unavailable. Would you like me to notify you when it becomes available?", exact=True)
else:
# Need more information
loop:
book_details_response = talk(
"I'd be happy to check book availability. Could you please provide the book title and author?",
True
)
until "User provides complete book details":
details = book_details_response.ask(
question="Extract the book title and author from the user's response.",
example={"title": "The Great Novel", "author": "Famous Writer"}
)
if "title" in details and "author" in details:
availability = check_book_availability(details["title"], details["author"])
if availability["available"]:
say(f"Good news! '{details['title']}' by {details['author']} is available in these formats: {', '.join(availability['formats'])}", exact=True)
else:
say(f"I'm sorry, '{details['title']}' by {details['author']} is currently unavailable. Would you like me to notify you when it becomes available?", exact=True)
break
break
# Conversation wrap-up
say("Is there anything else I can help you with today?", exact=True)
```
## Key Takeaways
This example demonstrates several important Based patterns:
1. **State Management**: Using the `state` dictionary to persist user intent and preferences across conversation turns
2. **Multiple Until Conditions**: Handling different user intents (recommendations, new releases, availability) with separate `until` blocks
3. **Nested Loops**: Using inner `loop`-`until` patterns for collecting additional information when needed
4. **API Integration**: Making HTTP requests to external services and using `.ask()` to extract structured data from responses
5. **Dynamic Responses**: Building personalized responses based on extracted user data
## Conclusion
The Based language provides a powerful yet intuitive framework for building conversational agents. By mastering the core constructs—particularly the essential `loop`-`talk`-`until` pattern—you can create sophisticated conversation flows that handle complex interactions while maintaining readability and maintainability.
Remember that Based is designed to be declarative, allowing you to focus on the "what" rather than the "how" of conversational AI. This approach dramatically reduces the amount of code needed to create powerful agents while increasing reliability and ease of maintenance.
The combination of the core language constructs with platform-specific functions allows you to build agents that take full advantage of each deployment platform's unique capabilities while maintaining a consistent codebase and user experience.
# Based Language Fundamentals
Source: https://docs.usebrainbase.com/language-fundamentals/overview
# Based Language Fundamentals
Welcome to the **Based Language Fundamentals** guide. This reference document provides a comprehensive explanation of Based's core language constructs, their declaration syntax, arguments, and practical usage examples. Understanding these fundamentals will enable you to build sophisticated conversational agents with precision and confidence.
Based is built around a set of specialized constructs designed specifically for conversational AI workflows. These constructs provide a high-level abstraction that makes it easy to build complex interactions without getting lost in implementation details.
Learn about `say`, `loop`, `talk`, `until`, and the `.ask` method
Understand how to persist data across conversation turns
Multiple until statements, tool schemas, and conditional flow
Voice-specific functions like transfer and end\_call
HTTP requests, SMS, integrations, and debugging
Complete Book Recommendation Agent walkthrough
# Platform-Specific Functions
Source: https://docs.usebrainbase.com/language-fundamentals/platform-functions
# Platform-Specific Functions
Based supports different deployment platforms (chat, voice, email, SMS) and provides specialized functions for each platform. These functions allow you to take advantage of platform-specific capabilities.
## Voice Deployment Functions
When your Based agent is deployed for voice conversations, you can use these special functions to control call flow:
### `transfer(phone_number, options?)`
Transfers the current call to another phone number. Optionally supports dialing extensions after the call connects.
**Syntax:**
```python theme={null}
transfer(phone_number)
transfer(phone_number, extension)
transfer(phone_number, options)
```
**Parameters:**
* `phone_number` (string): The destination phone number to transfer to (E.164 format recommended, e.g. `+15551234567`). When using `sipDomain`, this is treated as a SIP username (e.g. `"frontdesk"`) routed through your Twilio SIP Domain.
* `extension` (string, optional): Simple extension digits to dial after the call connects
* `options` (dict, optional): Advanced transfer options with the following keys:
* `extension` (string): Extension digits to route the call after it connects. In PSTN mode, sent as DTMF tones. In SIP mode, passed as a SIP header to the PBX.
* `pauseSeconds` (number): Seconds to wait before sending digits (default: 1 second)
* `sipDomain` (string): A Twilio SIP Domain (e.g. `yourcompany.sip.twilio.com`). When set, `phone_number` is treated as a SIP username (e.g. `"frontdesk"`) and the call is routed via SIP instead of the PSTN.
* `message` (string): A message to say to the caller before transferring. Works for all transfer types; when using `sipDomain`, prefer this over a standalone `say()` to ensure the message is delivered before the SIP leg is initiated.
**Examples:**
```python theme={null}
# Basic transfer - transfer to customer support
if user_request["needs_human_support"]:
say("I'll transfer you to our customer support team right away.", exact=True)
transfer("+1-800-123-4567")
# Transfer with extension (simple string format)
# Waits 1 second (default), then dials extension 123
say("Let me transfer you to Julie in the Finance department.", exact=True)
transfer("5302321272", "271")
# Transfer with extension and custom pause time (dict format)
# Waits 2 seconds before dialing the extension (useful for slower phone systems)
say("Connecting you to the service department now.", exact=True)
transfer("5303195426", {"extension": "221", "pauseSeconds": 2})
# Transfer with no pause (immediate extension dialing)
transfer("5302323297", {"extension": "123", "pauseSeconds": 0})
# Transfer via SIP domain to a PBX extension
# Routes through your Twilio SIP Domain instead of the PSTN
transfer("101", {"sipDomain": "yourcompany.sip.twilio.com"})
# Transfer via SIP with a message to the caller first
# Use the `message` option to speak before transferring (preferred over a standalone say())
transfer("305", {"sipDomain": "yourcompany.sip.twilio.com", "message": "Please hold while I connect you."})
# Transfer via SIP domain with extension dialing after connect
transfer("frontdesk", {"sipDomain": "yourcompany.sip.twilio.com", "extension": "4673", "pauseSeconds": 2})
```
When transferring to extensions, the `pauseSeconds` parameter controls how long to wait after the call connects before dialing the extension digits. The default of 1 second works for most phone systems, but you may need to increase this for systems that have longer greeting messages or slower IVR responses.
When using `sipDomain`, the `phone_number` argument is treated as a SIP username (alphanumeric, e.g. `"frontdesk"`) and the call is routed via `sip:@` instead of over the PSTN. When `extension` is provided, it is included as a SIP header so the PBX can route the call to the correct internal extension; `pauseSeconds` controls the delay before the header is sent. Use `message` to speak to the caller before the transfer is initiated.
### `end_call()`
Ends the current call immediately. Use this to gracefully terminate a voice conversation after completing the interaction.
**Syntax:**
```python theme={null}
end_call()
```
**Examples:**
```python theme={null}
# End call after completing a transaction
say("Thank you for your order! Your confirmation number is ABC123. Have a great day!", exact=True)
end_call()
# End call when user requests to hang up
if user_request["wants_to_end_call"]:
say("Thank you for calling. Goodbye!", exact=True)
end_call()
# End call after transferring to voicemail or completing a task
say("I've sent the information to your email. Is there anything else I can help with?", exact=True)
loop:
response = talk("", False) # Wait for user response
until "User confirms they're done":
done = response.ask(
question="Is the user indicating they're done and want to end the call?",
example={"is_done": true}
)
if done["is_done"]:
say("Great, have a wonderful day!", exact=True)
end_call()
```
### `click_ivr(digits)`
Sends DTMF tones (keypad presses) during an active call. This is useful for navigating IVR (Interactive Voice Response) menus programmatically, such as pressing "1" for sales or entering an account number.
**Syntax:**
```python theme={null}
click_ivr(digits)
```
**Parameters:**
* `digits` (string): The DTMF digits to send. Can include numbers 0-9, `*`, and `#`
**Examples:**
```python theme={null}
# Navigate an IVR menu by pressing "1" for English
say("Let me select English for you.", exact=True)
click_ivr("1")
# Enter a multi-digit selection (e.g., "Press 2 for billing, then 3 for payment")
click_ivr("23")
# Enter an account number
account_number = "123456789"
say("I'm entering your account number now.", exact=True)
click_ivr(account_number)
# Navigate through a phone tree: press 1, then *, then 0 for operator
click_ivr("1*0")
```
The `click_ivr` function sends DTMF tones immediately. If you need to wait for an IVR prompt before sending tones, use a `say` statement or add appropriate delays in your flow logic.
# State Management and Persistence
Source: https://docs.usebrainbase.com/language-fundamentals/state-management
# State Management and Persistence
Based automatically persists variables across conversation turns, allowing you to maintain context throughout a multi-turn conversation. Understanding how state works is essential for building stateful agents.
## The `state` Dictionary
The `state` dictionary is the primary way to store and retrieve data that should persist across conversation turns. It's automatically saved and restored between interactions.
**Usage:**
```python theme={null}
# Initialize state at the start of your flow
state = {}
# Store user information as you collect it
state["user_name"] = "John"
state["preferences"] = {"language": "en", "notifications": True}
state["order_items"] = []
# Add items to state throughout the conversation
state["order_items"].append({"item": "Taco", "quantity": 2})
# Access state later in the flow
total_items = len(state["order_items"])
say(f"You have {total_items} items in your cart.", exact=True)
```
## Variable Persistence Example
Here's a complete example showing how variables persist across conversation turns:
```python theme={null}
# First turn: Initialize and collect data
state = {}
say("Welcome! Let me help you place an order.")
loop:
response = talk("What would you like to order?", True)
until "user provides their order":
order = response.ask(
question="Extract the items the user wants to order",
example={"items": [{"name": "burger", "quantity": 1}]}
)
state["order"] = order
state["order_step"] = "collecting_details"
print(f"Order saved to state: {state['order']}")
# On subsequent turns, the state is automatically restored
# You can access state["order"] and continue from where you left off
```
Variables defined at the top level of your Based code (like `state = {}`) are automatically persisted across conversation turns. The session maintains the complete execution state, so your agent can pick up right where it left off.
## Pre-populated State for Voice Calls
When your Based agent is deployed for voice, the `state` dictionary is automatically pre-populated with call metadata. This gives you immediate access to caller information without needing to ask for it.
### Inbound Voice Calls
For inbound calls, `state` is pre-populated with Twilio call data:
```python theme={null}
# Example state for an inbound voice call
state = {
# Caller information
'From': '+14154650216',
'Caller': '+14154650216',
'CallerCity': 'SAN FRANCISCO',
'CallerState': 'CA',
'CallerZip': '94904',
'CallerCountry': 'US',
# Called number information
'To': '+14158738252',
'Called': '+14158738252',
'ToCity': 'POINT REYES STATION',
'ToState': 'CA',
'ToZip': '94956',
'ToCountry': 'US',
'CalledCity': 'POINT REYES STATION',
'CalledState': 'CA',
'CalledZip': '94956',
'CalledCountry': 'US',
# Call metadata
'Direction': 'inbound',
'CallStatus': 'ringing',
'CallSid': 'CAe64d540d7f8d465128c3e128d4cfb6d8',
'AccountSid': 'AC607f40827a8fce6eb9b4d9d67adbf425',
'ApiVersion': '2010-04-01',
'StirVerstat': 'TN-Validation-Passed-A',
# Brainbase metadata
'version': 'v2',
'deploymentId': 'deploy_a05e0b20-87ed-440b-9cd4-0427cc812c41',
'flowId': 'flow_86414fd8-f0b9-42d8-8fdf-e6d13daeec48',
'workerId': 'worker_5e864909-61c0-4785-8622-3af76cc58783',
'teamId': '581fdb69-309b-4e95-aa78-315d6a0ad0db',
'phoneNumber': '+14158738252'
}
```
You can use this data to personalize the conversation:
```python theme={null}
# Access caller information directly from state
caller_city = state.get('CallerCity', 'your area')
caller_number = state.get('From', '')
say(f"Thanks for calling from {caller_city}!", exact=True)
# Use caller ID for lookups
customer = lookup_customer_by_phone(caller_number)
if customer:
say(f"Welcome back, {customer['name']}!", exact=True)
```
### Outbound Voice Calls
For outbound calls, `state` includes all the same call metadata plus an `outbound_data` field containing the data that triggered the call:
```python theme={null}
# Example state for an outbound voice call
state = {
# Standard call metadata (same as inbound)
'Direction': 'outbound',
'From': '+14158738252',
'To': '+14154650216',
'CallStatus': 'in-progress',
# ... other Twilio fields ...
# Custom data that triggered the call
'outbound_data': {
'first_name': 'John',
'last_name': 'Smith',
'appointment_date': '2024-03-15',
'appointment_time': '2:30 PM',
'doctor_name': 'Dr. Johnson'
# ... any other data you included when initiating the call
}
}
```
Use `outbound_data` to personalize outbound calls:
```python theme={null}
# Access the data that triggered this outbound call
data = state.get('outbound_data', {})
first_name = data.get('first_name', 'there')
appointment_date = data.get('appointment_date', '')
appointment_time = data.get('appointment_time', '')
say(f"Hi {first_name}, this is a reminder about your appointment on {appointment_date} at {appointment_time}.", exact=True)
```
The `outbound_data` field contains whatever data you pass when initiating the outbound call through the API or trigger. This allows you to include any context needed for the conversation, such as customer details, appointment information, order numbers, etc.
# Built-in Utility Functions
Source: https://docs.usebrainbase.com/language-fundamentals/utility-functions
# Built-in Utility Functions
Based provides built-in utility functions that are available in all deployments for common operations like debugging, notifications, and more.
## Print Line Debugging
The `print` function works like Python's standard print, but outputs are captured and made available in the session trace for debugging purposes. This is invaluable for understanding flow execution and troubleshooting issues.
**Syntax:**
```python theme={null}
print(value, ...)
```
**Usage:**
```python theme={null}
# Print simple messages for debugging
print("Starting order processing...")
# Print variable values to inspect state
order_data = response.ask(
question="Extract order details",
example={"items": [], "total": 0}
)
print("Extracted order:", order_data)
# Print within conditional logic to trace execution path
if order_data["total"] > 100:
print("High-value order detected, applying discount")
discount = order_data["total"] * 0.1
print(f"Discount amount: ${discount}")
```
All print outputs appear in the session trace view, making it easy to debug conversation flows without interrupting the user experience. Print statements do not send messages to the user—they're purely for developer debugging.
## Sending SMS Messages with `send_sms`
The `send_sms` function allows you to send SMS messages programmatically from within your Based flow. This is useful for sending confirmations, notifications, or follow-up messages.
**Syntax:**
```python theme={null}
result = await send_sms(
to="recipient_phone_number",
content="message_content",
from_number="your_phone_number"
)
```
**Parameters:**
* `to` (string, required): The recipient's phone number in E.164 format (e.g., `"+12025551234"`)
* `content` (string, required): The SMS message content to send
* `from_number` (string, required): Your phone number from your Brainbase phone number library
**Return Value:**
Returns an `SMSResult` object with the following properties:
| Property | Type | Description |
| ------------- | ------- | ------------------------------------------------------------ |
| `success` | boolean | `True` if SMS was sent successfully |
| `status` | string | Status code: `"sent"`, `"failed"`, `"skipped"`, or `"error"` |
| `message_sid` | string | Twilio message SID (if sent successfully) |
| `to` | string | Recipient phone number |
| `from_number` | string | Sender phone number |
| `error` | string | Error message (if failed) |
| `error_code` | string | Provider error code (if applicable) |
**Example:**
```python theme={null}
# Send an order confirmation SMS
result = await send_sms(
to=customer_phone,
content=f"Your order #{order_id} has been confirmed! Estimated delivery: {delivery_time}",
from_number="+15551234567"
)
if result.success:
print(f"SMS sent successfully: {result.message_sid}")
say("I've sent a confirmation to your phone!", exact=True)
else:
print(f"SMS failed: {result.error}")
say("I wasn't able to send an SMS confirmation, but your order is still confirmed.", exact=True)
```
**Handling Failures Gracefully:**
The `send_sms` function is designed to never interrupt your flow. All errors are captured in the result object, allowing you to handle failures gracefully:
```python theme={null}
# Example: Appointment reminder with fallback
result = await send_sms(
to=patient_phone,
content=f"Reminder: Your appointment with Dr. {doctor_name} is tomorrow at {appointment_time}",
from_number="+15559876543"
)
if result.success:
say("I've sent you an SMS reminder for your appointment.", exact=True)
elif result.status == "skipped":
# SMS was skipped (e.g., A2P verification issue)
print(f"SMS skipped: {result.error}")
say("I'll make sure to remind you about your appointment.", exact=True)
else:
# SMS failed for another reason
print(f"SMS error: {result.error}")
say("Your appointment is confirmed. Please make a note of the time.", exact=True)
```
The `from_number` must be a phone number registered in your Brainbase phone number library with proper A2P (Application-to-Person) verification for SMS delivery compliance.
## Making HTTP Requests
Based provides the standard Python `requests` module for making HTTP requests to external APIs. This gives you full compatibility with the widely-used [requests library](https://requests.readthedocs.io/).
**Examples:**
```python theme={null}
# GET request
response = requests.get(
url="https://api.example.com/users/123",
headers={"Authorization": "Bearer your-token"}
)
if response.ok:
user_data = response.json()
print(f"User: {user_data['name']}")
# POST request with JSON body
response = requests.post(
url="https://api.example.com/orders",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer your-token"
},
json={
"items": order_items,
"customer_id": customer_id
}
)
if response.ok:
order = response.json()
say(f"Order {order['id']} created successfully!", exact=True)
else:
print(f"Request failed: {response.status_code} - {response.text}")
# Other HTTP methods
response = requests.put(url, headers=headers, json=data)
response = requests.delete(url, headers=headers)
response = requests.patch(url, headers=headers, json=data)
```
**Using `.ask()` with API Responses:**
You can use the `.ask()` method on response data to extract structured information:
```python theme={null}
response = requests.get("https://api.example.com/products")
products = response.json()
# Extract specific fields using .ask()
summary = products.ask(
question="Extract the top 3 products by price with name and price",
example={"products": [{"name": "Widget", "price": 29.99}]}
)
```
All HTTP requests are automatically logged in the session trace for debugging and observability. You can see request/response details, timing, and any errors in the trace view.
### Legacy API Utility (Deprecated)
The `api` utility is deprecated. Please use the standard `requests` module instead.
The legacy `api.get_req()` and `api.post_req()` methods are still supported for backwards compatibility:
```python theme={null}
# Deprecated - use requests.get() instead
result = api.get_req(url='https://api.example.com/data', headers={...})
# Deprecated - use requests.post() instead
result = api.post_req(url='https://api.example.com/data', headers={...}, body={...})
```
## Third-Party Integrations
Based provides an `integrations` client for connecting to third-party services configured in your Brainbase workspace.
**Usage:**
```python theme={null}
# Call an integration action (app_name.action_name pattern)
result = await integrations.slack.send_message(
channel="#notifications",
text=f"New order received: {order_id}"
)
# Send email via Gmail
result = await integrations.gmail.send_email(
to="user@example.com",
subject="Order Confirmation",
body=f"Your order #{order_id} has been confirmed!"
)
```
Integrations must be connected in your Brainbase workspace before they can be used in Based flows. See the Integrations documentation for setup instructions.
# Mega — AI Engineering for Brainbase
Source: https://docs.usebrainbase.com/mega
Mega is a repo that gives AI coding tools — Claude Code, Cursor, Codex, or any code-native environment — deep knowledge of the Brainbase platform and the ability to build, deploy, and manage conversational agents autonomously.
Instead of reading docs and writing code manually, you describe what you need in plain English and your AI tool does the rest — referencing the full Based language spec, production examples, and platform APIs.
Clone the repo and open it in your AI tool to start building.
## What can Mega do?
* **Write Based flows** from business requirements, documents, or spreadsheets
* **Deploy agents** across voice, chat, SMS, WhatsApp, and other channels
* **Manage deployments** — inspect logs, update flows, debug issues
* **Scale** — take one working flow and deploy it across dozens of instances with different parameters
## Quick start
```bash theme={null}
git clone https://github.com/BrainbaseHQ/mega.git
cd mega
cp .env.example .env # Add your Brainbase API key
```
Open the `mega/` directory in your AI tool. It auto-configures:
| Tool | Config file | What loads |
| ----------- | -------------- | --------------------------------------------------------- |
| Claude Code | `CLAUDE.md` | Full platform context, Based reference, workflow patterns |
| Cursor | `.cursorrules` | Based syntax, platform conventions |
| Codex | `AGENTS.md` | Agent instructions for autonomous operation |
Then just describe what you need:
```
"Here's our customer support playbook. Write a Based flow
for inbound voice calls that routes to sales, service, or
parts based on caller intent."
```
## What's inside
| Path | Description |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `docs/based.md` | Complete Based language reference — syntax, built-ins, patterns, limitations |
| `docs/platform.md` | Platform data model — workers, flows, deployments, resources |
| `docs/deployments.md` | Deployment types and their configuration |
| `examples/` | 5 production-quality Based flows (inbound routing, appointment booking, order taking, lead qualification, outbound campaigns) |
| `scripts/bb.sh` | CLI wrapper for the Brainbase API — create workers, manage flows, deploy |
## How it works
Mega doesn't introduce new tools or SDKs. It provides **context files** that AI coding tools already know how to read. When you open the `mega/` directory:
1. Your AI tool loads the context file (`CLAUDE.md`, `.cursorrules`, or `AGENTS.md`)
2. The context points it to `docs/based.md` — the complete Based language reference
3. It references `examples/` for production-quality patterns
4. It uses `scripts/bb.sh` to interact with the Brainbase API
The AI tool handles the rest — writing flows, creating workers, deploying, and testing — all from natural language instructions.
## Relationship to these docs
The Based reference in Mega's `docs/based.md` is the most up-to-date and complete guide to the Based language, covering v2 syntax, deployment-specific functions, limitations, and production patterns. The [Language Fundamentals](/language-fundamentals/overview) section on this site covers the same topics but may lag behind.
If you're building with an AI tool, use Mega. If you prefer reading docs directly, both sources cover the core language.
# Delete a registered phone number for the team.
Source: https://docs.usebrainbase.com/sdk/assets/delete-a-registered-phone-number-for-the-team
/openapi-specs/brainbase-openapi.documented.json delete /api/team/assets/phone_numbers/{phoneNumberId}/delete
# Get all registered phone numbers for the team, optionally filtered by integration id.
Source: https://docs.usebrainbase.com/sdk/assets/get-all-registered-phone-numbers-for-the-team-optionally-filtered-by-integration-id
/openapi-specs/brainbase-openapi.documented.json get /api/team/assets/phone_numbers
# Get the status of a WhatsApp sender.
Source: https://docs.usebrainbase.com/sdk/assets/get-the-status-of-a-whatsapp-sender
/openapi-specs/brainbase-openapi.documented.json get /api/team/assets/whatsapp_sender_status/{senderSid}
# Purchase a phone number and register it as a WhatsApp sender.
Source: https://docs.usebrainbase.com/sdk/assets/purchase-a-phone-number-and-register-it-as-a-whatsapp-sender
/openapi-specs/brainbase-openapi.documented.json post /api/team/assets/purchase_whatsapp_sender
# Purchase phone numbers via Brainbase Twilio account.
Source: https://docs.usebrainbase.com/sdk/assets/purchase-phone-numbers-via-brainbase-twilio-account
/openapi-specs/brainbase-openapi.documented.json post /api/team/assets/purchase_phone_numbers
# Register a phone number for the team via Twilio integration.
Source: https://docs.usebrainbase.com/sdk/assets/register-a-phone-number-for-the-team-via-twilio-integration
/openapi-specs/brainbase-openapi.documented.json post /api/team/assets/register_phone_number
# Search for available phone numbers to purchase via Brainbase.
Source: https://docs.usebrainbase.com/sdk/assets/search-for-available-phone-numbers-to-purchase-via-brainbase
/openapi-specs/brainbase-openapi.documented.json get /api/team/assets/available_phone_numbers
# Check if a phone number is callable at a given time
Source: https://docs.usebrainbase.com/sdk/businesshours/check-if-a-phone-number-is-callable-at-a-given-time
/openapi-specs/brainbase-openapi.documented.json post /api/workers/check-callable
Checks if a phone number is callable at a specific timestamp by:
1. Taking a UTC Unix timestamp
2. Converting it to the business hours timezone (from BusinessHours table)
3. Checking if the local time falls within the business hours for that day
# Create new business hours
Source: https://docs.usebrainbase.com/sdk/businesshours/create-new-business-hours
/openapi-specs/brainbase-openapi.documented.json post /api/workers/business-hours
# Delete business hours
Source: https://docs.usebrainbase.com/sdk/businesshours/delete-business-hours
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/business-hours/{id}
# Get all business hours
Source: https://docs.usebrainbase.com/sdk/businesshours/get-all-business-hours
/openapi-specs/brainbase-openapi.documented.json get /api/workers/business-hours
# Get business hours by ID
Source: https://docs.usebrainbase.com/sdk/businesshours/get-business-hours-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/business-hours/{id}
# Update business hours
Source: https://docs.usebrainbase.com/sdk/businesshours/update-business-hours
/openapi-specs/brainbase-openapi.documented.json put /api/workers/business-hours/{id}
# List chat deployment logs for a worker with optional filtering
Source: https://docs.usebrainbase.com/sdk/chat-deployment-logs/list-chat-deployment-logs-for-a-worker-with-optional-filtering
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/chat
Retrieves all chat deployment logs for the worker. Optionally, logs can be filtered by deploymentId and/or flowId by providing corresponding query parameters.
# Retrieve a single chat deployment log record
Source: https://docs.usebrainbase.com/sdk/chat-deployment-logs/retrieve-a-single-chat-deployment-log-record
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/chat/{logId}
# Create a new chat deployment
Source: https://docs.usebrainbase.com/sdk/chat-deployments/create-a-new-chat-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/chat
# Delete a chat deployment
Source: https://docs.usebrainbase.com/sdk/chat-deployments/delete-a-chat-deployment
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/chat/{deploymentId}
# Get a single chat deployment by chat agent ID
Source: https://docs.usebrainbase.com/sdk/chat-deployments/get-a-single-chat-deployment-by-chat-agent-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat/agent/{chatAgentId}
# Get a single chat deployment by ID
Source: https://docs.usebrainbase.com/sdk/chat-deployments/get-a-single-chat-deployment-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat/{deploymentId}
# Get all chat deployments for a worker
Source: https://docs.usebrainbase.com/sdk/chat-deployments/get-all-chat-deployments-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat
# Update a chat deployment
Source: https://docs.usebrainbase.com/sdk/chat-deployments/update-a-chat-deployment
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/chat/{deploymentId}
# List chat embed deployment logs for a worker with optional filtering
Source: https://docs.usebrainbase.com/sdk/chat-embed-deployment-logs/list-chat-embed-deployment-logs-for-a-worker-with-optional-filtering
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/chat-embed
Retrieves all chat embed deployment logs for the worker. Optionally, logs can be filtered by deploymentId and/or flowId by providing corresponding query parameters.
# Retrieve a single chat embed deployment log record
Source: https://docs.usebrainbase.com/sdk/chat-embed-deployment-logs/retrieve-a-single-chat-embed-deployment-log-record
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/chat-embed/{logId}
# Create a new chat embed deployment
Source: https://docs.usebrainbase.com/sdk/chat-embed-deployments/create-a-new-chat-embed-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/chat-embed
# Delete a chat embed deployment
Source: https://docs.usebrainbase.com/sdk/chat-embed-deployments/delete-a-chat-embed-deployment
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/chat-embed/{deploymentId}
# Get a single chat embed deployment by embed ID
Source: https://docs.usebrainbase.com/sdk/chat-embed-deployments/get-a-single-chat-embed-deployment-by-embed-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/deployments/chat-embed/by-embed/{embedId}
# Get a single chat embed deployment by ID
Source: https://docs.usebrainbase.com/sdk/chat-embed-deployments/get-a-single-chat-embed-deployment-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat-embed/{deploymentId}
# Get all chat embed deployments for a worker
Source: https://docs.usebrainbase.com/sdk/chat-embed-deployments/get-all-chat-embed-deployments-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/chat-embed
# Update a chat embed deployment
Source: https://docs.usebrainbase.com/sdk/chat-embed-deployments/update-a-chat-embed-deployment
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/chat-embed/{deploymentId}
# Create or update deployment-level default checks overrides
Source: https://docs.usebrainbase.com/sdk/default-checks/create-or-update-deployment-level-default-checks-overrides
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/deployments/{deploymentId}/default-checks
# Create or update team default checks configuration
Source: https://docs.usebrainbase.com/sdk/default-checks/create-or-update-team-default-checks-configuration
/openapi-specs/brainbase-openapi.documented.json put /api/team/default-checks
# Get resolved default checks configuration for a deployment
Source: https://docs.usebrainbase.com/sdk/default-checks/get-resolved-default-checks-configuration-for-a-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/default-checks
# Get team default checks configuration
Source: https://docs.usebrainbase.com/sdk/default-checks/get-team-default-checks-configuration
/openapi-specs/brainbase-openapi.documented.json get /api/team/default-checks
# Initialize team default checks with default values
Source: https://docs.usebrainbase.com/sdk/default-checks/initialize-team-default-checks-with-default-values
/openapi-specs/brainbase-openapi.documented.json post /api/team/default-checks
# Remove deployment-level overrides (revert to team defaults)
Source: https://docs.usebrainbase.com/sdk/default-checks/remove-deployment-level-overrides-revert-to-team-defaults
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/{deploymentId}/default-checks
# List deployment history
Source: https://docs.usebrainbase.com/sdk/deployment-history/list-deployment-history
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/history
Returns paginated change history for a deployment
# Create a deployment parameter
Source: https://docs.usebrainbase.com/sdk/deployment-parameters/create-a-deployment-parameter
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/{deploymentId}/params
# Delete a deployment parameter
Source: https://docs.usebrainbase.com/sdk/deployment-parameters/delete-a-deployment-parameter
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/{deploymentId}/params/{paramId}
# List deployment parameters
Source: https://docs.usebrainbase.com/sdk/deployment-parameters/list-deployment-parameters
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/params
# Update a deployment parameter
Source: https://docs.usebrainbase.com/sdk/deployment-parameters/update-a-deployment-parameter
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/{deploymentId}/params/{paramId}
# Retrieve a deployment by ID
Source: https://docs.usebrainbase.com/sdk/deployments/retrieve-a-deployment-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/deployments/{deploymentId}
Fetches a single deployment record by its ID, without requiring the worker ID. Works for all deployment types: Voice, VoiceV1, Chat, ChatEmbed, Whatsapp, SMS, Email, Slack, and API. Delegate-specific fields are flattened into the response automatically.
# Create a test agent
Source: https://docs.usebrainbase.com/sdk/echo/create-a-test-agent
/openapi-specs/brainbase-openapi.documented.json post /api/echo/agents
# Create a test suite
Source: https://docs.usebrainbase.com/sdk/echo/create-a-test-suite
/openapi-specs/brainbase-openapi.documented.json post /api/echo/suites
# Create an Echo scorecard
Source: https://docs.usebrainbase.com/sdk/echo/create-an-echo-scorecard
/openapi-specs/brainbase-openapi.documented.json post /api/echo/scorecards
# Delete a test agent
Source: https://docs.usebrainbase.com/sdk/echo/delete-a-test-agent
/openapi-specs/brainbase-openapi.documented.json delete /api/echo/agents/{id}
# Delete a test suite
Source: https://docs.usebrainbase.com/sdk/echo/delete-a-test-suite
/openapi-specs/brainbase-openapi.documented.json delete /api/echo/suites/{id}
# Delete an Echo scorecard
Source: https://docs.usebrainbase.com/sdk/echo/delete-an-echo-scorecard
/openapi-specs/brainbase-openapi.documented.json delete /api/echo/scorecards/{id}
# Get a single Echo scorecard
Source: https://docs.usebrainbase.com/sdk/echo/get-a-single-echo-scorecard
/openapi-specs/brainbase-openapi.documented.json get /api/echo/scorecards/{id}
# List Echo scorecards for the team
Source: https://docs.usebrainbase.com/sdk/echo/list-echo-scorecards-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/echo/scorecards
# List test agents for the team
Source: https://docs.usebrainbase.com/sdk/echo/list-test-agents-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/echo/agents
# List test suites for the team
Source: https://docs.usebrainbase.com/sdk/echo/list-test-suites-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/echo/suites
# Submit an Echo test run (agent or suite) to Redis queue
Source: https://docs.usebrainbase.com/sdk/echo/submit-an-echo-test-run-agent-or-suite-to-redis-queue
/openapi-specs/brainbase-openapi.documented.json post /api/echo/run
# Update a test agent
Source: https://docs.usebrainbase.com/sdk/echo/update-a-test-agent
/openapi-specs/brainbase-openapi.documented.json put /api/echo/agents/{id}
# Update a test suite
Source: https://docs.usebrainbase.com/sdk/echo/update-a-test-suite
/openapi-specs/brainbase-openapi.documented.json put /api/echo/suites/{id}
# Update an Echo scorecard
Source: https://docs.usebrainbase.com/sdk/echo/update-an-echo-scorecard
/openapi-specs/brainbase-openapi.documented.json put /api/echo/scorecards/{id}
# Create a new file resource
Source: https://docs.usebrainbase.com/sdk/file-resources/create-a-new-file-resource
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/file
# Get all file resources for a worker
Source: https://docs.usebrainbase.com/sdk/file-resources/get-all-file-resources-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/resources/file
# Commit a flow version
Source: https://docs.usebrainbase.com/sdk/flow-versions/commit-a-flow-version
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/flows/{flowId}/versions
Creates a snapshot of the current flow code and variables as a new version
# Get a single flow version
Source: https://docs.usebrainbase.com/sdk/flow-versions/get-a-single-flow-version
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/flows/{flowId}/versions/{versionId}
# List flow versions
Source: https://docs.usebrainbase.com/sdk/flow-versions/list-flow-versions
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/flows/{flowId}/versions
Returns paginated list of versions for a flow, ordered by version number descending
# Create a new flow
Source: https://docs.usebrainbase.com/sdk/flows/create-a-new-flow
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/flows
# Delete a flow
Source: https://docs.usebrainbase.com/sdk/flows/delete-a-flow
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/flows/{flowId}
# Get a single flow
Source: https://docs.usebrainbase.com/sdk/flows/get-a-single-flow
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/flows/{flowId}
# Get all flows for a worker
Source: https://docs.usebrainbase.com/sdk/flows/get-all-flows-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/flows
# Retrieve a flow by ID
Source: https://docs.usebrainbase.com/sdk/flows/retrieve-a-flow-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/flows/{flowId}
Fetches a single flow record by its ID, without requiring the worker ID. Supports the same `versionId` and `deploymentId` query parameters as the worker-scoped endpoint for version pinning and parameter merging.
# Update a flow
Source: https://docs.usebrainbase.com/sdk/flows/update-a-flow
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/flows/{flowId}
# Create a new folder
Source: https://docs.usebrainbase.com/sdk/folders/create-a-new-folder
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/folders
# Delete a folder
Source: https://docs.usebrainbase.com/sdk/folders/delete-a-folder
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/folders/{folderId}
# Get a folder by ID
Source: https://docs.usebrainbase.com/sdk/folders/get-a-folder-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/folders/{folderId}
# Get all folders for a worker
Source: https://docs.usebrainbase.com/sdk/folders/get-all-folders-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/folders
# Get all resources in a folder
Source: https://docs.usebrainbase.com/sdk/folders/get-all-resources-in-a-folder
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/folders/{folderId}/resources
# Update a folder
Source: https://docs.usebrainbase.com/sdk/folders/update-a-folder
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/folders/{folderId}
# Create a new Twilio integration for the authenticated team.
Source: https://docs.usebrainbase.com/sdk/integrations/create-a-new-twilio-integration-for-the-authenticated-team
/openapi-specs/brainbase-openapi.documented.json post /api/team/integrations/twilio/create
# Delete an existing Twilio integration.
Source: https://docs.usebrainbase.com/sdk/integrations/delete-an-existing-twilio-integration
/openapi-specs/brainbase-openapi.documented.json delete /api/team/integrations/twilio/{integrationId}/delete
# Get a specific integration by ID.
Source: https://docs.usebrainbase.com/sdk/integrations/get-a-specific-integration-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/team/integrations/{integrationId}
# Get all integrations for the authenticated team.
Source: https://docs.usebrainbase.com/sdk/integrations/get-all-integrations-for-the-authenticated-team
/openapi-specs/brainbase-openapi.documented.json get /api/team/integrations
# Get Twilio subaccount credentials for the authenticated team.
Source: https://docs.usebrainbase.com/sdk/integrations/get-twilio-subaccount-credentials-for-the-authenticated-team
/openapi-specs/brainbase-openapi.documented.json get /api/team/subaccount-credentials
Returns the team's Twilio subaccount SID and auth token. Used by workers for Brainbase-purchased phone numbers (integrationId is null).
# Update an existing integration's name and description.
Source: https://docs.usebrainbase.com/sdk/integrations/update-an-existing-integrations-name-and-description
/openapi-specs/brainbase-openapi.documented.json patch /api/team/integrations/{integrationId}
# Create a new link resource
Source: https://docs.usebrainbase.com/sdk/link-resources/create-a-new-link-resource
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/link
# Get all link resources for a worker
Source: https://docs.usebrainbase.com/sdk/link-resources/get-all-link-resources-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/resources/link
# Delete all LLM logs for a specific call
Source: https://docs.usebrainbase.com/sdk/llm-logs/delete-all-llm-logs-for-a-specific-call
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/llm-logs/by-call/{callId}
# Delete an LLM log
Source: https://docs.usebrainbase.com/sdk/llm-logs/delete-an-llm-log
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/llm-logs/{logId}
# Get a specific LLM log
Source: https://docs.usebrainbase.com/sdk/llm-logs/get-a-specific-llm-log
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/llm-logs/{logId}
# Get all LLM logs for a specific call
Source: https://docs.usebrainbase.com/sdk/llm-logs/get-all-llm-logs-for-a-specific-call
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/llm-logs/by-call/{callId}
# Get all LLM logs for a specific session
Source: https://docs.usebrainbase.com/sdk/llm-logs/get-all-llm-logs-for-a-specific-session
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/llm-logs/by-session/{sessionId}
# List LLM logs for a team
Source: https://docs.usebrainbase.com/sdk/llm-logs/list-llm-logs-for-a-team
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/llm-logs
# Create a new log export job
Source: https://docs.usebrainbase.com/sdk/log-exports/create-a-new-log-export-job
/openapi-specs/brainbase-openapi.documented.json post /api/team/exports
Queues an async export of deployment logs to CSV or JSON. The export is processed in the background and uploaded to S3. Poll GET /api/team/exports/{exportId} for status and download URL. Max one active export per team. Max 90-day date range.
# Get export status and download URL
Source: https://docs.usebrainbase.com/sdk/log-exports/get-export-status-and-download-url
/openapi-specs/brainbase-openapi.documented.json get /api/team/exports/{exportId}
Poll the status of a log export. When status is COMPLETED, the response includes a presigned S3 download URL valid for 24 hours.
# List recent log exports
Source: https://docs.usebrainbase.com/sdk/log-exports/list-recent-log-exports
/openapi-specs/brainbase-openapi.documented.json get /api/team/exports
Returns the 20 most recent log exports for the authenticated team.
# Retrieve a deployment log by ID
Source: https://docs.usebrainbase.com/sdk/logs/retrieve-a-deployment-log-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/logs/{logId}
Fetches a single deployment log record by its ID, without requiring the worker or deployment ID. Works for all log types: Voice, Chat, ChatEmbed, Whatsapp, SMS, API, and Email. Delegate-specific fields (e.g. transcription for voice, messages for chat) are flattened into the response automatically.
# Create a new outbound campaign
Source: https://docs.usebrainbase.com/sdk/outbound-campaigns/create-a-new-outbound-campaign
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns
# Delete an outbound campaign
Source: https://docs.usebrainbase.com/sdk/outbound-campaigns/delete-an-outbound-campaign
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns/{campaignId}
# Get a specific outbound campaign by ID
Source: https://docs.usebrainbase.com/sdk/outbound-campaigns/get-a-specific-outbound-campaign-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns/{campaignId}
# Get all outbound campaigns for a voice deployment
Source: https://docs.usebrainbase.com/sdk/outbound-campaigns/get-all-outbound-campaigns-for-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns
# Update an outbound campaign
Source: https://docs.usebrainbase.com/sdk/outbound-campaigns/update-an-outbound-campaign
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns/{campaignId}
# Receive logs from Portkey webhook
Source: https://docs.usebrainbase.com/sdk/portkey/receive-logs-from-portkey-webhook
/openapi-specs/brainbase-openapi.documented.json post /portkey-logs
# Delete a resource (link or file)
Source: https://docs.usebrainbase.com/sdk/resources/delete-a-resource-link-or-file
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/resources/{resourceId}
# Get a single resource (link or file) details
Source: https://docs.usebrainbase.com/sdk/resources/get-a-single-resource-link-or-file-details
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/resources/{resourceId}
# Move a resource to a different folder
Source: https://docs.usebrainbase.com/sdk/resources/move-a-resource-to-a-different-folder
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/{resourceId}/move
# Query RAG resources using vector search
Source: https://docs.usebrainbase.com/sdk/resources/query-rag-resources-using-vector-search
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/resources/query
# Get a specific runtime error
Source: https://docs.usebrainbase.com/sdk/runtime-errors/get-a-specific-runtime-error
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/runtime-errors/{errorId}
# List runtime errors for a worker
Source: https://docs.usebrainbase.com/sdk/runtime-errors/list-runtime-errors-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/runtime-errors
# Record a runtime error from the Based engine
Source: https://docs.usebrainbase.com/sdk/runtime-errors/record-a-runtime-error-from-the-based-engine
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/runtime-errors
# Get session data for a specific session
Source: https://docs.usebrainbase.com/sdk/sessions/get-session-data-for-a-specific-session
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/sessions/{sessionId}
# List SMS deployment logs for a worker
Source: https://docs.usebrainbase.com/sdk/sms-deployment-logs/list-sms-deployment-logs-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/sms
# Retrieve a single SMS deployment log
Source: https://docs.usebrainbase.com/sdk/sms-deployment-logs/retrieve-a-single-sms-deployment-log
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/sms/{logId}
# Assign a tag to a worker
Source: https://docs.usebrainbase.com/sdk/tags/assign-a-tag-to-a-worker
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/tags
# Create a new tag
Source: https://docs.usebrainbase.com/sdk/tags/create-a-new-tag
/openapi-specs/brainbase-openapi.documented.json post /api/team/tags
# Delete a tag
Source: https://docs.usebrainbase.com/sdk/tags/delete-a-tag
/openapi-specs/brainbase-openapi.documented.json delete /api/team/tags/{tagId}
# List all tags for the team
Source: https://docs.usebrainbase.com/sdk/tags/list-all-tags-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/team/tags
# List tags assigned to a worker
Source: https://docs.usebrainbase.com/sdk/tags/list-tags-assigned-to-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/tags
# Remove a tag from a worker
Source: https://docs.usebrainbase.com/sdk/tags/remove-a-tag-from-a-worker
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/tags/{tagId}
# Update a tag
Source: https://docs.usebrainbase.com/sdk/tags/update-a-tag
/openapi-specs/brainbase-openapi.documented.json patch /api/team/tags/{tagId}
# Add a custom ElevenLabs voice for the team
Source: https://docs.usebrainbase.com/sdk/team/add-a-custom-elevenlabs-voice-for-the-team
/openapi-specs/brainbase-openapi.documented.json post /api/team/customVoices
# Delete a custom voice
Source: https://docs.usebrainbase.com/sdk/team/delete-a-custom-voice
/openapi-specs/brainbase-openapi.documented.json delete /api/team/customVoices/{id}
# Get all custom voices for the team
Source: https://docs.usebrainbase.com/sdk/team/get-all-custom-voices-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/team/customVoices
# Get the team associated with the provided API key
Source: https://docs.usebrainbase.com/sdk/team/get-the-team-associated-with-the-provided-api-key
/openapi-specs/brainbase-openapi.documented.json get /api/team
# Create new team phone hours
Source: https://docs.usebrainbase.com/sdk/teamphonehours/create-new-team-phone-hours
/openapi-specs/brainbase-openapi.documented.json post /api/workers/team-phone-hours
# Delete team phone hours
Source: https://docs.usebrainbase.com/sdk/teamphonehours/delete-team-phone-hours
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/team-phone-hours/{id}
# Get all team phone hours
Source: https://docs.usebrainbase.com/sdk/teamphonehours/get-all-team-phone-hours
/openapi-specs/brainbase-openapi.documented.json get /api/workers/team-phone-hours
# Get team phone hours by ID
Source: https://docs.usebrainbase.com/sdk/teamphonehours/get-team-phone-hours-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/team-phone-hours/{id}
# Update team phone hours
Source: https://docs.usebrainbase.com/sdk/teamphonehours/update-team-phone-hours
/openapi-specs/brainbase-openapi.documented.json put /api/workers/team-phone-hours/{id}
# Create a new test
Source: https://docs.usebrainbase.com/sdk/tests/create-a-new-test
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/tests
# Delete a test
Source: https://docs.usebrainbase.com/sdk/tests/delete-a-test
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/tests/{testId}
# Get test runs for a specific test
Source: https://docs.usebrainbase.com/sdk/tests/get-test-runs-for-a-specific-test
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/tests/{testId}/runs
# Run a test
Source: https://docs.usebrainbase.com/sdk/tests/run-a-test
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/tests/{testId}/run
# Update a test
Source: https://docs.usebrainbase.com/sdk/tests/update-a-test
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/tests/{testId}
# Get detailed voice deployment analysis with billing breakdown
Source: https://docs.usebrainbase.com/sdk/voice-analysis/get-detailed-voice-deployment-analysis-with-billing-breakdown
/openapi-specs/brainbase-openapi.documented.json post /api/voice-analysis
# List voice deployment logs for a worker with optional filtering and pagination
Source: https://docs.usebrainbase.com/sdk/voice-deployment-logs/list-voice-deployment-logs-for-a-worker-with-optional-filtering-and-pagination
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/voice
Retrieves voice deployment logs for the worker with pagination support. Optionally, logs can be filtered by deploymentId and/or flowId by providing corresponding query parameters.
# Retrieve a single voice deployment log record
Source: https://docs.usebrainbase.com/sdk/voice-deployment-logs/retrieve-a-single-voice-deployment-log-record
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/voice/{logId}
# Create a new custom webhook for voice deployment
Source: https://docs.usebrainbase.com/sdk/voice-deployments/create-a-new-custom-webhook-for-voice-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks
# Create a new voice deployment
Source: https://docs.usebrainbase.com/sdk/voice-deployments/create-a-new-voice-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice
# Delete a custom webhook
Source: https://docs.usebrainbase.com/sdk/voice-deployments/delete-a-custom-webhook
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks/{webhookId}
# Delete a voice deployment
Source: https://docs.usebrainbase.com/sdk/voice-deployments/delete-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/voice/{deploymentId}
# Get a single voice deployment
Source: https://docs.usebrainbase.com/sdk/voice-deployments/get-a-single-voice-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voice/{deploymentId}
# Get a specific custom webhook
Source: https://docs.usebrainbase.com/sdk/voice-deployments/get-a-specific-custom-webhook
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks/{webhookId}
# Get all voice deployments for a worker
Source: https://docs.usebrainbase.com/sdk/voice-deployments/get-all-voice-deployments-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voice
# List custom webhooks for a deployment
Source: https://docs.usebrainbase.com/sdk/voice-deployments/list-custom-webhooks-for-a-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks
# Make batch calls for a voice deployment
Source: https://docs.usebrainbase.com/sdk/voice-deployments/make-batch-calls-for-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice/{deploymentId}/make-batch-calls
# Stop a specific campaign by removing its calls from the queue
Source: https://docs.usebrainbase.com/sdk/voice-deployments/stop-a-specific-campaign-by-removing-its-calls-from-the-queue
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice/{deploymentId}/stop-campaign
Removes all scheduled calls for a specific campaign from the Redis queue
# Stop batch calls for a voice deployment
Source: https://docs.usebrainbase.com/sdk/voice-deployments/stop-batch-calls-for-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voice/{deploymentId}/stop-batch-calls
Removes all scheduled batch calls for the specified deployment from the queue and returns the removed items
# Update a custom webhook
Source: https://docs.usebrainbase.com/sdk/voice-deployments/update-a-custom-webhook
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/{deploymentId}/voice/customWebhooks/{webhookId}
# Update a voice deployment
Source: https://docs.usebrainbase.com/sdk/voice-deployments/update-a-voice-deployment
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{workerId}/deployments/voice/{deploymentId}
# Create a new campaign for a voice v1 deployment
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/create-a-new-campaign-for-a-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns
# Create a new voice v1 deployment
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/create-a-new-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voicev1
# Delete a voice v1 deployment
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/delete-a-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{workerId}/deployments/voicev1/{deploymentId}
# Get a campaign by ID
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/get-a-campaign-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns/{campaignId}
# Get a single voice v1 deployment
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/get-a-single-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voicev1/{deploymentId}
# Get all voice v1 deployments for a worker
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/get-all-voice-v1-deployments-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voicev1
# Get specific campaign data by ID
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/get-specific-campaign-data-by-id
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns/{campaignId}/data/{dataId}
# Make batch calls for a voice v1 deployment
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/make-batch-calls-for-a-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voicev1/{deploymentId}/make-batch-calls
# Run a campaign with provided data
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/run-a-campaign-with-provided-data
/openapi-specs/brainbase-openapi.documented.json post /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns/{campaignId}/run
# Update a voice v1 deployment
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/update-a-voice-v1-deployment
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/deployments/voicev1/{deploymentId}
# Update specific campaign data by ID
Source: https://docs.usebrainbase.com/sdk/voice-v1-deployments/update-specific-campaign-data-by-id
/openapi-specs/brainbase-openapi.documented.json put /api/workers/{workerId}/deployments/voicev1/{deploymentId}/campaigns/{campaignId}/data/{dataId}
# List WhatsApp deployment logs for a worker
Source: https://docs.usebrainbase.com/sdk/whatsapp-deployment-logs/list-whatsapp-deployment-logs-for-a-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/whatsapp
# Retrieve a single WhatsApp deployment log
Source: https://docs.usebrainbase.com/sdk/whatsapp-deployment-logs/retrieve-a-single-whatsapp-deployment-log
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{workerId}/deploymentLogs/whatsapp/{logId}
# Create a new worker
Source: https://docs.usebrainbase.com/sdk/workers/create-a-new-worker
/openapi-specs/brainbase-openapi.documented.json post /api/workers
# Delete a worker
Source: https://docs.usebrainbase.com/sdk/workers/delete-a-worker
/openapi-specs/brainbase-openapi.documented.json delete /api/workers/{id}
# Get a single worker
Source: https://docs.usebrainbase.com/sdk/workers/get-a-single-worker
/openapi-specs/brainbase-openapi.documented.json get /api/workers/{id}
# Get all workers for the team
Source: https://docs.usebrainbase.com/sdk/workers/get-all-workers-for-the-team
/openapi-specs/brainbase-openapi.documented.json get /api/workers
# Update a worker
Source: https://docs.usebrainbase.com/sdk/workers/update-a-worker
/openapi-specs/brainbase-openapi.documented.json patch /api/workers/{id}