{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/coincover/main/json-schema/coincover-backup-store-request-schema.json",
  "title": "BackupStoreRequest",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/coincover-retail-openapi-openapi.json#/components/schemas/BackupStoreRequest",
  "type": "object",
  "properties": {
    "user_identifier": {
      "type": "string",
      "description": "User identifier (REQUIRED)"
    },
    "verification_id": {
      "type": "string",
      "description": "Verification ID from a previous verification. (REQUIRED) Must exist in identity_verifications table and belong to the user associated with the organisation."
    },
    "public_key": {
      "type": "string",
      "description": "Public key in hexadecimal format. (REQUIRED) 32-4096 characters long.",
      "minLength": 32,
      "maxLength": 4096,
      "pattern": "^[0-9a-fA-F]+$"
    },
    "backup": {
      "type": "array",
      "description": "Array of backup items to store. (REQUIRED) Allows multiple pieces of data to be backed up in a single request. Limited to a maximum of 3 items.",
      "minItems": 1,
      "maxItems": 3,
      "items": {
        "type": "object",
        "properties": {
          "item_key": {
            "type": "string",
            "description": "Unique identifier for the backup item (e.g., \"seed_phrase\", \"private_key\", \"wallet_config\"). (REQUIRED)"
          },
          "item_value": {
            "type": "string",
            "format": "base64",
            "description": "Base64 encoded encrypted data. (REQUIRED)"
          },
          "item_checksum": {
            "type": "string",
            "description": "SHA-256 hash of the data. (REQUIRED) 64 hex characters.",
            "pattern": "^[a-fA-F0-9]{64}$"
          }
        },
        "required": [
          "item_key",
          "item_value",
          "item_checksum"
        ]
      }
    },
    "metadata": {
      "type": "object",
      "description": "Optional metadata associated with the backup. Allows custom key-value pairs.",
      "properties": {
        "description": {
          "type": "string",
          "description": "Description of the backup (OPTIONAL)"
        },
        "content_type": {
          "type": "string",
          "description": "MIME type of the content (OPTIONAL)"
        },
        "original_filename": {
          "type": "string",
          "description": "Original filename if applicable (OPTIONAL)"
        }
      },
      "additionalProperties": true
    }
  },
  "required": [
    "user_identifier",
    "verification_id",
    "public_key",
    "backup"
  ]
}