Docs
Sign inStart free

Answers API

Grounded answers with citations, tuned for the agent loop. Ask a question, get a synthesized answer plus the sources it stands on. Synchronous: one request, one response.

POST /v1/answers/ask$0.002 / answersynchronousopen as text

Build Answers into your product

Copy one work order and paste it into Claude Code, Cursor, or any coding agent — it finds the right place in your codebase and wires STELQ Answers in, so your users get grounded, cited answers at runtime. Every payload references $STELQ_KEY from your environment, never a live secret.

Get a key

01Quickstart

One request to POST /v1/answers/ask. Set $STELQ_KEY in your environment and run this as-is — it is generated from the live contract, not transcribed.

submit · cURL
curl -X POST https://api.stelq.com/v1/answers/ask \
  -H "Authorization: Bearer $STELQ_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"RAG vs fine-tuning for enterprise?","maxTokens":512,"citations":true}'

02Authentication

Every request carries a bearer token in the Authorization header. Copied agent payloads reference the $STELQ_KEY environment variable, so set it in your agent's environment rather than pasting a live secret into a prompt or a chat log.

authorization header
Authorization: Bearer $STELQ_KEY

03Parameters

FieldTypeNotes
queryrequiredstringThe question to answer.
maxTokensintegerCap the answer length (default 512).
citationsbooleanReturn the sources behind the answer (default true).
request body · JSON
{
  "query": "RAG vs fine-tuning for enterprise?",
  "maxTokens": 512,
  "citations": true
}

04Response

A successful call returns JSON with the result inline.

200 · OK
{
  "answer": "Use RAG when the knowledge changes often or must be cited; fine-tune when you need…",
  "citations": [
    {
      "url": "https://example.com/rag-vs-ft",
      "title": "RAG vs fine-tuning, compared"
    }
  ]
}

05Errors

StatusMeaning
400Invalid request — a field is missing or malformed (the body says which).
401Missing or invalid API key.
402Insufficient balance — top up credits to continue.
429Rate limited — back off and retry after the Retry-After header.
502Upstream temporarily unavailable — safe to retry; not charged.

06Rate limits

Up to 50 requests/second per key.