Skip to main content

Poll & Results

GET /v1/ask/:id polls a natural-language ask: processing, completed with a cited markdown answer, structured citations, a verdict and usage, or an error.

GET /v1/ask/:id polls an ask started with POST /v1/ask and, once it settles, returns the cited answer. Poll roughly every 2 seconds: turns settle in 10 to 60 seconds, so a 2-second interval finds the answer promptly without wasted requests. Polling counts against the general read namespace, not the ask namespace, so a polling loop never consumes your daily ask budget. An ask_id created by another workspace returns 404, exactly as if it never existed. To watch the turn as it runs instead, GET /v1/ask/:id/stream delivers the same turn as server-sent events; both read the same turn.

The response is one of three shapes, discriminated by status. While the turn runs you get the minimal processing body: ask_id, status, poll_url and conversation_id. When the turn completes, status is completed and the body carries the answer, the structured citations, any cards and artifacts the turn produced, the lookup count, the verification verdict and usage. When the turn fails, status is error with a stable error code and a human-readable message.

Endpoint

GET/v1/ask/:id

Path parameters

id*uuidThe ask_id returned by POST /v1/ask.

Polling loop (bash)

ASK_ID=$(curl -s -X POST https://api.talonic.com/v1/ask \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"question": "What is the total value of the Acme master services agreement?"}' \
  | jq -r '.ask_id')

while true; do
  RESULT=$(curl -s https://api.talonic.com/v1/ask/$ASK_ID \
    -H "Authorization: Bearer $TALONIC_API_KEY")
  STATUS=$(echo "$RESULT" | jq -r '.status')
  [ "$STATUS" != "processing" ] && break
  sleep 2
done

echo "$RESULT" | jq '{status, answer, verdict: .verification.verdict}'

The completed payload

Response fields (completed)

ask_iduuidThe ask id.
statusstringprocessing, completed, or error.
poll_urlstringRelative URL of this endpoint, echoed for convenience.
conversation_iduuid | nullThe conversation the ask threads into. Present on every status, including processing.
answerstringThe answer as markdown. Citations appear inline as markdown links that open the source document in the Talonic app with the cited passage highlighted.
citationsarrayThe same citations in structured form: quote, document_id, kind, reference, filename, app_url. See Citations & Verification.
cardsarrayUI cards the turn produced, when any. Empty for most asks.
artifactsarrayArtifacts the turn produced, each {type, id, label, link}. Empty for most asks.
tool_callsintegerHow many lookups the turn ran to produce the answer; an audit count.
verificationobject | nullVerdict on whether the answer matches its cited evidence: verdict (supported / issues / unverifiable), checks_total, checks_unsupported, and an optional correction. null when no verdict was produced.
usage.tokensinteger | nullProcessing volume units for the turn; informational only, not billed.
usage.credits_chargedintegerThe flat charge for this ask: 100 credits.

Response (completed)

{
  "ask_id": "7c2f0a4e-9d31-4b8a-b3e6-2f1c5d9a8e07",
  "status": "completed",
  "poll_url": "/v1/ask/7c2f0a4e-9d31-4b8a-b3e6-2f1c5d9a8e07",
  "conversation_id": "8c4f2a1e-0b6d-4e2f-9a3c-5d7e1f2a3b4c",
  "answer": "The Acme master services agreement has a total contract value of [EUR 96,000](https://app.talonic.com/documents/1b6f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d?cite=contract_value) over a [24-month term](https://app.talonic.com/documents/1b6f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d?cite=contract_term).",
  "citations": [
    {
      "quote": "EUR 96,000",
      "document_id": "1b6f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
      "kind": "field",
      "reference": "contract_value",
      "filename": "acme-msa-2025.pdf",
      "app_url": "https://app.talonic.com/documents/1b6f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d?cite=contract_value"
    },
    {
      "quote": "24-month term",
      "document_id": "1b6f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
      "kind": "field",
      "reference": "contract_term",
      "filename": "acme-msa-2025.pdf",
      "app_url": "https://app.talonic.com/documents/1b6f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d?cite=contract_term"
    }
  ],
  "cards": [],
  "artifacts": [],
  "tool_calls": 4,
  "verification": {
    "verdict": "supported",
    "checks_total": 3,
    "checks_unsupported": 0
  },
  "usage": {
    "tokens": 18432,
    "credits_charged": 100
  }
}

The answer field renders as-is in any markdown surface: chat UIs, Slack, a support console. The inline citation links and the structured citations array describe the same evidence, because the array is parsed from the answer itself, so you can also strip the links and build your own citation display from the array.

A typed client

TypeScript polling helper

const BASE = 'https://api.talonic.com';
const headers = {
  Authorization: `Bearer ${process.env.TALONIC_API_KEY}`,
  'Content-Type': 'application/json',
};

interface AskResult {
  ask_id: string;
  status: 'processing' | 'completed' | 'error';
  poll_url: string;
  conversation_id: string | null;
  answer?: string;
  citations?: { quote: string; document_id: string; kind: 'field' | 'quote'; reference: string; filename: string | null; app_url: string }[];
  cards?: unknown[];
  artifacts?: { type: string; id: string; label: string; link: string }[];
  tool_calls?: number;
  verification?: { verdict: 'supported' | 'issues' | 'unverifiable'; checks_total: number; checks_unsupported: number; correction?: string } | null;
  usage?: { tokens: number | null; credits_charged: number };
  error?: string;
  message?: string;
}

async function ask(question: string): Promise<AskResult> {
  const submit = await fetch(`${BASE}/v1/ask`, {
    method: 'POST',
    headers,
    body: JSON.stringify({ question }),
  });
  if (submit.status === 402) throw new Error('Out of credits: top up and retry.');
  const { ask_id } = await submit.json();

  while (true) {
    await new Promise((r) => setTimeout(r, 2000));
    const res = await fetch(`${BASE}/v1/ask/${ask_id}`, { headers });
    const turn: AskResult = await res.json();
    if (turn.status !== 'processing') return turn;
  }
}

const result = await ask('Which invoices are overdue as of today?');
if (result.status === 'completed') {
  console.log(result.answer);
  console.log(`Verification: ${result.verification?.verdict ?? 'none'}`);
}

Error turns and error responses

A turn that fails settles to an error turn, delivered with HTTP 200 and status: "error" in the body, because the poll itself succeeded. The body carries error: "ask_failed" and a message. Submit the question again as a fresh ask: turns are independent, and a failed turn affects nothing else. HTTP-level errors on the poll request itself are different: they mean the request never reached a turn.

Response (error turn)

{
  "ask_id": "7c2f0a4e-9d31-4b8a-b3e6-2f1c5d9a8e07",
  "status": "error",
  "poll_url": "/v1/ask/7c2f0a4e-9d31-4b8a-b3e6-2f1c5d9a8e07",
  "conversation_id": "8c4f2a1e-0b6d-4e2f-9a3c-5d7e1f2a3b4c",
  "error": "ask_failed",
  "message": "The agent turn failed. Ask again; the question was not charged twice."
}

HTTP error responses

400validation_errorThe id is not a UUID.
401unauthorizedMissing or invalid API key.
404not_foundNo ask with this id exists in your workspace. Ids from other workspaces also read as 404.
Keep the ask_id and fetch the completed payload whenever convenient; there is no short result expiry. The poll is a plain read, so it is safe to poll from several consumers.

Frequently asked questions

How often should I poll?+
Roughly every 2 seconds. Turns settle in 10 to 60 seconds, and polling counts against the general read namespace rather than the ask namespace, so a 2-second loop never touches your daily ask cap.
What does an error turn mean and am I charged for it?+
status "error" with error "ask_failed" means the turn failed. Submit the question again as a fresh ask. Charging is keyed to the turn, so the failed turn is never billed twice.
Why did my poll return 404?+
Either the id is wrong or the ask belongs to a different workspace. Asks are isolated per workspace, and an id from another workspace is indistinguishable from one that does not exist.
Is usage.tokens what I am billed on?+
No. Billing is the flat agent_ask unit reported in usage.credits_charged (100 credits per ask). usage.tokens reports processing volume units and is informational only.