{
  "openapi": "3.1.0",
  "info": {
    "title": "VerixID REST API",
    "description": "API for registering and verifying cryptographic proof of digital file existence and integrity. VerixID processes SHA-256 file fingerprints, not original files.",
    "version": "1.0.0",
    "license": {
      "name": "VerixID API Terms",
      "url": "https://verixid.com/acceptable-use/"
    }
  },
  "servers": [
    {
      "url": "https://api.verixid.com",
      "description": "Production API"
    }
  ],
  "externalDocs": {
    "description": "VerixID REST API Documentation",
    "url": "https://verixid.com/docs/api/"
  },
  "security": [
    {
      "SecureKey": []
    }
  ],
  "paths": {
    "/submit": {
      "post": {
        "operationId": "submitHash",
        "summary": "Register a file hash",
        "description": "Registers a SHA-256 fingerprint in the VerixID ledger. The original file is never uploaded to VerixID.",
        "tags": [
          "Records"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitRequest"
              },
              "example": {
                "hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Hash successfully registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitResponse"
                },
                "example": {
                  "record_id": "vx202607026731ce",
                  "server_timestamp": "2026-07-21T12:54:59.469Z",
                  "receipt_signature": "ed25519-signature-hex",
                  "ownership_key": "64-character-hex-ownership-key"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/BillingExpired"
          },
          "409": {
            "description": "Hash already registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          }
        }
      }
    },
    "/verify": {
      "get": {
        "operationId": "verifyRecord",
        "summary": "Verify a record",
        "description": "Verifies whether a VerixID Record ID exists. An ownership key can optionally be supplied to perform cryptographic ownership verification.",
        "tags": [
          "Records"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "Public VerixID Record ID.",
            "schema": {
              "type": "string",
              "pattern": "^vx[0-9]{6}[a-f0-9]{8}$",
              "minLength": 16,
              "maxLength": 16
            },
            "example": "vx202607a1b2c3d4"
          },
          {
            "name": "ownership_key",
            "in": "query",
            "required": false,
            "description": "Optional 64-character hexadecimal ownership key. When valid, the response includes the full file hash and Ed25519 signature.",
            "schema": {
              "type": "string",
              "pattern": "^[a-fA-F0-9]{64}$",
              "minLength": 64,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Record found and verified",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PublicVerificationResponse"
                    },
                    {
                      "$ref": "#/components/schemas/OwnershipVerificationResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "SecureKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Secure-Key",
        "description": "64-character case-sensitive alphanumeric API key issued by VerixID."
      }
    },
    "schemas": {
      "SubmitRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "hash"
        ],
        "properties": {
          "hash": {
            "type": "string",
            "description": "SHA-256 fingerprint of the original file, calculated client-side.",
            "pattern": "^[a-fA-F0-9]{64}$",
            "minLength": 64,
            "maxLength": 64
          }
        }
      },
      "SubmitResponse": {
        "type": "object",
        "required": [
          "record_id",
          "server_timestamp",
          "receipt_signature",
          "ownership_key"
        ],
        "properties": {
          "record_id": {
            "type": "string",
            "description": "Public identifier for the registered record.",
            "pattern": "^vx[0-9]{6}[a-f0-9]{8}$"
          },
          "server_timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "UTC timestamp assigned by the VerixID server."
          },
          "receipt_signature": {
            "type": "string",
            "description": "Ed25519 receipt signature."
          },
          "ownership_key": {
            "type": "string",
            "description": "Private ownership proof returned once during registration. Store securely; it cannot be recovered.",
            "pattern": "^[a-fA-F0-9]{64}$",
            "minLength": 64,
            "maxLength": 64
          }
        }
      },
      "PublicVerificationResponse": {
        "type": "object",
        "required": [
          "record_id",
          "registered_at",
          "hash_preview",
          "ownership_verified"
        ],
        "properties": {
          "record_id": {
            "type": "string"
          },
          "registered_at": {
            "type": "integer",
            "description": "UTC registration timestamp in Unix milliseconds."
          },
          "hash_preview": {
            "type": "string",
            "description": "Public hash preview. Only the first 16 characters are exposed without ownership proof.",
            "minLength": 16,
            "maxLength": 16
          },
          "ownership_verified": {
            "type": "boolean",
            "const": false
          }
        }
      },
      "OwnershipVerificationResponse": {
        "type": "object",
        "required": [
          "record_id",
          "registered_at",
          "hash_preview",
          "ed25519_signature",
          "ownership_verified"
        ],
        "properties": {
          "record_id": {
            "type": "string"
          },
          "registered_at": {
            "type": "integer",
            "description": "UTC registration timestamp in Unix milliseconds."
          },
          "hash_preview": {
            "type": "string",
            "description": "Full 64-character SHA-256 hash revealed after successful ownership verification.",
            "pattern": "^[a-fA-F0-9]{64}$",
            "minLength": 64,
            "maxLength": 64
          },
          "ed25519_signature": {
            "type": "string",
            "description": "Ed25519 signature in hexadecimal form.",
            "pattern": "^[a-fA-F0-9]{128}$",
            "minLength": 128,
            "maxLength": 128
          },
          "ownership_verified": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing, invalid, or unregistered API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BillingExpired": {
        "description": "Account suspended or billing period expired",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Record or route not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Quota exceeded or rate limit exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalError": {
        "description": "Unexpected internal error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "UpstreamError": {
        "description": "Internal upstream service error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}