Stats

Stats delivers a clear-cut suite of API requests, providing up-to-the-minute subscriber figures, including active and unsubscribed counts. Plus, you can segment this data for even deeper insights.

Stats offers a straightforward collection of API requests that give you the latest figures on your subscriber numbers, detailing both active and unsubscribed counts. Additionally, this information can be segmented for deeper insights.

Note: These endpoints are designed exclusively for backend implementation. Call them from your server-side code, then forward the data to the front end in a way that matches your product requirements.

Method Endpoint Description
GET /v1/stats/site Get Site Stats
GET /v1/stats/segment Get Segment Stats
GET /v1/stats/report Get Report Stats

The stats model

The stats model offers straightforward totals and specific stats for your convenience. These data keys are accessible whether you're querying across the entire account or by individual segments.

user_count · integer

Total count of users in the account or segment.

subscriber_count · integer

Active user count for the account or segment.

unsubscriber_count · integer

Number of subscribers that have unsubscribed in the account or segment.

GET /v1/stats/site

Get Site Stats

Returns global subscriber statistics for a given site so you can monitor overall list health.

Required attributes

site_uuid · string
The UUID of the site to get stats for.

cURL

bash
curl -L -u publishableKey:secretKey \
  -X GET "https://app.bentonow.com/api/v1/stats/site?site_uuid=ExampleID1234" \
  -H "Accept: application/json"

JavaScript

javascript
const axios = require('axios');

let config = {
  method: 'get',
  url: 'https://app.bentonow.com/api/v1/stats/site',
  params: { site_uuid: 'ExampleID1234' },
  auth: {
    username: 'publishableKey',
    password: 'secretKey'
  },
  headers: {
    'Accept': 'application/json'
  }
};

axios(config)
  .then((response) => {
    console.log(JSON.stringify(response.data, null, 2));
  })
  .catch((error) => {
    console.error('Error:', error.response ? error.response.data : error.message);
  });

Laravel SDK

php
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getSiteStats()->json();

Ruby

ruby
require "uri"
require "net/http"
require "base64"

url = URI("https://app.bentonow.com/api/v1/stats/site?site_uuid=ExampleID1234")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
auth = Base64.strict_encode64("#{username}:#{password}")
request["Authorization"] = "Basic #{auth}"

response = https.request(request)
puts response.read_body

Python

python
from bento_api import BentoAPI
import os

api = BentoAPI(
  site_uuid=os.getenv('BENTO_SITE_UUID'),
  username=os.getenv('BENTO_PUBLISHABLE_KEY'),
  password=os.getenv('BENTO_SECRET_KEY')
)
site_stats = api.get_site_stats()

C#

csharp
public class StatsExample
{
  private readonly IBentoStatsService _statsService;

  public StatsExample(IBentoStatsService statsService)
  {
    _statsService = statsService;
  }

  public async Task StatsExamples()
  {
    var siteStatsResponse = await _statsService.GetSiteStatsAsync<dynamic>();
  }
}

Go

go
stats, err := client.GetSiteStats(ctx)
if err != nil {
  log.Fatal(err)
}
fmt.Printf("Site statistics: %+v\n", stats)

Rust

rust
let site_stats = client.get_site_stats().await?;

Response

Site statistics include user, subscriber, and unsubscribe totals for the selected site.

Response body

json
{
  "user_count": 0,
  "subscriber_count": 0,
  "unsubscriber_count": 0
}
GET /v1/stats/segment

Get Segment Stats

Returns subscriber totals scoped to a specific segment so you can track performance at a finer grain.

Required attributes

site_uuid · string
The UUID of the site to get stats for.
segment_id · string
The ID of the segment to get stats for.

cURL

bash
curl -L -u publishableKey:secretKey \
  -X GET "https://app.bentonow.com/api/v1/stats/segment?site_uuid=ExampleID1234&segment_id=123" \
  -H "Accept: application/json"

JavaScript

javascript
const axios = require('axios');

let config = {
  method: 'get',
  url: 'https://app.bentonow.com/api/v1/stats/segment',
  params: {
    site_uuid: 'ExampleID1234',
    segment_id: '123'
  },
  auth: {
    username: 'publishableKey',
    password: 'secretKey'
  },
  headers: {
    'Accept': 'application/json'
  }
};

axios(config)
  .then((response) => {
    console.log(JSON.stringify(response.data, null, 2));
  })
  .catch((error) => {
    console.error('Error:', error.response ? error.response.data : error.message);
  });

Laravel SDK

php
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\SegmentStatsData;

$data = new SegmentStatsData(segment_id: "123");

return Bento::getSegmentStats($data)->json();

Ruby

ruby
require "uri"
require "net/http"
require "base64"

url = URI("https://app.bentonow.com/api/v1/stats/segment?site_uuid=ExampleID1234&segment_id=123")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
auth = Base64.strict_encode64("#{username}:#{password}")
request["Authorization"] = "Basic #{auth}"

response = https.request(request)
puts response.read_body

Python

python
from bento_api import BentoAPI
import os

api = BentoAPI(
  site_uuid=os.getenv('BENTO_SITE_UUID'),
  username=os.getenv('BENTO_PUBLISHABLE_KEY'),
  password=os.getenv('BENTO_SECRET_KEY')
)
segment_stats = api.get_segment_stats(segment_id="12345")

C#

csharp
public class StatsExample
{
  private readonly IBentoStatsService _statsService;

  public StatsExample(IBentoStatsService statsService)
  {
    _statsService = statsService;
  }

  public async Task StatsExamples()
  {
    var segmentStatsResponse = await _statsService.GetSegmentStatsAsync<dynamic>("segment_id");
  }
}

Go

go
segmentStats, err := client.GetSegmentStats(ctx, "segment_123")
if err != nil {
  log.Fatal(err)
}
fmt.Printf("Segment stats: %+v\n", segmentStats)

Rust

rust
let segment_stats = client.get_segment_stats("segment_123").await?;

Elixir

elixir
{:ok, stats} = BentoSdk.Stats.get_segment("segment_id")

Response

Segment responses mirror the site payload but scoped to the provided segment.

Response body

json
{
  "user_count": 0,
  "subscriber_count": 0,
  "unsubscriber_count": 0
}
GET /v1/stats/report

Get Report Stats

Returns the data blob for a given report so you can rebuild charts or dashboards externally.

Required attributes

site_uuid · string
The UUID of the site to get stats for.
report_id · string
The ID of the report to get stats for.

cURL

bash
curl -L -u publishableKey:secretKey \
  -X GET "https://app.bentonow.com/api/v1/stats/report?site_uuid=ExampleID1234&report_id=456" \
  -H "Accept: application/json"

JavaScript

javascript
const axios = require('axios');

let config = {
  method: 'get',
  url: 'https://app.bentonow.com/api/v1/stats/report',
  params: {
    site_uuid: 'ExampleID1234',
    report_id: '456'
  },
  auth: {
    username: 'publishableKey',
    password: 'secretKey'
  },
  headers: {
    'Accept': 'application/json'
  }
};

axios(config)
  .then((response) => {
    console.log(JSON.stringify(response.data, null, 2));
  })
  .catch((error) => {
    console.error('Error:', error.response ? error.response.data : error.message);
  });

Laravel SDK

php
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\ReportStatsData;

$data = new ReportStatsData(report_id: "456");

return Bento::getReportStats($data)->json();

Ruby

ruby
require "uri"
require "net/http"
require "base64"

url = URI("https://app.bentonow.com/api/v1/stats/report?site_uuid=ExampleID1234&report_id=456")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
auth = Base64.strict_encode64("#{username}:#{password}")
request["Authorization"] = "Basic #{auth}"

response = https.request(request)
puts response.read_body

C#

csharp
public class StatsExample
{
  private readonly IBentoStatsService _statsService;

  public StatsExample(IBentoStatsService statsService)
  {
    _statsService = statsService;
  }

  public async Task StatsExamples()
  {
    var reportStatsResponse = await _statsService.GetReportStatsAsync<dynamic>("report_id");
  }
}

Go

go
reportStats, err := client.GetReportStats(ctx, "report_456")
if err != nil {
  log.Fatal(err)
}
fmt.Printf("Report stats: %+v\n", reportStats)

Rust

rust
let report_stats = client.get_report_stats("report_456").await?;

Elixir

elixir
{:ok, stats} = BentoSdk.Stats.get_report("report_id")

Response

The response wraps report metadata alongside the computed data payload so you can rebuild visualizations.

Response body

json
{
  "report_data": {
    "data": {
      // Actual data points
    },
    "chart_style": "count",
    "report_type": "Reporting::Reports::VisitorCountReport",
    "report_name": "New Subscribers"
  }
}

Need the original Markdown? Open raw file