{
  "openapi": "3.1.0",
  "info": {
    "title": "Beezifi PDF API",
    "version": "1.0.0",
    "description": "Upload, read, comment on, fill in, organize, redact, protect, sign and export PDFs. Edits go through the same command engine as the editor, so people with a document open see API changes live.",
    "contact": {
      "email": "support@beezifi.com"
    }
  },
  "servers": [
    {
      "url": "/api"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Auth",
      "description": "Sign in and manage personal access tokens (`bzp_…`)."
    },
    {
      "name": "E-signature",
      "description": "Send a document to several people to sign electronically, in order or all at once. Signers need no account: each gets a private link. On completion the signed PDF has every signature stamped, a certificate of completion appended, and a platform seal."
    },
    {
      "name": "Documents",
      "description": "List, create, upload, combine, rename, copy and delete documents."
    },
    {
      "name": "Content",
      "description": "Read pages and text, find text, and change documents with commands."
    },
    {
      "name": "Pages",
      "description": "Insert, paste, extract and split pages."
    },
    {
      "name": "Review",
      "description": "Comments and form data in and out."
    },
    {
      "name": "Protect",
      "description": "Redaction, passwords, permissions and digital signatures."
    },
    {
      "name": "Scan",
      "description": "Text recognition (OCR) and scan enhancement."
    },
    {
      "name": "Export",
      "description": "PDF, Word, PowerPoint, HTML, RTF, text, Markdown, images, XFDF, FDF."
    },
    {
      "name": "Inspect",
      "description": "Properties, accessibility, word count, space usage, compare."
    },
    {
      "name": "Sharing",
      "description": "Invite people as viewers, commenters or editors."
    },
    {
      "name": "History",
      "description": "Versions and the activity log."
    },
    {
      "name": "Account",
      "description": "Digital IDs, trusted certificates, settings and search across documents."
    },
    {
      "name": "Reference",
      "description": "Command list and accepted option names. No authentication needed."
    }
  ],
  "paths": {
    "/auth/login": {
      "post": {
        "tags": [
          "Auth"
        ],
        "operationId": "login",
        "summary": "Sign in",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "password"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/auth/register": {
      "post": {
        "tags": [
          "Auth"
        ],
        "operationId": "register",
        "summary": "Create an account",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "password"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/auth/me": {
      "get": {
        "tags": [
          "Auth"
        ],
        "operationId": "me",
        "summary": "The signed-in user",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/auth/tokens": {
      "get": {
        "tags": [
          "Auth"
        ],
        "operationId": "listTokens",
        "summary": "List access tokens",
        "description": "Needs a session sign-in, not an access token.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Auth"
        ],
        "operationId": "createToken",
        "summary": "Create an access token",
        "description": "Returns the token once.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "expiresInDays": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string",
                      "example": "bzp_…"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents": {
      "get": {
        "tags": [
          "Documents"
        ],
        "operationId": "listDocuments",
        "summary": "List documents",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "documents": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DocumentRow"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "createDocument",
        "summary": "Create a blank document",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "pages": {
                    "type": "integer"
                  },
                  "size": {
                    "type": "string",
                    "enum": [
                      "letter",
                      "legal",
                      "tabloid",
                      "executive",
                      "a3",
                      "a4",
                      "a5",
                      "b5"
                    ]
                  },
                  "landscape": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/import": {
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "importDocuments",
        "summary": "Upload files",
        "description": "PDFs, pictures (each becomes a page) and text files. `mode=combine` (default) makes one document; `separate` one per file. A protected PDF answers 401 with `code: password_required` and the file `index`; send `passwords` as JSON `{\"0\": \"secret\"}`.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "files"
                ],
                "properties": {
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "combine",
                      "separate"
                    ]
                  },
                  "title": {
                    "type": "string"
                  },
                  "passwords": {
                    "type": "string",
                    "description": "JSON object of passwords by file index or name."
                  },
                  "pageSize": {
                    "type": "string",
                    "enum": [
                      "letter",
                      "legal",
                      "tabloid",
                      "executive",
                      "a3",
                      "a4",
                      "a5",
                      "b5"
                    ],
                    "description": "Fit pictures on pages of this size."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "pages": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/combine": {
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "combineDocuments",
        "summary": "Combine documents",
        "description": "A new document with the given documents (or some of their pages) in order, each under a bookmark.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "documents"
                ],
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "documents": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "pages": {
                          "oneOf": [
                            {
                              "type": "string",
                              "example": "1-3,5"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "integer",
                                "minimum": 1
                              }
                            }
                          ]
                        }
                      }
                    }
                  },
                  "bookmarks": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "pages": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/form-data/merge": {
      "post": {
        "tags": [
          "Review"
        ],
        "operationId": "mergeFormData",
        "summary": "Merge data files into a spreadsheet",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [],
                "properties": {
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One row per file.",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/ocr/languages": {
      "get": {
        "tags": [
          "Scan"
        ],
        "operationId": "ocrLanguages",
        "summary": "OCR languages",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Documents"
        ],
        "operationId": "getDocument",
        "summary": "The full document model",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "tags": [
          "Documents"
        ],
        "operationId": "renameDocument",
        "summary": "Rename",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title"
                ],
                "properties": {
                  "title": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "delete": {
        "tags": [
          "Documents"
        ],
        "operationId": "deleteDocument",
        "summary": "Delete (owner) or leave (shared)",
        "description": "Owners move the document to the trash; it is erased after 30 days.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/duplicate": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "duplicateDocument",
        "summary": "Make a copy",
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/summary": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "items",
          "in": "query",
          "schema": {
            "type": "integer",
            "enum": [
              0,
              1
            ]
          }
        }
      ],
      "get": {
        "tags": [
          "Content"
        ],
        "operationId": "getSummary",
        "summary": "Pages, comments, fields, bookmarks, attachments, layers, security",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/pages/{page}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "page",
          "in": "path",
          "required": true,
          "description": "1-based page number or page id.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Content"
        ],
        "operationId": "getPage",
        "summary": "A page: text and items",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/pages/{page}/image": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "page",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "dpi",
          "in": "query",
          "schema": {
            "type": "integer",
            "default": 96
          }
        },
        {
          "name": "format",
          "in": "query",
          "schema": {
            "type": "string",
            "enum": [
              "png",
              "jpeg"
            ]
          }
        },
        {
          "name": "comments",
          "in": "query",
          "schema": {
            "type": "integer",
            "enum": [
              0,
              1
            ]
          }
        }
      ],
      "get": {
        "tags": [
          "Content"
        ],
        "operationId": "renderPage",
        "summary": "Render a page",
        "responses": {
          "200": {
            "description": "The page as it prints.",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/text": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "pages",
          "in": "query",
          "description": "Page range such as `1-3,7,10-last` (default: all).",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Content"
        ],
        "operationId": "getText",
        "summary": "Page text in reading order",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/search": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "q",
          "in": "query",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "case",
          "in": "query",
          "schema": {
            "type": "integer"
          }
        },
        {
          "name": "word",
          "in": "query",
          "schema": {
            "type": "integer"
          }
        },
        {
          "name": "regex",
          "in": "query",
          "schema": {
            "type": "integer"
          }
        }
      ],
      "get": {
        "tags": [
          "Content"
        ],
        "operationId": "findText",
        "summary": "Find text",
        "description": "Each match with its page and boxes `[x, y, w, h]` in points from the top-left.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/mark-text": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Content"
        ],
        "operationId": "markText",
        "summary": "Highlight, underline, strike out, link or redact every match",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string"
                  },
                  "patterns": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "email",
                        "phone",
                        "ssn",
                        "card",
                        "date",
                        "url",
                        "ip"
                      ]
                    }
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "highlight",
                      "underline",
                      "strikeout",
                      "squiggly",
                      "redact",
                      "link"
                    ]
                  },
                  "contents": {
                    "type": "string"
                  },
                  "color": {
                    "type": "string"
                  },
                  "pages": {
                    "oneOf": [
                      {
                        "type": "string",
                        "example": "1-3,5"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    ]
                  },
                  "caseSensitive": {
                    "type": "boolean"
                  },
                  "wholeWord": {
                    "type": "boolean"
                  },
                  "regex": {
                    "type": "boolean"
                  },
                  "overlay": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                }
              },
              "examples": {
                "example": {
                  "value": {
                    "query": "total due",
                    "type": "highlight",
                    "contents": "Check this amount"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/commands": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Content"
        ],
        "operationId": "runCommands",
        "summary": "Run commands",
        "description": "Runs up to 500 commands in order. Each result says whether it worked.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "commands"
                ],
                "properties": {
                  "commands": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Command"
                    }
                  }
                }
              },
              "examples": {
                "example": {
                  "value": {
                    "commands": [
                      {
                        "id": "item.add",
                        "params": {
                          "page": 1,
                          "item": {
                            "type": "note",
                            "x": 500,
                            "y": 60,
                            "contents": "Please review"
                          }
                        }
                      },
                      {
                        "id": "page.rotate",
                        "params": {
                          "pages": [
                            2
                          ],
                          "angle": 90
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ok": {
                            "type": "boolean"
                          },
                          "seq": {
                            "type": "integer"
                          },
                          "result": {
                            "type": "object"
                          },
                          "error": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/links/from-urls": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Content"
        ],
        "operationId": "linksFromUrls",
        "summary": "Create links from URLs in the text",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/bookmarks/from-text": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Content"
        ],
        "operationId": "bookmarksFromText",
        "summary": "New bookmarks from text styles",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "levels": {
                    "type": "integer"
                  },
                  "replace": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/form/detect": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Review"
        ],
        "operationId": "detectFields",
        "summary": "Detect form fields",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/files": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Content"
        ],
        "operationId": "uploadFile",
        "summary": "Upload a picture or attachment",
        "description": "Returns a file id (`fid`) for image items, stamps, watermarks and attachments.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fid": {
                      "type": "string"
                    },
                    "mime": {
                      "type": "string"
                    },
                    "width": {
                      "type": "integer"
                    },
                    "height": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/files/{fid}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "fid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Content"
        ],
        "operationId": "getFile",
        "summary": "Download a stored file",
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/insert": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Pages"
        ],
        "operationId": "insertFiles",
        "summary": "Insert pages from files",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "files"
                ],
                "properties": {
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  },
                  "at": {
                    "type": "integer",
                    "description": "0-based position."
                  },
                  "replace": {
                    "type": "string",
                    "description": "Pages to replace, e.g. `2-3`."
                  },
                  "passwords": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/pages/paste": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Pages"
        ],
        "operationId": "pastePages",
        "summary": "Paste pages from another document",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "source",
                  "pages"
                ],
                "properties": {
                  "source": {
                    "type": "string"
                  },
                  "pages": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Page ids."
                  },
                  "at": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/extract": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Pages"
        ],
        "operationId": "extractPages",
        "summary": "Extract pages into new documents",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pages": {
                    "oneOf": [
                      {
                        "type": "string",
                        "example": "1-3,5"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    ]
                  },
                  "separate": {
                    "type": "boolean"
                  },
                  "delete": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "documents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "title": {
                            "type": "string"
                          },
                          "pages": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/split": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Pages"
        ],
        "operationId": "splitDocument",
        "summary": "Split a document",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "every": {
                    "type": "integer"
                  },
                  "before": {
                    "oneOf": [
                      {
                        "type": "string",
                        "example": "1-3,5"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    ]
                  },
                  "parts": {
                    "type": "integer"
                  },
                  "bookmarks": {
                    "type": "boolean"
                  },
                  "output": {
                    "type": "string",
                    "enum": [
                      "documents",
                      "zip"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "documents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "title": {
                            "type": "string"
                          },
                          "pages": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/comments/import": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Review"
        ],
        "operationId": "importComments",
        "summary": "Import comments (XFDF or a PDF)",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/form/import": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Review"
        ],
        "operationId": "importFormData",
        "summary": "Fill the form from FDF, XFDF, JSON or CSV",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/redact/apply": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Protect"
        ],
        "operationId": "applyRedactions",
        "summary": "Apply redaction marks",
        "description": "Rewrites each page with marks as an image with the areas removed. By default earlier versions are removed too.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pages": {
                    "oneOf": [
                      {
                        "type": "string",
                        "example": "1-3,5"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    ]
                  },
                  "dpi": {
                    "type": "integer"
                  },
                  "purgeHistory": {
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/unlock": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Protect"
        ],
        "operationId": "unlock",
        "summary": "Enter the permissions password",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "password"
                ],
                "properties": {
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/signatures": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Protect"
        ],
        "operationId": "listSignatures",
        "summary": "Validate digital signatures",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/sign": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Protect"
        ],
        "operationId": "signDocument",
        "summary": "Sign with a digital ID",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "digitalId",
                  "password"
                ],
                "properties": {
                  "digitalId": {
                    "type": "integer"
                  },
                  "password": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "location": {
                    "type": "string"
                  },
                  "certify": {
                    "type": "string",
                    "enum": [
                      "none",
                      "forms",
                      "comments"
                    ]
                  },
                  "field": {
                    "type": "string"
                  },
                  "page": {
                    "type": "integer"
                  },
                  "rect": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "[x, y, w, h] from the top-left; omit for an invisible signature."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The signed PDF.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/ocr": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Scan"
        ],
        "operationId": "recognizeText",
        "summary": "Recognize text (OCR)",
        "description": "Up to 5 pages per request. With `apply: false` the words are returned without changing the document.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "page": {
                    "type": "integer"
                  },
                  "pages": {
                    "oneOf": [
                      {
                        "type": "string",
                        "example": "1-3,5"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    ]
                  },
                  "lang": {
                    "type": "string",
                    "example": "eng"
                  },
                  "apply": {
                    "type": "boolean"
                  },
                  "rect": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    }
                  },
                  "enhance": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/enhance": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Scan"
        ],
        "operationId": "enhancePages",
        "summary": "Enhance scanned pages",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pages": {
                    "oneOf": [
                      {
                        "type": "string",
                        "example": "1-3,5"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    ]
                  },
                  "dpi": {
                    "type": "integer"
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "grayscale": {
                        "type": "boolean"
                      },
                      "whiten": {
                        "type": "boolean"
                      },
                      "deskew": {
                        "type": "boolean"
                      },
                      "denoise": {
                        "type": "boolean"
                      },
                      "binarize": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/export": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "format",
          "in": "query",
          "required": true,
          "schema": {
            "type": "string",
            "enum": [
              "pdf",
              "txt",
              "md",
              "html",
              "docx",
              "rtf",
              "pptx",
              "png",
              "jpeg",
              "images",
              "xfdf",
              "fdf",
              "form-xfdf",
              "form-json",
              "form-csv",
              "comments-html",
              "measurements",
              "json"
            ]
          }
        },
        {
          "name": "pages",
          "in": "query",
          "description": "Page range such as `1-3,7,10-last` (default: all).",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "flatten",
          "in": "query",
          "schema": {
            "type": "string",
            "enum": [
              "comments",
              "fields",
              "all"
            ]
          }
        },
        {
          "name": "dpi",
          "in": "query",
          "schema": {
            "type": "integer"
          }
        }
      ],
      "get": {
        "tags": [
          "Export"
        ],
        "operationId": "exportDocument",
        "summary": "Download",
        "responses": {
          "200": {
            "description": "The file. `X-Export-Warnings` lists anything that could not be written.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Export"
        ],
        "operationId": "exportDocumentWithOptions",
        "summary": "Download with options (passwords, sanitizing, size)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "format": {
                    "type": "string"
                  },
                  "pages": {
                    "oneOf": [
                      {
                        "type": "string",
                        "example": "1-3,5"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    ]
                  },
                  "flatten": {
                    "type": "string"
                  },
                  "sanitize": {
                    "type": "boolean"
                  },
                  "optimize": {
                    "type": "string",
                    "enum": [
                      "high",
                      "medium",
                      "small"
                    ]
                  },
                  "encrypt": {
                    "type": "object",
                    "properties": {
                      "userPassword": {
                        "type": "string"
                      },
                      "ownerPassword": {
                        "type": "string"
                      },
                      "algorithm": {
                        "type": "string",
                        "enum": [
                          "AES-256",
                          "AES-128"
                        ]
                      },
                      "permissions": {
                        "type": "object",
                        "properties": {
                          "print": {
                            "type": "boolean"
                          },
                          "printHigh": {
                            "type": "boolean"
                          },
                          "modify": {
                            "type": "boolean"
                          },
                          "copy": {
                            "type": "boolean"
                          },
                          "annotate": {
                            "type": "boolean"
                          },
                          "fill": {
                            "type": "boolean"
                          },
                          "assemble": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/reduce": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Export"
        ],
        "operationId": "reduceSize",
        "summary": "Reduce file size",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preset": {
                    "type": "string",
                    "enum": [
                      "high",
                      "medium",
                      "small"
                    ]
                  },
                  "ppi": {
                    "type": "integer"
                  },
                  "quality": {
                    "type": "integer"
                  },
                  "grayscale": {
                    "type": "boolean"
                  },
                  "report": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/properties": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Inspect"
        ],
        "operationId": "getProperties",
        "summary": "Document properties: fonts, security, versions",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/accessibility": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Inspect"
        ],
        "operationId": "checkAccessibility",
        "summary": "Accessibility check",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/word-count": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Inspect"
        ],
        "operationId": "wordCount",
        "summary": "Word count",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/audit-space": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Inspect"
        ],
        "operationId": "auditSpace",
        "summary": "Audit space usage",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/compare": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Inspect"
        ],
        "operationId": "compareDocuments",
        "summary": "Compare with another document or a version",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "other": {
                    "type": "string"
                  },
                  "version": {
                    "type": "integer"
                  },
                  "mark": {
                    "type": "boolean"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "html"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/shares": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Sharing"
        ],
        "operationId": "listShares",
        "summary": "Who has access",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Sharing"
        ],
        "operationId": "share",
        "summary": "Share (owner only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "viewer",
                      "commenter",
                      "editor"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/shares/{userId}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "userId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          }
        }
      ],
      "delete": {
        "tags": [
          "Sharing"
        ],
        "operationId": "unshare",
        "summary": "Remove access (owner only)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/versions": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "History"
        ],
        "operationId": "listVersions",
        "summary": "List versions",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "History"
        ],
        "operationId": "saveVersion",
        "summary": "Save a named version",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/versions/{versionId}/restore": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "versionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          }
        }
      ],
      "post": {
        "tags": [
          "History"
        ],
        "operationId": "restoreVersion",
        "summary": "Restore a version",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/activity": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "History"
        ],
        "operationId": "getActivity",
        "summary": "Recent changes",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/documents/{id}/sign-requests": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Document id (a UUID).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "E-signature"
        ],
        "operationId": "listSignRequests",
        "summary": "This document's signature requests",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "E-signature"
        ],
        "operationId": "createSignRequest",
        "summary": "Start a signature request (draft)",
        "description": "Freezes the current pages into a draft. Add recipients and fields with PUT, then send.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignRequest"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/sign-requests": {
      "get": {
        "tags": [
          "E-signature"
        ],
        "operationId": "listMySignRequests",
        "summary": "Requests you sent",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/sign-requests/{rid}": {
      "parameters": [
        {
          "name": "rid",
          "in": "path",
          "required": true,
          "description": "Signature request id.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "E-signature"
        ],
        "operationId": "getSignRequest",
        "summary": "Status, recipients (with signing links once sent), fields and history",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignRequest"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "put": {
        "tags": [
          "E-signature"
        ],
        "operationId": "updateSignRequest",
        "summary": "Edit a draft",
        "description": "Send the full recipient and field lists. New recipients have no id: refer to them from fields as `#0`, `#1`… by position.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignRequestDraft"
              },
              "examples": {
                "example": {
                  "value": {
                    "title": "NDA",
                    "signingOrder": "sequential",
                    "recipients": [
                      {
                        "name": "Ann Lee",
                        "email": "ann@example.com",
                        "role": "signer",
                        "order": 1
                      },
                      {
                        "name": "Bob Ray",
                        "email": "bob@example.com",
                        "role": "signer",
                        "order": 2
                      },
                      {
                        "name": "Cara Diaz",
                        "email": "cara@example.com",
                        "role": "cc",
                        "order": 3
                      }
                    ],
                    "fields": [
                      {
                        "recipient": "#0",
                        "type": "signature",
                        "page": 1,
                        "x": 72,
                        "y": 640,
                        "w": 180,
                        "h": 44
                      },
                      {
                        "recipient": "#1",
                        "type": "signature",
                        "page": 1,
                        "x": 340,
                        "y": 640,
                        "w": 180,
                        "h": 44
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignRequest"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "delete": {
        "tags": [
          "E-signature"
        ],
        "operationId": "deleteSignRequest",
        "summary": "Delete a draft",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/sign-requests/{rid}/send": {
      "parameters": [
        {
          "name": "rid",
          "in": "path",
          "required": true,
          "description": "Signature request id.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "E-signature"
        ],
        "operationId": "sendSignRequest",
        "summary": "Send: invite the first group (or everyone)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignRequest"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/sign-requests/{rid}/remind": {
      "parameters": [
        {
          "name": "rid",
          "in": "path",
          "required": true,
          "description": "Signature request id.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "E-signature"
        ],
        "operationId": "remindSignRequest",
        "summary": "Email a reminder to whoever’s turn it is",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipientId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/sign-requests/{rid}/void": {
      "parameters": [
        {
          "name": "rid",
          "in": "path",
          "required": true,
          "description": "Signature request id.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "E-signature"
        ],
        "operationId": "voidSignRequest",
        "summary": "Cancel for everyone",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/sign-requests/{rid}/refresh": {
      "parameters": [
        {
          "name": "rid",
          "in": "path",
          "required": true,
          "description": "Signature request id.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "E-signature"
        ],
        "operationId": "refreshSignRequest",
        "summary": "Draft only: take the document's current pages again",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/sign-requests/{rid}/download": {
      "parameters": [
        {
          "name": "rid",
          "in": "path",
          "required": true,
          "description": "Signature request id.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "E-signature"
        ],
        "operationId": "downloadSigned",
        "summary": "The completed, sealed PDF",
        "responses": {
          "200": {
            "description": "Signed PDF with the certificate of completion.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/ids": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "listDigitalIds",
        "summary": "Your digital IDs",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Account"
        ],
        "operationId": "createDigitalId",
        "summary": "Create a digital ID",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "password"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "org": {
                    "type": "string"
                  },
                  "years": {
                    "type": "integer"
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/trust": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "listTrusted",
        "summary": "Trusted certificates",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/search": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "searchDocuments",
        "summary": "Search the text of every document you can open",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/commands": {
      "get": {
        "tags": [
          "Reference"
        ],
        "operationId": "listCommands",
        "summary": "Every command and its parameters",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/options": {
      "get": {
        "tags": [
          "Reference"
        ],
        "operationId": "listOptions",
        "summary": "Item types, stamps, paper sizes, patterns, fonts, OCR languages",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "A personal access token (`bzp_…`) or a session token from /auth/login."
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid input",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "…",
              "code": "invalid_request",
              "requestId": "…"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid token, or a PDF password is needed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "…",
              "code": "unauthorized",
              "requestId": "…"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Not allowed for your role, or by the PDF's security settings",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "…",
              "code": "forbidden",
              "requestId": "…"
            }
          }
        }
      },
      "NotFound": {
        "description": "No such document, or no access",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "…",
              "code": "not_found",
              "requestId": "…"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "…",
              "code": "rate_limited",
              "requestId": "…"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "Session": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          },
          "user": {
            "$ref": "#/components/schemas/User"
          }
        }
      },
      "DocumentRow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "pages": {
            "type": "integer"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "editor",
              "commenter",
              "viewer"
            ]
          },
          "owner_name": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SignRequestDraft": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "signingOrder": {
            "type": "string",
            "enum": [
              "sequential",
              "parallel"
            ]
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "reminderDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 60
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "email"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "signer",
                    "approver",
                    "cc"
                  ]
                },
                "order": {
                  "type": "integer",
                  "description": "Routing order; the same number signs at the same time."
                }
              }
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "recipient",
                "type",
                "page",
                "x",
                "y"
              ],
              "description": "PDF points from the top-left of the page as displayed.",
              "properties": {
                "recipient": {
                  "type": "string",
                  "description": "Recipient id, or `#n` for the n-th recipient in this request."
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "signature",
                    "initials",
                    "date",
                    "name",
                    "email",
                    "company",
                    "title",
                    "text",
                    "checkbox"
                  ]
                },
                "page": {
                  "type": "integer"
                },
                "x": {
                  "type": "number"
                },
                "y": {
                  "type": "number"
                },
                "w": {
                  "type": "number"
                },
                "h": {
                  "type": "number"
                },
                "required": {
                  "type": "boolean"
                },
                "label": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "SignRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "sent",
              "in_progress",
              "completed",
              "declined",
              "expired",
              "voided"
            ]
          },
          "signingOrder": {
            "type": "string"
          },
          "signedDocumentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "emailEnabled": {
            "type": "boolean"
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "role": {
                  "type": "string"
                },
                "order": {
                  "type": "integer"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "sent",
                    "viewed",
                    "signed",
                    "declined"
                  ]
                },
                "turn": {
                  "type": "boolean"
                },
                "link": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Private signing link; share only with this person."
                }
              }
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "action": {
                  "type": "string"
                },
                "actor": {
                  "type": "string"
                },
                "at": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          }
        }
      },
      "Command": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "doc.title",
              "doc.info",
              "doc.initialView",
              "doc.layers",
              "doc.measureScale",
              "doc.tabOrder",
              "doc.sanitize",
              "page.insert",
              "page.insertBlank",
              "page.delete",
              "page.move",
              "pages.order",
              "page.rotate",
              "page.reverse",
              "page.duplicate",
              "page.paste",
              "page.replace",
              "page.crop",
              "labels.set",
              "item.add",
              "item.update",
              "item.delete",
              "item.move",
              "item.arrange",
              "comment.reply",
              "comment.replyEdit",
              "comment.replyDelete",
              "comment.status",
              "comment.mark",
              "comment.lock",
              "comments.flatten",
              "comments.deleteAll",
              "form.set",
              "form.reset",
              "form.delete",
              "form.props",
              "form.flatten",
              "bookmark.add",
              "bookmark.update",
              "bookmark.delete",
              "bookmark.move",
              "bookmarks.set",
              "marks.set",
              "attachment.add",
              "attachment.update",
              "attachment.delete",
              "links.removeAll",
              "redact.clear",
              "ocr.set"
            ]
          },
          "params": {
            "type": "object"
          }
        }
      },
      "Item": {
        "type": "object",
        "required": [
          "type"
        ],
        "description": "Positions are PDF points from the top-left of the unrotated page.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "note",
              "highlight",
              "underline",
              "strikeout",
              "squiggly",
              "replace",
              "caret",
              "freetext",
              "callout",
              "ink",
              "line",
              "arrow",
              "square",
              "circle",
              "polygon",
              "polyline",
              "cloud",
              "stamp",
              "attach",
              "measure",
              "text",
              "textedit",
              "whiteout",
              "image",
              "link",
              "redact",
              "field",
              "sign",
              "ocr"
            ]
          },
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "w": {
            "type": "number"
          },
          "h": {
            "type": "number"
          },
          "quads": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          },
          "pts": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          },
          "color": {
            "type": "string"
          },
          "contents": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "stamp": {
            "type": "string",
            "enum": [
              "Approved",
              "NotApproved",
              "Draft",
              "Final",
              "Completed",
              "Confidential",
              "ForPublicRelease",
              "NotForPublicRelease",
              "ForComment",
              "Void",
              "PreliminaryResults",
              "InformationOnly",
              "Expired",
              "SignHere",
              "InitialHere",
              "Witness",
              "Received",
              "Reviewed",
              "Revised",
              "ApprovedBy",
              "Rejected"
            ]
          }
        }
      }
    }
  }
}
