AION
/Substrate Codex
Computational APIsIntegration Guide

Quickstart: Interrogating AION

Learn how to execute your first longitudinal query via cURL, TypeScript, or Python, handle asynchronous reasoning synthesis, and unpack the 13-field Answer Contract.

STEP 01

Obtain an Institutional API Key

Access to the AION API is restricted to accredited institutional researchers, risk desks, and policy analysts. Submit your application at the Waitlist Portal or request enterprise licensing. Once approved, you will receive an API token (e.g. aion_live_...).

STEP 02

Submit an Analytical Query (Q01 Benchmark)

Queries are sent to POST /v1/query. The reasoning engine executes relational knowledge traversals, extracts corroborating claims, detects contradictions, and synthesizes the Answer Contract.

cURL Request
curl -X POST https://api.aion.ng/v1/query \
  -H "X-AION-Key: aion_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What changed in Nigeria education discourse over the last 30 days?",
    "domain": "education",
    "requireContradictions": true,
    "sync": true
  }'
TypeScript (Node.js / Next.js)
const res = await fetch("https://api.aion.ng/v1/query", {
  method: "POST",
  headers: {
    "X-AION-Key": process.env.AION_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    question: "What changed in Nigeria education discourse over the last 30 days?",
    domain: "education",
    requireContradictions: true,
  }),
});

const contract = await res.json();
console.log("Epistemic Strength:", contract.evidenceStrength);
console.log("Extracted Claims:", contract.claims.length);
STEP 03

Handling Asynchronous Queries (HTTP 202 Accepted)

Deep longitudinal synthesis spanning multi-month intervals may require background execution. When this occurs, the engine responds immediately with an HTTP 202 status and a polling URL:

// HTTP 202 Accepted Response
{
  "queryId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "status": "processing",
  "resultUrl": "/v1/query/7c9e6679-7425-40de-944b-e07fc1f90ae7/result",
  "estimatedTimeMs": 2400
}

Poll GET /v1/query/{queryId}/result with exponential backoff until status is "completed" and the full 13-field Answer Contract is returned.

Next Reference
Analytical Query API Specification
View POST /v1/query Spec →