Run an analysis
Ask a question about a report, quote it, run it and read it.
Outcome Lab describes what happened after a search report's matches: how the price moved
over stages, how many events followed, and how the groups compare. It is descriptive, not a
forecast.
Analytics is available on every plan.
Start from the question library
A complete analysis spec is large. The question library returns ready-made specs, already
aware of the report you pass in:
curl -s -H "X-API-Key: $DEJABARS_KEY" "$API/analytics/questions" | head -c 1200
Each question has an id, a description and a spec. Use that spec as-is; it is the
supported way to ask a question without inventing a rule tree.
Price it
curl -s -X POST "$API/analytics/offer" \
-H "X-API-Key: $DEJABARS_KEY" \
-H 'Content-Type: application/json' \
-d '{"spec": <spec from the question>}'
{
"offer_id": "f1c2…",
"cost_total": 18,
"cost_is_free": false,
"expires_in": 60
}
The quote reserves the price for 60 seconds. Asking costs nothing. If the account cannot
afford it, the response is 402 with the cost and the shortfall.
Run it
curl -s -X POST "$API/analytics" \
-H "X-API-Key: $DEJABARS_KEY" \
-H 'Content-Type: application/json' \
-d '{
"spec": <spec from the question>,
"offer_id": "f1c2…"
}'
The response carries an analysis id. A run may take a moment; poll the result endpoint
until it is ready.
curl -s -H "X-API-Key: $DEJABARS_KEY" "$API/analytics/<analysis_id>"
Read it
The result has three useful blocks:
| Block | What it answers |
|---|---|
| Stage table | What happened in each window after the match |
| Event table | How often each event occurred, and when |
| Conditional table | How one condition changed the outcome of another |
Every table is descriptive. Sample sizes are shown next to the numbers; a row with a small
sample is not a trend. Export the whole result if you want to chart it yourself:
curl -s -H "X-API-Key: $DEJABARS_KEY" \
"$API/analytics/<analysis_id>/export" -o analysis.csv
Cost and limits
- The quote is the price. Running without an
offer_idstill charges the current price. - A cheap "fast verification" pass exists for checking a spec before a paid run; it is not
a substitute for the analysis.
- One run at a time per account. A burst queues.
- The report must still be available. Expired reports cannot be analysed.
A good first question
Ask the library for the similarity question. It compares how the price behaved after the
closest matches versus the rest of the report, which is the most direct check on whether
the pattern found something worth looking at. Read the stage table first, then the event
table; ignore a conditional table until the sample is large enough to mean something.
Try a quote in the playground.
Open the interactive reference and run the operation with your key.
