Sign inGet started

Get a broadcast's audience counts

GET
/v1/email/broadcasts/{broadcast_id}/counts
const counts = await bird.broadcasts.counts("eb_01krdgeqcxet5s7t44vh8rt9mg");
console.log(counts.total, counts.addressable, counts.sendable);
响应200
{
  "broadcast_id": "eb_01krdgeqcxet5s7t44vh8rt9mg",
  "status": "draft",
  "next": [
    {
      "kind": "operation"
    }
  ],
  "total": 13000,
  "addressable": 12500,
  "sendable": 12000
}
Returns a live estimate of how many contacts the broadcast can reach, narrowing from everyone in its audience down to the ones the send would go to.
  • total is every contact in the audience.
  • addressable is how many of those have an email address.
  • sendable is how many addressable contacts are not suppressed for the broadcast's category.
A transactional broadcast still reaches a contact who unsubscribed from or complained about marketing mail. A marketing broadcast does not.
The estimate can change until the broadcast sends. The broadcast must have an audience selected; otherwise, the request returns 422.
These are audience numbers, and sending does not change them: after a send they still describe who the broadcast resolved to, not what happened to them. status says which of the two situations you are in. For delivery outcomes, read the broadcast's recipients for per-recipient status, its events for the raw feed, or email statistics by broadcast for the aggregates.
参数
broadcast_id
string
Broadcast identifier. Starts with eb_.
响应载荷
broadcast_id
string
必填
The broadcast these counts are for.
status
string
必填
Where the broadcast is in its lifecycle, so the counts read in context. Anything past draft or scheduled means these numbers describe an audience the broadcast has already been sent to, not one it is about to reach.
next
array of object
What to do next, given where the broadcast is. On a broadcast that has already sent this names the reads that carry delivery outcomes, which these counts never do. An empty list means there is nothing to do; the field is absent entirely on responses that do not report next actions.
显示子属性
next.kind
string
必填
What you do about this step.
  • operation: call the operation named in operation, then read again.
  • external: act somewhere this API does not reach, then read again.
  • wait: nothing is asked of you, so read again later.
  • terminal: nothing you do resolves this, so stop retrying.
Tolerate a value you do not recognize: show the description and offer no action.
Possible values (may grow over time): operation, external, wait, terminal
next.description
string
必填
A short, human-readable label for the step, suitable for display.
next.operation
string
The operationId to call. Present only when kind is operation. The operation's own schema says how to call it; this says only which one, and what to address it with.
next.params
object
The parameters that address the operation, by name: {"sender_id": "…"} for an operation on /v1/sms/senders/{sender_id}/requirements. A parameter the operation takes in its query string is given the same way, so an operation addressed as ?subject_id= carries {"subject_id": "…"}. Every parameter the call needs is here, whether its value came from the thing you were acting on or is fixed for this step, so you can make the call from this object alone. Present only when kind is operation and the operation names a subject. A request body, when the operation takes one, is described by the operation's own schema and never appears here.
next.url
string
A URL to open. Present only when kind is external, and only when the step has one. An external step whose description says to go and do something with no URL to open is normal.
total
integer
必填
How many contacts are in the audience.
addressable
integer
必填
How many of those contacts have an email address. A contact with no address is not counted. This is never higher than total.
sendable
integer
必填
How many of the addressable contacts are not suppressed for this broadcast's category, which is who the email would actually go to. This is never higher than addressable. Which suppressions apply depends on the category, so the same audience can give a higher number for a transactional broadcast than for a marketing one. A transactional broadcast still reaches people who unsubscribed from or complained about marketing mail, and a marketing broadcast does not.