{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/preuve-ai/json-schema/preuve-ai-batch-export-schema.json",
  "title": "BatchExport",
  "description": "Note the asymmetry with the other two exports: this one carries no exportType. The single-analysis and agency-report exports each stamp one, this payload identifies itself by batchId instead, and the schema follows the wire rather than inventing a discriminator that is never sent.\n",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/preuve-ai-openapi.json#/components/schemas/BatchExport",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "integer",
      "const": 2
    },
    "batchId": {
      "type": "string",
      "format": "uuid",
      "description": "The batch this export was built from."
    },
    "exportedAt": {
      "type": "string",
      "format": "date-time"
    },
    "verbosity": {
      "type": "string",
      "enum": [
        "full",
        "summary"
      ],
      "description": "The verbosity every idea in this payload was built at, echoed back. On \"summary\", each idea's details.omitted names what was dropped.\n"
    },
    "locked": {
      "$ref": "#/$defs/ExportLocks"
    },
    "upsell": {
      "$ref": "#/$defs/ExportUpsell"
    },
    "counts": {
      "type": "object",
      "description": "The batch's own item tally (total, plus one key per item status such as COMPLETED or FAILED) with the export's two counts merged on top. Read the named keys; do not assume the set is closed.\n",
      "properties": {
        "total": {
          "type": "integer",
          "description": "Items in the batch."
        },
        "exported": {
          "type": "integer",
          "description": "Items whose report made it into ideas."
        },
        "omitted": {
          "type": "integer",
          "description": "Items listed in omittedItems instead."
        }
      },
      "additionalProperties": {
        "type": "integer"
      }
    },
    "ideas": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "omittedItems": {
      "type": "array",
      "description": "Every incomplete item with the reason it was skipped.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null when the item is a late-collision stub that never became a run."
          },
          "clientRunId": {
            "type": "string"
          },
          "reportId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        }
      }
    }
  },
  "$defs": {
    "ExportLocks": {
      "type": "object",
      "description": "Which fields this export left null, and why. Present only when the caller's tier withheld something, and absent entirely when the payload is complete. Read it before concluding a field is absent: a null under one of these paths is locked, not missing and not a failed analysis. It ships to every tier, paid included, and carries no price and no URL. On a batch export there is ONE object for the whole batch, the union of every exported item's withheld fields, deduplicated by path.\n",
      "properties": {
        "reason": {
          "type": "string",
          "description": "Why the fields were withheld. \"starter_scan\" today."
        },
        "unlockedBy": {
          "type": "string",
          "description": "What lifts the lock. \"founder_report\" today."
        },
        "fields": {
          "type": "array",
          "description": "One entry per withheld field.",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string",
                "description": "Dotted path into the export, e.g. \"details.pivots\". A path may name several keys of one object with a pipe, e.g. \"details.risks[].explanation|mitigation\".\n"
              },
              "label": {
                "type": "string",
                "description": "What that path holds, in plain language. Some labels also say the field needs an enrich call once the report is deep.\n"
              }
            }
          }
        },
        "note": {
          "type": "string",
          "description": "One sentence restating that the nulls are a tier boundary rather than missing data.\n"
        }
      }
    },
    "ExportUpsell": {
      "type": "object",
      "description": "Purchase context for a locked export or buyable quota refusal. Export upsells are free-owner only; a paid non-regional caller may receive a scan_pack top-up on INSUFFICIENT_TOKENS. Ignore it if you only need the data contract.\n",
      "properties": {
        "offer": {
          "type": "string",
          "enum": [
            "founder_report",
            "scan_pack"
          ],
          "description": "\"founder_report\" is the one-time Founder Report tier. \"scan_pack\" is a top-up for an account that already bought and has no deep credits left.\n"
        },
        "guarantee": {
          "type": "string",
          "description": "Guarantee text for offer=founder_report. Omitted for scan_pack top-ups; an empty string is never used.\n"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Purchase or report URL, with attribution query parameters."
        },
        "locked": {
          "type": "array",
          "description": "Section names the offer covers. Distinct from the top-level locked object, which names response FIELDS.\n",
          "items": {
            "type": "string"
          }
        },
        "note": {
          "type": "string",
          "description": "The same facts as one sentence, for a client that relays text."
        }
      }
    }
  }
}