Developer docs

    Build on GemstoneAI Enterprise.

    One REST API for Scan API, Intake and Verify. Every item is stored under your own ID, every route works in a free sandbox, and every sample comes in curl, TypeScript and Python.

    How it fits together

    The API keeps one record per item, filed under the reference you already use: a SKU, lot number, claim number or listing ID. The three products work on that same record, so you can start with one and add the others without moving data.

    Keys and the sandbox

    Every request carries a workspace key as a Bearer token. Keys are issued by our team, one workspace per customer, each with the scopes it needs.

    KeyWhat it does
    gsk_test_…Sandbox. Every route behaves as in production, but photo assessments run on a stub engine: deterministic output, no cost, never counted against quota.
    gsk_live_…Production. Assessments run the real engine and count as billable units under your pilot terms.
    Call the API from your server. A key in a browser or mobile app can be copied by anyone who opens it. Request a sandbox key to start.

    Your first assessment

    Set the base URL and your key once. Every sample in these docs assumes this setup.

    export GEMSTONEAI_BASE="https://api.gemstoneaiapp.com/public/v1"
    export GEMSTONEAI_KEY="gsk_test_..."   # your sandbox key

    1. Store a case under your own reference. The title says solid gold, the seller says plated: a conflict the assessment should catch. Sending the same case again changes nothing.

    curl -X POST "$GEMSTONEAI_BASE/cases" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "external_id": "SKU-1001",
        "title": "14k gold diamond ring",
        "statement": "Gold plated sterling silver ring with CZ, size 7",
        "claims": [{"field": "metal", "value": "14k solid gold", "source_kind": "stated"}]
      }'

    2. Assess it. With text only, the answer comes back at once with 201. Send an Idempotency-Key so a retried request is never run twice.

    curl -X POST "$GEMSTONEAI_BASE/case-assessments" \
      -H "Authorization: Bearer $GEMSTONEAI_KEY" \
      -H "Idempotency-Key: sku-1001-r1" \
      -F external_id=SKU-1001
    Response (shortened)
    {
      "id": 81,
      "external_id": "SKU-1001",
      "revision": 1,
      "status": "completed",
      "mode": "text_only",
      "photo_count": 0,
      "rules_version": "commerce-evidence-2",
      "result": {
        "fields": [
          {
            "field": "metal",
            "value": null,
            "standing": "conflict",
            "note": "The sources disagree on the metal. Nothing here is promoted to solid gold."
          }
        ],
        "conflicts": [
          {
            "code": "metal_solid_vs_not_solid",
            "severity": "high",
            "field": "metal"
          }
        ],
        "next_evidence": [
          {
            "field": "metal",
            "ask": "Which description is correct, with a photo that shows it."
          }
        ],
        "indicative_value": null
      },
      "sandbox": true,
      "outcome": "completed"
    }

    The metal is reported as a conflict with the evidence behind each side, never promoted to the higher claim. With photos the same call answers 202 and you poll it; the Scan API guide walks through that and every field of the result.

    Rules every route follows

    • Base URL https://api.gemstoneaiapp.com/public/v1. JSON in and out, except uploads, which are multipart/form-data.
    • Every response carries GemstoneAI-API-Version: 2026-11-23, the date of the contract it was served under.
    • Your ID is the key. Cases are read, revised and deleted by external_id; a case from another workspace is a 404.
    • Writes are safe to retry. Re-sending a case with the same content changes nothing; an assessment retried with the same Idempotency-Key returns the first one and is not billed again.
    • Earlier revisions are kept as they were. A correction adds a revision; it never edits history.
    • Timestamps are UTC, ISO 8601. Monthly quotas and unit ledgers run on UTC months.
    • A partner request never creates an item in a consumer collection and never uses a person's scan allowance.

    Scopes

    Each key carries scopes. A route that needs one the key lacks answers 403 and names it.

    ScopeAllows
    cases:readRead cases, assessments, usage, the review queue, outcomes and the pilot ledger.
    cases:writeCreate, revise and delete cases, import batches, record outcomes.
    assessments:writeRun assessments.
    cases:reviewAssign, correct, escalate, request evidence and refer.
    cases:approveApprove, decline, export, and set pilot terms.
    listings:checkRun listing checks and preview reviews.
    listings:reviewRecord listing reviews and act on their flags.
    listings:escalationsClear an escalated flag.
    listings:adminPublish and retire rule packs, read review metrics.

    Errors

    Errors come back as JSON with a detail field. Where your code should branch, detail is an object with an error code and a plain-language message.

    409 response
    {
      "detail": {
        "error": "idempotency_conflict",
        "assessment_id": 81,
        "message": "This Idempotency-Key was used with a different request. Use a new key for new input."
      }
    }
    StatusMeaningWhat to do
    401Missing, invalid, revoked or suspended keyCheck the Authorization header and the key.
    403The key lacks a scope the route needsThe message names the missing scope.
    404Not found in your workspaceAnother workspace's case is also a 404.
    409 idempotency_conflictThe same Idempotency-Key with a different bodyUse a new key for new input.
    409 staleThe case moved past the revision you sentRead current_revision and show the newer version.
    409 (cases)POST /cases for an existing ID with different contentSend it to /case-revisions.
    413A photo over 15 MB, or a CSV over 5 MBResize or split.
    422Validation failed, or missing_evidence on an assessmentdetail says which field.
    429 quota_exhaustedThe workspace used its assessments for the monthRetry-After and resets_at say when. Reads and replays still work.
    429 rate_limit_exceededToo many requests in the windowWait retry_after_seconds.
    5xxOur faultRetry with the same Idempotency-Key.

    OpenAPI spec

    The API reference is generated from the published OpenAPI 3.1 spec. Any OpenAPI generator can build a typed client from it, and Swagger lets you try each route with your sandbox key.

    Sandbox key

    Request a sandbox key.

    Tell us what you are connecting. We issue a gsk_test_ key for your own workspace, with the scopes your product needs.

    A sandbox key runs every route against a stub engine: no cost, no quota, nothing billed.