Skip to main content

API Key Auth

Use this page for Auto integrations on /v2/auto/*. If you still need to choose between API key and x402 models, start with Auto Overview.

Base URL​

https://api.elfa.ai/v2/auto

Get an API Key​

Get an API key from the Elfa Developer Portal.

There is no separate Auto enablement step in the portal. A new API key can call /v2/auto/* immediately. Elfa resolves the API key to the Auto user context needed to scope queries.

Required Header​

All /v2/auto/* routes require:

x-elfa-api-key: <api_key>
Never Print Secrets

Never print or log ELFA_API_KEY or full auth headers.

Do not use debug commands like echo $ELFA_API_KEY, printenv, or console.log(process.env).

If you must debug auth, log only redacted metadata such as request path and status code.

Create Example​

API_KEY="your_api_key"
BODY='{"query":{"conditions":{"AND":[{"source":"price","method":"current","args":{"symbol":"BTC"},"operator":">","value":80000}]},"actions":[{"stepId":"step_1","type":"notify","params":{"message":"BTC crossed 80k"}}],"expiresIn":"24h"}}'

curl -X POST https://api.elfa.ai/v2/auto/queries \
-H "x-elfa-api-key: ${API_KEY}" \
-H "Content-Type: application/json" \
-d "${BODY}"

Action Types​

API-key Auto supports these action types:

  • notify
  • telegram_bot
  • webhook
  • llm

Endpoint Matrix​

Mounted endpoints below are the routes inside /v2/auto.

Queries and Drafts​

EndpointPurpose
GET /queriesList queries
GET /queries/:idGet a query
GET /queries/streamStream notifications for all active queries
GET /queries/:id/streamStream notifications for one query
GET /queries/:id/sessionsList query sessions
GET /queries/:id/sessions/:sessionIdGet one query session
POST /queries/validateValidate query syntax and estimate cost
POST /queriesCreate and activate a query
POST /queries/:id/cancelCancel an active query
DELETE /queries/:idDelete a terminal query
GET /queries/draftsList drafts
GET /queries/drafts/:idGet a draft
POST /queries/draftsCreate or update a draft
DELETE /queries/drafts/:idDelete a draft
POST /queries/drafts/:id/validateValidate a draft
POST /queries/drafts/:id/convertConvert a draft into an active query

Executions​

EndpointPurpose
GET /executionsList executions
GET /executions/:idGet one execution

Chat and Validation​

EndpointPurpose
POST /chatBuild or refine Auto query drafts
GET /validate-symbol/:exchange/:symbolCheck symbol support

Common Errors​

  • 401: missing or invalid API key
  • 403: key or user is not allowed to perform the requested Auto operation
  • 409: active plan limit exceeded, or lifecycle state conflict
  • 422: query validation failure