{
  "openapi": "3.1.0",
  "info": {
    "title": "Bona Fide API",
    "version": "1.0.0",
    "description": "API-first e-signature. Errors are RFC 9457 problem+json with JSON Pointers."
  },
  "servers": [
    {
      "url": "https://bonafide-api.republic.global"
    }
  ],
  "paths": {
    "/v1/templates": {
      "post": {
        "operationId": "createTemplate",
        "summary": "Create a template",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTemplate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listTemplates",
        "summary": "List templates",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "TemplateList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}": {
      "get": {
        "operationId": "getTemplate",
        "summary": "Get a template",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTemplate",
        "summary": "Delete a template that was never used by an envelope or signing link",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/files": {
      "post": {
        "operationId": "uploadTemplateFile",
        "summary": "Upload the source PDF (or a .docx, converted to PDF to keep the exact Word layout)",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/pdf": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/pdf"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "TemplateFile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateFile"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/import": {
      "post": {
        "operationId": "importTemplateDocument",
        "summary": "Convert a Word document (.docx) into an editable Document-mode draft body (nothing is stored)",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "DocumentImport",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentImport"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/draft": {
      "put": {
        "operationId": "saveTemplateDraft",
        "summary": "Create or replace the draft version",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveTemplateDraft"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "TemplateVersion",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateVersion"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/publish": {
      "post": {
        "operationId": "publishTemplate",
        "summary": "Publish the draft as a new immutable version",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "201": {
            "description": "TemplateVersion",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateVersion"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/versions": {
      "get": {
        "operationId": "listTemplateVersions",
        "summary": "List versions (newest first)",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "TemplateVersionList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateVersionList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/versions/{version}": {
      "get": {
        "operationId": "getTemplateVersion",
        "summary": "Get a version (number, \"latest\" or \"draft\")",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "TemplateVersion",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateVersion"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/versions/{version}/document": {
      "get": {
        "operationId": "getTemplateVersionDocument",
        "summary": "The base PDF of a version (number, \"latest\" or \"draft\"); drafts give the uploaded original unless ?edited=true",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Source PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/pdf"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/versions/{version}/render": {
      "post": {
        "operationId": "renderTemplatePreview",
        "summary": "Render a watermarked PREVIEW PDF with variables",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderPreview"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Watermarked preview PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/pdf"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/envelopes": {
      "post": {
        "operationId": "createEnvelope",
        "summary": "Create and send an envelope from a template (dry_run=true validates and renders only)",
        "tags": [
          "Envelopes"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "dry_run",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "test_mode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1",
                "true",
                "false"
              ]
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEnvelope"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "EnvelopeDryRun",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeDryRun"
                }
              }
            }
          },
          "201": {
            "description": "Envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listEnvelopes",
        "summary": "List envelopes",
        "tags": [
          "Envelopes"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "rendering",
                "sent",
                "completed",
                "declined",
                "voided",
                "expired"
              ]
            }
          },
          {
            "name": "seal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "not_started",
                "pending",
                "sealed",
                "failed"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "template",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
            }
          },
          {
            "name": "testMode",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "EnvelopeList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/envelopes/{id}": {
      "get": {
        "operationId": "getEnvelope",
        "summary": "Get an envelope",
        "tags": [
          "Envelopes"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/envelopes/{id}/document": {
      "get": {
        "operationId": "getEnvelopeDocument",
        "summary": "Download the rendered original, the sealed PDF or the standalone certificate of completion",
        "tags": [
          "Envelopes"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "default": "original",
              "type": "string",
              "enum": [
                "original",
                "sealed",
                "certificate"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/pdf"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/envelopes/{id}/void": {
      "post": {
        "operationId": "voidEnvelope",
        "summary": "Void an envelope in progress",
        "tags": [
          "Envelopes"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoidEnvelope"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/envelopes/{id}/recipients/{recipient}/resend": {
      "post": {
        "operationId": "resendToRecipient",
        "summary": "Email the recipient a fresh signing link (their turn only; at most once a minute)",
        "tags": [
          "Envelopes"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recipient",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Sent"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/envelopes/{id}/sessions": {
      "post": {
        "operationId": "createSigningSession",
        "summary": "Mint a short-lived, single-use signing session for a recipient (embedded or hosted)",
        "tags": [
          "Signing"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSession"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/envelopes/{id}/events": {
      "get": {
        "operationId": "listEnvelopeEvents",
        "summary": "The envelope audit trail with hash-chain verification",
        "tags": [
          "Envelopes"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "EnvelopeEventList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeEventList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/envelopes/{id}/events/stream": {
      "get": {
        "operationId": "streamEnvelopeEvents",
        "summary": "Server-sent events for one envelope (Last-Event-ID = seq resumes)",
        "tags": [
          "Envelopes"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/event-stream of EnvelopeEventRecord",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/exchange": {
      "post": {
        "operationId": "exchangeSigningToken",
        "summary": "Exchange a session token (email link / embed) for a short-lived access token",
        "tags": [
          "Signing"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionExchangeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SessionExchangeResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionExchangeResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/session": {
      "get": {
        "operationId": "getSigningSession",
        "summary": "Load the signer view",
        "tags": [
          "Signing"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "SigningSessionView",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningSessionView"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/document": {
      "get": {
        "operationId": "getSigningDocument",
        "summary": "The PDF to display to the signer",
        "tags": [
          "Signing"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/pdf"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/otp": {
      "post": {
        "operationId": "sendSigningOtp",
        "summary": "Send a one-time code (email; SMS if enabled for the org)",
        "tags": [
          "Signing"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OtpSendRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "OtpSendResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OtpSendResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/otp/verify": {
      "post": {
        "operationId": "verifySigningOtp",
        "summary": "Verify the one-time code",
        "tags": [
          "Signing"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OtpVerifyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OtpVerifyResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OtpVerifyResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/attachments": {
      "post": {
        "operationId": "uploadSigningAttachment",
        "summary": "Upload a file for an attachment field (multipart: field, file)",
        "tags": [
          "Signing"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "string",
                "contentMediaType": "multipart/form-data"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "AttachmentUploadResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachmentUploadResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/submit": {
      "post": {
        "operationId": "submitSigning",
        "summary": "Submit field values, signature and consent",
        "tags": [
          "Signing"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitSigning"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SubmitSigningResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitSigningResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/decline": {
      "post": {
        "operationId": "declineSigning",
        "summary": "Decline to sign (ends the envelope)",
        "tags": [
          "Signing"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeclineSigning"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{id}": {
      "get": {
        "operationId": "getPublicSigningLink",
        "summary": "Public description of an always-on link",
        "tags": [
          "Signing links"
        ],
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PublicSigningLink",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSigningLink"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{id}/start": {
      "post": {
        "operationId": "startSigningLink",
        "summary": "Visitor details → email OTP (rate limited)",
        "tags": [
          "Signing links"
        ],
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartSigningLink"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "LinkChallenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkChallenge"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{id}/verify": {
      "post": {
        "operationId": "verifySigningLink",
        "summary": "Verify the OTP; creates the envelope and a signing session",
        "tags": [
          "Signing links"
        ],
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifySigningLink"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "LinkSession",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkSession"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing-links": {
      "post": {
        "operationId": "createSigningLink",
        "summary": "Create an always-on signing link",
        "tags": [
          "Signing links"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "test_mode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSigningLink"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "SigningLink",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningLink"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listSigningLinks",
        "summary": "List signing links",
        "tags": [
          "Signing links"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "testMode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SigningLinkList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningLinkList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing-links/{id}": {
      "patch": {
        "operationId": "updateSigningLink",
        "summary": "Change, pause or resume a link",
        "tags": [
          "Signing links"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSigningLink"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SigningLink",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningLink"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteSigningLink",
        "summary": "Delete a link (envelopes it created stay)",
        "tags": [
          "Signing links"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook-endpoints": {
      "post": {
        "operationId": "createWebhookEndpoint",
        "summary": "Register a webhook endpoint (Standard Webhooks; the secret is returned once)",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookEndpoint"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "WebhookEndpoint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listWebhookEndpoints",
        "summary": "List webhook endpoints with delivery health",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "WebhookEndpointList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook-endpoints/{id}": {
      "get": {
        "operationId": "getWebhookEndpoint",
        "summary": "Get a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "WebhookEndpoint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateWebhookEndpoint",
        "summary": "Change URL, events, description or pause",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookEndpoint"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "WebhookEndpoint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhookEndpoint",
        "summary": "Delete a webhook endpoint",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook-endpoints/{id}/secret": {
      "post": {
        "operationId": "revealWebhookSecret",
        "summary": "Reveal the signing secret",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "WebhookSecret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecret"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook-endpoints/{id}/secret/rotate": {
      "post": {
        "operationId": "rotateWebhookSecret",
        "summary": "Rotate the signing secret (the old one also signs for 24 h)",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "WebhookSecret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecret"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook-endpoints/{id}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "summary": "Recent delivery attempts",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "WebhookDeliveryList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook-endpoints/{id}/test": {
      "post": {
        "operationId": "testWebhookEndpoint",
        "summary": "Send a `webhook.test` ping",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "WebhookDelivery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/{id}/redeliver": {
      "post": {
        "operationId": "redeliverEvent",
        "summary": "Deliver an envelope event to an endpoint again",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedeliverEvent"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "WebhookDelivery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api-keys": {
      "post": {
        "operationId": "createApiKey",
        "summary": "Create an org API key (bf_live_/bf_test_); shown once",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKey"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "CreatedApiKey",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedApiKey"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listApiKeys",
        "summary": "List org API keys",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "ApiKeyList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api-keys/{id}": {
      "delete": {
        "operationId": "deleteApiKey",
        "summary": "Revoke an API key",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scim": {
      "get": {
        "operationId": "getScimStatus",
        "summary": "SCIM endpoint, token state and provisioned users",
        "tags": [
          "Directory"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "ScimStatus",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScimStatus"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scim/token": {
      "post": {
        "operationId": "createScimToken",
        "summary": "Create (or replace) the SCIM bearer token; shown once",
        "tags": [
          "Directory"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "201": {
            "description": "ScimToken",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScimToken"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "revokeScimToken",
        "summary": "Revoke the SCIM token (provisioning stops)",
        "tags": [
          "Directory"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organization/settings": {
      "get": {
        "operationId": "getOrganizationSettings",
        "summary": "Feature flags (e.g. SMS add-on)",
        "tags": [
          "Organization"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Settings"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organization/email-branding": {
      "get": {
        "operationId": "getEmailBranding",
        "summary": "Email branding settings and what the plan allows",
        "tags": [
          "Organization"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "EmailBranding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailBranding"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateEmailBranding",
        "summary": "Change email branding (display name, custom message; footer and Powered-by removal by plan)",
        "tags": [
          "Organization"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailBranding"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "EmailBranding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailBranding"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organization/email-branding/preview": {
      "post": {
        "operationId": "previewEmail",
        "summary": "Render a sample email for the organization (optionally with unsaved branding); the plan's limits apply",
        "tags": [
          "Organization"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "EmailPreview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailPreview"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organization/logo": {
      "post": {
        "operationId": "uploadOrganizationLogo",
        "summary": "Upload a logo (multipart `file`, PNG/JPEG/SVG/WebP ≤ 512 KB) → public URL to store via Better Auth organization.update",
        "tags": [
          "Organization"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "string",
                "contentMediaType": "multipart/form-data"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "UploadedLogo",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadedLogo"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/public/logos/{org}/{file}": {
      "get": {
        "operationId": "getOrganizationLogo",
        "summary": "A public organization logo",
        "tags": [
          "Organization"
        ],
        "security": [],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Image",
            "content": {
              "image/*": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "image/*"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "getUsage",
        "summary": "Metered usage for a billing period (YYYY-MM)",
        "tags": [
          "Organization"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/organizations/{id}/features": {
      "patch": {
        "operationId": "setOrganizationFeatures",
        "summary": "Staff only: toggle paid add-ons such as SMS",
        "tags": [
          "Admin"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Features"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/discover": {
      "get": {
        "operationId": "discoverSso",
        "summary": "Does this email sign in with company SSO? (public, rate limited)",
        "tags": [
          "SSO"
        ],
        "security": [],
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 320,
              "format": "email",
              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SsoDiscovery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SsoDiscovery"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/connections": {
      "get": {
        "operationId": "listSsoConnections",
        "summary": "Settings and health of the org's SSO connections",
        "tags": [
          "SSO"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "SsoConnectionList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SsoConnectionList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/connections/{providerId}": {
      "get": {
        "operationId": "getSsoConnection",
        "summary": "Settings and health of one connection",
        "tags": [
          "SSO"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "providerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SsoConnection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SsoConnection"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/connections/{providerId}/settings": {
      "put": {
        "operationId": "saveSsoConnectionSettings",
        "summary": "Enforcement, default role and JIT provisioning",
        "tags": [
          "SSO"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "providerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SsoConnectionSettings"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SsoConnectionSettings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SsoConnectionSettings"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/connections/{providerId}/tests": {
      "post": {
        "operationId": "startSsoTest",
        "summary": "Start a test login; open `url` in a popup and poll the test",
        "tags": [
          "SSO"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "providerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "SsoTest",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SsoTest"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/connections/{providerId}/tests/{testId}/start": {
      "get": {
        "operationId": "redirectSsoTest",
        "summary": "Redirect to the IdP for a test login (popup)",
        "tags": [
          "SSO"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "providerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "To the IdP"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/connections/{providerId}/tests/{testId}": {
      "get": {
        "operationId": "getSsoTest",
        "summary": "Outcome of a test login",
        "tags": [
          "SSO"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "providerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SsoTest",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SsoTest"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/saml-metadata": {
      "post": {
        "operationId": "fetchSamlMetadata",
        "summary": "Fetch an IdP metadata URL server-side",
        "tags": [
          "SSO"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FetchSamlMetadata"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SamlMetadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SamlMetadata"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sso/audit": {
      "get": {
        "operationId": "listSsoAudit",
        "summary": "SSO and SCIM administration audit trail (newest first)",
        "tags": [
          "SSO"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "providerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SsoAuditList",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SsoAuditList"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing": {
      "get": {
        "operationId": "getBilling",
        "summary": "Plan, usage this period, upcoming invoice and entitlements",
        "tags": [
          "Billing"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "BillingOverview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingOverview"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/subscription": {
      "get": {
        "operationId": "getSubscription",
        "summary": "Plan and usage (subset of GET /v1/billing)",
        "tags": [
          "Billing"
        ],
        "security": [
          {
            "apiKey": []
          },
          {
            "bearerApiKey": []
          },
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/checkout": {
      "post": {
        "operationId": "createCheckout",
        "summary": "Start a subscription (Stripe Checkout URL) or switch an existing one in place",
        "tags": [
          "Billing"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCheckout"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "RedirectUrl",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedirectUrl"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/portal": {
      "post": {
        "operationId": "createPortal",
        "summary": "Stripe Customer Portal URL (cards, invoices, tax IDs, cancel)",
        "tags": [
          "Billing"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePortal"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "RedirectUrl",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedirectUrl"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/webhooks/stripe": {
      "post": {
        "operationId": "stripeWebhook",
        "summary": "Stripe webhook receiver (Stripe-Signature verified)",
        "tags": [
          "Billing"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Received"
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/bona-fide/keys.json": {
      "get": {
        "operationId": "getAnchorKeys",
        "summary": "Ed25519 public keys that sign evidence anchors, with validity periods (public)",
        "tags": [
          "Verification"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "AnchorKeySet",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnchorKeySet"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/public/anchors": {
      "get": {
        "operationId": "listAnchors",
        "summary": "Signed evidence anchors, newest first (public)",
        "tags": [
          "Verification"
        ],
        "security": [],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AnchorPage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnchorPage"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/public/anchors/latest": {
      "get": {
        "operationId": "getLatestAnchor",
        "summary": "The latest signed evidence anchor (public)",
        "tags": [
          "Verification"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Anchor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Anchor"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/public/anchors/{sequence}": {
      "get": {
        "operationId": "getAnchor",
        "summary": "A signed evidence anchor by sequence number (public)",
        "tags": [
          "Verification"
        ],
        "security": [],
        "parameters": [
          {
            "name": "sequence",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Anchor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Anchor"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/public/verify": {
      "post": {
        "operationId": "verifyDocument",
        "summary": "Look up a document by SHA-256: envelope summary, Merkle leaf, inclusion proof and signed anchor (public; hash the file locally)",
        "tags": [
          "Verification"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "VerifyResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error (RFC 9457)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
          },
          "organization": {
            "type": "string",
            "pattern": "^org_[A-Za-z0-9]{10,40}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 2000
          },
          "latestVersion": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "draftVersion": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "id",
          "organization",
          "name",
          "latestVersion",
          "draftVersion",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "detail": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pointer": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "hint": {
                  "type": "string"
                }
              },
              "required": [
                "pointer",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "requestId": {
            "type": "string"
          },
          "upgradeUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "type",
          "title",
          "status"
        ],
        "additionalProperties": false
      },
      "CreateTemplate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "name"
        ]
      },
      "TemplateList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
                },
                "organization": {
                  "type": "string",
                  "pattern": "^org_[A-Za-z0-9]{10,40}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "description": {
                  "type": "string",
                  "maxLength": 2000
                },
                "latestVersion": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "draftVersion": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                }
              },
              "required": [
                "id",
                "organization",
                "name",
                "latestVersion",
                "draftVersion",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "TemplateFile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^tfl_[A-Za-z0-9]{10,40}$"
          },
          "template": {
            "type": "string",
            "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "pageCount": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "pageSizes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "width": {
                  "type": "number",
                  "exclusiveMinimum": 0
                },
                "height": {
                  "type": "number",
                  "exclusiveMinimum": 0
                }
              },
              "required": [
                "width",
                "height"
              ],
              "additionalProperties": false
            }
          },
          "convertedFrom": {
            "type": "string",
            "enum": [
              "docx"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "id",
          "template",
          "sha256",
          "sizeBytes",
          "pageCount",
          "pageSizes",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "DocumentImport_schema0": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "attrs": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "content": {
            "maxItems": 20000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentImport_schema0"
            }
          },
          "marks": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "attrs": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": [
                "type"
              ],
              "additionalProperties": false
            }
          },
          "text": {
            "type": "string",
            "maxLength": 100000
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": false
      },
      "DocumentImport": {
        "type": "object",
        "properties": {
          "content": {
            "type": "object",
            "properties": {
              "format": {
                "type": "string",
                "const": "prosemirror"
              },
              "schemaVersion": {
                "type": "number",
                "const": 1
              },
              "doc": {
                "$ref": "#/components/schemas/DocumentImport_schema0"
              },
              "settings": {
                "default": {
                  "pageSize": "letter",
                  "margins": {
                    "top": 72,
                    "right": 72,
                    "bottom": 72,
                    "left": 72
                  },
                  "font": "Inter Tight",
                  "fontSize": 11
                },
                "type": "object",
                "properties": {
                  "pageSize": {
                    "default": "letter",
                    "type": "string",
                    "enum": [
                      "letter",
                      "a4"
                    ]
                  },
                  "margins": {
                    "default": {
                      "top": 72,
                      "right": 72,
                      "bottom": 72,
                      "left": 72
                    },
                    "type": "object",
                    "properties": {
                      "top": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "right": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "bottom": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "left": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      }
                    },
                    "required": [
                      "top",
                      "right",
                      "bottom",
                      "left"
                    ],
                    "additionalProperties": false
                  },
                  "font": {
                    "default": "Inter Tight",
                    "type": "string",
                    "enum": [
                      "Inter Tight",
                      "Instrument Serif",
                      "JetBrains Mono"
                    ]
                  },
                  "fontSize": {
                    "default": 11,
                    "type": "number",
                    "minimum": 6,
                    "maximum": 24
                  },
                  "header": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "footer": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "pageSize",
                  "margins",
                  "font",
                  "fontSize"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "format",
              "schemaVersion",
              "doc",
              "settings"
            ],
            "additionalProperties": false
          },
          "roles": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9_]*$"
                },
                "label": {
                  "type": "string",
                  "maxLength": 100
                },
                "kind": {
                  "default": "signer",
                  "type": "string",
                  "enum": [
                    "signer",
                    "approver",
                    "form_filler",
                    "cc"
                  ]
                },
                "order": {
                  "default": 1,
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "verification": {
                  "default": "email_otp",
                  "type": "string",
                  "enum": [
                    "none",
                    "email_otp",
                    "passkey",
                    "sms_otp",
                    "id_check",
                    "integrator_asserted"
                  ]
                },
                "color": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                }
              },
              "required": [
                "key",
                "label",
                "kind",
                "order",
                "verification"
              ],
              "additionalProperties": false
            }
          },
          "variables": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "sampleVariables": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "detected": {
            "type": "object",
            "properties": {
              "variables": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "signature",
                        "initials",
                        "name",
                        "email",
                        "date_signed",
                        "text",
                        "number",
                        "date",
                        "checkbox",
                        "radio",
                        "dropdown",
                        "attachment",
                        "formula",
                        "stamp",
                        "variable_text"
                      ]
                    },
                    "role": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "tag",
                        "line"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "type",
                    "source"
                  ],
                  "additionalProperties": false
                }
              },
              "sections": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "variables",
              "fields",
              "sections"
            ],
            "additionalProperties": false
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "content",
          "roles",
          "variables",
          "sampleVariables",
          "detected",
          "warnings"
        ],
        "additionalProperties": false
      },
      "TemplateVersion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^tplv_[A-Za-z0-9]{10,40}$"
          },
          "template": {
            "type": "string",
            "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "pdf",
              "docx",
              "html",
              "markdown",
              "document"
            ]
          },
          "pageCount": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "pageSizes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "width": {
                  "type": "number"
                },
                "height": {
                  "type": "number"
                }
              },
              "required": [
                "width",
                "height"
              ],
              "additionalProperties": false
            }
          },
          "roles": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9_]*$"
                },
                "label": {
                  "type": "string",
                  "maxLength": 100
                },
                "kind": {
                  "default": "signer",
                  "type": "string",
                  "enum": [
                    "signer",
                    "approver",
                    "form_filler",
                    "cc"
                  ]
                },
                "order": {
                  "default": 1,
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "verification": {
                  "default": "email_otp",
                  "type": "string",
                  "enum": [
                    "none",
                    "email_otp",
                    "passkey",
                    "sms_otp",
                    "id_check",
                    "integrator_asserted"
                  ]
                },
                "color": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                }
              },
              "required": [
                "key",
                "label",
                "kind",
                "order",
                "verification"
              ],
              "additionalProperties": false
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9_.-]*$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "signature",
                    "initials",
                    "name",
                    "email",
                    "date_signed",
                    "text",
                    "number",
                    "date",
                    "checkbox",
                    "radio",
                    "dropdown",
                    "attachment",
                    "formula",
                    "stamp",
                    "variable_text"
                  ]
                },
                "role": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "label": {
                  "type": "string",
                  "maxLength": 200
                },
                "required": {
                  "default": true,
                  "type": "boolean"
                },
                "rect": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "x": {
                      "type": "number",
                      "minimum": 0
                    },
                    "y": {
                      "type": "number",
                      "minimum": 0
                    },
                    "width": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "height": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "page",
                    "x",
                    "y",
                    "width",
                    "height"
                  ],
                  "additionalProperties": false
                },
                "variable": {
                  "type": "string",
                  "format": "starts_with",
                  "pattern": "^\\/.*"
                },
                "default": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "validation": {
                  "type": "object",
                  "properties": {
                    "pattern": {
                      "type": "string"
                    },
                    "min": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    },
                    "maxLength": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "email",
                        "phone",
                        "date",
                        "number",
                        "currency"
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                "formula": {
                  "type": "string",
                  "maxLength": 500
                },
                "showIf": {
                  "type": "string",
                  "maxLength": 500
                },
                "overflow": {
                  "default": "shrink",
                  "type": "string",
                  "enum": [
                    "shrink",
                    "wrap",
                    "reject"
                  ]
                },
                "font": {
                  "type": "object",
                  "properties": {
                    "family": {
                      "type": "string"
                    },
                    "size": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  },
                  "additionalProperties": false
                },
                "tabOrder": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "repeat": {
                  "type": "string",
                  "format": "starts_with",
                  "pattern": "^\\/.*"
                }
              },
              "required": [
                "id",
                "type",
                "required",
                "rect",
                "overflow"
              ],
              "additionalProperties": false
            }
          },
          "variables": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "sampleVariables": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "file": {
            "type": "string",
            "pattern": "^tfl_[A-Za-z0-9]{10,40}$"
          },
          "documentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "content": {
            "type": "object",
            "properties": {
              "format": {
                "type": "string",
                "const": "prosemirror"
              },
              "schemaVersion": {
                "type": "number",
                "const": 1
              },
              "doc": {
                "$ref": "#/components/schemas/DocumentImport_schema0"
              },
              "settings": {
                "default": {
                  "pageSize": "letter",
                  "margins": {
                    "top": 72,
                    "right": 72,
                    "bottom": 72,
                    "left": 72
                  },
                  "font": "Inter Tight",
                  "fontSize": 11
                },
                "type": "object",
                "properties": {
                  "pageSize": {
                    "default": "letter",
                    "type": "string",
                    "enum": [
                      "letter",
                      "a4"
                    ]
                  },
                  "margins": {
                    "default": {
                      "top": 72,
                      "right": 72,
                      "bottom": 72,
                      "left": 72
                    },
                    "type": "object",
                    "properties": {
                      "top": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "right": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "bottom": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "left": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      }
                    },
                    "required": [
                      "top",
                      "right",
                      "bottom",
                      "left"
                    ],
                    "additionalProperties": false
                  },
                  "font": {
                    "default": "Inter Tight",
                    "type": "string",
                    "enum": [
                      "Inter Tight",
                      "Instrument Serif",
                      "JetBrains Mono"
                    ]
                  },
                  "fontSize": {
                    "default": 11,
                    "type": "number",
                    "minimum": 6,
                    "maximum": 24
                  },
                  "header": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "footer": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "pageSize",
                  "margins",
                  "font",
                  "fontSize"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "format",
              "schemaVersion",
              "doc",
              "settings"
            ],
            "additionalProperties": false
          },
          "edits": {
            "type": "object",
            "properties": {
              "pages": {
                "minItems": 1,
                "maxItems": 2000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rotate": {
                      "default": 0,
                      "anyOf": [
                        {
                          "type": "number",
                          "const": 0
                        },
                        {
                          "type": "number",
                          "const": 90
                        },
                        {
                          "type": "number",
                          "const": 180
                        },
                        {
                          "type": "number",
                          "const": 270
                        }
                      ]
                    },
                    "width": {
                      "type": "number",
                      "exclusiveMinimum": 0,
                      "maximum": 14400
                    },
                    "height": {
                      "type": "number",
                      "exclusiveMinimum": 0,
                      "maximum": 14400
                    }
                  },
                  "required": [
                    "source",
                    "rotate"
                  ],
                  "additionalProperties": false
                }
              },
              "items": {
                "default": [],
                "maxItems": 2000,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "kind": {
                          "type": "string",
                          "const": "whiteout"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "rect": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "number"
                            },
                            "y": {
                              "type": "number"
                            },
                            "width": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "height": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            }
                          },
                          "required": [
                            "x",
                            "y",
                            "width",
                            "height"
                          ],
                          "additionalProperties": false
                        },
                        "color": {
                          "default": "#FFFFFF",
                          "type": "string",
                          "pattern": "^#[0-9a-fA-F]{6}$"
                        },
                        "group": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        }
                      },
                      "required": [
                        "id",
                        "kind",
                        "page",
                        "rect",
                        "color"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "kind": {
                          "type": "string",
                          "const": "text"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "rect": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "number"
                            },
                            "y": {
                              "type": "number"
                            },
                            "width": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "height": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            }
                          },
                          "required": [
                            "x",
                            "y",
                            "width",
                            "height"
                          ],
                          "additionalProperties": false
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "font": {
                          "default": "helvetica",
                          "type": "string",
                          "enum": [
                            "helvetica",
                            "times",
                            "courier"
                          ]
                        },
                        "bold": {
                          "default": false,
                          "type": "boolean"
                        },
                        "italic": {
                          "default": false,
                          "type": "boolean"
                        },
                        "size": {
                          "default": 11,
                          "type": "number",
                          "minimum": 4,
                          "maximum": 144
                        },
                        "color": {
                          "default": "#0B0F1A",
                          "type": "string",
                          "pattern": "^#[0-9a-fA-F]{6}$"
                        },
                        "align": {
                          "default": "left",
                          "type": "string",
                          "enum": [
                            "left",
                            "center",
                            "right",
                            "justify"
                          ]
                        },
                        "background": {
                          "default": null,
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "face": {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string",
                              "enum": [
                                "pdf",
                                "bundled"
                              ]
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "fallback": {
                              "type": "string",
                              "enum": [
                                "sans",
                                "serif",
                                "mono",
                                "carlito"
                              ]
                            }
                          },
                          "required": [
                            "source",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        "lineHeight": {
                          "type": "number",
                          "minimum": 1,
                          "maximum": 600
                        },
                        "padding": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 36
                        },
                        "baseline": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 600
                        },
                        "group": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "original": {
                          "type": "string",
                          "maxLength": 5000
                        }
                      },
                      "required": [
                        "id",
                        "kind",
                        "page",
                        "rect",
                        "text",
                        "font",
                        "bold",
                        "italic",
                        "size",
                        "color",
                        "align",
                        "background"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "kind": {
                          "type": "string",
                          "const": "image"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "rect": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "number"
                            },
                            "y": {
                              "type": "number"
                            },
                            "width": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "height": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            }
                          },
                          "required": [
                            "x",
                            "y",
                            "width",
                            "height"
                          ],
                          "additionalProperties": false
                        },
                        "src": {
                          "type": "string",
                          "maxLength": 4000000,
                          "pattern": "^data:image\\/(png|jpeg);base64,[A-Za-z0-9+/]+=*$"
                        }
                      },
                      "required": [
                        "id",
                        "kind",
                        "page",
                        "rect",
                        "src"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            },
            "required": [
              "items"
            ],
            "additionalProperties": false
          },
          "sourceFile": {
            "type": "string",
            "pattern": "^tfl_[A-Za-z0-9]{10,40}$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "publishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "template",
          "version",
          "status",
          "source",
          "pageCount",
          "pageSizes",
          "roles",
          "fields",
          "variables",
          "documentHash",
          "createdAt",
          "publishedAt"
        ],
        "additionalProperties": false
      },
      "SaveTemplateDraft_schema0": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "attrs": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "content": {
            "maxItems": 20000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SaveTemplateDraft_schema0"
            }
          },
          "marks": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "attrs": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": [
                "type"
              ]
            }
          },
          "text": {
            "type": "string",
            "maxLength": 100000
          }
        },
        "required": [
          "type"
        ]
      },
      "SaveTemplateDraft": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "pattern": "^tfl_[A-Za-z0-9]{10,40}$"
          },
          "source": {
            "type": "string",
            "enum": [
              "pdf",
              "document"
            ]
          },
          "content": {
            "type": "object",
            "properties": {
              "format": {
                "type": "string",
                "const": "prosemirror"
              },
              "schemaVersion": {
                "type": "number",
                "const": 1
              },
              "doc": {
                "$ref": "#/components/schemas/SaveTemplateDraft_schema0"
              },
              "settings": {
                "default": {
                  "pageSize": "letter",
                  "margins": {
                    "top": 72,
                    "right": 72,
                    "bottom": 72,
                    "left": 72
                  },
                  "font": "Inter Tight",
                  "fontSize": 11
                },
                "type": "object",
                "properties": {
                  "pageSize": {
                    "default": "letter",
                    "type": "string",
                    "enum": [
                      "letter",
                      "a4"
                    ]
                  },
                  "margins": {
                    "default": {
                      "top": 72,
                      "right": 72,
                      "bottom": 72,
                      "left": 72
                    },
                    "type": "object",
                    "properties": {
                      "top": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "right": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "bottom": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      },
                      "left": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 216
                      }
                    },
                    "required": [
                      "top",
                      "right",
                      "bottom",
                      "left"
                    ]
                  },
                  "font": {
                    "default": "Inter Tight",
                    "type": "string",
                    "enum": [
                      "Inter Tight",
                      "Instrument Serif",
                      "JetBrains Mono"
                    ]
                  },
                  "fontSize": {
                    "default": 11,
                    "type": "number",
                    "minimum": 6,
                    "maximum": 24
                  },
                  "header": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "footer": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            },
            "required": [
              "format",
              "schemaVersion",
              "doc"
            ]
          },
          "edits": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "pages": {
                    "minItems": 1,
                    "maxItems": 2000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "rotate": {
                          "default": 0,
                          "anyOf": [
                            {
                              "type": "number",
                              "const": 0
                            },
                            {
                              "type": "number",
                              "const": 90
                            },
                            {
                              "type": "number",
                              "const": 180
                            },
                            {
                              "type": "number",
                              "const": 270
                            }
                          ]
                        },
                        "width": {
                          "type": "number",
                          "exclusiveMinimum": 0,
                          "maximum": 14400
                        },
                        "height": {
                          "type": "number",
                          "exclusiveMinimum": 0,
                          "maximum": 14400
                        }
                      },
                      "required": [
                        "source"
                      ]
                    }
                  },
                  "items": {
                    "default": [],
                    "maxItems": 2000,
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9_-]+$"
                            },
                            "kind": {
                              "type": "string",
                              "const": "whiteout"
                            },
                            "page": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "rect": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                },
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": [
                                "x",
                                "y",
                                "width",
                                "height"
                              ]
                            },
                            "color": {
                              "default": "#FFFFFF",
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "group": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9_-]+$"
                            }
                          },
                          "required": [
                            "id",
                            "kind",
                            "page",
                            "rect"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9_-]+$"
                            },
                            "kind": {
                              "type": "string",
                              "const": "text"
                            },
                            "page": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "rect": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                },
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": [
                                "x",
                                "y",
                                "width",
                                "height"
                              ]
                            },
                            "text": {
                              "type": "string",
                              "maxLength": 5000
                            },
                            "font": {
                              "default": "helvetica",
                              "type": "string",
                              "enum": [
                                "helvetica",
                                "times",
                                "courier"
                              ]
                            },
                            "bold": {
                              "default": false,
                              "type": "boolean"
                            },
                            "italic": {
                              "default": false,
                              "type": "boolean"
                            },
                            "size": {
                              "default": 11,
                              "type": "number",
                              "minimum": 4,
                              "maximum": 144
                            },
                            "color": {
                              "default": "#0B0F1A",
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "default": "left",
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right",
                                "justify"
                              ]
                            },
                            "background": {
                              "default": null,
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^#[0-9a-fA-F]{6}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "face": {
                              "type": "object",
                              "properties": {
                                "source": {
                                  "type": "string",
                                  "enum": [
                                    "pdf",
                                    "bundled"
                                  ]
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "fallback": {
                                  "type": "string",
                                  "enum": [
                                    "sans",
                                    "serif",
                                    "mono",
                                    "carlito"
                                  ]
                                }
                              },
                              "required": [
                                "source",
                                "name"
                              ]
                            },
                            "lineHeight": {
                              "type": "number",
                              "minimum": 1,
                              "maximum": 600
                            },
                            "padding": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 36
                            },
                            "baseline": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 600
                            },
                            "group": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9_-]+$"
                            },
                            "original": {
                              "type": "string",
                              "maxLength": 5000
                            }
                          },
                          "required": [
                            "id",
                            "kind",
                            "page",
                            "rect",
                            "text"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9_-]+$"
                            },
                            "kind": {
                              "type": "string",
                              "const": "image"
                            },
                            "page": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "rect": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                },
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": [
                                "x",
                                "y",
                                "width",
                                "height"
                              ]
                            },
                            "src": {
                              "type": "string",
                              "maxLength": 4000000,
                              "pattern": "^data:image\\/(png|jpeg);base64,[A-Za-z0-9+/]+=*$"
                            }
                          },
                          "required": [
                            "id",
                            "kind",
                            "page",
                            "rect",
                            "src"
                          ]
                        }
                      ]
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "roles": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9_]*$"
                },
                "label": {
                  "type": "string",
                  "maxLength": 100
                },
                "kind": {
                  "default": "signer",
                  "type": "string",
                  "enum": [
                    "signer",
                    "approver",
                    "form_filler",
                    "cc"
                  ]
                },
                "order": {
                  "default": 1,
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "verification": {
                  "default": "email_otp",
                  "type": "string",
                  "enum": [
                    "none",
                    "email_otp",
                    "passkey",
                    "sms_otp",
                    "id_check",
                    "integrator_asserted"
                  ]
                },
                "color": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                }
              },
              "required": [
                "key",
                "label"
              ]
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9_.-]*$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "signature",
                    "initials",
                    "name",
                    "email",
                    "date_signed",
                    "text",
                    "number",
                    "date",
                    "checkbox",
                    "radio",
                    "dropdown",
                    "attachment",
                    "formula",
                    "stamp",
                    "variable_text"
                  ]
                },
                "role": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "label": {
                  "type": "string",
                  "maxLength": 200
                },
                "required": {
                  "default": true,
                  "type": "boolean"
                },
                "rect": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "x": {
                      "type": "number",
                      "minimum": 0
                    },
                    "y": {
                      "type": "number",
                      "minimum": 0
                    },
                    "width": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "height": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "page",
                    "x",
                    "y",
                    "width",
                    "height"
                  ]
                },
                "variable": {
                  "type": "string",
                  "format": "starts_with",
                  "pattern": "^\\/.*"
                },
                "default": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "validation": {
                  "type": "object",
                  "properties": {
                    "pattern": {
                      "type": "string"
                    },
                    "min": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    },
                    "maxLength": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "email",
                        "phone",
                        "date",
                        "number",
                        "currency"
                      ]
                    }
                  }
                },
                "formula": {
                  "type": "string",
                  "maxLength": 500
                },
                "showIf": {
                  "type": "string",
                  "maxLength": 500
                },
                "overflow": {
                  "default": "shrink",
                  "type": "string",
                  "enum": [
                    "shrink",
                    "wrap",
                    "reject"
                  ]
                },
                "font": {
                  "type": "object",
                  "properties": {
                    "family": {
                      "type": "string"
                    },
                    "size": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  }
                },
                "tabOrder": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "repeat": {
                  "type": "string",
                  "format": "starts_with",
                  "pattern": "^\\/.*"
                }
              },
              "required": [
                "id",
                "type",
                "rect"
              ]
            }
          },
          "variables": {
            "default": {
              "type": "object"
            },
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "sampleVariables": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "roles",
          "fields"
        ]
      },
      "TemplateVersionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^tplv_[A-Za-z0-9]{10,40}$"
                },
                "template": {
                  "type": "string",
                  "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "draft",
                    "published"
                  ]
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "pdf",
                    "docx",
                    "html",
                    "markdown",
                    "document"
                  ]
                },
                "pageCount": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "pageSizes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "width": {
                        "type": "number"
                      },
                      "height": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "width",
                      "height"
                    ],
                    "additionalProperties": false
                  }
                },
                "roles": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "pattern": "^[a-z][a-z0-9_]*$"
                      },
                      "label": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "kind": {
                        "default": "signer",
                        "type": "string",
                        "enum": [
                          "signer",
                          "approver",
                          "form_filler",
                          "cc"
                        ]
                      },
                      "order": {
                        "default": 1,
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      },
                      "verification": {
                        "default": "email_otp",
                        "type": "string",
                        "enum": [
                          "none",
                          "email_otp",
                          "passkey",
                          "sms_otp",
                          "id_check",
                          "integrator_asserted"
                        ]
                      },
                      "color": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      }
                    },
                    "required": [
                      "key",
                      "label",
                      "kind",
                      "order",
                      "verification"
                    ],
                    "additionalProperties": false
                  }
                },
                "fields": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "pattern": "^[a-z][a-z0-9_.-]*$"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "signature",
                          "initials",
                          "name",
                          "email",
                          "date_signed",
                          "text",
                          "number",
                          "date",
                          "checkbox",
                          "radio",
                          "dropdown",
                          "attachment",
                          "formula",
                          "stamp",
                          "variable_text"
                        ]
                      },
                      "role": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "label": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "required": {
                        "default": true,
                        "type": "boolean"
                      },
                      "rect": {
                        "type": "object",
                        "properties": {
                          "page": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "x": {
                            "type": "number",
                            "minimum": 0
                          },
                          "y": {
                            "type": "number",
                            "minimum": 0
                          },
                          "width": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          },
                          "height": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          }
                        },
                        "required": [
                          "page",
                          "x",
                          "y",
                          "width",
                          "height"
                        ],
                        "additionalProperties": false
                      },
                      "variable": {
                        "type": "string",
                        "format": "starts_with",
                        "pattern": "^\\/.*"
                      },
                      "default": {
                        "type": [
                          "string",
                          "number",
                          "boolean"
                        ]
                      },
                      "options": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "validation": {
                        "type": "object",
                        "properties": {
                          "pattern": {
                            "type": "string"
                          },
                          "min": {
                            "type": "number"
                          },
                          "max": {
                            "type": "number"
                          },
                          "maxLength": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "format": {
                            "type": "string",
                            "enum": [
                              "email",
                              "phone",
                              "date",
                              "number",
                              "currency"
                            ]
                          }
                        },
                        "additionalProperties": false
                      },
                      "formula": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "showIf": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "overflow": {
                        "default": "shrink",
                        "type": "string",
                        "enum": [
                          "shrink",
                          "wrap",
                          "reject"
                        ]
                      },
                      "font": {
                        "type": "object",
                        "properties": {
                          "family": {
                            "type": "string"
                          },
                          "size": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          }
                        },
                        "additionalProperties": false
                      },
                      "tabOrder": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "repeat": {
                        "type": "string",
                        "format": "starts_with",
                        "pattern": "^\\/.*"
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "required",
                      "rect",
                      "overflow"
                    ],
                    "additionalProperties": false
                  }
                },
                "variables": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "sampleVariables": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "file": {
                  "type": "string",
                  "pattern": "^tfl_[A-Za-z0-9]{10,40}$"
                },
                "documentHash": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "content": {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string",
                      "const": "prosemirror"
                    },
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "doc": {
                      "$ref": "#/components/schemas/DocumentImport_schema0"
                    },
                    "settings": {
                      "default": {
                        "pageSize": "letter",
                        "margins": {
                          "top": 72,
                          "right": 72,
                          "bottom": 72,
                          "left": 72
                        },
                        "font": "Inter Tight",
                        "fontSize": 11
                      },
                      "type": "object",
                      "properties": {
                        "pageSize": {
                          "default": "letter",
                          "type": "string",
                          "enum": [
                            "letter",
                            "a4"
                          ]
                        },
                        "margins": {
                          "default": {
                            "top": 72,
                            "right": 72,
                            "bottom": 72,
                            "left": 72
                          },
                          "type": "object",
                          "properties": {
                            "top": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 216
                            },
                            "right": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 216
                            },
                            "bottom": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 216
                            },
                            "left": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 216
                            }
                          },
                          "required": [
                            "top",
                            "right",
                            "bottom",
                            "left"
                          ],
                          "additionalProperties": false
                        },
                        "font": {
                          "default": "Inter Tight",
                          "type": "string",
                          "enum": [
                            "Inter Tight",
                            "Instrument Serif",
                            "JetBrains Mono"
                          ]
                        },
                        "fontSize": {
                          "default": 11,
                          "type": "number",
                          "minimum": 6,
                          "maximum": 24
                        },
                        "header": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "footer": {
                          "type": "string",
                          "maxLength": 500
                        }
                      },
                      "required": [
                        "pageSize",
                        "margins",
                        "font",
                        "fontSize"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "format",
                    "schemaVersion",
                    "doc",
                    "settings"
                  ],
                  "additionalProperties": false
                },
                "edits": {
                  "type": "object",
                  "properties": {
                    "pages": {
                      "minItems": 1,
                      "maxItems": 2000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "rotate": {
                            "default": 0,
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 0
                              },
                              {
                                "type": "number",
                                "const": 90
                              },
                              {
                                "type": "number",
                                "const": 180
                              },
                              {
                                "type": "number",
                                "const": 270
                              }
                            ]
                          },
                          "width": {
                            "type": "number",
                            "exclusiveMinimum": 0,
                            "maximum": 14400
                          },
                          "height": {
                            "type": "number",
                            "exclusiveMinimum": 0,
                            "maximum": 14400
                          }
                        },
                        "required": [
                          "source",
                          "rotate"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "items": {
                      "default": [],
                      "maxItems": 2000,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64,
                                "pattern": "^[A-Za-z0-9_-]+$"
                              },
                              "kind": {
                                "type": "string",
                                "const": "whiteout"
                              },
                              "page": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "rect": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  },
                                  "width": {
                                    "type": "number",
                                    "exclusiveMinimum": 0
                                  },
                                  "height": {
                                    "type": "number",
                                    "exclusiveMinimum": 0
                                  }
                                },
                                "required": [
                                  "x",
                                  "y",
                                  "width",
                                  "height"
                                ],
                                "additionalProperties": false
                              },
                              "color": {
                                "default": "#FFFFFF",
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "group": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64,
                                "pattern": "^[A-Za-z0-9_-]+$"
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "page",
                              "rect",
                              "color"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64,
                                "pattern": "^[A-Za-z0-9_-]+$"
                              },
                              "kind": {
                                "type": "string",
                                "const": "text"
                              },
                              "page": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "rect": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  },
                                  "width": {
                                    "type": "number",
                                    "exclusiveMinimum": 0
                                  },
                                  "height": {
                                    "type": "number",
                                    "exclusiveMinimum": 0
                                  }
                                },
                                "required": [
                                  "x",
                                  "y",
                                  "width",
                                  "height"
                                ],
                                "additionalProperties": false
                              },
                              "text": {
                                "type": "string",
                                "maxLength": 5000
                              },
                              "font": {
                                "default": "helvetica",
                                "type": "string",
                                "enum": [
                                  "helvetica",
                                  "times",
                                  "courier"
                                ]
                              },
                              "bold": {
                                "default": false,
                                "type": "boolean"
                              },
                              "italic": {
                                "default": false,
                                "type": "boolean"
                              },
                              "size": {
                                "default": 11,
                                "type": "number",
                                "minimum": 4,
                                "maximum": 144
                              },
                              "color": {
                                "default": "#0B0F1A",
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "align": {
                                "default": "left",
                                "type": "string",
                                "enum": [
                                  "left",
                                  "center",
                                  "right",
                                  "justify"
                                ]
                              },
                              "background": {
                                "default": null,
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^#[0-9a-fA-F]{6}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "face": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "enum": [
                                      "pdf",
                                      "bundled"
                                    ]
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "fallback": {
                                    "type": "string",
                                    "enum": [
                                      "sans",
                                      "serif",
                                      "mono",
                                      "carlito"
                                    ]
                                  }
                                },
                                "required": [
                                  "source",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              "lineHeight": {
                                "type": "number",
                                "minimum": 1,
                                "maximum": 600
                              },
                              "padding": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 36
                              },
                              "baseline": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 600
                              },
                              "group": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64,
                                "pattern": "^[A-Za-z0-9_-]+$"
                              },
                              "original": {
                                "type": "string",
                                "maxLength": 5000
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "page",
                              "rect",
                              "text",
                              "font",
                              "bold",
                              "italic",
                              "size",
                              "color",
                              "align",
                              "background"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64,
                                "pattern": "^[A-Za-z0-9_-]+$"
                              },
                              "kind": {
                                "type": "string",
                                "const": "image"
                              },
                              "page": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "rect": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  },
                                  "width": {
                                    "type": "number",
                                    "exclusiveMinimum": 0
                                  },
                                  "height": {
                                    "type": "number",
                                    "exclusiveMinimum": 0
                                  }
                                },
                                "required": [
                                  "x",
                                  "y",
                                  "width",
                                  "height"
                                ],
                                "additionalProperties": false
                              },
                              "src": {
                                "type": "string",
                                "maxLength": 4000000,
                                "pattern": "^data:image\\/(png|jpeg);base64,[A-Za-z0-9+/]+=*$"
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "page",
                              "rect",
                              "src"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                },
                "sourceFile": {
                  "type": "string",
                  "pattern": "^tfl_[A-Za-z0-9]{10,40}$"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "publishedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "template",
                "version",
                "status",
                "source",
                "pageCount",
                "pageSizes",
                "roles",
                "fields",
                "variables",
                "documentHash",
                "createdAt",
                "publishedAt"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "RenderPreview": {
        "type": "object",
        "properties": {
          "variables": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        }
      },
      "EnvelopeDryRun": {
        "type": "object",
        "properties": {
          "dryRun": {
            "type": "boolean",
            "const": true
          },
          "template": {
            "type": "string",
            "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
          },
          "templateVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "documentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "pageCount": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "order": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "role",
                "name",
                "email",
                "order"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "dryRun",
          "template",
          "templateVersion",
          "documentHash",
          "pageCount",
          "recipients"
        ],
        "additionalProperties": false
      },
      "Envelope": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^env_[A-Za-z0-9]{10,40}$"
          },
          "organization": {
            "type": "string",
            "pattern": "^org_[A-Za-z0-9]{10,40}$"
          },
          "template": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "templateVersion": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "rendering",
              "sent",
              "completed",
              "declined",
              "voided",
              "expired"
            ]
          },
          "seal": {
            "type": "string",
            "enum": [
              "not_started",
              "pending",
              "sealed",
              "failed"
            ]
          },
          "testMode": {
            "type": "boolean"
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^rcp_[A-Za-z0-9]{10,40}$"
                },
                "role": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "order": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "sent",
                    "viewed",
                    "completed",
                    "declined"
                  ]
                },
                "verification": {
                  "type": "string",
                  "enum": [
                    "none",
                    "email_otp",
                    "passkey",
                    "sms_otp",
                    "id_check",
                    "integrator_asserted"
                  ]
                },
                "completedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "role",
                "name",
                "email",
                "order",
                "status",
                "verification",
                "completedAt"
              ],
              "additionalProperties": false
            }
          },
          "documentHash": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "sealedDocumentHash": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "externalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "organization",
          "template",
          "templateVersion",
          "status",
          "seal",
          "testMode",
          "recipients",
          "documentHash",
          "sealedDocumentHash",
          "externalId",
          "metadata",
          "createdAt",
          "completedAt"
        ],
        "additionalProperties": false
      },
      "CreateEnvelope": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
          },
          "version": {
            "default": "latest",
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "string",
                "const": "latest"
              }
            ]
          },
          "variables": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "recipients": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "externalUserId": {
                  "type": "string",
                  "maxLength": 200
                },
                "verification": {
                  "type": "string",
                  "enum": [
                    "none",
                    "email_otp",
                    "passkey",
                    "sms_otp",
                    "id_check",
                    "integrator_asserted"
                  ]
                },
                "fields": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": [
                      "string",
                      "number",
                      "boolean"
                    ]
                  }
                }
              },
              "required": [
                "role",
                "name",
                "email"
              ]
            }
          },
          "subject": {
            "type": "string",
            "maxLength": 200
          },
          "message": {
            "type": "string",
            "maxLength": 4000
          },
          "delivery": {
            "default": "email",
            "type": "string",
            "enum": [
              "email",
              "embedded",
              "none"
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "externalId": {
            "type": "string",
            "maxLength": 200
          },
          "dedupeOn": {
            "type": "string",
            "enum": [
              "external_id"
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            }
          }
        },
        "required": [
          "template",
          "recipients"
        ]
      },
      "EnvelopeList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^env_[A-Za-z0-9]{10,40}$"
                },
                "organization": {
                  "type": "string",
                  "pattern": "^org_[A-Za-z0-9]{10,40}$"
                },
                "template": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "templateVersion": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "rendering",
                    "sent",
                    "completed",
                    "declined",
                    "voided",
                    "expired"
                  ]
                },
                "seal": {
                  "type": "string",
                  "enum": [
                    "not_started",
                    "pending",
                    "sealed",
                    "failed"
                  ]
                },
                "testMode": {
                  "type": "boolean"
                },
                "recipients": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^rcp_[A-Za-z0-9]{10,40}$"
                      },
                      "role": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      "order": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "sent",
                          "viewed",
                          "completed",
                          "declined"
                        ]
                      },
                      "verification": {
                        "type": "string",
                        "enum": [
                          "none",
                          "email_otp",
                          "passkey",
                          "sms_otp",
                          "id_check",
                          "integrator_asserted"
                        ]
                      },
                      "completedAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "role",
                      "name",
                      "email",
                      "order",
                      "status",
                      "verification",
                      "completedAt"
                    ],
                    "additionalProperties": false
                  }
                },
                "documentHash": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sealedDocumentHash": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "externalId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "metadata": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "completedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "organization",
                "template",
                "templateVersion",
                "status",
                "seal",
                "testMode",
                "recipients",
                "documentHash",
                "sealedDocumentHash",
                "externalId",
                "metadata",
                "createdAt",
                "completedAt"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "VoidEnvelope": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "reason"
        ]
      },
      "Session": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ses_[A-Za-z0-9]{10,40}$"
          },
          "token": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "id",
          "token",
          "url",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "CreateSession": {
        "type": "object",
        "properties": {
          "recipient": {
            "type": "string",
            "pattern": "^rcp_[A-Za-z0-9]{10,40}$"
          },
          "mode": {
            "default": "embedded",
            "type": "string",
            "enum": [
              "embedded",
              "hosted"
            ]
          },
          "allowedOrigins": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "returnUrl": {
            "type": "string",
            "format": "uri"
          },
          "ttlSeconds": {
            "default": 600,
            "type": "integer",
            "minimum": 60,
            "maximum": 3600
          }
        },
        "required": [
          "recipient"
        ]
      },
      "EnvelopeEventList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^evt_[A-Za-z0-9]{10,40}$"
                },
                "envelope": {
                  "type": "string",
                  "pattern": "^env_[A-Za-z0-9]{10,40}$"
                },
                "seq": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "type": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "recipient": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^rcp_[A-Za-z0-9]{10,40}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "actor": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "system",
                        "user",
                        "api_key",
                        "recipient",
                        "visitor"
                      ]
                    },
                    "id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "kind",
                    "id",
                    "name",
                    "email"
                  ],
                  "additionalProperties": false
                },
                "ip": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "userAgent": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "data": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "hash": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "prevHash": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              },
              "required": [
                "id",
                "envelope",
                "seq",
                "type",
                "createdAt",
                "recipient",
                "actor",
                "ip",
                "userAgent",
                "data",
                "hash",
                "prevHash"
              ],
              "additionalProperties": false
            }
          },
          "chain": {
            "type": "object",
            "properties": {
              "valid": {
                "type": "boolean"
              },
              "brokenAt": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "valid",
              "brokenAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "data",
          "chain"
        ],
        "additionalProperties": false
      },
      "SessionExchangeResponse": {
        "type": "object",
        "properties": {
          "accessToken": {
            "type": "string",
            "minLength": 1
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "accessToken",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "SessionExchangeRequest": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "token"
        ]
      },
      "SigningSessionView": {
        "type": "object",
        "properties": {
          "session": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^ses_[A-Za-z0-9]{10,40}$"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "embedded",
                  "hosted"
                ]
              }
            },
            "required": [
              "id",
              "expiresAt",
              "mode"
            ],
            "additionalProperties": false
          },
          "envelope": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^env_[A-Za-z0-9]{10,40}$"
              },
              "status": {
                "type": "string",
                "enum": [
                  "rendering",
                  "sent",
                  "completed",
                  "declined",
                  "voided",
                  "expired"
                ]
              },
              "title": {
                "type": "string"
              },
              "sender": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "organization": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "organization"
                ],
                "additionalProperties": false
              },
              "message": {
                "type": "string"
              },
              "testMode": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "title",
              "sender",
              "testMode"
            ],
            "additionalProperties": false
          },
          "recipient": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^rcp_[A-Za-z0-9]{10,40}$"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "role": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "email",
              "role"
            ],
            "additionalProperties": false
          },
          "role": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9_]*$"
              },
              "label": {
                "type": "string",
                "maxLength": 100
              },
              "kind": {
                "default": "signer",
                "type": "string",
                "enum": [
                  "signer",
                  "approver",
                  "form_filler",
                  "cc"
                ]
              },
              "order": {
                "default": 1,
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "verification": {
                "default": "email_otp",
                "type": "string",
                "enum": [
                  "none",
                  "email_otp",
                  "passkey",
                  "sms_otp",
                  "id_check",
                  "integrator_asserted"
                ]
              },
              "color": {
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$"
              }
            },
            "required": [
              "key",
              "label",
              "kind",
              "order",
              "verification"
            ],
            "additionalProperties": false
          },
          "canSign": {
            "default": true,
            "type": "boolean"
          },
          "verification": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "none",
                  "email_otp",
                  "passkey",
                  "sms_otp",
                  "id_check",
                  "integrator_asserted"
                ]
              },
              "stage": {
                "default": "before_submit",
                "type": "string",
                "enum": [
                  "before_view",
                  "before_submit"
                ]
              },
              "maskedDestination": {
                "type": "string"
              },
              "verified": {
                "default": false,
                "type": "boolean"
              }
            },
            "required": [
              "method",
              "stage",
              "verified"
            ],
            "additionalProperties": false
          },
          "document": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "hash": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "pageCount": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "pageSizes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "width": {
                      "type": "number"
                    },
                    "height": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "width",
                    "height"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "url",
              "hash",
              "pageCount",
              "pageSizes"
            ],
            "additionalProperties": false
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9_.-]*$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "signature",
                    "initials",
                    "name",
                    "email",
                    "date_signed",
                    "text",
                    "number",
                    "date",
                    "checkbox",
                    "radio",
                    "dropdown",
                    "attachment",
                    "formula",
                    "stamp",
                    "variable_text"
                  ]
                },
                "role": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "label": {
                  "type": "string",
                  "maxLength": 200
                },
                "required": {
                  "default": true,
                  "type": "boolean"
                },
                "rect": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "x": {
                      "type": "number",
                      "minimum": 0
                    },
                    "y": {
                      "type": "number",
                      "minimum": 0
                    },
                    "width": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "height": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "page",
                    "x",
                    "y",
                    "width",
                    "height"
                  ],
                  "additionalProperties": false
                },
                "variable": {
                  "type": "string",
                  "format": "starts_with",
                  "pattern": "^\\/.*"
                },
                "default": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "validation": {
                  "type": "object",
                  "properties": {
                    "pattern": {
                      "type": "string"
                    },
                    "min": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    },
                    "maxLength": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "email",
                        "phone",
                        "date",
                        "number",
                        "currency"
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                "formula": {
                  "type": "string",
                  "maxLength": 500
                },
                "showIf": {
                  "type": "string",
                  "maxLength": 500
                },
                "overflow": {
                  "default": "shrink",
                  "type": "string",
                  "enum": [
                    "shrink",
                    "wrap",
                    "reject"
                  ]
                },
                "font": {
                  "type": "object",
                  "properties": {
                    "family": {
                      "type": "string"
                    },
                    "size": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  },
                  "additionalProperties": false
                },
                "tabOrder": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "repeat": {
                  "type": "string",
                  "format": "starts_with",
                  "pattern": "^\\/.*"
                }
              },
              "required": [
                "id",
                "type",
                "required",
                "rect",
                "overflow"
              ],
              "additionalProperties": false
            }
          },
          "values": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean"
              ]
            }
          },
          "variables": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "disclosure": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              },
              "text": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "version",
              "text"
            ],
            "additionalProperties": false
          },
          "locale": {
            "type": "string"
          },
          "returnUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "session",
          "envelope",
          "recipient",
          "role",
          "canSign",
          "verification",
          "document",
          "fields",
          "values",
          "variables",
          "disclosure"
        ],
        "additionalProperties": false
      },
      "OtpSendResponse": {
        "type": "object",
        "properties": {
          "sentTo": {
            "type": "string"
          },
          "resendAfterSeconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "sentTo",
          "resendAfterSeconds"
        ],
        "additionalProperties": false
      },
      "OtpSendRequest": {
        "type": "object",
        "properties": {
          "channel": {
            "default": "email",
            "type": "string",
            "enum": [
              "email",
              "sms"
            ]
          }
        }
      },
      "OtpVerifyResponse": {
        "type": "object",
        "properties": {
          "verified": {
            "type": "boolean"
          },
          "attemptsLeft": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "verified"
        ],
        "additionalProperties": false
      },
      "OtpVerifyRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[0-9]{6}$"
          }
        },
        "required": [
          "code"
        ]
      },
      "AttachmentUploadResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "contentType": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "size",
          "contentType"
        ],
        "additionalProperties": false
      },
      "SubmitSigningResponse": {
        "type": "object",
        "properties": {
          "envelope": {
            "type": "string",
            "pattern": "^env_[A-Za-z0-9]{10,40}$"
          },
          "recipient": {
            "type": "string",
            "pattern": "^rcp_[A-Za-z0-9]{10,40}$"
          },
          "envelopeStatus": {
            "type": "string",
            "enum": [
              "rendering",
              "sent",
              "completed",
              "declined",
              "voided",
              "expired"
            ]
          }
        },
        "required": [
          "envelope",
          "recipient",
          "envelopeStatus"
        ],
        "additionalProperties": false
      },
      "SubmitSigning": {
        "type": "object",
        "properties": {
          "values": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "drawn",
                        "typed",
                        "uploaded"
                      ]
                    },
                    "data": {
                      "type": "string",
                      "maxLength": 700000
                    },
                    "font": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "data"
                  ]
                }
              ]
            }
          },
          "consent": {
            "type": "object",
            "properties": {
              "disclosureVersion": {
                "type": "string"
              },
              "accepted": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "disclosureVersion",
              "accepted"
            ]
          },
          "viewedDocumentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        },
        "required": [
          "values",
          "consent",
          "viewedDocumentHash"
        ]
      },
      "Ok": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      },
      "DeclineSigning": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 1000
          }
        }
      },
      "PublicSigningLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^lnk_[A-Za-z0-9]{10,40}$"
          },
          "name": {
            "type": "string"
          },
          "visitorRole": {
            "type": "string"
          },
          "variables": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9_.-]*$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "signature",
                    "initials",
                    "name",
                    "email",
                    "date_signed",
                    "text",
                    "number",
                    "date",
                    "checkbox",
                    "radio",
                    "dropdown",
                    "attachment",
                    "formula",
                    "stamp",
                    "variable_text"
                  ]
                },
                "role": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "label": {
                  "type": "string",
                  "maxLength": 200
                },
                "required": {
                  "default": true,
                  "type": "boolean"
                },
                "rect": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "x": {
                      "type": "number",
                      "minimum": 0
                    },
                    "y": {
                      "type": "number",
                      "minimum": 0
                    },
                    "width": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "height": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "page",
                    "x",
                    "y",
                    "width",
                    "height"
                  ],
                  "additionalProperties": false
                },
                "variable": {
                  "type": "string",
                  "format": "starts_with",
                  "pattern": "^\\/.*"
                },
                "default": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "validation": {
                  "type": "object",
                  "properties": {
                    "pattern": {
                      "type": "string"
                    },
                    "min": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    },
                    "maxLength": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "email",
                        "phone",
                        "date",
                        "number",
                        "currency"
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                "formula": {
                  "type": "string",
                  "maxLength": 500
                },
                "showIf": {
                  "type": "string",
                  "maxLength": 500
                },
                "overflow": {
                  "default": "shrink",
                  "type": "string",
                  "enum": [
                    "shrink",
                    "wrap",
                    "reject"
                  ]
                },
                "font": {
                  "type": "object",
                  "properties": {
                    "family": {
                      "type": "string"
                    },
                    "size": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  },
                  "additionalProperties": false
                },
                "tabOrder": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "repeat": {
                  "type": "string",
                  "format": "starts_with",
                  "pattern": "^\\/.*"
                }
              },
              "required": [
                "id",
                "type",
                "required",
                "rect",
                "overflow"
              ],
              "additionalProperties": false
            }
          },
          "testMode": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "visitorRole",
          "variables",
          "fields",
          "testMode"
        ],
        "additionalProperties": false
      },
      "LinkChallenge": {
        "type": "object",
        "properties": {
          "challenge": {
            "type": "string",
            "pattern": "^otp_[A-Za-z0-9]{10,40}$"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "challenge",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "StartSigningLink": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "variables": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "name",
          "email"
        ]
      },
      "LinkSession": {
        "type": "object",
        "properties": {
          "envelope": {
            "type": "string",
            "pattern": "^env_[A-Za-z0-9]{10,40}$"
          },
          "token": {
            "type": "string",
            "minLength": 1
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "envelope",
          "token",
          "url"
        ],
        "additionalProperties": false
      },
      "VerifySigningLink": {
        "type": "object",
        "properties": {
          "challenge": {
            "type": "string",
            "pattern": "^otp_[A-Za-z0-9]{10,40}$"
          },
          "code": {
            "type": "string",
            "pattern": "^\\d{6}$"
          }
        },
        "required": [
          "challenge",
          "code"
        ]
      },
      "SigningLink": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
          },
          "version": {
            "default": "latest",
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "string",
                "const": "latest"
              }
            ]
          },
          "visitorRole": {
            "type": "string"
          },
          "countersign": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "auto",
                  "person"
                ]
              },
              "email": {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              }
            },
            "required": [
              "role",
              "mode"
            ],
            "additionalProperties": false
          },
          "limits": {
            "default": {
              "perEmailPerDay": 3,
              "perIpPerHour": 20
            },
            "type": "object",
            "properties": {
              "perEmailPerDay": {
                "default": 3,
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "perIpPerHour": {
                "default": 20,
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "dailyCap": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "allowedEmailDomains": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "blockedEmailDomains": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "perEmailPerDay",
              "perIpPerHour"
            ],
            "additionalProperties": false
          },
          "dedupe": {
            "default": true,
            "type": "boolean"
          },
          "active": {
            "default": true,
            "type": "boolean"
          },
          "id": {
            "type": "string",
            "pattern": "^lnk_[A-Za-z0-9]{10,40}$"
          },
          "organization": {
            "type": "string",
            "pattern": "^org_[A-Za-z0-9]{10,40}$"
          },
          "resolvedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "testMode": {
            "type": "boolean"
          },
          "usage": {
            "type": "object",
            "properties": {
              "today": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "total": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "lastUsedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "today",
              "total",
              "lastUsedAt"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "template",
          "version",
          "visitorRole",
          "limits",
          "dedupe",
          "active",
          "id",
          "organization",
          "resolvedVersion",
          "url",
          "testMode",
          "usage",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CreateSigningLink": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
          },
          "version": {
            "default": "latest",
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "string",
                "const": "latest"
              }
            ]
          },
          "visitorRole": {
            "type": "string"
          },
          "countersign": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "auto",
                  "person"
                ]
              },
              "email": {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              }
            },
            "required": [
              "role",
              "mode"
            ]
          },
          "limits": {
            "default": {
              "perEmailPerDay": 3,
              "perIpPerHour": 20
            },
            "type": "object",
            "properties": {
              "perEmailPerDay": {
                "default": 3,
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "perIpPerHour": {
                "default": 20,
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "dailyCap": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "allowedEmailDomains": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "blockedEmailDomains": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "dedupe": {
            "default": true,
            "type": "boolean"
          },
          "active": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "template",
          "visitorRole"
        ]
      },
      "SigningLinkList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "template": {
                  "type": "string",
                  "pattern": "^tpl_[A-Za-z0-9]{10,40}$"
                },
                "version": {
                  "default": "latest",
                  "anyOf": [
                    {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "string",
                      "const": "latest"
                    }
                  ]
                },
                "visitorRole": {
                  "type": "string"
                },
                "countersign": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "auto",
                        "person"
                      ]
                    },
                    "email": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                    }
                  },
                  "required": [
                    "role",
                    "mode"
                  ],
                  "additionalProperties": false
                },
                "limits": {
                  "default": {
                    "perEmailPerDay": 3,
                    "perIpPerHour": 20
                  },
                  "type": "object",
                  "properties": {
                    "perEmailPerDay": {
                      "default": 3,
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "perIpPerHour": {
                      "default": 20,
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "dailyCap": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "allowedEmailDomains": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "blockedEmailDomains": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "perEmailPerDay",
                    "perIpPerHour"
                  ],
                  "additionalProperties": false
                },
                "dedupe": {
                  "default": true,
                  "type": "boolean"
                },
                "active": {
                  "default": true,
                  "type": "boolean"
                },
                "id": {
                  "type": "string",
                  "pattern": "^lnk_[A-Za-z0-9]{10,40}$"
                },
                "organization": {
                  "type": "string",
                  "pattern": "^org_[A-Za-z0-9]{10,40}$"
                },
                "resolvedVersion": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "testMode": {
                  "type": "boolean"
                },
                "usage": {
                  "type": "object",
                  "properties": {
                    "today": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "lastUsedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "today",
                    "total",
                    "lastUsedAt"
                  ],
                  "additionalProperties": false
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                }
              },
              "required": [
                "template",
                "version",
                "visitorRole",
                "limits",
                "dedupe",
                "active",
                "id",
                "organization",
                "resolvedVersion",
                "url",
                "testMode",
                "usage",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "UpdateSigningLink": {
        "type": "object",
        "properties": {
          "version": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "string",
                "const": "latest"
              }
            ]
          },
          "visitorRole": {
            "type": "string"
          },
          "countersign": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "person"
                    ]
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  }
                },
                "required": [
                  "role",
                  "mode"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "limits": {
            "type": "object",
            "properties": {
              "perEmailPerDay": {
                "default": 3,
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "perIpPerHour": {
                "default": 20,
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "dailyCap": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "allowedEmailDomains": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "blockedEmailDomains": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "dedupe": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^whk_[A-Za-z0-9]{10,40}$"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "envelope.created",
                "envelope.ready",
                "envelope.completed",
                "envelope.sealed",
                "envelope.declined",
                "envelope.voided",
                "envelope.expired",
                "recipient.sent",
                "recipient.viewed",
                "recipient.signed",
                "recipient.declined",
                "signing_link.used",
                "acceptance.created"
              ]
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "testMode": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "health": {
            "type": "object",
            "properties": {
              "successRate24h": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lastDeliveryAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lastStatus": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "successRate24h",
              "lastDeliveryAt",
              "lastStatus"
            ],
            "additionalProperties": false
          },
          "secret": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "events",
          "enabled",
          "testMode",
          "createdAt",
          "health"
        ],
        "additionalProperties": false
      },
      "CreateWebhookEndpoint": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "events": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "envelope.created",
                "envelope.ready",
                "envelope.completed",
                "envelope.sealed",
                "envelope.declined",
                "envelope.voided",
                "envelope.expired",
                "recipient.sent",
                "recipient.viewed",
                "recipient.signed",
                "recipient.declined",
                "signing_link.used",
                "acceptance.created"
              ]
            }
          },
          "testMode": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "url"
        ]
      },
      "WebhookEndpointList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^whk_[A-Za-z0-9]{10,40}$"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "description": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 500
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "events": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "envelope.created",
                      "envelope.ready",
                      "envelope.completed",
                      "envelope.sealed",
                      "envelope.declined",
                      "envelope.voided",
                      "envelope.expired",
                      "recipient.sent",
                      "recipient.viewed",
                      "recipient.signed",
                      "recipient.declined",
                      "signing_link.used",
                      "acceptance.created"
                    ]
                  }
                },
                "enabled": {
                  "type": "boolean"
                },
                "testMode": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "health": {
                  "type": "object",
                  "properties": {
                    "successRate24h": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lastDeliveryAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lastStatus": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "successRate24h",
                    "lastDeliveryAt",
                    "lastStatus"
                  ],
                  "additionalProperties": false
                },
                "secret": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "url",
                "description",
                "events",
                "enabled",
                "testMode",
                "createdAt",
                "health"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "UpdateWebhookEndpoint": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "envelope.created",
                "envelope.ready",
                "envelope.completed",
                "envelope.sealed",
                "envelope.declined",
                "envelope.voided",
                "envelope.expired",
                "recipient.sent",
                "recipient.viewed",
                "recipient.signed",
                "recipient.declined",
                "signing_link.used",
                "acceptance.created"
              ]
            }
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "WebhookSecret": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^whsec_.*"
          },
          "previousValidUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "secret",
          "previousValidUntil"
        ],
        "additionalProperties": false
      },
      "WebhookDeliveryList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "endpoint": {
                  "type": "string",
                  "pattern": "^whk_[A-Za-z0-9]{10,40}$"
                },
                "event": {
                  "type": "string"
                },
                "eventType": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "envelope.created",
                        "envelope.ready",
                        "envelope.completed",
                        "envelope.sealed",
                        "envelope.declined",
                        "envelope.voided",
                        "envelope.expired",
                        "recipient.sent",
                        "recipient.viewed",
                        "recipient.signed",
                        "recipient.declined",
                        "signing_link.used",
                        "acceptance.created"
                      ]
                    },
                    {
                      "type": "string",
                      "const": "webhook.test"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "succeeded",
                    "failed"
                  ]
                },
                "attempt": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "responseStatus": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "durationMs": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "nextRetryAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "endpoint",
                "event",
                "eventType",
                "status",
                "attempt",
                "responseStatus",
                "durationMs",
                "error",
                "createdAt",
                "nextRetryAt"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "endpoint": {
            "type": "string",
            "pattern": "^whk_[A-Za-z0-9]{10,40}$"
          },
          "event": {
            "type": "string"
          },
          "eventType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "envelope.created",
                  "envelope.ready",
                  "envelope.completed",
                  "envelope.sealed",
                  "envelope.declined",
                  "envelope.voided",
                  "envelope.expired",
                  "recipient.sent",
                  "recipient.viewed",
                  "recipient.signed",
                  "recipient.declined",
                  "signing_link.used",
                  "acceptance.created"
                ]
              },
              {
                "type": "string",
                "const": "webhook.test"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ]
          },
          "attempt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "responseStatus": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "durationMs": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "nextRetryAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "endpoint",
          "event",
          "eventType",
          "status",
          "attempt",
          "responseStatus",
          "durationMs",
          "error",
          "createdAt",
          "nextRetryAt"
        ],
        "additionalProperties": false
      },
      "RedeliverEvent": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "pattern": "^whk_[A-Za-z0-9]{10,40}$"
          }
        },
        "required": [
          "endpoint"
        ]
      },
      "CreatedApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "start": {
            "type": [
              "string",
              "null"
            ]
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "envelope:read",
                "envelope:send",
                "envelope:void",
                "template:read",
                "template:write",
                "template:publish",
                "org:manage",
                "member:manage",
                "sso:manage",
                "apikey:manage",
                "billing:manage",
                "audit:read"
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "key": {
            "type": "string",
            "pattern": "^bf_(live|test)_[A-Za-z0-9_-]{16,128}$"
          }
        },
        "required": [
          "id",
          "name",
          "mode",
          "start",
          "scopes",
          "createdAt",
          "lastUsedAt",
          "expiresAt",
          "createdBy",
          "key"
        ],
        "additionalProperties": false
      },
      "CreateApiKey": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "mode": {
            "default": "live",
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "scopes": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "envelope:read",
                "envelope:send",
                "envelope:void",
                "template:read",
                "template:write",
                "template:publish",
                "org:manage",
                "member:manage",
                "sso:manage",
                "apikey:manage",
                "billing:manage",
                "audit:read"
              ]
            }
          },
          "expiresInDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 365
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "ApiKeyList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "mode": {
                  "type": "string",
                  "enum": [
                    "test",
                    "live"
                  ]
                },
                "start": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "envelope:read",
                      "envelope:send",
                      "envelope:void",
                      "template:read",
                      "template:write",
                      "template:publish",
                      "org:manage",
                      "member:manage",
                      "sso:manage",
                      "apikey:manage",
                      "billing:manage",
                      "audit:read"
                    ]
                  }
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "lastUsedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "expiresAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdBy": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string",
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": [
                        "name",
                        "email"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "mode",
                "start",
                "scopes",
                "createdAt",
                "lastUsedAt",
                "expiresAt",
                "createdBy"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "ScimStatus": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "enabled": {
            "type": "boolean"
          },
          "tokenCreatedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastRequestAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "provisionedUsers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "endpoint",
          "enabled",
          "tokenCreatedAt",
          "lastRequestAt",
          "provisionedUsers"
        ],
        "additionalProperties": false
      },
      "ScimToken": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "minLength": 20
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "token",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "EmailBranding": {
        "type": "object",
        "properties": {
          "settings": {
            "type": "object",
            "properties": {
              "displayName": {},
              "customMessage": {},
              "footerText": {},
              "hidePoweredBy": {
                "type": "boolean"
              }
            },
            "required": [
              "displayName",
              "customMessage",
              "footerText",
              "hidePoweredBy"
            ],
            "additionalProperties": false
          },
          "allowed": {
            "type": "object",
            "properties": {
              "displayName": {
                "type": "boolean"
              },
              "customMessage": {
                "type": "boolean"
              },
              "logo": {
                "type": "boolean"
              },
              "colors": {
                "type": "boolean"
              },
              "footerText": {
                "type": "boolean"
              },
              "hidePoweredBy": {
                "type": "boolean"
              }
            },
            "required": [
              "displayName",
              "customMessage",
              "logo",
              "colors",
              "footerText",
              "hidePoweredBy"
            ],
            "additionalProperties": false
          },
          "upgradeUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "settings",
          "allowed",
          "upgradeUrl"
        ],
        "additionalProperties": false
      },
      "UpdateEmailBranding": {
        "type": "object",
        "properties": {
          "displayName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          },
          "customMessage": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "footerText": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "hidePoweredBy": {
            "type": "boolean"
          }
        }
      },
      "EmailPreview": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "enum": [
              "sign_in_code",
              "magic_link",
              "invitation",
              "signing_request",
              "signing_code",
              "link_verification_code",
              "reminder",
              "completed",
              "declined",
              "voided"
            ]
          },
          "subject": {
            "type": "string"
          },
          "html": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "template",
          "subject",
          "html",
          "text"
        ],
        "additionalProperties": false
      },
      "EmailPreviewRequest": {
        "type": "object",
        "properties": {
          "template": {
            "default": "signing_request",
            "type": "string",
            "enum": [
              "sign_in_code",
              "magic_link",
              "invitation",
              "signing_request",
              "signing_code",
              "link_verification_code",
              "reminder",
              "completed",
              "declined",
              "voided"
            ]
          },
          "settings": {
            "type": "object",
            "properties": {
              "displayName": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 80
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "customMessage": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 300
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "footerText": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 500
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "hidePoweredBy": {
                "type": "boolean"
              }
            }
          },
          "branding": {
            "type": "object",
            "properties": {
              "primaryColor": {
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$"
              },
              "accentColor": {
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$"
              }
            },
            "required": [
              "primaryColor",
              "accentColor"
            ]
          },
          "logo": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "UploadedLogo": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": false
      },
      "SsoDiscovery": {
        "type": "object",
        "properties": {
          "sso": {
            "type": "boolean"
          },
          "enforced": {
            "type": "boolean"
          },
          "organizationName": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "sso",
          "enforced",
          "organizationName"
        ],
        "additionalProperties": false
      },
      "SsoConnectionList": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "settings": {
              "type": "object",
              "properties": {
                "providerId": {
                  "type": "string"
                },
                "idp": {
                  "type": "string",
                  "enum": [
                    "entra",
                    "okta",
                    "google",
                    "jumpcloud",
                    "saml",
                    "oidc"
                  ]
                },
                "enforce": {
                  "type": "boolean"
                },
                "defaultRole": {
                  "type": "string",
                  "enum": [
                    "admin",
                    "sender",
                    "template_manager",
                    "auditor",
                    "billing"
                  ]
                },
                "jit": {
                  "type": "boolean"
                }
              },
              "required": [
                "providerId",
                "idp",
                "enforce",
                "defaultRole",
                "jit"
              ],
              "additionalProperties": false
            },
            "health": {
              "type": "object",
              "properties": {
                "providerId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "healthy",
                    "warning",
                    "error",
                    "unused"
                  ]
                },
                "lastLoginAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "loginsLast30d": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "certificates": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "subject": {
                        "type": "string"
                      },
                      "notAfter": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      "fingerprintSha256": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "subject",
                      "notAfter",
                      "fingerprintSha256"
                    ],
                    "additionalProperties": false
                  }
                },
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "at": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      "code": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      },
                      "fix": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "at",
                      "code",
                      "message",
                      "fix"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "providerId",
                "status",
                "lastLoginAt",
                "loginsLast30d",
                "certificates",
                "errors"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "settings",
            "health"
          ],
          "additionalProperties": false
        }
      },
      "SsoConnection": {
        "type": "object",
        "properties": {
          "settings": {
            "type": "object",
            "properties": {
              "providerId": {
                "type": "string"
              },
              "idp": {
                "type": "string",
                "enum": [
                  "entra",
                  "okta",
                  "google",
                  "jumpcloud",
                  "saml",
                  "oidc"
                ]
              },
              "enforce": {
                "type": "boolean"
              },
              "defaultRole": {
                "type": "string",
                "enum": [
                  "admin",
                  "sender",
                  "template_manager",
                  "auditor",
                  "billing"
                ]
              },
              "jit": {
                "type": "boolean"
              }
            },
            "required": [
              "providerId",
              "idp",
              "enforce",
              "defaultRole",
              "jit"
            ],
            "additionalProperties": false
          },
          "health": {
            "type": "object",
            "properties": {
              "providerId": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "healthy",
                  "warning",
                  "error",
                  "unused"
                ]
              },
              "lastLoginAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "loginsLast30d": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "certificates": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "subject": {
                      "type": "string"
                    },
                    "notAfter": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "fingerprintSha256": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "subject",
                    "notAfter",
                    "fingerprintSha256"
                  ],
                  "additionalProperties": false
                }
              },
              "errors": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "fix": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "at",
                    "code",
                    "message",
                    "fix"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "providerId",
              "status",
              "lastLoginAt",
              "loginsLast30d",
              "certificates",
              "errors"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "settings",
          "health"
        ],
        "additionalProperties": false
      },
      "SsoConnectionSettings": {
        "type": "object",
        "properties": {
          "providerId": {
            "type": "string"
          },
          "idp": {
            "type": "string",
            "enum": [
              "entra",
              "okta",
              "google",
              "jumpcloud",
              "saml",
              "oidc"
            ]
          },
          "enforce": {
            "type": "boolean"
          },
          "defaultRole": {
            "type": "string",
            "enum": [
              "admin",
              "sender",
              "template_manager",
              "auditor",
              "billing"
            ]
          },
          "jit": {
            "type": "boolean"
          }
        },
        "required": [
          "providerId",
          "idp",
          "enforce",
          "defaultRole",
          "jit"
        ],
        "additionalProperties": false
      },
      "SsoTest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "claims": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "status",
          "url",
          "claims",
          "error"
        ],
        "additionalProperties": false
      },
      "SamlMetadata": {
        "type": "object",
        "properties": {
          "xml": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "xml"
        ],
        "additionalProperties": false
      },
      "FetchSamlMetadata": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "url"
        ]
      },
      "SsoAuditList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "providerId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "connection.created",
                    "connection.updated",
                    "connection.deleted",
                    "domain.verification_requested",
                    "domain.verified",
                    "test.succeeded",
                    "test.failed",
                    "enforcement.enabled",
                    "enforcement.disabled",
                    "scim.token_created",
                    "scim.token_revoked"
                  ]
                },
                "actor": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                    }
                  },
                  "required": [
                    "name",
                    "email"
                  ],
                  "additionalProperties": false
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "detail": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "providerId",
                "action",
                "actor",
                "createdAt",
                "detail"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "BillingOverview": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "payg",
              "team",
              "business",
              "platform"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "trialing",
              "past_due",
              "incomplete",
              "unpaid",
              "canceled",
              "none"
            ]
          },
          "currentPeriodEnd": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "cancelAtPeriodEnd": {
            "type": "boolean"
          },
          "usage": {
            "type": "object",
            "properties": {
              "completedEnvelopes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "included": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "periodStart": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "periodEnd": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "overage": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "addOns": {
                "type": "object",
                "properties": {
                  "smsOtp": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "idCheck": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "qesSignature": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "smsOtp",
                  "idCheck",
                  "qesSignature"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "completedEnvelopes",
              "included",
              "periodStart",
              "periodEnd",
              "overage",
              "addOns"
            ],
            "additionalProperties": false
          },
          "hasPaymentMethod": {
            "type": "boolean"
          },
          "sendingBlocked": {
            "type": "boolean"
          },
          "upcomingInvoice": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "stripe",
                      "estimate"
                    ]
                  },
                  "subtotal": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "tax": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "total": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "periodEnd": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "quantity": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "description",
                        "amount",
                        "quantity"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "currency",
                  "source",
                  "subtotal",
                  "tax",
                  "total",
                  "periodEnd",
                  "lines"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "entitlements": {
            "type": "object",
            "properties": {
              "plan": {
                "type": "string",
                "enum": [
                  "free",
                  "payg",
                  "team",
                  "business",
                  "platform"
                ]
              },
              "includedEnvelopes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "overageAllowed": {
                "type": "boolean"
              },
              "features": {
                "type": "object",
                "properties": {
                  "ssoConnections": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "scim": {
                    "type": "boolean"
                  },
                  "enforcedSso": {
                    "type": "boolean"
                  },
                  "auditLogExport": {
                    "type": "boolean"
                  },
                  "whiteLabel": {
                    "type": "boolean"
                  },
                  "subAccounts": {
                    "type": "boolean"
                  },
                  "branding": {
                    "type": "boolean"
                  },
                  "euResidency": {
                    "type": "boolean"
                  },
                  "sms": {
                    "type": "boolean"
                  },
                  "signingLinks": {
                    "type": "boolean"
                  },
                  "emailBranding": {
                    "type": "boolean"
                  },
                  "emailCustomFooter": {
                    "type": "boolean"
                  },
                  "emailRemovePoweredBy": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "ssoConnections",
                  "scim",
                  "enforcedSso",
                  "auditLogExport",
                  "whiteLabel",
                  "subAccounts",
                  "branding",
                  "euResidency",
                  "sms",
                  "signingLinks",
                  "emailBranding",
                  "emailCustomFooter",
                  "emailRemovePoweredBy"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "plan",
              "includedEnvelopes",
              "overageAllowed",
              "features"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "plan",
          "status",
          "currentPeriodEnd",
          "cancelAtPeriodEnd",
          "usage",
          "hasPaymentMethod",
          "sendingBlocked",
          "upcomingInvoice",
          "entitlements"
        ],
        "additionalProperties": false
      },
      "Subscription": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "payg",
              "team",
              "business",
              "platform"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "trialing",
              "past_due",
              "incomplete",
              "unpaid",
              "canceled",
              "none"
            ]
          },
          "currentPeriodEnd": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "cancelAtPeriodEnd": {
            "type": "boolean"
          },
          "usage": {
            "type": "object",
            "properties": {
              "completedEnvelopes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "included": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "periodStart": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "periodEnd": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              }
            },
            "required": [
              "completedEnvelopes",
              "included",
              "periodStart",
              "periodEnd"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "plan",
          "status",
          "currentPeriodEnd",
          "cancelAtPeriodEnd",
          "usage"
        ],
        "additionalProperties": false
      },
      "RedirectUrl": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": false
      },
      "CreateCheckout": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "payg",
              "team",
              "business",
              "platform"
            ]
          },
          "successUrl": {
            "type": "string",
            "format": "uri"
          },
          "cancelUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "plan",
          "successUrl",
          "cancelUrl"
        ]
      },
      "CreatePortal": {
        "type": "object",
        "properties": {
          "returnUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "returnUrl"
        ]
      },
      "AnchorKeySet": {
        "type": "object",
        "properties": {
          "issuer": {
            "type": "string"
          },
          "anchor_format": {
            "type": "string"
          },
          "keys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key_id": {
                  "type": "string"
                },
                "algorithm": {
                  "type": "string",
                  "const": "Ed25519"
                },
                "public_key": {
                  "type": "string"
                },
                "public_key_pem": {
                  "type": "string"
                },
                "valid_from": {
                  "type": "string"
                },
                "valid_until": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "active",
                    "retired"
                  ]
                }
              },
              "required": [
                "key_id",
                "algorithm",
                "public_key",
                "valid_from",
                "valid_until"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "issuer",
          "anchor_format",
          "keys"
        ],
        "additionalProperties": false
      },
      "AnchorPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "version": {
                  "type": "string",
                  "const": "bona-fide-anchor-v1"
                },
                "sequence": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "root": {
                  "type": "string"
                },
                "previous_root": {
                  "type": "string"
                },
                "leaf_count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "created_at": {
                  "type": "string"
                },
                "key_id": {
                  "type": "string"
                },
                "signature": {
                  "type": "string"
                },
                "signed_message": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "version",
                "sequence",
                "root",
                "previous_root",
                "leaf_count",
                "created_at",
                "key_id",
                "signature",
                "signed_message"
              ],
              "additionalProperties": false
            }
          },
          "next_before": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "data",
          "next_before"
        ],
        "additionalProperties": false
      },
      "Anchor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "const": "bona-fide-anchor-v1"
          },
          "sequence": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "root": {
            "type": "string"
          },
          "previous_root": {
            "type": "string"
          },
          "leaf_count": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "created_at": {
            "type": "string"
          },
          "key_id": {
            "type": "string"
          },
          "signature": {
            "type": "string"
          },
          "signed_message": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "version",
          "sequence",
          "root",
          "previous_root",
          "leaf_count",
          "created_at",
          "key_id",
          "signature",
          "signed_message"
        ],
        "additionalProperties": false
      },
      "VerifyResponse": {
        "type": "object",
        "properties": {
          "sha256": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "verified",
              "pending_anchor",
              "not_found"
            ]
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "enum": [
                    "verified",
                    "pending_anchor"
                  ]
                },
                "matched": {
                  "type": "string",
                  "enum": [
                    "sealed_document",
                    "original_document"
                  ]
                },
                "envelope": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "completed_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sealed_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "organization_name": {
                      "type": "string"
                    },
                    "signer_count": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "verification_methods": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "test_mode": {
                      "type": "boolean"
                    },
                    "signers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "role": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "verification_method": {
                            "type": "string"
                          },
                          "signed_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "email",
                          "role",
                          "verification_method",
                          "signed_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "completed_at",
                    "sealed_at",
                    "organization_name",
                    "signer_count",
                    "verification_methods",
                    "test_mode",
                    "signers"
                  ],
                  "additionalProperties": false
                },
                "leaf": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "envelope_id": {
                          "type": "string"
                        },
                        "sealed_document_sha256": {
                          "type": "string"
                        },
                        "original_document_sha256": {
                          "type": "string"
                        },
                        "event_chain_head": {
                          "type": "string"
                        },
                        "completed_at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "envelope_id",
                        "sealed_document_sha256",
                        "original_document_sha256",
                        "event_chain_head",
                        "completed_at"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "leaf_hash": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "proof": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "leaf_index": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "tree_size": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "hashes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "leaf_index",
                        "tree_size",
                        "hashes"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "anchor": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "version": {
                          "type": "string",
                          "const": "bona-fide-anchor-v1"
                        },
                        "sequence": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "root": {
                          "type": "string"
                        },
                        "previous_root": {
                          "type": "string"
                        },
                        "leaf_count": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "key_id": {
                          "type": "string"
                        },
                        "signature": {
                          "type": "string"
                        },
                        "signed_message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "version",
                        "sequence",
                        "root",
                        "previous_root",
                        "leaf_count",
                        "created_at",
                        "key_id",
                        "signature",
                        "signed_message"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "links": {
                  "type": "object",
                  "properties": {
                    "anchor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "keys": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "anchor",
                    "keys"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "status",
                "matched",
                "envelope",
                "leaf",
                "leaf_hash",
                "proof",
                "anchor",
                "links"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "sha256",
          "status",
          "results"
        ],
        "additionalProperties": false
      },
      "VerifyRequest": {
        "type": "object",
        "properties": {
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        },
        "required": [
          "sha256"
        ]
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "bf_live_… or bf_test_…"
      },
      "bearerApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer bf_live_…"
      },
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "bf.session_token",
        "description": "Dashboard session (Better Auth)"
      }
    }
  }
}
