Sign inGet Started

Get audience membership statistics

GET
/v1/audiences/{audience_id}/membership-statistics
const history = await bird.audiences.membershipHistory(
  "adn_01krdgeqcxet5s7t44vh8rt9mg",
  {
    from: "2026-10-09",
    to: "2026-10-12",
  },
);
for (const point of history.data) {
  console.log(point.bucket, point.total, point.observed_at);
}
Odpowiedź200
{
  "period": {
    "from": "2026-10-09",
    "to": "2026-10-12",
    "data_as_of": null
  },
  "data": [
    {
      "bucket": "2026-10-09",
      "total": null,
      "observed_at": null
    },
    {
      "bucket": "2026-10-10",
      "total": 0,
      "observed_at": "2026-10-10T00:07:12.218Z"
    },
    {
      "bucket": "2026-10-11",
      "total": 1279,
      "observed_at": "2026-10-11T00:05:48.903Z"
    },
    {
      "bucket": "2026-10-12",
      "total": 1284,
      "observed_at": "2026-10-12T00:06:31.44Z"
    }
  ]
}

Returns the first successful observation for each requested UTC date, in chronological order. Changes between observations are unobserved. A missing observation has null total and observed_at; a successful empty audience has zero members. History retains today and the preceding 364 UTC dates; older requested dates are gaps. No history is reconstructed before observation began.

Only daily UTC observations are supported. Period data_as_of is always null because samples do not establish continuous freshness; each point carries its actual observed_at. Future, reversed, invalid or longer-than-365-date windows return 422. For the current exact count, use Get audience membership.

Returns 421 when the workspace's organization is served from a different region from the API host. Retry against that workspace's regional host.

Parametry

audience_idstring

ID of the audience whose observations to read.

Parametry zapytania

fromstring

Inclusive first UTC date. Defaults to 30 days before to, yielding 31 inclusive dates.

tostring

Inclusive last UTC date. Defaults to today in UTC; future dates are rejected. At most 365 inclusive dates.

Treść odpowiedzi

period
object
wymagane

Requested UTC date window.

Pokaż atrybuty podrzędne
period.from
string
wymagane

Inclusive first UTC date.

period.to
string
wymagane

Inclusive last UTC date.

period.data_as_of
nullable string
wymagane

Always null. Use each point's observed_at for its actual observation instant.

data
array of object
wymagane

One point for every requested date, including gaps.

Pokaż atrybuty podrzędne

Przejdź do dokumentacji, przewodników i przykładów dotyczących tego tematu.