Tests

Create test

Commit to a Test. Its intent is frozen from this moment.

POST
/api/v1/tests

Pass a next_test_id computed now (same window / funnel), or a custom test with its hypothesis and the evidence it rests on. A changed mind is a new Test with supersedes_id, never an edit. Touches nothing on Meta.

Requires a key with write scope or higher.

MCP: meta_create_test.

Authorization

bearerAuth
headerAuthorizationBearer <token>

An API key from Settings → API keys, sent as Authorization: Bearer rsk_….

Authorization has two independent axes.

The scope is ranked — a key satisfies any requirement at or below its own tier:

  • read — every GET.
  • write — launch ads PAUSED, sync, pull history, edit thresholds, Values, briefs, tests, swipes and research.
  • admin — everything write can. No operation requires more than write today.

There is no approve scope. It was a rung once; it is not one now, and a key requested with it is rejected.

The approval grant (can_approve) is a separate boolean, not a rung. Changing spend on Meta — activating a launch, pausing or resuming ads, retargeting an ad set, or rebuilding a launch's live creative — needs write and the grant. Keeping them on separate axes is what makes the review gate a control rather than a convention: a key that may propose is not automatically a key that may approve its own proposal.

A key reaches the one workspace — one Meta ad account — it was minted in, and stops working when the operator who minted it leaves the workspace. The same key authenticates the MCP endpoint (/api/mcp) for a headless agent, with the same scope and grant.

Header Parameters

Idempotency-Key?string

Any unique string up to 256 characters. A retry with the same key and body replays the first success (Idempotency-Replay: true) instead of doing the work twice; the same key with a different body is refused.

Lengthlength <= 256

Request Body

application/json
  1. body
next_test_id?string
Length1 <= length <= 300
window?string
Default"90d"
Value in"30d""90d""180d""lifetime"
funnel?string

The funnel the Next tests were read in; for an exploration that pools funnels, where to run it.

Value in"instant_form""website""messaging""profile""traffic""unknown"
custom?
hypothesis?string

Overrides the default hypothesis written from the Next test.

Lengthlength <= 800
comparator?string
Default"baseline"
Value in"reference""baseline"
min_expected_goals?number
Range1 <= value <= 1000
maturity_days?integer
Range0 <= value <= 90
window_days?integer
Range1 <= value <= 180
supersedes_id?string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
brief_id?string

The brief this Test judges; it is linked, and learned when the Test concludes.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid

Response Body

Created. The body is the tool's own result — the same payload the MCP tool returns.

application/json
  1. response
Example Request
curl -X POST 'https://winandscale.com/api/v1/tests' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{}