Skip to content

List contacts

GET
/workspaces/{workspace}/contacts
curl --request GET \
--url 'https://api.sendtruss.com/v1/workspaces/example/contacts?status=subscribed' \
--header 'Authorization: Bearer <token>'

Newest first, 50 to a page.

workspace
required
string
/^(?:[0-9A-Za-z]{26}|ref:[A-Za-z0-9._-]{1,128})$/

The workspace: our id, or ref: plus your reference for it, such as ref:cust_4821. A reference is letters, digits, ., _ and -, up to 128 characters, and needs no URL encoding.

search
string
<= 255 characters

Only contacts whose email address contains this text.

status
string
Allowed values: subscribed unsubscribed cleaned pending

Only contacts in this marketing state.

tag
string
<= 64 characters

Only contacts with the tag that has this key.

Paginated set of ContactResource

Media typeapplication/json
object
data
required
Array
object
id
required
string
reference
required
string | null
email
required
string
status
required

The marketing state: pending until you send consent, then subscribed or unsubscribed.

string
locale
required
string | null
marketing
required

Marketing consent and when it was given or withdrawn, with who gave it: consented_by_key is the id of the API key that sent the latest accepted subscribed. Null until you send consent.

object
state
required
string
at
required
string | null
consented_at
required
string | null
consented_by_key
required
string | null
pixel_consent_at
required

When the person agreed to open tracking, or null.

string | null
attributes
required

Values by attribute definition key; {} when the contact has none.

object
tags
required
Array<object>
TagResource
object
id
required
string
key
required
string
name
required
string
color_code
required
string | null
created_at
required
string | null
updated_at
required
string | null
links
required
object
first
required
string | null
last
required
string | null
prev
required
string | null
next
required
string | null
meta
required
object
path
required

Base path for paginator generated URLs.

string | null
per_page
required

Number of items shown per page.

integer
next_cursor
required

The “cursor” that points to the next set of items.

string | null
prev_cursor
required

The “cursor” that points to the previous set of items.

string | null
Examplegenerated
{
"data": [
{
"id": "example",
"reference": "example",
"email": "example",
"status": "example",
"locale": "example",
"marketing": {
"state": "example",
"at": "example",
"consented_at": "example",
"consented_by_key": "example"
},
"pixel_consent_at": "example",
"attributes": {},
"tags": [
{
"id": "example",
"key": "example",
"name": "example",
"color_code": "example"
}
],
"created_at": "example",
"updated_at": "example"
}
],
"links": {
"first": "example",
"last": "example",
"prev": "example",
"next": "example"
},
"meta": {
"path": "example",
"per_page": 1,
"next_cursor": "example",
"prev_cursor": "example"
}
}
Request-Id
required
string format: uuid

This request’s id. Quote it when you ask us about the request.

The API key is missing, malformed, revoked or expired.

Media typeapplication/json
object
message
required

What went wrong, for a person to read. It may change, so branch on code.

string
code
required

What went wrong, for your code to branch on. A new code is not a breaking change.

string
Allowed values: unauthenticated
doc_url
required

The entry on our errors page that explains this code.

string format: uri
request_id
required

This request’s id, the same as its Request-Id header. Quote it when you ask us about the request.

string format: uuid
Example
{
"code": "unauthenticated"
}
Request-Id
required
string format: uuid

This request’s id. Quote it when you ask us about the request.

Nothing is at this path for your key. Another platform’s or another workspace’s resource answers the same as one that doesn’t exist.

Media typeapplication/json
object
message
required

What went wrong, for a person to read. It may change, so branch on code.

string
code
required

What went wrong, for your code to branch on. A new code is not a breaking change.

string
Allowed values: not_found
doc_url
required

The entry on our errors page that explains this code.

string format: uri
request_id
required

This request’s id, the same as its Request-Id header. Quote it when you ask us about the request.

string format: uuid
Example
{
"code": "not_found"
}
Request-Id
required
string format: uuid

This request’s id. Quote it when you ask us about the request.

The request is invalid. The code says why, and errors names each field at fault.

Media typeapplication/json
object
message
required

What went wrong, for a person to read. It may change, so branch on code.

string
code
required

What went wrong, for your code to branch on. A new code is not a breaking change.

string
Allowed values: validation_failed
errors
required

Each field that failed validation, by its path in the request, with its messages.

object
key
additional properties
Array<string>
doc_url
required

The entry on our errors page that explains this code.

string format: uri
request_id
required

This request’s id, the same as its Request-Id header. Quote it when you ask us about the request.

string format: uuid
Example
{
"code": "validation_failed"
}
Request-Id
required
string format: uuid

This request’s id. Quote it when you ask us about the request.

Too many requests. Wait for the seconds in Retry-After.

Media typeapplication/json
object
message
required

What went wrong, for a person to read. It may change, so branch on code.

string
code
required

What went wrong, for your code to branch on. A new code is not a breaking change.

string
Allowed values: rate_limited
doc_url
required

The entry on our errors page that explains this code.

string format: uri
request_id
required

This request’s id, the same as its Request-Id header. Quote it when you ask us about the request.

string format: uuid
Example
{
"code": "rate_limited"
}
Request-Id
required
string format: uuid

This request’s id. Quote it when you ask us about the request.

Retry-After
integer

Seconds to wait before trying again.