Developer docs

    Intake

    Put every submission in front of the right person with its evidence and conflicts, record each decision against one exact revision, and measure what changed.

    Intake works on the cases and assessments from the Scan API. Scopes: cases:read to read, cases:review to assign, correct, escalate, request evidence and refer, cases:approve to approve, decline, export and set pilot terms.

    The flow

    • A case arrives (POST /cases or a CSV batch) and is assessed.
    • Your reviewers work the queue: cases with open conflicts and evidence requests first, as your own routing decides.
    • A reviewer corrects a field, escalates, or decides on the exact revision they looked at.
    • An approved revision is exported as a frozen record with a sha256 receipt.
    • You record what your team actually did, and what happened, so the pilot ledger can compare cohorts.

    Every write names the person acting (actor, as your system names them) and their actor_role, and lands in the case's audit trail. Writes that change the record carry the revision the reviewer was looking at. If the case moved on, the answer is 409 stale with current_revision, so your screen shows the newer version instead of overwriting it.

    Work the queue

    GET/review/queue

    curl "$GEMSTONEAI_BASE/review/queue?status=open&escalated=false&limit=50" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY"
    Response (shortened)
    {
      "total": 1,
      "items": [
        {
          "external_id": "LOT-2231",
          "title": "Vintage sapphire ring",
          "status": "open",
          "assignee": null,
          "escalated": false,
          "current_revision": 2,
          "assessed": true,
          "open_conflicts": 1,
          "flags": 0,
          "evidence_requests": 1,
          "last_decision": null
        }
      ]
    }

    Most recently changed first. Filter by status (open, awaiting_evidence, decided), assignee (empty for unassigned) and escalated; page with limit (up to 200) and offset.

    GET/review/case?external_id=…

    curl "$GEMSTONEAI_BASE/review/case?external_id=LOT-2231" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY"

    One case with every revision, the assessment of record (reviewed), the audit trail (events) and past exports.

    POST/review/assign

    curl -X POST "$GEMSTONEAI_BASE/review/assign" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "external_id": "LOT-2231",
        "actor": "maria.k",
        "actor_role": "specialist",
        "assignee": "maria.k"
      }'

    Send an empty assignee to unassign.

    Correct and escalate

    A correction never edits a revision. It writes a new revision that copies the current one and adds a claim with source_kind: reviewer; the reason stays on the audit event. The corrected field then reads as standing: reviewer.

    POST/review/edit

    curl -X POST "$GEMSTONEAI_BASE/review/edit" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "external_id": "LOT-2231",
        "actor": "maria.k",
        "actor_role": "specialist",
        "revision": 2,
        "field": "metal",
        "value": "18k yellow gold (750 stamp read under loupe)",
        "reason": "Stamp confirmed in hand at intake desk",
        "handling_seconds": 140
      }'

    handling_seconds is optional; when sent, it counts toward handling time in the pilot ledger.

    POST/review/escalate

    curl -X POST "$GEMSTONEAI_BASE/review/escalate" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "external_id": "LOT-2231",
        "actor": "maria.k",
        "reason": "Possible signed maker; needs the jewelry department"
      }'

    Send clear: true to clear an escalation.

    Decide

    POST/review/decision

    curl -X POST "$GEMSTONEAI_BASE/review/decision" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "external_id": "LOT-2231",
        "actor": "maria.k",
        "actor_role": "specialist",
        "revision": 3,
        "disposition": "approve",
        "handling_seconds": 60
      }'
    dispositionRulesCase status after
    approveNeeds cases:approve. Refused with 409 not_allowed while any conflict is open: correct the field first.decided
    declineNeeds cases:approve and a reason.decided
    request_evidenceNeeds a reason. Ask the submitter for the case's next_evidence.awaiting_evidence
    referNeeds a reason. Also escalates the case.open

    Export with a receipt

    POST/review/export

    curl -X POST "$GEMSTONEAI_BASE/review/export" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{"external_id": "LOT-2231", "actor": "maria.k"}'
    Response (shortened)
    {
      "receipt": {
        "export_id": 17,
        "receipt_hash": "9f2c…e41a",
        "revision": 3,
        "exported_by": "maria.k",
        "exported_at": "2026-11-29T15:04:11"
      },
      "record": {
        "external_id": "LOT-2231",
        "revision": 3,
        "statement": "…",
        "claims": [
          "…"
        ],
        "fields": [
          "…"
        ],
        "decision": {
          "disposition": "approve",
          "decided_by": "maria.k"
        }
      }
    }

    Only the current revision, approved by the latest decision, can be exported. The record is frozen: its claims, fields, conflicts, flags and the decision, with a sha256 receipt_hash over the canonical JSON. Exporting the same record again returns the same receipt.

    Record what happened

    Our recommendation (the reviewer's decision) and your actual action are recorded apart and never derived from each other. An outcome event is immutable and keyed by your event_id; a fix is a new event with correction_of. A result nobody knows stays empty and counts as unknown.

    POST/case-outcomes

    curl -X POST "$GEMSTONEAI_BASE/case-outcomes" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "event_id": "evt-2231-1",
        "external_id": "LOT-2231",
        "outcome_type": "action",
        "occurred_at": "2026-11-30T14:00:00Z",
        "action": "accepted",
        "cohort": "assisted"
      }'
    outcome_typeCarries
    actionWhat your team did: accepted, declined, listed.
    resultThe true result, only when known: sold, returned.
    costamount, currency, cost_type.
    timehandling_seconds.

    cohort (for example baseline, assisted, holdout) is how the ledger compares groups. Import history with POST /case-outcomes/import: a CSV with the same columns, up to 20,000 rows; rows already stored count as replayed. Read a case's events with GET /case-outcomes?external_id=….

    Pilot terms and ledger

    PUT/pilot-terms

    curl -X PUT "$GEMSTONEAI_BASE/pilot-terms" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "eligible": "reviewed",
        "unit_price": 4.5,
        "currency": "USD",
        "unit_label": "reviewed submission",
        "baseline_minutes": 12
      }'

    Terms say what one billable unit is (eligible: all, assessed, reviewed or approved) and what it costs. Each change adds a version.

    GET/pilot-ledger

    curl "$GEMSTONEAI_BASE/pilot-ledger?cohort=assisted&format=csv" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY"

    The ledger is computed, not stored: one row per case with every input behind the totals, the terms version, and a method that says how each column is derived, so a second evaluator can rebuild every total from the rows alone. Filter by cohort, since and until; JSON or CSV.