Skip to content

start_test

Pay for one option of a quote in USDC on Base over x402, and open a ten-day demand test.

POST/api/agent/tests
MCP tool start_testPaid

start_test turns a quote into a real test. It is called twice: first without a payment, to get an x402 payment request for the exact amount; then again with the signed payment, which opens the test. A person reviews every test before its ads run, and a declined test is refunded in full.

The price is the option's total_usd: its ad budget plus the $29 launch fee, in one USDC payment on Base. With sandbox: true the same flow runs on Base Sepolia for 1 test USDC and no ads run.

Parameters

Name Type Description
quote_id string Required. The quote_id from quote_test. Quotes hold for 30 minutes.
option signal · clear · compare · yours Which of the quote's options to pay for. Default signal.
payment string Over MCP: the x402 payment, base64, as an x402 client makes it. Leave it out to get the payment request. Over REST, send it in the PAYMENT-SIGNATURE header instead.
idempotency_key string Any string; use a random one of at least 16 characters. The same key again returns the same test and never charges twice.
webhook_url string A public https address told of every change, signed with the webhook_secret returned once.
sandbox boolean Base Sepolia and test USDC; no ads run. Default false.

1. Ask for the payment request

curl -i -X POST https://app.decalabs.ai/api/agent/tests \
  -H "content-type: application/json" \
  -d '{"quote_id": "q1.…", "option": "signal", "sandbox": true, "idempotency_key": "6f1c…"}'

The answer is 402 Payment Required. The body and the PAYMENT-REQUIRED header carry the request; deca says what it pays for:

JSON
{
  "x402Version": 2,
  "accepts": [{ "scheme": "exact", "network": "eip155:84532", "amount": "1000000", "payTo": "0x7FB30eD8D7a7B45EE7b98903d94D87D1B9C3DaD2", "…": "…" }],
  "deca": { "pay": "$1 test USDC", "budget_usd": 600, "launch_fee_usd": 29, "total_usd": 629, "network": "Base Sepolia (sandbox)", "option": "signal", "pass_line": 15 }
}
Warning

Check payTo before you pay. DECA's wallet is decalabs.base.eth, 0x7FB30eD8D7a7B45EE7b98903d94D87D1B9C3DaD2. A request to pay any other address did not come from DECA.

2. Pay and open the test

Sign the request with an x402 client and send the same request again with the payment. Most x402 clients cap a payment at $1 by default; raise the cap to the test's total first. The full client code is in Paid tests.

The answer is 201 with the test, in in_review:

JSON
{
  "test": { "id": "…", "state": "in_review", "sandbox": true, "option": "signal", "budget_usd": 600, "pass_line": 15, "payment": { "network": "base-sepolia", "amount_usdc": 1, "tx": "0x…" }, "next": "A person reviews the idea before its ads run, usually within one business day." },
  "access_token": "deca_tt_…",
  "note": "Keep access_token: with it (or the key the test was paid with) get_test reads this test. It is not shown again."
}

Keep access_token: it is the only way to read a test paid without an API key. A 202 means the payment was sent but its settlement did not answer yet; read the test with get_test and do not pay again.

Errors

Code Status What to do
quote_invalid · quote_expired 400 Call quote_test again
option_not_in_quote 400 Use one of the quote's options
over_cap · over_month_cap 403 A smaller option, or ask the key's owner to raise its cap
payment_invalid 402 Fix the part why names, then pay the new request
payment_already_used · idempotency_key_used 409 Read the existing test, or use a new key for a new test
payments_unavailable 503 Nothing was charged; retry later, or use the sandbox

Every code is in Errors.