{"openapi":"3.1.0","info":{"title":"GET /api/v1/credit/lines/{credit_line_id}/ledger/verify","version":"1.0.0","description":"Verify ledger integrity"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/lines/{credit_line_id}/ledger/verify":{"get":{"tags":["credit"],"summary":"Verify ledger integrity","description":"Recomputes the hash chain and re-derives the balance from the entries. An append-only register has no legitimate way to fail this, so a false result means a row was altered or removed.","operationId":"verify_ledger_api_v1_credit_lines__credit_line_id__ledger_verify_get","parameters":[{"name":"credit_line_id","in":"path","required":true,"schema":{"type":"string","title":"Credit Line Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_LedgerVerificationResponse_"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LedgerVerificationResponse":{"properties":{"credit_line_id":{"type":"string","title":"Credit Line Id"},"entry_count":{"type":"integer","title":"Entry Count"},"chain_valid":{"type":"boolean","title":"Chain Valid"},"balance_valid":{"type":"boolean","title":"Balance Valid"},"computed_balance_cents":{"type":"integer","title":"Computed Balance Cents"},"stored_balance_cents":{"type":"integer","title":"Stored Balance Cents"},"first_bad_sequence_no":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"First Bad Sequence No"}},"type":"object","required":["credit_line_id","entry_count","chain_valid","balance_valid","computed_balance_cents","stored_balance_cents"],"title":"LedgerVerificationResponse","description":"Result of a tamper-evidence sweep over the register.\n\nRecomputes the hash chain and re-derives balances from the entries.\nA mismatch means a row was altered or removed out of band — the ledger\nis append-only, so there is no legitimate way for this to fail."},"SuccessEnvelope_LedgerVerificationResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/LedgerVerificationResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[LedgerVerificationResponse]"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}