Last updated: November 12, 2026
Automate DejaBars from your own code, from a scheduled job, or from an AI host that
speaks the Model Context Protocol. The same pattern engine, market data and saved
catalog are available on every path; only the way you prove who you are changes.
The interactive reference lives at https://dejabars.com/developers.
This page is the written guide: what an API key can call, how to register an app,
how to approve an agent, and what a working integration looks like.
What the API is for
The API exposes four product areas:
- Search — submit a drawn pattern and read the matches across every tracked market.
- Market data — the coin universe, OHLC candles and stored series.
- Pattern library — the signed-in user's saved patterns and their share links.
- Analytics — the Outcome Lab: schema, quote, run, configs and exports.
MCP wraps search, market data, the catalog and analytics as tools so an agent can call
them without writing HTTP code. A read-only content endpoint serves published articles
and documentation to any host, without a key.
Get an API key
- Sign in and open your account page.
- Create a key and give it a label you will recognise later.
- Copy it immediately — it is shown once. The server stores only a hash.
- Send it on every request in the
X-API-Keyheader.
export DEJABARS_KEY="tc_live_…"
curl -s -H "X-API-Key: $DEJABARS_KEY" https://dejabars.com/api/v1/app/search/algorithms
List your keys and their last use, or revoke one, on the same page. Revoking is immediate.
The list endpoint never returns the key itself, and it is not part of the app API.
A key belongs to the account that created it. Treat it like a password: one key per
integration, and revoke it when the integration is retired.
Base URL and versioning
https://dejabars.com/api/v1/app → the public app API (pin this)
https://dejabars.com/api → the service root
New integrations call /api/v1/app. The website and the MCP transport have their own
paths; the app namespace deliberately contains only the operations in this page. The
interactive reference and the OpenAPI document use the same /api/v1/app base.
What an API key can call
The public API covers three jobs: the search flow, alerts delivered to a webhook, and
Outcome Lab analyses. The developer handbook explains
each job step by step; this page is the integration reference.
Every app operation is served under /v1/app; the website's internal routes and the
unversioned copies are not part of the public contract.
| Method | Route | Purpose |
|---|---|---|
GET | /v1/app/search/algorithms | Every matcher, its description and its cost multiplier |
POST | /v1/app/search-offer | Price a search before running it |
POST | /v1/app/search-task | Submit a pattern; returns a task_id |
GET | /v1/app/task-status/{task_id} | Current status and progress |
GET | /v1/app/task-result/{task_id} | The stored summary of a finished search |
GET | /v1/app/task-result/{task_id}/symbol/{symbol} | Every match for one coin |
A search body carries the pattern points and the same controls the editor sends:
{
"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
}
Searches run one at a time per account. A burst queues behind the running search instead
of competing with it, and only the searches you start are charged. Send an
Idempotency-Key header when a retry must not start a second search.
Alerts and webhooks
| Method | Route | Purpose |
|---|---|---|
POST | /v1/app/watches/price | Price a watch before creating it |
GET / POST | /v1/app/watches | List or create watches |
GET / PATCH / DELETE | /v1/app/watches/{watch_id} | Read, update or remove one |
POST | /v1/app/watches/{watch_id}/pause | Stop evaluating a watch |
POST | /v1/app/watches/{watch_id}/resume | Resume it |
GET / POST | /v1/app/notifications/destinations | List or connect a webhook |
POST | /v1/app/notifications/destinations/{id}/test | Send a real test delivery |
DELETE | /v1/app/notifications/destinations/{id} | Remove the destination |
GET | /v1/app/notifications/deliveries | Delivery state, attempts and last error |
A watch evaluates one or more lanes on every closed candle. API integrations deliver alerts
to webhooks only; the site also supports chat and email. Every delivery is signed with the
destination secret — see Receive webhooks.
Analytics
| Method | Route | Purpose |
|---|---|---|
GET | /v1/app/analytics/schema | Events, fields, rules and defaults |
GET | /v1/app/analytics/questions | Ready-made, report-aware analysis specs |
POST | /v1/app/analytics/offer | Quote an analysis |
POST | /v1/app/analytics | Run it |
GET | /v1/app/analytics/{analysis_id} | Read the stored result |
GET | /v1/app/analytics/{analysis_id}/export | Download the result |
Analytics is available on every plan. The steps are in
What is not in the public API
These stay on the website and are not offered to apps, even to an authenticated key:
- Market data. OHLC candles, stored series, segments, the coin universe and signal
statistics. A chart is something the site draws for a visitor; it is not sold as a data
feed. An API key is refused on these routes. MCP sessions can still read coins and
klines as a tool.
- The pattern library. Saving, editing, sharing and team visibility. A single pattern
can still be hashed and reused across calls.
- Teams, billing, support and notification internals. These are account surfaces, not
integration surfaces.
- The MCP transport. It is documented in its own page and uses its own OAuth
session, not an API key.
If an integration needs one of these, talk to us first; do not assume an undocumented
route is stable or permitted.
MCP
The MCP endpoint, its manifest, its tools and its approval flow are documented on the
MCP documentation page. An MCP session is separate from an
API key: it is scoped, revocable and auditable per agent.
Prices, quota and the free windows
- Every agent tool returns the
costit charged and the account'squota_remaining. - Quote before you run:
search-offerandanalytics_quotereturn the price with no charge. - The free window — timeframes
1h,4h,1dand1w, thegeomatcher, and periods up
to 30 days — costs 0 tokens. Daily and weekly geo searches are free across the full year.
- Minute timeframes cost more than hourly ones; the selector shows the multiplier for each
matcher.
- If the account cannot afford a search, the call returns
quota_exceededand nothing is
charged. The message states the cost and the missing amount.
- Each agent session also has its own spend ceiling. When it is reached the tool returns
spend_cap_exceeded; revoke the session and approve a new one to continue.
MCP: one protocol, three ways to connect
https://dejabars.com/api/v1/mcp is a streamable HTTP MCP endpoint. The manifest at
https://dejabars.com/.well-known/mcp.json describes the
transport, the tools, the scopes and the authorization servers, so a host can discover
everything without a conversation.
There are three ways in:
- Personal API key — a script or a single-user tool. Send
X-API-Key. - Registered OAuth app — a hosted chat or a product with many users. Register once,
then use authorization code with PKCE.
- Device flow — a local CLI with no browser callback. The human approves a short code.
Register an app (multi-user integrations)
Register the client once. The endpoint returns a client_id; this is a public client, so
there is no secret and PKCE S256 is mandatory.
curl -s -X POST https://dejabars.com/api/v1/oauth/register \
-H 'Content-Type: application/json' \
-d '{
"client_name": "My integration",
"redirect_uris": ["https://app.example.com/oauth/callback"],
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"token_endpoint_auth_method": "none"
}'
Signed-in registrations may use any redirect URI. Anonymous registrations are accepted
only for hosts on the allowlist, so a bot cannot register an arbitrary callback. Register
from a signed-in browser session when you are building something new.
Then walk the authorization-code flow:
- Send the human to
/api/v1/oauth/authorizewithresponse_type=code, yourclient_id,
the exact redirect_uri, the scopes, a state, and a PKCE code_challenge using
S256.
- The human signs in and approves the requested scopes on
https://dejabars.com/agents/approve.
- Exchange the code at
/api/v1/oauth/tokenwithgrant_type=authorization_code, the
code, the redirect_uri and the code_verifier.
- Refresh with
grant_type=refresh_tokenbefore the access token expires.
Never ask a person to paste a token into a chat, and never echo one back.
Device flow (local tools)
curl -s -X POST https://dejabars.com/api/v1/oauth/device_authorization \
-H 'Content-Type: application/json' \
-d '{"client_name":"My CLI","scopes":["search:run","market:read"]}'
The response carries a short user_code, a verification_uri, a
verification_uri_complete, an expires_in and a polling interval. Show the code, let
the human approve it, then poll:
curl -s -X POST https://dejabars.com/api/v1/oauth/token \
-H 'Content-Type: application/json' \
-d '{"grant_type":"urn:ietf:params:oauth:grant-type:device_code","device_code":"<device_code>"}'
Until the human approves you receive authorization_pending; afterwards the response
carries an access_token and a refresh_token.
Call the MCP endpoint with the token:
curl -s -X POST https://dejabars.com/api/v1/mcp \
-H "Authorization: Bearer <access_token>" \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Keep the Mcp-Session-Id returned by initialize and send it on every later call.
Scopes
| Scope | What it allows |
|---|---|
search:run | Submit and read pattern searches |
market:read | Read coins and klines |
catalog:read | List the user's saved patterns |
catalog:write | Save patterns on the user's behalf (opt-in) |
analytics:read | Read the analytics schema, defaults and config drafts |
analytics:write | Save configs and run paid analyses (opt-in) |
Approval defaults to the read-only set. A tool outside the granted scopes returns
insufficient_scope. Revoke a session on the agents page and
approve a new one when the scope needs change.
The tools
| Tool | Purpose |
|---|---|
agent_capabilities | What this session may call, and its limits |
search_submit | Start a search; returns a task id |
search_status | Progress and status for a task |
search_result | Matches, with optional per-candle series |
quota_status | Remaining balance and the next reset |
list_coins | The tracked universe |
market_klines | OHLC candles for one symbol and timeframe |
catalog_list | The user's saved patterns |
catalog_save | Save a pattern |
analytics_schema | Fields, events and defaults |
analytics_report | Defaults for one report token |
analytics_quote | Price an analysis |
analytics_fast_verify | Cheap sanity check before a paid run |
analytics_config_list | Saved analysis configs |
analytics_config_save | Save a config |
analytics_config_delete | Delete a config |
analytics_run | Run a paid analysis |
Every tool returns the same envelope: status, data, cost, quota_remaining,
errors[], request_id and next_cursor. search_status and search_result also
return a report_url — a link to the full, human-readable report on the site. Share that
link when a person should review the matches.
Connect a third-party host
The host only needs the MCP endpoint. It discovers the authorization servers and the
scopes from the manifest and the two well-known documents on the site origin.
ChatGPT
- Open Settings → Connectors → Advanced and enable developer mode if it is not
already visible.
- Create a connector with the URL
https://dejabars.com/api/v1/mcp. - Approve the scopes on the consent page when ChatGPT opens it.
ChatGPT registers itself with the registration endpoint and uses PKCE, so no client
secret is involved. Connector availability depends on the plan and region.
Claude
On claude.ai, open Settings → Connectors → Add custom connector, name it, and paste
https://dejabars.com/api/v1/mcp. Approve the scopes on the consent page.
For Claude Desktop builds without remote connectors, bridge the endpoint over stdio:
{
"mcpServers": {
"dejabars": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://dejabars.com/api/v1/mcp"]
}
}
}
Cursor
Add a remote server to .cursor/mcp.json:
{
"mcpServers": {
"dejabars": {
"url": "https://dejabars.com/api/v1/mcp"
}
}
}
If the client asks for a header instead of running the OAuth flow, send
Authorization: Bearer <access_token> with a token obtained through the device flow.
Any other streamable HTTP client
Point it at https://dejabars.com/api/v1/mcp, send Content-Type: application/json, keep the
Mcp-Session-Id returned by initialize, and authorize with a bearer token or an API
key. For read-only content, use https://dejabars.com/api/v1/mcp/content with no authentication.
Use cases
1. Scan a watchlist after a rough sketch
Input: five to twenty points drawn on the editor, the 1h timeframe, the geo
matcher, a 30-day period.
Calls: search_submit → search_status until completed → search_result for the
ranked list and report_url.
Result: a ranked set of matches, each with its symbol, distance and window. The agent
summarises the ten best and links the report for review.
Why it works: the search is queued and charged once, so a chat can start it and come
back later without holding a connection open.
2. Compare two reads of the same pattern
Input: a saved pattern, the same timeframe, two runs a week apart.
Calls: search_submit → search_result for the first run; repeat later; compare the
ranked symbols and their distances.
Result: a short message that names the symbols that entered the match list, the ones
that left it, and the ones that moved closer. Each run links its report_url.
Why it works: the result is the product. No price feed is needed to say what changed;
the two runs already describe it.
3. Keep a pattern library in sync
Input: a pattern the person saved in the editor, plus the name they use for it.
Calls: catalog_list to find it, catalog_save with the new points when the sketch
changed.
Result: the same pattern is available in the editor, in the alerts tool and in the
next agent session, because all three read the same catalog row.
Success stories
These are authored walkthroughs of the flows above. They describe what the tool calls
return, not a customer quote or a measured return.
"One sketch, three matchers, one afternoon"
A researcher wants to know whether a shape repeats. They draw it once, quote the search
with search-offer, and run geo first because it is free on their timeframe. When the
free run returns too many weak matches, they quote dtw, see the price, and run it once.
The second run is smaller and better ranked. The takeaway: quote before you run, and use
the free matcher to decide whether the paid one is worth it.
"The agent remembers the pattern, the person remembers the idea"
A person saves a pattern in the editor and approves an agent with catalog:read and
search:run only. Days later the agent lists the saved pattern, submits it again, and
posts the report_url into the conversation. The person never pastes points into a chat,
and the agent cannot change the library because catalog:write was not granted. The
takeaway: approve the narrowest scope set that still does the job.
"A local script that behaves like a hosted integration"
A developer wants a scheduled scan without exposing a callback URL. They run the device
flow once, store the refresh token in the system keychain, and refresh on each run. The
scan submits the same pattern with an Idempotency-Key, so a retry after a network drop
does not start a second paid search. The takeaway: the device flow plus idempotent
submission is enough for a cron job.
Errors and what to do
| Code | Meaning | What to do |
|---|---|---|
authorization_pending | The human has not approved the device code yet | Keep polling at the advertised interval |
access_denied | The human denied the request | Ask again, or narrow the scopes |
expired_token | The device code expired | Start a new device authorization |
auth_expired | The session token is expired or revoked | Run the flow again; do not retry the call |
insufficient_scope | The tool needs a scope the session was not granted | Approve a new session with that scope |
quota_exceeded | The account cannot afford the call | Top up, wait for the reset, or choose a free window |
spend_cap_exceeded | The agent session reached its own ceiling | Revoke the session and approve a new one |
invalid_client | The client is unknown or the redirect does not match | Register again and reuse the exact redirect URI |
invalid_scope | A requested scope is not in the list | Request only the documented scopes |
HTTP errors carry a JSON body with a detail field. A 429 means the rate limiter is
active; back off and retry later.
Rules
- One key per integration. Revoke keys and agent sessions you no longer use.
- Stay inside the documented rate limits; do not build a bulk downloader or mirror the
dataset.
- Approve the narrowest scopes that still do the job. A read-only integration should not
ask for catalog:write or analytics:write.
- Never ask a person to paste a token into a chat, and never log one.
- Everything in the Acceptable Use Policy
applies to programmatic access.
