Contact statistics
const url = 'https://api.getsitecontrol.com/v1/sites/1/contacts/stats';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.getsitecontrol.com/v1/sites/1/contacts/stats \ --header 'Authorization: Bearer <token>'The number of contacts matching the filters now, by status. Takes the same
filters as list_contacts; call it for totals instead of walking the list.
all is the sum of the three statuses. Deleted contacts are not counted.
segment_id applies the conditions of the segment as they are now.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Query Parameters
Section titled “Query Parameters”Any of these statuses; repeat for several. subscribed: subscribed, with double opt-in confirmed or not needed; unsubscribed: unsubscribed, never subscribed or awaiting double opt-in; bounced: the address bounced or failed the e-mail check
Any of these statuses; repeat for several. subscribed: subscribed, with double opt-in confirmed or not needed; unsubscribed: unsubscribed, never subscribed or awaiting double opt-in; bounced: the address bounced or failed the e-mail check
Tagged with any of these tag ids from list_tags; repeat for several
Tagged with any of these tag ids from list_tags; repeat for several
In any of these countries, ISO 3166-1 alpha-2 codes such as US; repeat for several
In any of these countries, ISO 3166-1 alpha-2 codes such as US; repeat for several
With any of these whole addresses, without case; repeat for several
With any of these whole addresses, without case; repeat for several
Part of the e-mail, phone, first or last name, without case; % and _ are plain characters. Digits also match the id. To find a contact by its address, use email
Part of the e-mail, phone, first or last name, without case; % and _ are plain characters. Digits also match the id. To find a contact by its address, use email
created_at at or after this moment; without an offset, taken as UTC; a plain date means its start
created_at at or after this moment; without an offset, taken as UTC; a plain date means its start
created_at before this moment; without an offset, taken as UTC; a plain date means its start
created_at before this moment; without an offset, taken as UTC; a plain date means its start
updated_at at or after this moment; without an offset, taken as UTC; a plain date means its start. Only contacts with a recorded change match
updated_at at or after this moment; without an offset, taken as UTC; a plain date means its start. Only contacts with a recorded change match
Matching the conditions of this segment, a segment id from list_segments
Matching the conditions of this segment, a segment id from list_segments
Matching a tree of conditions, as JSON: the language of create_segment conditions, without saving a segment; for example contacts without a first name: {“op”: “and”, “args”: [{“op”: “undefined”, “args”: [”{{$contact.firstName}}”]}]}
Matching a tree of conditions, as JSON: the language of create_segment conditions, without saving a segment; for example contacts without a first name: {“op”: “and”, “args”: [{“op”: “undefined”, “args”: [”{{$contact.firstName}}”]}]}
Responses
Section titled “Responses”object
Contacts matching the filters, by current status
object
The sum of the three statuses
Subscribed, with double opt-in confirmed or not needed
Unsubscribed, never subscribed or awaiting double opt-in
The address bounced or failed the e-mail check
{ "total": { "all": 1, "subscribed": 1, "unsubscribed": 1, "bounced": 1 }}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
Authentication scheme: Bearer
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
segment_not_found: no segment segment_id on the site
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
segment_conditions_invalid: the conditions cannot be applied, the ones in conditions or the saved ones of the segment, which are fixed in the admin. validation_failed: a parameter is invalid
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
rate_limited: a request limit is spent; this request also spends the heavy request limit
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
Seconds until the bucket refills
temporarily_unavailable: the request took too long, or limits or idempotency keys cannot be enforced; narrow the filters or retry later
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds