{"openapi":"3.1.0","info":{"title":"Ledgerlot API","version":"1.0.0","description":"Create documents from templates, send them for e-signature, poll status, and download the executed PDF + certificate. Every endpoint is Bearer (API key) authenticated and scoped to the key's own organization."},"servers":[{"url":"https://ledgerlot.ca"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key, e.g. 'llk_...' (see Org Settings -> API Keys)."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"]},"Folder":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"stage":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"DocumentSummary":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"documentType":{"type":"string","enum":["purchase_loi","commercial_lease","residential_lease","custom_template","form_template"]},"locked":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"DocumentDetail":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"documentType":{"type":"string"},"locked":{"type":"boolean"},"signatureStatus":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["pending","fully_executed","voided","declined"]},"verifyCode":{"type":"string"},"signers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"signed":{"type":"boolean"},"signedAt":{"type":["string","null"],"format":"date-time"},"declined":{"type":"boolean"}}}}}}}},"Template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"pageCount":{"type":"integer"},"kind":{"type":"string","enum":["custom_template","form_template"]}}},"Signer":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["signer","notify_only"]},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"order":{"type":"integer"},"tokenUsedAt":{"type":["string","null"],"format":"date-time"},"signed":{"type":"boolean"},"signedAt":{"type":["string","null"],"format":"date-time"},"declinedAt":{"type":["string","null"],"format":"date-time"},"declineReason":{"type":["string","null"]}}},"SignatureRequestStatus":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","fully_executed","voided","declined"]},"verifyCode":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"voidedAt":{"type":["string","null"],"format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"lastReminderSentAt":{"type":["string","null"],"format":"date-time"},"finalDocumentHash":{"type":["string","null"]},"deliveryError":{"type":["string","null"]},"signers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["signer","notify_only"]},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"order":{"type":"integer"},"tokenUsedAt":{"type":["string","null"],"format":"date-time"},"signed":{"type":"boolean"},"signedAt":{"type":["string","null"],"format":"date-time"},"declinedAt":{"type":["string","null"],"format":"date-time"},"declineReason":{"type":["string","null"]}}}}}},"Participant":{"type":"object","properties":{"kind":{"type":"string","enum":["signer","notify_only"],"default":"signer"},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"roleOtherLabel":{"type":"string"},"sameStepAsPrevious":{"type":"boolean"}},"required":["name","email","role"]}}},"paths":{"/api/v1/folders":{"get":{"summary":"List folders","description":"Lists this org's folders (excludes folders restricted to participants).","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"folders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"stage":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}}}},"401":{"description":"Invalid or missing API key"},"429":{"description":"Rate limited"}}}},"/api/v1/folders/{id}/documents":{"get":{"summary":"List documents in a folder","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"documentType":{"type":"string","enum":["purchase_loi","commercial_lease","residential_lease","custom_template","form_template"]},"locked":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}}}},"404":{"description":"Folder not found"}}},"post":{"summary":"Create a built-in document in a folder","description":"Creates a purchase_loi/commercial_lease/residential_lease Ledger directly (not from a template). Counts against document usage.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentType":{"type":"string","enum":["purchase_loi","commercial_lease","residential_lease"]},"name":{"type":"string"},"formData":{"type":"object"}},"required":["documentType"]}}}},"responses":{"201":{"description":"Created"},"402":{"description":"Upgrade required / usage limit reached"},"404":{"description":"Folder not found"}}}},"/api/v1/documents/{id}":{"get":{"summary":"Get a document","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"documentType":{"type":"string"},"locked":{"type":"boolean"},"signatureStatus":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["pending","fully_executed","voided","declined"]},"verifyCode":{"type":"string"},"signers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"signed":{"type":"boolean"},"signedAt":{"type":["string","null"],"format":"date-time"},"declined":{"type":"boolean"}}}}}}}}}}},"404":{"description":"Document not found"}}}},"/api/v1/templates":{"get":{"summary":"List templates","description":"Lists this org's CustomTemplates (owner-created only) and org-wide-shared FormTemplates -- either can be used with POST /api/v1/templates/{id}/documents.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"pageCount":{"type":"integer"},"kind":{"type":"string","enum":["custom_template","form_template"]}}}}}}}}}}}},"/api/v1/templates/{id}/documents":{"post":{"summary":"Create a document from a template","description":"Fills a CustomTemplate or FormTemplate from a flat `answers` object and creates a Ledger. Creates a new Folder automatically if folderId is omitted. Counts against document usage.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Template id (CustomTemplate or org-shared FormTemplate)."},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional client-generated key. Retrying a POST with the same key returns the original response verbatim without re-running the request.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"answers":{"type":"object","description":"Flat map of anchor/field id (or wizard question key) to value."},"folderId":{"type":"string","description":"Existing folder id. Omit to auto-create a new folder named after the template."}},"required":["answers"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"folderId":{"type":"string"},"documentType":{"type":"string"},"templateId":{"type":"string"},"name":{"type":"string"}}}}},"headers":{"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window for this API key."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the rate limit window resets (only on 429)."}}},"402":{"description":"Upgrade required / usage limit reached"},"404":{"description":"Template or folder not found"}}}},"/api/v1/documents/{id}/signature-requests":{"post":{"summary":"Send a document for signature","description":"Creates a SignatureRequest with one or more participants and emails the first signer(s). Counts against e-sign usage.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Ledger (document) id."},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional client-generated key. Retrying a POST with the same key returns the original response verbatim without re-running the request.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"participants":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["signer","notify_only"],"default":"signer"},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"roleOtherLabel":{"type":"string"},"sameStepAsPrevious":{"type":"boolean"}},"required":["name","email","role"]}},"signatureAnchors":{"type":"array","items":{"type":"object"},"description":"Optional sender-finalized signature/initials/date placement."}},"required":["participants"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"verifyCode":{"type":"string"}}}}}},"400":{"description":"Validation error (missing signer, invalid role, request already pending, ...)"},"402":{"description":"Upgrade required / usage limit reached"},"404":{"description":"Document not found"}}}},"/api/v1/signature-requests/{id}":{"get":{"summary":"Get signature request status","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","fully_executed","voided","declined"]},"verifyCode":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"voidedAt":{"type":["string","null"],"format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"lastReminderSentAt":{"type":["string","null"],"format":"date-time"},"finalDocumentHash":{"type":["string","null"]},"deliveryError":{"type":["string","null"]},"signers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["signer","notify_only"]},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"order":{"type":"integer"},"tokenUsedAt":{"type":["string","null"],"format":"date-time"},"signed":{"type":"boolean"},"signedAt":{"type":["string","null"],"format":"date-time"},"declinedAt":{"type":["string","null"],"format":"date-time"},"declineReason":{"type":["string","null"]}}}}}}}}},"404":{"description":"Signature request not found"}}}},"/api/v1/signature-requests/{id}/void":{"post":{"summary":"Void a pending signature request","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"emailWarning":{"type":"string"}}}}}},"400":{"description":"No in-progress signature request to void"},"404":{"description":"Signature request not found"}}}},"/api/v1/signature-requests/{id}/remind":{"post":{"summary":"Resend the signing-link email to whoever's currently unlocked","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"remindedCount":{"type":"integer"},"emailWarning":{"type":"string"}}}}}},"404":{"description":"No in-progress signature request found"}}}},"/api/v1/signature-requests/{id}/pdf":{"get":{"summary":"Download the final executed PDF","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"PDF binary","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"No fully executed signature request found"}}}},"/api/v1/signature-requests/{id}/certificate":{"get":{"summary":"Download the Certificate of Completion","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"PDF binary","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"No fully executed signature request found"}}}}}}