Skip to main content
POST
Create a custom result query

Authorizations

Authorization
string
header
required

Bearer tokens created in the ABConvert admin under Settings → MCP & API Access. Scopes: read_experiments and write_experiments (write implies read; the default is read). See Authentication for which scope each request needs.

Path Parameters

id
string
required

The test's numeric ID as a string, for example "3021".

Pattern: ^[0-9]+$
Example:

"3021"

Body

application/json
breakdown
enum<string>[]

Group the rows by one or two dimensions. Order doesn't matter: it names a query, and the same pair in either order is the same query. Naming the same dimension twice returns 422 duplicate_breakdown_dimension. Grouping by product_id also needs product_group_id (that group is what the products are resolved from), and without it the request returns 422 product_id_requires_product_group.

Required array length: 1 - 2 elements

A dimension a custom result query can group by. product_id requires product_group_id, which scopes it to that product group's products.

Available options:
date,
country,
market,
device,
visitor_type,
traffic_channel,
traffic_platform,
referral_domain,
landing_page,
utm_source,
utm_medium,
utm_campaign,
utm_term,
utm_content,
product_id
sample_basis
enum<string>

Which visitors count. assignment includes every visitor put in a test group; exposure only those the test actually reached. exposure is only available on tests measured that way; asking for it elsewhere returns 422 sample_basis_unsupported.

Available options:
assignment,
exposure
product_group_id
string

Scope the query to one product group. Read the id from a test's product_group; any other value returns 422 product_group_not_found.

Pattern: ^[a-fA-F0-9]{24}$
date_range
object

Inclusive window, both bounds required. Defaults to the test's own lifetime. An unknown key here returns 422 invalid_date_range.

The window is narrowed to the days that can hold data: no earlier than the day the test started, no later than today. Asking for more isn't an error. The window isn't narrowed to the day the test ended: orders count on the day they were placed, so a window past the end date picks up conversions from visitors assigned before it.

A window that can hold nothing at all (ending before the test started, or beginning after today) returns 422 date_range_out_of_bounds.

Response

A computed snapshot already answers this query.

A custom result query job. Beta.

status is pending until the snapshot is computed, then completed or failed. The result fields are present only when completed.

object
string
required
Allowed value: "results_query"
id
string
required

Treat as opaque. Never parse it.

Example:

"66d3b91c4f2a7e5081c9a3b7"

experiment_id
string
required
Example:

"3021"

status
enum<string>
required
Available options:
pending,
completed,
failed
failure_reason
string | null

Why the query failed, in plain language. Present only when status is failed. Run the query again; if it fails again, send support this text and the query id.

computed_at
string<date-time> | null
test_groups
object[]

Whole-test totals. Present on a query with no breakdown; a dimensional query answers with breakdown.rows instead, and carries no separate totals.

breakdown
object | null

Present when the query named a breakdown.