{"openapi":"3.1.0","info":{"title":"BizLDNGov Commerce API","version":"1.0.0","description":"Authority-scoped commerce integration. See /guide for onboarding and data mapping."},"servers":[{"url":"/"}],"components":{"securitySchemes":{"AuthorityKey":{"type":"http","scheme":"bearer","description":"Authority-issued import or read credential."}},"schemas":{"Error":{"type":"object","required":["error","requestId"],"properties":{"error":{"type":"string"},"requestId":{"type":"string"}}},"CommerceRecord":{"type":"object","additionalProperties":false,"required":["source","merchant","reference","date","kind","net_pence","vat_pence","gross_pence"],"properties":{"source":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"},"merchant":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"},"reference":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"},"date":{"type":"string","format":"date"},"kind":{"enum":["sale","refund"]},"net_pence":{"type":"integer"},"vat_pence":{"type":"integer"},"gross_pence":{"type":"integer"}},"description":"Use GBP pence, negative values for refunds and stable source, merchant and transaction references."}}},"paths":{"/api/v1/pricing":{"get":{"summary":"Get the base licence price and indicative quote","parameters":[],"security":[],"responses":{"200":{"description":"Operation completed","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/tax-rates":{"get":{"summary":"Get GOV.UK tax rates and the last verified time for each source","parameters":[],"security":[],"responses":{"200":{"description":"Operation completed","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/tax-calculator":{"post":{"summary":"Estimate invoice cost, VAT recovery and company tax savings","parameters":[],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cycles":{"type":"integer","minimum":1,"maximum":13,"default":1},"vatRecoveryBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"taxableProfitPence":{"type":"integer","description":"Optional annual taxable profit before the licence expense, for a full accounting year."},"associatedCompanies":{"type":"integer","minimum":0,"maximum":999,"default":0}}}}}},"responses":{"200":{"description":"Operation completed","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Reference conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds 128 KiB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Unsupported content type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/calendar":{"get":{"summary":"Preview one billing cycle","parameters":[{"name":"start","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"cycle","in":"query","schema":{"type":"integer","minimum":1,"maximum":2600,"default":1}}],"security":[],"responses":{"200":{"description":"Operation completed","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/commerce":{"post":{"summary":"Validate or import settled sales and refunds","parameters":[{"name":"validate","in":"query","schema":{"type":"string","enum":["1"]},"description":"Check record format without writing data."}],"security":[{"AuthorityKey":[]}],"x-credential-scope":"import","requestBody":{"required":true,"content":{"text/csv":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object","required":["records"],"properties":{"records":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/CommerceRecord"}}}}}}},"responses":{"200":{"description":"Operation completed","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"Records created","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Inactive contract or incorrect scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Reference conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds 128 KiB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Unsupported content type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"Export settled sales and refunds","parameters":[{"name":"after","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Exclusive end date. Maximum range of 366 days."},{"name":"format","in":"query","schema":{"enum":["json","csv"],"default":"json"}}],"security":[{"AuthorityKey":[]}],"x-credential-scope":"read","responses":{"200":{"description":"Commerce page","content":{"text/csv":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object","required":["records","nextCursor","hasMore"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/CommerceRecord","additionalProperties":true}},"nextCursor":{"type":"integer"},"hasMore":{"type":"boolean"}}}}},"headers":{"X-Next-Cursor":{"schema":{"type":"integer"}},"X-Has-More":{"schema":{"type":"boolean"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Inactive contract or incorrect scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/bizldn-activity":{"post":{"summary":"Validate or import a BizLDN Business Max report","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Exclusive end date. Maximum range of 366 days."},{"name":"validate","in":"query","schema":{"type":"string","enum":["1"]},"description":"Check record format without writing data."},{"name":"merchant","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$"}}],"security":[{"AuthorityKey":[]}],"x-credential-scope":"import","requestBody":{"required":true,"content":{"text/csv":{"schema":{"type":"string"}}}},"responses":{"200":{"description":"Operation completed","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"Records created","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Inactive contract or incorrect scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Reference conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds 128 KiB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Unsupported content type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"Export BizLDN activity","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Exclusive end date. Maximum range of 366 days."},{"name":"after","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"security":[{"AuthorityKey":[]}],"x-credential-scope":"read","responses":{"200":{"description":"Activity page","content":{"application/json":{"schema":{"type":"object","required":["records","nextCursor","hasMore"],"properties":{"records":{"type":"array","items":{"type":"object"}},"nextCursor":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Inactive contract or incorrect scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/reconciliation":{"get":{"summary":"Get net, VAT and gross totals by transaction kind","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Exclusive end date. Maximum range of 366 days."}],"security":[{"AuthorityKey":[]}],"x-credential-scope":"read","responses":{"200":{"description":"Operation completed","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Inactive contract or incorrect scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/audit":{"get":{"summary":"Read authority audit events","parameters":[{"name":"after","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"security":[{"AuthorityKey":[]}],"x-credential-scope":"read","responses":{"200":{"description":"Audit page","content":{"application/json":{"schema":{"type":"object","required":["records","nextCursor","hasMore"],"properties":{"records":{"type":"array","items":{"type":"object"}},"nextCursor":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Inactive contract or incorrect scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/billing":{"get":{"summary":"Read up to 52 authority billing cycles","parameters":[{"name":"cycle","in":"query","schema":{"type":"integer","minimum":1,"maximum":2600,"default":1}}],"security":[{"AuthorityKey":[]}],"x-credential-scope":"read","responses":{"200":{"description":"Operation completed","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Inactive contract or incorrect scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Service error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}