{
  "openapi": "3.0.3",
  "info": {
    "title": "Authentific DVP public API guide",
    "version": "4.3",
    "description": "Selected customer operations. Response schemas describe the documented fields. Use your approved deployment origin and consult the authenticated portal for its full contract."
  },
  "servers": [
    {
      "url": "https://dvp.example.invalid",
      "description": "Illustrative deployment origin"
    }
  ],
  "paths": {
    "/api/v1/documents": {
      "post": {
        "operationId": "registerDocument",
        "summary": "Register a source PDF",
        "description": "Requires the document:write scope and registration permission. Issuance is a subsequent independently authorised operation. The public schema shows the core registration fields.",
        "security": [
          {
            "TenantBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegistrationInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Registered source document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistrationResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or unsupported PDF."
          },
          "401": {
            "description": "Credentials missing or expired."
          },
          "403": {
            "description": "Role or scope denied."
          },
          "409": {
            "description": "State conflict or expired or consumed challenge."
          },
          "429": {
            "description": "Request limit reached."
          }
        }
      }
    },
    "/api/v1/verify/{publicId}": {
      "get": {
        "operationId": "lookUpRecord",
        "summary": "Read current public record status",
        "parameters": [
          {
            "name": "publicId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The verification reference supplied by the issuer."
          }
        ],
        "description": "Only published records and issuer-permitted public metadata are available. The response includes a fresh, short-lived challenge for comparing the recipient’s PDF.",
        "security": [],
        "responses": {
          "200": {
            "description": "Public record and comparison challenge.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordLookup"
                }
              }
            }
          },
          "404": {
            "description": "Verification reference unavailable."
          },
          "429": {
            "description": "Request limit reached."
          }
        }
      }
    },
    "/api/v1/verify/{publicId}/compare": {
      "post": {
        "operationId": "compareIssuedFile",
        "summary": "Compare the received PDF with the registered final fingerprint",
        "parameters": [
          {
            "name": "publicId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The verification reference supplied by the issuer."
          }
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComparisonInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File comparison and current document status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComparisonResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or unsupported PDF."
          },
          "403": {
            "description": "Role or scope denied."
          },
          "404": {
            "description": "Verification reference unavailable."
          },
          "409": {
            "description": "State conflict or expired or consumed challenge."
          },
          "429": {
            "description": "Request limit reached."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "TenantBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "RegistrationInput": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 3,
            "maxLength": 180
          },
          "document_type": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100
          },
          "reference": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100
          },
          "pdf_base64": {
            "type": "string",
            "maxLength": 14000000,
            "description": "Base64 encoding of the actual PDF bytes. The deployment also validates the decoded file.",
            "minLength": 16
          }
        },
        "required": [
          "title",
          "document_type",
          "reference",
          "pdf_base64"
        ]
      },
      "RegistrationResult": {
        "type": "object",
        "properties": {
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "reference": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "status"
            ]
          }
        },
        "required": [
          "document"
        ]
      },
      "RecordLookup": {
        "type": "object",
        "properties": {
          "document": {
            "type": "object",
            "properties": {
              "public_id": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "public_id",
              "status"
            ]
          },
          "challenge": {
            "type": "object",
            "properties": {
              "token": {
                "type": "string"
              },
              "sessionId": {
                "type": "string",
                "format": "uuid"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "token",
              "sessionId",
              "expiresAt"
            ]
          }
        },
        "required": [
          "document",
          "challenge"
        ]
      },
      "ComparisonInput": {
        "type": "object",
        "properties": {
          "pdf_base64": {
            "type": "string",
            "maxLength": 14000000,
            "description": "Base64 encoding of the actual PDF bytes. The deployment also validates the decoded file."
          },
          "challenge_token": {
            "type": "string",
            "maxLength": 6000
          },
          "session_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "pdf_base64",
          "challenge_token",
          "session_id"
        ]
      },
      "ComparisonResult": {
        "type": "object",
        "properties": {
          "matches": {
            "type": "boolean"
          },
          "fingerprint_result": {
            "type": "string",
            "enum": [
              "MATCH",
              "MISMATCH"
            ]
          },
          "status": {
            "type": "string"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "matches",
          "fingerprint_result",
          "status",
          "verified_at"
        ]
      }
    }
  }
}
