JavaScript
import BrainbaseLabs from 'brainbase-labs';
const client = new BrainbaseLabs({
apiKey: process.env['BRAINBASE_LABS_API_KEY'], // This is the default and can be omitted
});
const response = await client.voiceAnalysis.analyze();
console.log(response.breakdown);import os
from brainbase_labs import BrainbaseLabs
client = BrainbaseLabs(
api_key=os.environ.get("BRAINBASE_LABS_API_KEY"), # This is the default and can be omitted
)
response = client.voice_analysis.analyze()
print(response.breakdown)curl --request POST \
--url https://brainbase-monorepo-api.onrender.com/api/voice-analysis \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"granularity": "monthly",
"deploymentIds": [
"<string>"
],
"workerId": "<string>",
"includeTransfers": true,
"includeCallDetails": false,
"timezone": "UTC"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://brainbase-monorepo-api.onrender.com/api/voice-analysis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'granularity' => 'monthly',
'deploymentIds' => [
'<string>'
],
'workerId' => '<string>',
'includeTransfers' => true,
'includeCallDetails' => false,
'timezone' => 'UTC'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://brainbase-monorepo-api.onrender.com/api/voice-analysis"
payload := strings.NewReader("{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"granularity\": \"monthly\",\n \"deploymentIds\": [\n \"<string>\"\n ],\n \"workerId\": \"<string>\",\n \"includeTransfers\": true,\n \"includeCallDetails\": false,\n \"timezone\": \"UTC\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://brainbase-monorepo-api.onrender.com/api/voice-analysis")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"granularity\": \"monthly\",\n \"deploymentIds\": [\n \"<string>\"\n ],\n \"workerId\": \"<string>\",\n \"includeTransfers\": true,\n \"includeCallDetails\": false,\n \"timezone\": \"UTC\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brainbase-monorepo-api.onrender.com/api/voice-analysis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"granularity\": \"monthly\",\n \"deploymentIds\": [\n \"<string>\"\n ],\n \"workerId\": \"<string>\",\n \"includeTransfers\": true,\n \"includeCallDetails\": false,\n \"timezone\": \"UTC\"\n}"
response = http.request(request)
puts response.read_body{
"summary": {
"totalCalls": 123,
"totalMinutes": 123,
"totalTransfers": 123,
"totalTransferMinutes": 123,
"totalTransferEvents": 123,
"totalTransferEventMinutes": 123,
"averageCallDuration": 123
},
"breakdown": [
{
"period": "<string>",
"periodStart": "2023-11-07T05:31:56Z",
"periodEnd": "2023-11-07T05:31:56Z",
"totalCalls": 123,
"totalMinutes": 123,
"totalTransfers": 123,
"totalTransferMinutes": 123,
"totalTransferEvents": 123,
"totalTransferEventMinutes": 123,
"deployments": [
{
"deploymentId": "<string>",
"deploymentName": "<string>",
"workerId": "<string>",
"workerName": "<string>",
"calls": 123,
"minutes": 123,
"transfers": 123,
"transferMinutes": 123,
"transferEvents": 123,
"transferEventMinutes": 123,
"averageCallDuration": 123
}
]
}
],
"callDetails": [
{
"logId": "<string>",
"deploymentId": "<string>",
"deploymentName": "<string>",
"workerId": "<string>",
"workerName": "<string>",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"duration": 123,
"fromNumber": "<string>",
"toNumber": "<string>",
"direction": "<string>",
"transfers": 123,
"transferMinutes": 123,
"transferEvents": 123,
"transferEventMinutes": 123
}
]
}Voice Analysis
Get detailed voice deployment analysis with billing breakdown
POST
/
api
/
voice-analysis
JavaScript
import BrainbaseLabs from 'brainbase-labs';
const client = new BrainbaseLabs({
apiKey: process.env['BRAINBASE_LABS_API_KEY'], // This is the default and can be omitted
});
const response = await client.voiceAnalysis.analyze();
console.log(response.breakdown);import os
from brainbase_labs import BrainbaseLabs
client = BrainbaseLabs(
api_key=os.environ.get("BRAINBASE_LABS_API_KEY"), # This is the default and can be omitted
)
response = client.voice_analysis.analyze()
print(response.breakdown)curl --request POST \
--url https://brainbase-monorepo-api.onrender.com/api/voice-analysis \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"granularity": "monthly",
"deploymentIds": [
"<string>"
],
"workerId": "<string>",
"includeTransfers": true,
"includeCallDetails": false,
"timezone": "UTC"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://brainbase-monorepo-api.onrender.com/api/voice-analysis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'granularity' => 'monthly',
'deploymentIds' => [
'<string>'
],
'workerId' => '<string>',
'includeTransfers' => true,
'includeCallDetails' => false,
'timezone' => 'UTC'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://brainbase-monorepo-api.onrender.com/api/voice-analysis"
payload := strings.NewReader("{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"granularity\": \"monthly\",\n \"deploymentIds\": [\n \"<string>\"\n ],\n \"workerId\": \"<string>\",\n \"includeTransfers\": true,\n \"includeCallDetails\": false,\n \"timezone\": \"UTC\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://brainbase-monorepo-api.onrender.com/api/voice-analysis")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"granularity\": \"monthly\",\n \"deploymentIds\": [\n \"<string>\"\n ],\n \"workerId\": \"<string>\",\n \"includeTransfers\": true,\n \"includeCallDetails\": false,\n \"timezone\": \"UTC\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brainbase-monorepo-api.onrender.com/api/voice-analysis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"granularity\": \"monthly\",\n \"deploymentIds\": [\n \"<string>\"\n ],\n \"workerId\": \"<string>\",\n \"includeTransfers\": true,\n \"includeCallDetails\": false,\n \"timezone\": \"UTC\"\n}"
response = http.request(request)
puts response.read_body{
"summary": {
"totalCalls": 123,
"totalMinutes": 123,
"totalTransfers": 123,
"totalTransferMinutes": 123,
"totalTransferEvents": 123,
"totalTransferEventMinutes": 123,
"averageCallDuration": 123
},
"breakdown": [
{
"period": "<string>",
"periodStart": "2023-11-07T05:31:56Z",
"periodEnd": "2023-11-07T05:31:56Z",
"totalCalls": 123,
"totalMinutes": 123,
"totalTransfers": 123,
"totalTransferMinutes": 123,
"totalTransferEvents": 123,
"totalTransferEventMinutes": 123,
"deployments": [
{
"deploymentId": "<string>",
"deploymentName": "<string>",
"workerId": "<string>",
"workerName": "<string>",
"calls": 123,
"minutes": 123,
"transfers": 123,
"transferMinutes": 123,
"transferEvents": 123,
"transferEventMinutes": 123,
"averageCallDuration": 123
}
]
}
],
"callDetails": [
{
"logId": "<string>",
"deploymentId": "<string>",
"deploymentName": "<string>",
"workerId": "<string>",
"workerName": "<string>",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"duration": 123,
"fromNumber": "<string>",
"toNumber": "<string>",
"direction": "<string>",
"transfers": 123,
"transferMinutes": 123,
"transferEvents": 123,
"transferEventMinutes": 123
}
]
}Authorizations
API key authentication
Body
application/json
Start date for analysis (ISO 8601)
End date for analysis (ISO 8601)
Time granularity for breakdown
Available options:
daily, weekly, monthly, yearly Optional filter by deployment IDs
Optional filter by worker ID
Include transfer analysis
Include detailed call logs in response
Timezone for date calculations
⌘I
