Skip to main content
POST
AhaSend Go SDK
The AhaSend API counts the contacts that a definition matches now, and returns up to 10 of them. Nothing is saved. Access requires segments:read and contacts:read, because a preview reads contacts by any rule. Request:
  • definition is required. It follows the same rules as in Create Segment. See Definitions.
  • timezone is the IANA time zone that relative times and days are read in. Without it, or with null or an empty string, they are read in UTC.
Response:
  • count is the number of contacts that match, whatever their consent. A campaign can reach fewer of them. See Members and reachable contacts.
  • The count stops after 10 seconds, and count is then null.
  • contacts holds up to 10 matching contacts, in no particular order, each with contact_id and email. They are a separate read, so they come back also when count is null. contacts is empty when they cannot be read within 10 seconds.
A refused definition or an unknown time zone answers 400, and the message names each problem.

Authorizations

Authorization
string
header
required

API key for authentication. Non-empty Security Requirement values are AhaSend API-key roles. Roles listed within one requirement object are jointly required; separate requirement objects are alternatives.

Path Parameters

account_id
string<uuid>
required

Account ID

Body

application/json

A definition to try. Nothing is saved.

definition
object
required

The rules of a segment. The root group holds conditions and groups; a group holds conditions only, so groups nest one level deep. A definition has at most 50 conditions in all, and at most 5 of them are campaign, any_campaign or campaign_count conditions. An unknown key, or a schema_version other than 1, is refused. A refused definition is answered with 400 and a message that names each problem by its path, such as conditions[3].value.

Example:
timezone
string | null

The IANA time zone that relative times and days are read in. Null, omission and an empty string all read them in UTC.

Response

What the definition matches now

object
enum<string>
required

Object type identifier

Available options:
segment_preview
count
integer | null
required

The contacts the definition matches now, whatever their consent. Null when they cannot be counted within 10 seconds.

Required range: x >= 0
contacts
object[]
required

Up to 10 of the matching contacts, in no particular order. They are returned also when count is null, and are empty when they cannot be read within 10 seconds.

Maximum array length: 10