Skip to main content
POST
Typescript (SDK)

Authorizations

Authorization
string
header
required

API key in the format: Bearer {api_token}

Headers

Idempotency-Key
string

Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.

Maximum string length: 255

Path Parameters

id
string
required

The resource's ID, as returned in its id field

Body

application/json
key
string
required

The test's handle in site code, unique on the site: lowercase letters, digits and dashes (e.g. pricing-headline). Sent to the site as the x-crevio-experiment header.

name
string
required

What the merchant calls the test.

Maximum string length: 120
path
string
required

The one page under test, e.g. /pricing or /. No trailing slash, query or fragment.

variants
object[]
required

2 to 4 versions, the control first.

Required array length: 2 - 4 elements
hypothesis
string | null

What the test expects to learn, in a sentence.

Maximum string length: 2000
goal
string
default:purchase

What counts as a conversion. purchase counts orders placed through the site's checkout. Any other value is a tracker event name the site fires with window.crevio("<goal>"), such as lead_submitted or booking_requested: a visitor converts by firing it on the site after first seeing the page. pageview is refused.

Pattern: ^[a-z0-9_]{1,40}$
primary_metric
enum<string>
default:conversion_rate

What decides the winner: the share of visitors who reach the goal, or revenue per visitor. revenue_per_visitor needs the purchase goal.

Available options:
conversion_rate,
revenue_per_visitor

Response

The draft test

object
string
required
id
string
required
site_id
string
required
key
string
required
name
string
required
hypothesis
string | null
required
path
string
required
goal
string
required
primary_metric
enum<string>
required
Available options:
conversion_rate,
revenue_per_visitor
status
enum<string>
required
Available options:
draft,
running,
shipped,
archived
shipped_variant
string | null
required
variants
object[]
required

The versions under test. The first is the control and is keyed control; weights are whole percentages of visitors that add up to 100.

Required array length: 2 - 4 elements
started_at
string<date-time> | null
required
ended_at
string<date-time> | null
required
results
object | null
required

How each version is doing, from visitors who saw only that version and what they did after first seeing it: the orders they placed for a purchase goal, or whether they fired the goal event. Null in lists, while the test is a draft, and when results are briefly unavailable. Recomputed at most every 5 minutes while running; frozen when the test ships.

created_at
string<date-time>
required
updated_at
string<date-time>
required