Docs

REST API

Read your store's tests and their results from your own code with a developer API key.

The developer API gives read access to a store's tests and their headline results: visitors, orders, conversion rate and revenue per version. Use it to pull results into a spreadsheet, a BI tool or an internal dashboard.

The API is read-only. It can't create, change, launch or end tests. To set up tests from an AI app, use the MCP server.

Get an API key

  1. Open the API key settings

    Go to Store settings → API key.

  2. Generate the key

    Click Generate API Key. The key appears under Your API Key.

  3. Copy it now

    Click Copy and store the key somewhere safe, such as a password manager or your server's secret store. ab.one shows it only this once.

  • One key per store. It reads only that store's data.
  • ab.one keeps only a hash of the key and its last 4 characters. If you lose the key, click Generate New Key. The old key stops working at once.
  • Only the store's owners and admins can generate or revoke the key. Other team members see "You don't have permission to manage this store's credentials".
  • Keys start with ab_live_.

Keep the key on your server. Don't put it in theme code, a browser script or a public repository: anyone with the key can read the store's test results.

Revoke the key

Click Revoke Key under Store settings → API key. From then on, requests with the old key get 401. Generating a new key also replaces the old one.

Base URL and authentication

https://app.ab.one/api/v1/developer

Send the key in one of these headers:

X-API-Key: ab_live_…
Authorization: Bearer ab_live_…

If both are present, X-API-Key is used. Call the API from a server or a script: browsers block requests from web pages on other domains (CORS).

Endpoints

MethodPathReturns
GET/testsAll tests of the store, newest first
GET/tests/:testIdOne test

List tests

GET /api/v1/developer/tests

Returns every test of the store, including drafts and ended tests, newest first. There's no paging or filtering.

{
  "data": [
    {
      "id": "3f1c2a9e-5b7d-4e21-9a0c-8d6f4b2e1a37",
      "name": "Product page: trust badges",
      "status": "live",
      "type": "ab",
      "primaryGoalMetric": "cvr",
      "totalVisitors": 4210,
      "revenue": 18342,
      "startedAt": "2026-10-12T08:30:00.000Z",
      "endedAt": null,
      "variants": [
        {
          "id": "a0e4c7d2-1f3b-4c58-9e6a-2b7d8f1c4e90",
          "name": "Control",
          "isControl": true,
          "visitors": 2098,
          "conversions": 51,
          "cvr": "2.431",
          "revenue": 8876,
          "aov": 174.03,
          "rpv": 4.23,
          "ctr": 38.2
        },
        {
          "id": "b71d5e3a-8c2f-4a96-b1d0-7e3f9a2c6b18",
          "name": "Variant B",
          "isControl": false,
          "visitors": 2112,
          "conversions": 58,
          "cvr": "2.746",
          "revenue": 9466,
          "aov": 163.21,
          "rpv": 4.48,
          "ctr": 40.1
        }
      ]
    }
  ]
}

A store without tests gets { "data": [] }.

Get one test

GET /api/v1/developer/tests/:testId

testId is the test's ID, a UUID. You find it in the address of the test page in ab.one (/tests/3f1c…) or in the list above. The response is { "data": { … } } with one test, in the same shape as in the list.

Fields

Test

FieldTypeWhat it is
idstringThe test's ID.
namestringThe test's name.
statusstringdraft, scheduled, live, paused or ended. See Test statuses.
typestringab for a Template test, split_url for a Split URL test.
primaryGoalMetricstringThe test's goal: cvr, rpv, aov, atc or ctr. See Goals and metrics.
totalVisitorsnumberVisitors across all versions.
revenuenumberRevenue across all versions, in the store's currency, rounded to whole units.
startedAtstring or nullWhen the test went live (ISO 8601, UTC).
endedAtstring or nullWhen the test ended.
variantsarrayThe versions, control first.

Version (variants[])

FieldTypeWhat it is
idstringThe version's ID. Webhooks use the same ID in variantId and winner.
namestringThe version's name.
isControlbooleantrue for the control.
visitorsnumberVisitors who saw this version.
conversionsnumberOrders from those visitors.
cvrstringConversion rate in percent with 3 decimals, for example "2.431". It's a string, not a number.
revenuenumberRevenue, in the store's currency, rounded to whole units.
aovnumberAverage order value.
rpvnumberRevenue per visitor.
ctrnumberClickthrough rate in percent: visitors who viewed more than one page.

These are the headline numbers the test page shows, and they follow the store's Exclude $0 orders setting (General settings). Significance, breakdowns and the visitor log aren't part of the API. For those, use the test page or export the results.

Examples

curl:

curl https://app.ab.one/api/v1/developer/tests \
  -H "X-API-Key: $ABONE_API_KEY"

JavaScript (Node.js 18 or later):

const res = await fetch("https://app.ab.one/api/v1/developer/tests", {
  headers: { "X-API-Key": process.env.ABONE_API_KEY },
});
if (!res.ok) throw new Error(`ab.one API: ${res.status}`);
const { data: tests } = await res.json();

for (const test of tests.filter((t) => t.status === "live")) {
  for (const v of test.variants) {
    console.log(test.name, v.name, `${v.cvr} %`, v.revenue);
  }
}

One test, with the Authorization header:

curl https://app.ab.one/api/v1/developer/tests/3f1c2a9e-5b7d-4e21-9a0c-8d6f4b2e1a37 \
  -H "Authorization: Bearer $ABONE_API_KEY"

Errors

Errors come back as JSON with a code and a message:

{ "error": { "code": "UNAUTHORIZED", "message": "Invalid API key." } }
StatuscodeWhen
400–testId isn't a UUID. This response has a different body: { "success": false, "error": { … } } with the validation details.
401UNAUTHORIZEDNo key sent ("API key is required."), or the key is wrong, revoked or in an old format ("Invalid API key.").
404NOT_FOUNDThe test doesn't exist or belongs to another store ("Test not found."), or the path doesn't exist ("Route not found").
429RATE_LIMITEDToo many requests. Wait for the number of seconds in the Retry-After header.
500INTERNAL_SERVER_ERRORSomething went wrong on ab.one's side. Try again later.

Rate limit

120 requests per minute per IP address. Every request counts, including ones with a wrong key. Above the limit you get 429 and a Retry-After header in seconds.

Results change slowly, so polling every few minutes is enough. To react when a test starts or ends, use webhooks instead of polling.