Skip to content

Contact statistics

GET
https://api.getsitecontrol.com/v1/sites/{site_id}/contacts/stats
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.

FieldDescription
site_id
required
Site Id
integer
FieldDescription
status
Status

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

Array<string>
Allowed values: subscribed unsubscribed bounced

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

tag_ids
Tag Ids

Tagged with any of these tag ids from list_tags; repeat for several

Array<integer>
<= 50 items

Tagged with any of these tag ids from list_tags; repeat for several

country
Country

In any of these countries, ISO 3166-1 alpha-2 codes such as US; repeat for several

Array<string>
<= 50 items

In any of these countries, ISO 3166-1 alpha-2 codes such as US; repeat for several

email
Email

With any of these whole addresses, without case; repeat for several

Array<string>
<= 50 items

With any of these whole addresses, without case; repeat for several

search
Search

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

string
>= 1 characters <= 255 characters

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_since
Created Since

created_at at or after this moment; without an offset, taken as UTC; a plain date means its start

string format: date-time

created_at at or after this moment; without an offset, taken as UTC; a plain date means its start

created_before
Created Before

created_at before this moment; without an offset, taken as UTC; a plain date means its start

string format: date-time

created_at before this moment; without an offset, taken as UTC; a plain date means its start

updated_since
Updated Since

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

string format: date-time

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

segment_id
Segment Id

Matching the conditions of this segment, a segment id from list_segments

integer

Matching the conditions of this segment, a segment id from list_segments

conditions
Conditions

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}}”]}]}

string
<= 4000 characters

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}}”]}]}

Successful Response

Media typeapplication/json
ContactsStatsTotal
object
FieldDescription
total
required
Total

Contacts matching the filters, by current status

object
FieldDescription
all
required
All

The sum of the three statuses

integer
subscribed
required
Subscribed

Subscribed, with double opt-in confirmed or not needed

integer
unsubscribed
required
Unsubscribed

Unsubscribed, never subscribed or awaiting double opt-in

integer
bounced
required
Bounced

The address bounced or failed the e-mail check

integer

Example · Generated

{
"total": {
"all": 1,
"subscribed": 1,
"unsubscribed": 1,
"bounced": 1
}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Unsupported GSC-Version

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"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": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Missing or invalid API key or access token

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"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": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

WWW-Authenticate
string

Authentication scheme: Bearer

Access denied

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"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": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

segment_not_found: no segment segment_id on the site

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"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": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Media typeapplication/problem+json

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

Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"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": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

rate_limited: a request limit is spent; this request also spends the heavy request limit

Media typeapplication/problem+json
Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"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": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds

Retry-After
integer

Seconds until the bucket refills

Media typeapplication/problem+json

temporarily_unavailable: the request took too long, or limits or idempotency keys cannot be enforced; narrow the filters or retry later

Problem

The documented shape of every error body on the versioned surface.

object
FieldDescription
type
required
Type
string
title
required
Title
string
status
required
Status
integer
detail
Detail
string
nullable
instance
required
Instance
string
reason
Reason
string
nullable
next
Next
string
nullable
request_id
required
Request Id
string
errors
Errors
Array<object>
nullable
ValidationIssue
object
FieldDescription
loc
required
Loc
Array
msg
required
Msg
string
type
required
Type
string
metadata
Metadata
object

Example · Generated

{
"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": {}
}
FieldDescription
GSC-Version
string

API version the response was produced for

X-Request-Id
string

Request id, echoed from the request when valid

X-RateLimit-Limit
integer

Limit of the tightest bucket

X-RateLimit-Remaining
integer

Requests left in its window

X-RateLimit-Reset
integer

End of its window, epoch seconds