Segments

Full reference for the Segments resource in the bluefox.email API. See the API overview for authentication, the response envelope, and pagination.

List segments

GET /v1/projectId/{projectId}/segments

Parameters

NameInTypeRequiredDescription
projectIdpathstringyesThe project _id, found in the app under Project Settings.
limitqueryintegerMax items per page. Capped at 30.
skipqueryintegerNumber of items to skip, for pagination.
sortquerystringField to sort by.
orderquerystring
filter[<field>]querystringExact-match filter on a top-level field, e.g. filter[name]=Welcome. Repeatable for multiple fields.

Responses

StatusDescription
200OK
403Missing or invalid API key

Response body

FieldTypeRequiredDescription
itemsarray
countintegerTotal matching items across all pages, not just this page.
nextstringFull URL (path + query string) of the next page, or null if this is the last page.

Create a segment

POST /v1/projectId/{projectId}/segments

Parameters

NameInTypeRequiredDescription
projectIdpathstringyesThe project _id, found in the app under Project Settings.

Request body

FieldTypeRequiredDescription
namestringyes
groupsarray of objectOR-ed groups of AND-ed conditions - matches the segment builder in the app.
groups[].conditionsarray of object
groups[].conditions[].categorystring (contact-property | engagement)
groups[].conditions[].propertystringA custom contact field name, or "createdAt". Required unless operator is "any" or a tag operator.
groups[].conditions[].operatorstring (any | equals | does-not-equal | contains | does-not-contain | is-empty | is-not-empty | is-true | is-false | greater-than | greater-than-or-equal | less-than | less-than-or-equal | has-tag | does-not-have-tag | opened | not-opened | clicked | not-clicked | received | not-received | date-equals | date-before | date-after | date-in-last | date-more-than)
groups[].conditions[].valueanyType depends on operator/property - string, number, boolean, or date string.

Responses

StatusDescription
201Created
400Invalid request body or query - every violation found (missing/invalid/unexpected fields) is reported in one response, semicolon-separated, not just the first one hit.
403Missing or invalid API key

Response body

FieldTypeRequiredDescription
_idstring
namestring
groupsarray of objectOR-ed groups of AND-ed conditions - matches the segment builder in the app.
groups[].conditionsarray of object
groups[].conditions[].categorystring (contact-property | engagement)
groups[].conditions[].propertystringA custom contact field name, or "createdAt". Required unless operator is "any" or a tag operator.
groups[].conditions[].operatorstring (any | equals | does-not-equal | contains | does-not-contain | is-empty | is-not-empty | is-true | is-false | greater-than | greater-than-or-equal | less-than | less-than-or-equal | has-tag | does-not-have-tag | opened | not-opened | clicked | not-clicked | received | not-received | date-equals | date-before | date-after | date-in-last | date-more-than)
groups[].conditions[].valueanyType depends on operator/property - string, number, boolean, or date string.
createdAtstring
updatedAtstring

Get a single segment

GET /v1/projectId/{projectId}/segments/{id}

Parameters

NameInTypeRequiredDescription
projectIdpathstringyesThe project _id, found in the app under Project Settings.
idpathstringyes

Responses

StatusDescription
200OK
403Missing or invalid API key
404Segments not found

Response body

FieldTypeRequiredDescription
_idstring
namestring
groupsarray of objectOR-ed groups of AND-ed conditions - matches the segment builder in the app.
groups[].conditionsarray of object
groups[].conditions[].categorystring (contact-property | engagement)
groups[].conditions[].propertystringA custom contact field name, or "createdAt". Required unless operator is "any" or a tag operator.
groups[].conditions[].operatorstring (any | equals | does-not-equal | contains | does-not-contain | is-empty | is-not-empty | is-true | is-false | greater-than | greater-than-or-equal | less-than | less-than-or-equal | has-tag | does-not-have-tag | opened | not-opened | clicked | not-clicked | received | not-received | date-equals | date-before | date-after | date-in-last | date-more-than)
groups[].conditions[].valueanyType depends on operator/property - string, number, boolean, or date string.
createdAtstring
updatedAtstring

Partially update a segment

PATCH /v1/projectId/{projectId}/segments/{id}

Merges the given fields into the existing document - omitted fields are left unchanged. Nothing is required (unlike create) since every field is optional on a partial update.

Parameters

NameInTypeRequiredDescription
projectIdpathstringyesThe project _id, found in the app under Project Settings.
idpathstringyes

Request body

FieldTypeRequiredDescription
namestring
groupsarray of objectOR-ed groups of AND-ed conditions - matches the segment builder in the app.
groups[].conditionsarray of object
groups[].conditions[].categorystring (contact-property | engagement)
groups[].conditions[].propertystringA custom contact field name, or "createdAt". Required unless operator is "any" or a tag operator.
groups[].conditions[].operatorstring (any | equals | does-not-equal | contains | does-not-contain | is-empty | is-not-empty | is-true | is-false | greater-than | greater-than-or-equal | less-than | less-than-or-equal | has-tag | does-not-have-tag | opened | not-opened | clicked | not-clicked | received | not-received | date-equals | date-before | date-after | date-in-last | date-more-than)
groups[].conditions[].valueanyType depends on operator/property - string, number, boolean, or date string.

Responses

StatusDescription
200OK
400Invalid request body or query - every violation found (missing/invalid/unexpected fields) is reported in one response, semicolon-separated, not just the first one hit.
403Missing or invalid API key
404Segments not found

Response body

FieldTypeRequiredDescription
_idstring
namestring
groupsarray of objectOR-ed groups of AND-ed conditions - matches the segment builder in the app.
groups[].conditionsarray of object
groups[].conditions[].categorystring (contact-property | engagement)
groups[].conditions[].propertystringA custom contact field name, or "createdAt". Required unless operator is "any" or a tag operator.
groups[].conditions[].operatorstring (any | equals | does-not-equal | contains | does-not-contain | is-empty | is-not-empty | is-true | is-false | greater-than | greater-than-or-equal | less-than | less-than-or-equal | has-tag | does-not-have-tag | opened | not-opened | clicked | not-clicked | received | not-received | date-equals | date-before | date-after | date-in-last | date-more-than)
groups[].conditions[].valueanyType depends on operator/property - string, number, boolean, or date string.
createdAtstring
updatedAtstring

Delete a segment

DELETE /v1/projectId/{projectId}/segments/{id}

Parameters

NameInTypeRequiredDescription
projectIdpathstringyesThe project _id, found in the app under Project Settings.
idpathstringyes

Responses

StatusDescription
200Deleted
403Missing or invalid API key
404Segments not found
405The operation is blocked by a business rule (e.g. the resource is still in use)

Response body

FieldTypeRequiredDescription
_idstring
namestring
groupsarray of objectOR-ed groups of AND-ed conditions - matches the segment builder in the app.
groups[].conditionsarray of object
groups[].conditions[].categorystring (contact-property | engagement)
groups[].conditions[].propertystringA custom contact field name, or "createdAt". Required unless operator is "any" or a tag operator.
groups[].conditions[].operatorstring (any | equals | does-not-equal | contains | does-not-contain | is-empty | is-not-empty | is-true | is-false | greater-than | greater-than-or-equal | less-than | less-than-or-equal | has-tag | does-not-have-tag | opened | not-opened | clicked | not-clicked | received | not-received | date-equals | date-before | date-after | date-in-last | date-more-than)
groups[].conditions[].valueanyType depends on operator/property - string, number, boolean, or date string.
createdAtstring
updatedAtstring