{ "openapi": "3.0.0", "info": { "title": "API Documentation", "description": "API endpoints for document signing and management", "contact": { "name": "API Support", "email": "support@example.com" }, "license": { "name": "MIT", "url": "https://opensource.org/licenses/MIT" }, "version": "1.0.0" }, "servers": [ { "url": "http://localhost:8000", "description": "Local Development Server" }, { "url": "https://blocksign.io", "description": "Production Server" } ], "paths": { "/api/invite-for-sign": { "post": { "tags": [ "Documents" ], "summary": "Invite a user to sign a document", "operationId": "2e78c03a612142687e0ff0ff1fdb98a2", "requestBody": { "required": true, "content": { "application/json": { "schema": { "required": [ "uuid", "email" ], "properties": { "uuid": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" }, "email": { "type": "string", "format": "email", "example": "websinghajit@gmail.com" }, "firstname": { "type": "string", "example": "John" }, "lastname": { "type": "string", "example": "Doe" }, "page": { "type": "integer", "example": 1 }, "x": { "type": "number", "format": "float", "example": 100.5 }, "y": { "type": "number", "format": "float", "example": 200.5 }, "signature_level": { "description": "Signature level: aes, aesb, qes, or qesb", "type": "string", "enum": [ "aes", "aesb", "qes", "qesb" ], "example": "aes" }, "type": { "description": "Document type: signature or pod (proof of delivery)", "type": "string", "enum": [ "signature", "pod" ], "example": "signature" }, "callback_url": { "description": "Optional callback URL for status change notifications (signed, declined)", "type": "string", "format": "url", "example": "https://yourapp.com/webhook/document-status" } }, "type": "object" } } } }, "responses": { "200": { "description": "Invitation email sent successfully", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "invitation email sent" }, "uuid": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" }, "email": { "type": "string", "format": "email", "example": "websinghajit@gmail.com" } }, "type": "object" } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Invalid input data" } }, "type": "object" } } } }, "404": { "description": "User or document not found", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "User not found" } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/document/{uuid}/signature-level": { "put": { "tags": [ "Documents" ], "summary": "Set signature level for a document", "operationId": "411a4a32c410b454ef409abd6b8fa541", "parameters": [ { "name": "uuid", "in": "path", "description": "Document UUID", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "required": [ "signature_level" ], "properties": { "signature_level": { "type": "string", "enum": [ "aes", "aesb", "qes", "qesb" ], "example": "aes" } }, "type": "object" } } } }, "responses": { "200": { "description": "Signature level updated", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "Signature level updated" }, "uuid": { "type": "string" }, "signature_level": { "type": "string" } }, "type": "object" } } } }, "400": { "description": "Invalid signature level" }, "404": { "description": "Document not found" } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/document/{uuid}/type": { "put": { "tags": [ "Documents" ], "summary": "Set document type (signature or pod)", "operationId": "38aa6ae907006e0de2e8e31b003b67bf", "parameters": [ { "name": "uuid", "in": "path", "description": "Document UUID", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "signature", "pod" ], "example": "signature" } }, "type": "object" } } } }, "responses": { "200": { "description": "Document type updated", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "Document type updated" }, "uuid": { "type": "string" }, "type": { "type": "string" } }, "type": "object" } } } }, "400": { "description": "Invalid type" }, "404": { "description": "Document not found" } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/document/{uuid}/callback-url": { "put": { "tags": [ "Documents" ], "summary": "Set callback URL for document status notifications", "operationId": "6ec51684f4123c9e53e74efd70944835", "parameters": [ { "name": "uuid", "in": "path", "description": "Document UUID", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "required": [ "callback_url" ], "properties": { "callback_url": { "type": "string", "format": "url", "example": "https://yourapp.com/webhook/document-status" } }, "type": "object" } } } }, "responses": { "200": { "description": "Callback URL updated", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "Callback URL updated" }, "uuid": { "type": "string" }, "callback_url": { "type": "string" } }, "type": "object" } } } }, "400": { "description": "Invalid callback URL" }, "404": { "description": "Document not found" } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/upload-document": { "post": { "tags": [ "Documents" ], "summary": "Upload a PDF document", "description": "Allows authenticated users to upload a PDF document. The document is stored, and a thumbnail is generated.", "operationId": "16af6a70a598e23e118260fc7a456c30", "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "required": [ "file" ], "properties": { "file": { "description": "PDF document file (Only PDF format allowed)", "type": "string", "format": "binary" } }, "type": "object" } } } }, "responses": { "200": { "description": "Document uploaded successfully", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "Document uploaded Successfully" }, "url": { "type": "string", "format": "url", "example": "https://blocksign.io/invite/72dcaac9-7398-408f-b4c0-c058d4a652ed" }, "uuid": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" } }, "type": "object" } } } }, "400": { "description": "No document uploaded", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "No Document Uploaded" } }, "type": "object" } } } }, "415": { "description": "Invalid file format", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Upload only pdf document" } }, "type": "object" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "User ID Does Not Exist" } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/delete-document": { "delete": { "tags": [ "Documents" ], "summary": "Delete a document", "description": "Allows authenticated users to delete a document by its UUID. If the document has not been signed, it is removed along with associated recipients and files.", "operationId": "300429cce91b66231df9bcd1d084ee64", "parameters": [ { "name": "uuid", "in": "query", "description": "The UUID of the document to be deleted", "required": true, "schema": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" } } ], "responses": { "200": { "description": "Document removed successfully", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "Document Removed Successfully" }, "uuid": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" } }, "type": "object" } } } }, "400": { "description": "Invalid request or missing UUID", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Please select the uuid and it cannot be empty" } }, "type": "object" } } } }, "403": { "description": "Document cannot be deleted as it is signed", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Document is signed cannot be deleted" } }, "type": "object" } } } }, "404": { "description": "Document not found", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Document not found for uuid" } }, "type": "object" } } } }, "401": { "description": "User not authenticated", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "user is not authenticated" } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/download-document": { "get": { "tags": [ "Documents" ], "summary": "Download a signed document", "description": "Allows authenticated users to download a signed document using its UUID.", "operationId": "1c63064ec27ea82b3f5fefcbbe1ad967", "parameters": [ { "name": "uuid", "in": "query", "description": "The UUID of the signed document to be downloaded", "required": true, "schema": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" } } ], "responses": { "200": { "description": "Signed document download", "headers": { "Content-Disposition": { "description": "attachment; filename=document.pdf", "schema": { "type": "string" } }, "Content-Type": { "description": "application/pdf", "schema": { "type": "string" } } } }, "400": { "description": "Invalid request or missing UUID", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Please select the uuid and it cannot be empty" } }, "type": "object" } } } }, "404": { "description": "Document not found or not signed", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Document is not signed with this uuid" } }, "type": "object" } } } }, "401": { "description": "User not authenticated", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "user is not authenticated" } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/download-invoice": { "get": { "tags": [ "Invoices" ], "summary": "Download an invoice", "description": "Allows an authenticated user to download an invoice using its UUID and ID.", "operationId": "13cb554b5a070250e00ba2f67b5f54ff", "parameters": [ { "name": "uuid", "in": "query", "description": "The UUID associated with the invoice", "required": true, "schema": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" } }, { "name": "id", "in": "query", "description": "The unique ID of the invoice", "required": true, "schema": { "type": "integer", "example": 101 } } ], "responses": { "200": { "description": "Invoice PDF file download", "headers": { "Content-Disposition": { "description": "attachment; filename=invoice.pdf", "schema": { "type": "string" } }, "Content-Type": { "description": "application/pdf", "schema": { "type": "string" } } } }, "400": { "description": "Invalid request, missing UUID or ID", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Please select the uuid and it cannot be empty" } }, "type": "object" } } } }, "404": { "description": "Invoice not found", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Invoice is not found with this uuid and id" } }, "type": "object" } } } }, "401": { "description": "User not authenticated", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "user is not authenticated" } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/documents": { "get": { "tags": [ "Documents" ], "summary": "List all documents", "description": "Retrieves a list of all documents belonging to the authenticated user.", "operationId": "f1a07916c6d51ec180fbfd24109a438c", "responses": { "200": { "description": "Successful retrieval of documents", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "List of all Documents" }, "documents": { "type": "array", "items": { "properties": { "id": { "type": "integer", "example": 1 }, "uuid": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" }, "name": { "type": "string", "example": "Sample Document" }, "status": { "type": "integer", "example": 1 }, "created_at": { "type": "string", "format": "date-time", "example": "2024-03-17T12:34:56Z" }, "updated_at": { "type": "string", "format": "date-time", "example": "2024-03-17T12:34:56Z" } }, "type": "object" } } }, "type": "object" } } } }, "404": { "description": "No document found", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "No Document found" } }, "type": "object" } } } }, "401": { "description": "User not authenticated", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "user is not authenticated" } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/documents/status": { "get": { "tags": [ "Documents" ], "summary": "Get document status", "description": "Retrieves the status of a specific document belonging to the authenticated user.", "operationId": "fa601cf5ae5f7d35e9fdea046cd020bc", "parameters": [ { "name": "uuid", "in": "query", "description": "The UUID of the document.", "required": true, "schema": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" } } ], "responses": { "200": { "description": "Successful retrieval of document status", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "List of all Documents" }, "documents": { "type": "array", "items": { "properties": { "id": { "type": "integer", "example": 1 }, "uuid": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" }, "name": { "type": "string", "example": "Sample Document" }, "status": { "type": "integer", "example": 3 }, "created_at": { "type": "string", "format": "date-time", "example": "2024-03-17T12:34:56Z" }, "updated_at": { "type": "string", "format": "date-time", "example": "2024-03-17T12:34:56Z" } }, "type": "object" } } }, "type": "object" } } } }, "400": { "description": "Missing UUID parameter", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Please select the uuid and it cannot be empty." } }, "type": "object" } } } }, "404": { "description": "No document found", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "No Document found." } }, "type": "object" } } } }, "401": { "description": "User not authenticated", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "user is not authenticated." } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/documents/signed_status": { "get": { "tags": [ "Documents" ], "summary": "Check if a document is signed", "description": "Checks whether a document associated with a given UUID and email has been signed.", "operationId": "e7e87f0bb47105afd4b1d73aebf73406", "parameters": [ { "name": "uuid", "in": "query", "description": "The UUID of the document.", "required": true, "schema": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" } }, { "name": "email", "in": "query", "description": "The email address of the recipient.", "required": true, "schema": { "type": "string", "format": "email", "example": "websinghajit@gmail.com" } } ], "responses": { "200": { "description": "Document signed status", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "Document is signed" } }, "type": "object" } } } }, "400": { "description": "Missing UUID parameter", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Please select the uuid and it cannot be empty." } }, "type": "object" } } } }, "404": { "description": "Document not signed", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Document is Not Signed." } }, "type": "object" } } } }, "401": { "description": "User not authenticated", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "user is not authenticated." } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/documents/reminder": { "post": { "tags": [ "Documents" ], "summary": "Send a reminder email to a recipient", "description": "Sends a reminder email to a recipient for signing a document.", "operationId": "45113c8036006021f37e47d8a2014e5e", "requestBody": { "required": true, "content": { "application/json": { "schema": { "required": [ "uuid", "email" ], "properties": { "uuid": { "description": "The UUID of the document.", "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" }, "email": { "description": "The email address of the recipient.", "type": "string", "format": "email", "example": "websinghajit@gmail.com" } }, "type": "object" } } } }, "responses": { "200": { "description": "Reminder email sent successfully", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "Email to recipients sent successfully" }, "uuid": { "type": "string", "format": "uuid", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" }, "email": { "type": "string", "format": "email", "example": "websinghajit@gmail.com" } }, "type": "object" } } } }, "400": { "description": "Missing or invalid parameters", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Please select the uuid and it cannot be empty." } }, "type": "object" } } } }, "404": { "description": "Document or recipient not found", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "No Document found with uuid." } }, "type": "object" } } } }, "401": { "description": "User not authenticated", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "user is not authenticated." } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } }, "/api/sign_document": { "post": { "tags": [ "Documents" ], "summary": "Sign a document", "description": "Allows an authenticated user to sign a document by providing a valid UUID.", "operationId": "signDocument", "requestBody": { "required": true, "content": { "application/json": { "schema": { "required": [ "uuid" ], "properties": { "uuid": { "description": "Unique identifier of the document", "type": "string", "example": "72dcaac9-7398-408f-b4c0-c058d4a652ed" }, "page": { "description": "Page number where the signature should be placed", "type": "integer", "example": 1 }, "x": { "description": "X-coordinate of the signature placement", "type": "integer", "example": 50 }, "y": { "description": "Y-coordinate of the signature placement", "type": "integer", "example": 100 } }, "type": "object" } } } }, "responses": { "200": { "description": "Document signed successfully", "content": { "application/json": { "schema": { "properties": { "success": { "type": "string", "example": "document signed successfully." } }, "type": "object" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Please select the uuid and it cannot be empty." } }, "type": "object" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "user is not authenticated." } }, "type": "object" } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "No Document found." } }, "type": "object" } } } } }, "security": [ { "ApiKeyAuth": [] } ] } } }, "components": { "schemas": { "WebhookPayload": { "title": "Webhook Payload", "description": "The payload sent to your callback URL when document status changes", "properties": { "event": { "description": "Event type identifier", "type": "string", "example": "document.status_changed" }, "document": { "properties": { "uuid": { "type": "string", "format": "uuid", "example": "d290f1ee-6c54-4b01-90e6-d701748f0851" }, "name": { "type": "string", "example": "Contract.pdf" }, "status": { "type": "string", "enum": [ "signed", "declined", "canceled" ], "example": "signed" }, "signature_level": { "type": "string", "enum": [ "aes", "aesb", "qes", "qesb" ], "example": "aes", "nullable": true }, "type": { "type": "string", "enum": [ "signature", "pod" ], "example": "signature", "nullable": true } }, "type": "object" }, "timestamp": { "type": "string", "format": "date-time", "example": "2026-01-13T14:30:00+00:00" }, "signer": { "description": "Present only for 'signed' events", "properties": { "email": { "type": "string", "format": "email", "example": "signer@example.com" }, "name": { "type": "string", "example": "John Doe" } }, "type": "object", "nullable": true }, "all_signed": { "description": "True if all recipients have signed (only for 'signed' events)", "type": "boolean", "example": true }, "declined_by": { "description": "Email of the person who declined (only for 'declined' events)", "type": "string", "format": "email", "nullable": true } }, "type": "object" }, "WebhookHeaders": { "title": "Webhook Request Headers", "description": "Headers sent with webhook POST requests", "properties": { "Content-Type": { "type": "string", "example": "application/json" }, "User-Agent": { "type": "string", "example": "BlockSign-Webhook/1.0" }, "X-BlockSign-Event": { "type": "string", "example": "document.status_changed" } }, "type": "object" } }, "securitySchemes": { "ApiKeyAuth": { "type": "http", "description": "Enter your API key in the format (Bearer ). Get your API key from your profile settings.", "bearerFormat": "API Key", "scheme": "bearer" }, "security": [ { "sanctum": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT", "description": "Enter token in format (Bearer )" } } ] } }, "security": [ { "ApiKeyAuth": [] } ], "tags": [ { "name": "Documents", "description": "Operations related to document management" }, { "name": "Invoices", "description": "Invoices" } ] }