Core jobsRun a search

Run a search

Encode a sketch, price it, submit it and follow the run.

A search compares your sketch with every tracked market on one timeframe and returns the

windows that look closest. It is asynchronous: submit, poll, then read the result.

The pattern

Send two arrays of the same length:

  • pattern — the Y value of each point, normalised to the 0–1 range.
  • xs — the X position of each point, also 0–1 and increasing.
{
  "pattern": [0.42, 0.51, 0.47, 0.63, 0.58],
  "xs": [0.0, 0.2, 0.4, 0.6, 0.8]
}

Two points is the minimum; 500 is the maximum. If you omit xs, the points are spread

evenly. A sketch drawn on the site is already in this form, so you can export the points

from the editor and send them unchanged.

Pick a matcher

curl -s -H "X-API-Key: $DEJABARS_KEY" "$API/search/algorithms"

Each entry has an id (geo, dtw, wdtw, erp, lcss, sax, matrix_profile,

cross_correlation), a description, and a cost multiplier. geo is the geometric matcher:

it is the cheapest and the one the free window covers. dtw is the classic shape

distance. The others trade speed for a different notion of similarity.

Price it before you run it

The quote locks the price and the parameters for 60 seconds. It costs nothing to ask.

HASH="$(python3 - <<'PY'
points = [0.42, 0.51, 0.47, 0.63, 0.58]
print(",".join(f"{p:.4f}" for p in points))
PY
)"

curl -s -X POST "$API/search-offer" \
  -H "X-API-Key: $DEJABARS_KEY" \
  -H 'Content-Type: application/json' \
  -d "{
    \"pattern_hash\": \"$HASH\",
    \"timeframe\": \"1h\",
    \"period_days\": 30,
    \"search_mode\": \"geo\"
  }"
{
  "offer_id": "b0f1…",
  "cost_total": 0,
  "cost_is_free": true,
  "expires_in": 60
}

The pattern_hash is the points joined as text, each fixed to four decimals. It is an

identifier, not a secret; the same sketch always produces the same value. Send the same

value in the task so the server can match the offer to the submission.

If the quote returns 402, the account cannot afford that combination. The detail names

the shortfall and the factors. Try a cheaper timeframe, a shorter period or geo.

Submit

curl -s -X POST "$API/search-task" \
  -H "X-API-Key: $DEJABARS_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: scan-2026-11-13-001' \
  -d "{
    \"pattern\": [0.42, 0.51, 0.47, 0.63, 0.58],
    \"xs\": [0.0, 0.2, 0.4, 0.6, 0.8],
    \"timeframe\": \"1h\",
    \"period_days\": 30,
    \"search_mode\": \"geo\",
    \"max_distance\": 0.35,
    \"check_dirs\": true,
    \"check_angles\": true,
    \"check_ratios\": true,
    \"check_turns\": true,
    \"check_peaks\": true,
    \"offer_id\": \"b0f1…\",
    \"pattern_hash\": \"$HASH\"
  }"
{
  "task_id": "9f2c…",
  "status": "queued",
  "delayed_seconds": 0,
  "queued_behind_running": false
}

Notes:

  • One search runs per account at a time. A second submission waits behind it and the

response sets queued_behind_running to true.

  • Only the searches you actually start are charged. Sending the same Idempotency-Key

twice returns the first task instead of starting a second paid search.

  • max_distance is the tolerance, from 0 (exact) to 1 (loose). Lower is stricter.
  • The check_* flags only apply to geo. Leave them on unless you are deliberately

ignoring one kind of evidence.

Follow it

curl -s -H "X-API-Key: $DEJABARS_KEY" "$API/task-status/<task_id>"
# {"status":"running","progress":"42"}

status is queued, running, completed or an error state. Poll every two to five

seconds; the stream endpoint exists for browsers, but polling is the portable choice.

Read it

curl -s -H "X-API-Key: $DEJABARS_KEY" "$API/task-result/<task_id>"

The next page explains every field. If you only need one coin:

curl -s -H "X-API-Key: $DEJABARS_KEY" \
  "$API/task-result/<task_id>/symbol/BTCUSDT"

Good defaults

timeframe     1h
period_days   30
search_mode   geo      (free on 1h/4h/1d/1w up to 30 days)
max_distance  0.35
check_*       all true

Try the request in the playground with your key.

Verify a call

Open the interactive reference and run the operation with your key.

Open the playground →