Audience Targeting API

View Markdown

The Audience Targeting API manages subscription pools and selects users who are most relevant for a promotion.

A pool is a set of users with a specific eligibility for push communication. Froomle uses the users in a pool to find the most relevant audience for a promotion. Rate limits can be applied to each audience request to control how often users are selected.

Specifications

Create or replace a pool

Creates or fully replaces a pool for an environment. The environment and pool_id in the request body must match the path. Pool members use typed user_id or device_id identities. Repeated members are deduplicated.

$ curl --location --request POST 'https://{subdomain}.froomle.com/api/{environment}/audience/pools/{pool_id}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "environment": "20min",
  "pool_id": "midterms_subscribers",
  "users": [
    {"device_id": 1},
    {"user_id": 2}
  ],
  "metadata": {}
}'

Manage pool memberships

Use the pool membership route to retrieve, add, or remove addressed memberships:

$ curl --location 'https://{subdomain}.froomle.com/api/{environment}/audience/pools/{pool_id}/users/{user_id}' \
--header 'Authorization: Bearer X'

$ curl --location --request PUT 'https://{subdomain}.froomle.com/api/{environment}/audience/pools/{pool_id}/users/{user_id}' \
--header 'Authorization: Bearer X'

$ curl --location --request DELETE 'https://{subdomain}.froomle.com/api/{environment}/audience/pools/{pool_id}/users/{user_id}' \
--header 'Authorization: Bearer X'

Use value_type=string or value_type=integer when a digit-only identifier needs disambiguation. An untyped path addresses both identity types.

Submit an audience request

Audience generation is asynchronous. A valid request returns 202 Accepted with a request ID, status URL, and polling guidance.

$ curl --location --request POST 'https://{subdomain}.froomle.com/api/{environment}/audience/requests' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer X' \
--data-raw '{
  "item_id": "item-1",
  "when": "2030-01-01T12:00:00Z",
  "pool_id": "midterms_subscribers",
  "size": 100,
  "size_type": "hard_limit",
  "list_name": "midterms",
  "rate_limits": {"1d": 1, "7d": 3}
}'

The response includes an opaque request ID:

{
  "request_id": "2f3d9d4a-6b5e-4b18-98cb-4fd3f7c07110",
  "status": "pending",
  "status_url": "/api/20min/audience/requests/2f3d9d4a-6b5e-4b18-98cb-4fd3f7c07110",
  "created_at": "2030-01-01T12:00:00Z",
  "retry_after_seconds": 5
}

Get request status and result

Poll the status URL until the request is succeeded or failed. When it succeeds, retrieve the result. Requesting the completed result increments the push pressure counter for the returned audience. Results may contain next_page_token; pass it as page_token to retrieve the next page.

$ curl --location 'https://{subdomain}.froomle.com/api/{environment}/audience/requests/{request_id}' \
--header 'Authorization: Bearer X'

$ curl --location 'https://{subdomain}.froomle.com/api/{environment}/audience/requests/{request_id}/result' \
--header 'Authorization: Bearer X'

The API does not schedule delivery. Interaction filtering, when enabled, excludes users who already consumed the relevant item before the requested size is applied.

Definitions

Pool request

Field Description

environment

Environment identifier. Must match the path.

pool_id

Subscription pool identifier. Must match the path.

users

Typed user_id or device_id identities. Integer and string values remain distinct.

metadata

Custom metadata associated with the pool for enrichment in reporting.

Audience request

Field Description

item_id

Item or promotion identifier.

when

Planned contact time in ISO 8601 date-time format.

pool_id

Pool from which eligible users are selected.

size

Maximum number of users to return.

size_type

Must be hard_limit.

list_name

Configured audience list name.

rate_limits

Rolling pressure limits, such as {"1d": 1, "7d": 3} for a maximum of one contact per day and three contacts per seven days.

exclude_interacted_users

Optional override for the configured interaction-filtering policy.

Errors

Errors contain code, message, and optional field-level details. A result requested before completion returns 409; expired request data returns 410; overly frequent status polling returns 429.