Skip to main content

Create Query

POST 

/v2/auto/queries

Create and activate a conditional query.

Allowed action types: webhook, notify, telegram, llm.

Cost

Simulation-driven estimate (reference values):

  • baseline: $0.045
  • fast call: +$0.225
  • expert call: +$1.00

Auth

Required headers:

x-elfa-api-key: <api_key>
x-elfa-timestamp: <unix_seconds>
x-elfa-signature: <hex_hmac_sha256>

Signing payload:

timestamp + method + path + body

For this route, sign with path = "/queries".

Request Example

{
"query": {
"conditions": {
"AND": [
{
"source": "price",
"method": "current",
"args": { "symbol": "BTC" },
"operator": ">",
"value": 100000
}
]
},
"actions": [
{
"stepId": "step_1",
"type": "notify",
"params": { "message": "BTC crossed target" }
}
],
"expiresIn": "24h"
},
"title": "BTC breakout alert",
"description": "Notify when BTC is above 100k"
}

Response Example (201)

{
"queryId": "q_123",
"status": "active",
"cost": {
"credits": 116,
"price": "$1.045"
}
}

Best practice: call validate first, then create. After creation, wire notifications (webhook, telegram, or SSE) to a background runner.

Request

Responses

Ok