{"openapi":"3.1.0","info":{"title":"Ledgerage API","version":"1.0.0","description":"Compute ASC 842, IFRS 16 and GASB 87 lease accounting: present value, right-of-use asset, lease liability, amortization schedule, journal entries, disclosures and classification. Deterministic and audit-grade.","contact":{"name":"Ledgerage","url":"https://ledgerage.com"}},"servers":[{"url":"https://ledgerage.com/api"}],"security":[{"ApiKeyAuth":[]},{"ApiKeyHeader":[]}],"paths":{"/v1/compute":{"post":{"summary":"Compute a full lease","description":"Return the full computation: initial liability, ROU asset, amortization schedule, disclosures, classification and journal entries. Billable: 1 computation.","operationId":"computeLease","security":[{"ApiKeyAuth":[]},{"ApiKeyHeader":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Opaque key; an identical (key, body) replay returns the same result billed at 0 units."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaseRequest"},"example":{"standard":"ASC_842","commencementDate":"2026-01-01","termMonths":60,"paymentAmount":5000,"paymentFrequency":"monthly","paymentTiming":"advance","discountRateAnnual":0.07}}}},"responses":{"200":{"description":"Success","headers":{"x-request-id":{"schema":{"type":"string"},"description":"Correlates with the inspectable usage log."},"x-quota-limit":{"schema":{"type":"integer"},"description":"Monthly computation quota for the plan."},"x-quota-remaining":{"schema":{"type":"integer"},"description":"Computations remaining this UTC-month window after this call."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComputeResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Quota or rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/schedule":{"post":{"summary":"Get the amortization schedule","description":"Return the period-by-period amortization schedule (interest, principal, liability and ROU balances). Billable: 1 computation.","operationId":"leaseSchedule","security":[{"ApiKeyAuth":[]},{"ApiKeyHeader":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Opaque key; an identical (key, body) replay returns the same result billed at 0 units."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaseRequest"},"example":{"standard":"ASC_842","commencementDate":"2026-01-01","termMonths":60,"paymentAmount":5000,"paymentFrequency":"monthly","paymentTiming":"advance","discountRateAnnual":0.07}}}},"responses":{"200":{"description":"Success","headers":{"x-request-id":{"schema":{"type":"string"},"description":"Correlates with the inspectable usage log."},"x-quota-limit":{"schema":{"type":"integer"},"description":"Monthly computation quota for the plan."},"x-quota-remaining":{"schema":{"type":"integer"},"description":"Computations remaining this UTC-month window after this call."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Quota or rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/journal-entries":{"post":{"summary":"Get journal entries","description":"Return the double-entry journal entries (commencement plus one per period), each balanced. Billable: 1 computation.","operationId":"journalEntries","security":[{"ApiKeyAuth":[]},{"ApiKeyHeader":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Opaque key; an identical (key, body) replay returns the same result billed at 0 units."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaseRequest"},"example":{"standard":"ASC_842","commencementDate":"2026-01-01","termMonths":60,"paymentAmount":5000,"paymentFrequency":"monthly","paymentTiming":"advance","discountRateAnnual":0.07}}}},"responses":{"200":{"description":"Success","headers":{"x-request-id":{"schema":{"type":"string"},"description":"Correlates with the inspectable usage log."},"x-quota-limit":{"schema":{"type":"integer"},"description":"Monthly computation quota for the plan."},"x-quota-remaining":{"schema":{"type":"integer"},"description":"Computations remaining this UTC-month window after this call."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Quota or rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/classify":{"post":{"summary":"Classify operating vs finance","description":"Evaluate the five ASC 842 finance-lease criteria and return the classification with reasoning and citations. Free: 0 units.","operationId":"classifyLease","security":[{"ApiKeyAuth":[]},{"ApiKeyHeader":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Opaque key; an identical (key, body) replay returns the same result billed at 0 units."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaseRequest"},"example":{"standard":"ASC_842","commencementDate":"2026-01-01","termMonths":60,"paymentAmount":5000,"paymentFrequency":"monthly","paymentTiming":"advance","discountRateAnnual":0.07}}}},"responses":{"200":{"description":"Success","headers":{"x-request-id":{"schema":{"type":"string"},"description":"Correlates with the inspectable usage log."},"x-quota-limit":{"schema":{"type":"integer"},"description":"Monthly computation quota for the plan."},"x-quota-remaining":{"schema":{"type":"integer"},"description":"Computations remaining this UTC-month window after this call."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Classification"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Quota or rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","description":"Authorization: Bearer sk_live_… (or sk_test_…)."},"ApiKeyHeader":{"type":"apiKey","in":"header","name":"x-api-key","description":"Alternative to the bearer header: x-api-key: sk_live_…"}},"schemas":{"LeaseRequest":{"type":"object","required":["commencementDate","termMonths","paymentAmount","discountRateAnnual"],"properties":{"standard":{"type":"string","enum":["ASC_842","IFRS_16","GASB_87"],"default":"ASC_842"},"classification":{"type":"string","enum":["operating","finance"],"description":"Optional override; otherwise derived."},"commencementDate":{"type":"string","format":"date","example":"2026-01-01"},"termMonths":{"type":"integer","minimum":1,"maximum":1200,"example":60},"paymentAmount":{"type":"number","exclusiveMinimum":0,"example":5000},"paymentFrequency":{"type":"string","enum":["monthly","quarterly","semiannual","annual"],"default":"monthly"},"paymentTiming":{"type":"string","enum":["advance","arrears"],"default":"advance"},"discountRateAnnual":{"type":"number","minimum":0,"maximum":1,"example":0.07,"description":"Annual rate as a decimal (0.07 = 7%)."},"annualEscalationPct":{"type":"number","minimum":0,"maximum":1,"description":"Annual escalation, e.g. 0.03 for 3%/yr."},"initialDirectCosts":{"type":"number","minimum":0},"leaseIncentives":{"type":"number","minimum":0},"prepaidRent":{"type":"number","minimum":0},"residualValueGuarantee":{"type":"number","minimum":0},"purchaseOptionAmount":{"type":"number","minimum":0},"assetFairValue":{"type":"number","minimum":0},"assetEconomicLifeMonths":{"type":"integer","minimum":1},"transfersOwnership":{"type":"boolean"},"purchaseOptionReasonablyCertain":{"type":"boolean"},"specializedAsset":{"type":"boolean"}}},"SchedulePeriod":{"type":"object","properties":{"period":{"type":"integer"},"date":{"type":"string","format":"date"},"payment":{"type":"number"},"interest":{"type":"number"},"principal":{"type":"number"},"liabilityClose":{"type":"number"},"rouAmortization":{"type":"number"},"rouAssetClose":{"type":"number"},"leaseExpense":{"type":"number"}}},"Disclosures":{"type":"object","properties":{"weightedAverageRemainingTermMonths":{"type":"number"},"weightedAverageDiscountRate":{"type":"number"},"totalUndiscountedPayments":{"type":"number"},"imputedInterest":{"type":"number"},"maturityAnalysis":{"type":"array","items":{"type":"object","properties":{"year":{"type":"integer"},"label":{"type":"string"},"undiscountedPayments":{"type":"number"}}}},"currentLiability":{"type":"number"},"longTermLiability":{"type":"number"},"totalLeaseCost":{"type":"number"}}},"LeaseResult":{"type":"object","properties":{"standard":{"type":"string"},"classification":{"type":"string","enum":["operating","finance"]},"commencementDate":{"type":"string","format":"date"},"termMonths":{"type":"integer"},"periods":{"type":"integer"},"periodicRate":{"type":"number"},"initialLiability":{"type":"number"},"initialRouAsset":{"type":"number"},"totalUndiscountedPayments":{"type":"number"},"totalLeaseCost":{"type":"number"},"schedule":{"type":"array","items":{"$ref":"#/components/schemas/SchedulePeriod"}},"disclosures":{"$ref":"#/components/schemas/Disclosures"},"citations":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}}},"Classification":{"type":"object","properties":{"classification":{"type":"string","enum":["operating","finance"]},"standard":{"type":"string"},"single_model":{"type":"boolean"},"criteria":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"met":{"type":"boolean"},"detail":{"type":"string"},"citation":{"type":"string"}}}},"rationale":{"type":"string"}}},"JournalEntry":{"type":"object","properties":{"date":{"type":"string","format":"date"},"memo":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"account":{"type":"string"},"debit":{"type":"number"},"credit":{"type":"number"}}}}}},"ComputeResponse":{"type":"object","properties":{"input":{"$ref":"#/components/schemas/LeaseRequest"},"result":{"$ref":"#/components/schemas/LeaseResult"},"classification":{"$ref":"#/components/schemas/Classification"},"journalEntries":{"type":"array","items":{"$ref":"#/components/schemas/JournalEntry"}},"request_id":{"type":"string"},"replay":{"type":"boolean"}}},"ScheduleResponse":{"type":"object","properties":{"standard":{"type":"string"},"classification":{"type":"string","enum":["operating","finance"]},"initialLiability":{"type":"number"},"initialRouAsset":{"type":"number"},"periods":{"type":"integer"},"schedule":{"type":"array","items":{"$ref":"#/components/schemas/SchedulePeriod"}},"request_id":{"type":"string"},"replay":{"type":"boolean"}}},"JournalResponse":{"type":"object","properties":{"standard":{"type":"string"},"classification":{"type":"string","enum":["operating","finance"]},"journalEntries":{"type":"array","items":{"$ref":"#/components/schemas/JournalEntry"}},"request_id":{"type":"string"},"replay":{"type":"boolean"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized","invalid_key","quota_exceeded","rate_limited","invalid_request","plan_required","not_found","internal_error"]},"message":{"type":"string"},"docs":{"type":"string"},"request_id":{"type":"string"}}}}}}}}