Developer docs

    Scan API

    Send an item's photos, statement and claims under your own ID. Get back what is established, what conflicts, what is missing, and what to ask for next.

    Samples assume the base URL and key from the quickstart setup. Scopes: cases:write to store, assessments:write to assess, cases:read to read.

    Store a case

    A case is one item under your reference. Send what you know: the submitter's own words, links to photos and documents, and the claims made about the item, each saying where it came from.

    POST/cases

    curl -X POST "$GEMSTONEAI_BASE/cases" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "external_id": "LOT-2231",
        "title": "Vintage sapphire ring",
        "submitted_by": "seller-8812",
        "statement": "My grandmother'\''s ring, 18k gold, the stone is a natural sapphire.",
        "attachments": [
          {
            "kind": "photo",
            "source_ref": "https://files.example.com/lot-2231/front.jpg",
            "key": "front"
          },
          {
            "kind": "photo",
            "source_ref": "https://files.example.com/lot-2231/inside-band.jpg",
            "key": "band"
          }
        ],
        "claims": [
          {
            "field": "metal",
            "value": "18k gold",
            "source_kind": "seen",
            "source_label": "Stamp inside the band",
            "attachment": "band"
          },
          {"field": "stone_origin", "value": "natural", "source_kind": "stated"}
        ]
      }'
    FieldNotes
    external_idRequired. Your case, lot, claim or listing reference.
    statementThe submitter's own words, unedited.
    attachments[]kind is photo, document or text; source_ref is your URL or object key. Photo links are fetched when the case is assessed. key names the attachment so a claim can point at it.
    claims[]field and value, plus source_kind: stated (someone said it), seen (visible in a photo), document (a paper says it) or unknown. attachment is the key of the file it rests on.
    titleproduct, submitted_by: optional labels.

    A case needs at least a statement, an attachment or a claim. A new ID answers 201. The same ID with the same content answers 200 and changes nothing; a changed title or product alone is relabeled. The same ID with different content answers 409: send it to /case-revisions. The outcome field says which happened.

    Revise, read, delete

    A revision keeps every earlier version as it was. Identical content adds no revision.

    POST/case-revisions

    curl -X POST "$GEMSTONEAI_BASE/case-revisions" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "external_id": "LOT-2231",
        "statement": "My grandmother'\''s ring, 18k gold. Lab report attached for the sapphire.",
        "attachments": [
          {
            "kind": "document",
            "source_ref": "https://files.example.com/lot-2231/report.pdf",
            "label": "Lab report"
          }
        ]
      }'

    GET/cases?external_id=…

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

    The case comes back with every revision, its attachments and claims, and any decisions.

    DELETE/cases?external_id=…

    curl -X DELETE "$GEMSTONEAI_BASE/cases?external_id=LOT-2231" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY"

    Answers 204 and deletes the case and everything under it: revisions, attachments, claims, assessments, decisions, review history, exports and outcomes. Completed units stay in the unit ledger.

    Import a CSV

    For a backlog, send one CSV with a media manifest. Columns external_id, title, product, statement and submitted_by map to the case; every other non-empty column becomes a stated claim named after the column. The manifest is a JSON list of {external_id, kind, source_ref, label}.

    POST/case-batches

    curl -X POST "$GEMSTONEAI_BASE/case-batches" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -F file=@cases.csv \
      -F 'manifest=[{"external_id": "LOT-2231", "kind": "photo", "source_ref": "https://files.example.com/lot-2231/front.jpg"}]'

    The receipt counts rows created, revised, relabeled and unchanged, and lists bad rows in invalid without stopping the rest. The same file and manifest again return the first receipt with replayed: true. Files up to 5 MB. Read a receipt later at GET /case-batches/{batch_id}.

    Assess

    An assessment reads one revision of a case: its statement, claims and photos. Upload up to 5 photos (15 MB each) with the request, or let it fetch the https photo links already attached to the revision. revision defaults to the current one.

    POST/case-assessments

    curl -X POST "$GEMSTONEAI_BASE/case-assessments" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Idempotency-Key: lot-2231-r1" \
      -F external_id=LOT-2231 \
      -F images=@front.jpg \
      -F images=@inside-band.jpg
    AnswerWhen
    201Text only. The result is in the response, status: completed.
    202Photos. status: processing; poll it.
    200The same request, or the same Idempotency-Key and body, again. The first assessment, not billed twice.
    409idempotency_conflict: the same key with a different body.
    422missing_evidence: no statement, no claims and no photos.
    429quota_exhausted: the month's assessments are used. resets_at says when.

    Poll a photo run

    GET/case-assessments/{assessment_id}

    curl "$GEMSTONEAI_BASE/case-assessments/82" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY"
    • Poll until status is completed or failed. Every few seconds is plenty.
    • While error_code is retrying, the run is retried for you: at most 3 attempts, after 30 seconds and then 2 minutes. attempts and next_attempt_at say where it is.
    • Runs survive our restarts.
    • GET /case-assessments?external_id=… lists a case's assessments, newest first.
    Rehearse failures in the sandbox by putting a phrase in the case statement: sandbox:fail_once fails the first attempt and then completes; sandbox:fail fails every attempt.

    Read the result

    The result separates what each source says from what the evidence establishes. A higher claim is never promoted over a lower one without proof.

    result (photo assessment)
    {
      "rules_version": "commerce-evidence-2",
      "image_evidence": "camera_photos",
      "fields": [
        {
          "field": "metal",
          "value": "Gold-colored metal, purity unknown",
          "standing": "unknown",
          "sources": [
            {
              "kind": "inferred",
              "label": "Photos",
              "engine": "metal_basis=assumed"
            }
          ],
          "note": "No legible mark. Color does not set purity."
        },
        {
          "field": "stone",
          "value": "Looks like Diamond",
          "standing": "inferred",
          "sources": [
            {
              "kind": "inferred",
              "label": "Photos"
            }
          ],
          "note": null
        },
        {
          "field": "stone_origin",
          "value": null,
          "standing": "unknown",
          "sources": [],
          "note": "Photos cannot tell natural from lab-grown."
        }
      ],
      "conflicts": [],
      "flags": [],
      "next_evidence": [
        {
          "field": "stone_origin",
          "ask": "A lab report stating natural or laboratory-grown.",
          "why": "Photos cannot tell natural from lab-grown."
        }
      ],
      "indicative_value": {
        "currency": "USD",
        "low": 800,
        "high": 1600,
        "basis": "Model estimate from photos. Not an appraisal.",
        "assumptions": [
          "The engine priced the metal as Yellow Gold; that purity is not established here."
        ]
      }
    }

    fields[]

    One entry per attribute (metal, maker, stone, stone origin), with its sources and a note. standing says how far it is established:

    standingMeaning
    readA mark was read in the photos. Reading a mark is not a test.
    observedVisible in the photos, such as plating or base metal.
    documentA document attached to the case says it.
    statedOnly the submitter says it.
    inferredThe engine's likeliest call from the photos.
    conflictThe sources disagree. The value stays empty.
    unknownNothing establishes it.
    reviewerA reviewer set it (see Intake).

    conflicts[], flags[], next_evidence[]

    • conflicts: sources that contradict each other, each with a code, severity and the quotes on each side.
    • flags: things to know that are not contradictions, such as a disclosed treatment or catalog-style photos.
    • next_evidence: what to ask the submitter for, and why. Show it to them as is.

    image_evidence and indicative_value

    image_evidence is camera_photos, commercial_photos, not_camera_photos, unchecked or none. indicative_value is a model range from photos with the assumptions behind it, or null. It is not an appraisal.

    Usage and units

    A unit is one completed live assessment. Replays, reads and sandbox runs are free. Usage runs on UTC calendar months.

    GET/assessment-usage

    curl "$GEMSTONEAI_BASE/assessment-usage" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY"
    Response
    {
      "month": "2026-11",
      "completed": 42,
      "in_flight": 1,
      "used": 43,
      "quota": 500,
      "remaining": 457,
      "resets_at": "2026-12-01T00:00:00Z"
    }

    GET/assessment-units?month=2026-11&format=csv

    curl "$GEMSTONEAI_BASE/assessment-units?month=2026-11&format=csv" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY"

    Every completed unit for the month, one row each, to reconcile against your own records. JSON by default.