Quickstart (v2, Beta)

From zero to an explained prediction in about five minutes — no signup. Every call below runs against the live read-only sandbox (the aito-demo dataset as rep2 collections). Copy, paste, run.

  • Base URL: https://shared.aito.ai/db/aito-demo/env/v2/api/v2/
  • Read key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi (public, read-only)

1. Run your first query

A _query filters and projects rows — the same from / where / select you'll later use as evidence for inference.

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_query' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "products", "where": { "name": { "$match": "milk" } },
        "limit": 2, "select": ["name", "price"] }'
{ "offset": 0, "total": 6, "hits": [
  { "name": "Pirkka Finnish semi-skimmed milk 1l", "price": 0.81 },
  { "name": "Pirkka Finnish nonfat milk 1l",        "price": 0.75 } ] }

2. Make your first prediction

_predict ranks the values of a field by probability, conditioned on the evidence in where. Here: route an invoice to a GL account from its text.

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_predict' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "invoices", "where": { "Description": { "$match": "cloud services" } },
        "predict": "GLCode", "select": ["$value", "$p"], "limit": 3 }'
{ "offset": 0, "total": 4, "hits": [
  { "$p": 0.853, "$value": "E002" },
  { "$p": 0.082, "$value": "R001" },
  { "$p": 0.032, "$value": "E001" } ] }

The probability is calibratedE002 at 85% means you can threshold ($p > 0.9 → auto-post) and trust the number.

3. See why

Add "$why" to select and every candidate carries its factor tree — the base rate, the calibration, and the lift each piece of evidence contributed.

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_predict' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "invoices", "where": { "Description": { "$match": "cloud services" } },
        "predict": "GLCode", "select": ["$value", "$p", "$why"], "limit": 1 }'
{ "offset": 0, "total": 4, "hits": [ {
  "$value": "E002",
  "$p": 0.8528,
  "$why": {
    "type": "product",
    "factors": [
      { "type": "baseP", "value": 0.1143,
        "proposition": { "GLCode": { "$has": "E002" } } },
      { "type": "product", "factors": [
        { "type": "normalizer",  "name": "exclusiveness",           "value": 1.0362 },
        { "type": "normalizer",  "name": "trueFalseExclusiveness",  "value": 1.0164 },
        { "type": "calibration", "name": "support-tempering(auto)", "value": 0.9553 } ] },
      { "type": "relatedPropositionLift", "value": 7.4167,
        "proposition": { "Description": { "$match": "cloud services" } } } ] } } ] }

Read the tree as a product of factors: the base rate for E002 is 11.4% (baseP), the words cloud services in the invoice's description raise that 7.4× (relatedPropositionLift), and the normalizers plus support-tempering keep the number honest — they multiply out to the calibrated 0.853 you saw above. That is the whole differentiator in one payload: no model to train, no pipeline to deploy — the prediction and its explanation are computed from the live rows at query time. See Inference for the full grammar of the factor tree.

4. Try more, in the browser

The Playground runs these same calls against this env with JSON highlighting and timing — a faster loop than curl. Then browse the Use Cases for the full patterns (GL coding, support triage, tagging, market basket, search, analytics), each with runnable queries.

5. Load your own data

When you're ready to leave the sandbox: with a read-write key, branch an environment, declare your tables as collections, and batch-load. The aito-demo upload-data-v2.js script is a complete worked example.

# creates the env, defines "type": "collection" tables, batch-loads data
AITO_URL=https://your-instance.aito.ai/db/your-db \
AITO_API_KEY=<read-write-key> \
node upload-data-v2.js

See CollectionDb for the ingest endpoints, Schema Design for the type system, and Common Errors when something doesn't behave.

Next steps