Get started

Quickstart

Go from zero to a verified policy search and automated test assertion in under 60 seconds.

Guided setup

  1. Create an API key and export it

    Open Dashboard → API keys, mint a key, and store it in your environment. The raw key is displayed once; Mackerel stores only its SHA-512 hash.

    export MACKEREL_API_KEY="mk_live_..."
  2. Send your first policy search

    Pick your language below. Switching tabs updates every code block across the documentation automatically.

    curl -sS https://api.runmackerel.com/v1/search \
      -H "Authorization: Bearer $MACKEREL_API_KEY" \
      -H "Content-Type: application/json" \
      -H "X-Mackerel-ZDR: true" \
      -d '{
        "corpus": "demo_sops",
        "query": "Can a contractor on our German entity expense a €140 client dinner?",
        "groups": ["finance-emea"],
        "model": "mackerel-flash"
      }' | jq '{governing: .governing[0].id, overrides: .governing[0].overrides, abstained}'
  3. Inspect governing, overridden, and superseded

    Notice how te-4.2b (the DACH contractor €95 cap) appears in governing, while the global €150 meal cap moves to overridden and the retired 2024 handbook moves to superseded.

    {
      "id": "tr_hJ66bZ4lqzRKuVz1",
      "engine": "rust-engine",
      "model": "mackerel-flash",
      "corpus": "demo_sops",
      "governing": [
        {
          "id": "te-4.2b",
          "source": "Travel and Expense Policy, DACH addendum",
          "section": "§4.2(b) Contractors",
          "text": "Client meals for contractors engaged through a German entity are capped at €95 a head. Receipts require VP Finance approval above €75.",
          "effective": "2026-01-15",
          "overrides": ["Travel and Expense Policy §4.2 Client meals"]
        }
      ],
      "overridden": [
        {
          "id": "te-4.2",
          "source": "Travel and Expense Policy",
          "section": "§4.2 Client meals",
          "text": "Client meals are capped at €150 per attendee globally.",
          "effective": "2025-04-01"
        }
      ],
      "superseded": [
        {
          "id": "eh-7",
          "source": "2024 Expense Handbook",
          "section": "§7 Entertaining clients"
        }
      ],
      "abstained": false,
      "trace": {
        "hops": [
          { "step": "access", "node": "ACL scope: finance-emea", "score": 1 },
          { "step": "hop 1", "node": "Travel and Expense Policy", "score": 0.91 },
          { "step": "hop 2", "node": "§4.2 Client meals", "score": 0.91 },
          { "step": "hop 3", "node": "Travel and Expense Policy, DACH addendum §4.2(b) Contractors", "score": 0.97 }
        ],
        "considered": 12,
        "pruned": 9
      },
      "latency_ms": 1,
      "usage": { "cost_usd": 0.002, "balance_usd": 0.498 }
    }
  4. Verify all three production invariants

    Run a 10-second verification script against demo_sops to confirm override resolution, ACL-before-retrieval, and clean abstention before wiring your own corpus.

    set -euo pipefail
    
    check() {
      curl -fsS -X POST "https://api.runmackerel.com/v1/search" \
        -H "Authorization: Bearer $MACKEREL_API_KEY" \
        -H "Content-Type: application/json" \
        -H "X-Mackerel-ZDR: true" \
        -d "$1"
    }
    
    GOV=$(check '{"corpus":"demo_sops","query":"Can a contractor on our German entity expense a €140 client dinner?","groups":["finance-emea"]}' | jq -r '.governing[0].id')
    test "$GOV" = "te-4.2b"
    
    ABS=$(check '{"corpus":"demo_sops","query":"What is the office Wi-Fi password in Tokyo?","groups":["finance-emea"]}' | jq -r '.abstained')
    test "$ABS" = "true"
    
    echo "All Mackerel assertions passed."

Verify the response

Next steps