{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/lightspark/main/json-schema/lightspark-document-schema.json",
  "title": "Document",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lightspark-documents-api-openapi.yml#/components/schemas/Document",
  "type": "object",
  "required": [
    "id",
    "documentHolder",
    "documentType",
    "country",
    "fileName",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for this document"
    },
    "documentHolder": {
      "type": "string",
      "description": "ID of the entity that owns this document. Can be a Customer ID or a BeneficialOwner ID."
    },
    "documentType": {
      "$ref": "#/$defs/DocumentType"
    },
    "side": {
      "type": "string",
      "enum": [
        "FRONT",
        "BACK"
      ],
      "description": "Which side of the document this upload represents. Relevant for two-sided documents like driver's licenses or national IDs."
    },
    "country": {
      "type": "string",
      "description": "Country that issued the document (ISO 3166-1 alpha-2)"
    },
    "documentNumber": {
      "type": "string",
      "description": "Document identification number (e.g., passport number)"
    },
    "issuingAuthority": {
      "type": "string",
      "description": "Name of the government agency or organization that issued the document"
    },
    "fileName": {
      "type": "string",
      "description": "Original file name of the uploaded document"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "When this document was uploaded"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When this document was last updated"
    }
  },
  "$defs": {
    "DocumentType": {
      "type": "string",
      "enum": [
        "PASSPORT",
        "DRIVERS_LICENSE",
        "NATIONAL_ID",
        "PROOF_OF_ADDRESS",
        "BANK_STATEMENT",
        "TAX_RETURN",
        "CERTIFICATE_OF_INCORPORATION",
        "ARTICLES_OF_INCORPORATION",
        "ARTICLES_OF_ASSOCIATION",
        "STATE_REGISTRY_EXCERPT",
        "GOOD_STANDING_CERTIFICATE",
        "INFORMATION_STATEMENT",
        "INCUMBENCY_CERTIFICATE",
        "BUSINESS_LICENSE",
        "SHAREHOLDER_REGISTER",
        "POWER_OF_ATTORNEY",
        "UTILITY_BILL",
        "ELECTRICITY_BILL",
        "RENT_OR_LEASE_AGREEMENT",
        "DIRECTOR_REGISTRY",
        "TRUST_AGREEMENT",
        "STATE_COMPANY_REGISTRY",
        "PARTNERSHIP_CONTROL_AGREEMENT",
        "PARTNERSHIP_AGREEMENT",
        "SELFIE",
        "OTHER"
      ],
      "description": "Type of identity or business verification document. Document types are grouped by verification category:\n**Identity** — PASSPORT, DRIVERS_LICENSE, NATIONAL_ID\n**Business — Legal presence** — CERTIFICATE_OF_INCORPORATION, ARTICLES_OF_INCORPORATION, ARTICLES_OF_ASSOCIATION, STATE_REGISTRY_EXCERPT\n**Business — Control structure** — DIRECTOR_REGISTRY, TRUST_AGREEMENT, STATE_COMPANY_REGISTRY, PARTNERSHIP_CONTROL_AGREEMENT\n**Business — Ownership structure** — SHAREHOLDER_REGISTER, TRUST_AGREEMENT, PARTNERSHIP_AGREEMENT\n**Proof of address** — UTILITY_BILL, RENT_OR_LEASE_AGREEMENT, ELECTRICITY_BILL, BANK_STATEMENT, TAX_RETURN"
    }
  }
}