v2 Auto

Validate Query

Validate EQL syntax and get a cost estimate without creating a query. Returns simulation-based cost details when the query is valid.

Required Sequence (Enforced)

POST /v2/auto/queries/validate must be called before POST /v2/auto/queries.

Lifecycle sequencing after create:

  1. POST /v2/auto/queries/{queryId}/cancel while status is active.
  2. DELETE /v2/auto/queries/{queryId} only after status is terminal (triggered, expired, cancelled, failed).

Cost

Free.

Auth

Required header:

x-elfa-api-key: <api_key>

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 so I can review the breakout setup."
}

Response Example (200)

{
  "valid": true,
  "errors": [],
  "warnings": [],
  "simulationLlmCallsEstimate": {
    "conditionCallsUpperBound": 1,
    "actionCallsUpperBound": 0,
    "conditionCallsBySpeed": { "fast": 1, "expert": 0, "adaptive": 0 },
    "actionCallsBySpeed": { "fast": 0, "expert": 0, "adaptive": 0 },
    "autoActionCallsBySpeed": { "fast": 0, "expert": 0, "adaptive": 0 }
  },
  "estimatedCost": {
    "credits": 30,
    "price": "$0.270"
  }
}

Best practice: always validate before create to catch schema issues and preview estimated cost.

post/v2/auto/queries/validate

Request

  • Base URL: https://api.elfa.ai
  • URL: https://api.elfa.ai/v2/auto/queries/validate
  • Auth: API key in header x-elfa-api-key

Request body

queryJsonObject required

Construct a type with a set of properties K of type T

titlestring

Optional title to validate alongside the query. Accepted so agents can validate the full create-query payload in one call. See {@link ApiKeyCreateQueryRequestBody.title}.

descriptionstring

Optional description to validate alongside the query. See {@link ApiKeyCreateQueryRequestBody.description}.

Example request

{
  "title": "BTC breakout alert",
  "description": "Notify when BTC is above 100k so I can review the breakout setup."
}

Response

Ok

validboolean required

Whether the query is valid

estimatedCostJsonObject

Construct a type with a set of properties K of type T

simulationLlmCallsEstimateJsonObject

Construct a type with a set of properties K of type T

Changes

No recorded changes to this operation across all 1 revision of this API.