{"openapi":"3.1.0","info":{"title":"Bahrain e-Invoicing API","description":"\nSubmit invoices to Bahrain's NBR (National Bureau for Revenue). The service handles CSR\ngeneration, XAdES signing, the QR stamp, BR-BH validation and clearance/reporting — you send a\nminimal invoice and get back the result.\n\n**Model:** an Organization (you) holds one API key and owns Connected Accounts (taxpayers);\neach has Devices (one per branch / sub-CR). Authenticate with `Authorization: Api-Key <key>`;\nroute invoicing by the `X-NBR-Connected-Account-Id` (+ `X-NBR-Sub-CR`) headers.\n\nRead the [integration guides and API reference](https://docs.wafeq.com/bahrain-einvoicing).\n","contact":{"name":"Wafeq","url":"https://wafeq.com/"},"version":"0.1.0"},"paths":{"/organizations/me":{"get":{"tags":["organizations"],"summary":"Whoami","description":"Identify the organization behind the presented API key.","operationId":"whoami_organizations_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationModel"}}}}},"security":[{"ApiKey":[]}]},"patch":{"tags":["organizations"],"summary":"Update Organization","description":"Set your organization's legal name, VAT/TIN identity and address for THIRD_PARTY invoices.","operationId":"update_organization_organizations_me_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":[]}]}},"/organizations/me/devices/register":{"post":{"tags":["organizations"],"summary":"Register Organization Device","description":"Register the provider's own EGS with its OTP, once for all delegated suppliers.","operationId":"register_organization_device_organizations_me_devices_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceRegistrationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSummaryModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":[]}]}},"/organizations/me/devices":{"get":{"tags":["organizations"],"summary":"List Organization Devices","description":"Provider-owned EGS registrations, including incomplete and revoked registrations.","operationId":"list_organization_devices_organizations_me_devices_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/DeviceSummaryModel"},"type":"array","title":"Response List Organization Devices Organizations Me Devices Get"}}}}},"security":[{"ApiKey":[]}]}},"/connected-accounts":{"post":{"tags":["connected-accounts"],"summary":"Create Connected Account","operationId":"create_connected_account_connected_accounts_post","security":[{"ApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectedAccountCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectedAccountModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["connected-accounts"],"summary":"List Connected Accounts","operationId":"list_connected_accounts_connected_accounts_get","security":[{"ApiKey":[]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedConnectedAccounts"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/connected-accounts/{account_id}":{"get":{"tags":["connected-accounts"],"summary":"Get Connected Account","operationId":"get_connected_account_connected_accounts__account_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectedAccountModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["connected-accounts"],"summary":"Update Connected Account","operationId":"update_connected_account_connected_accounts__account_id__patch","security":[{"ApiKey":[]}],"parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectedAccountUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectedAccountModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["connected-accounts"],"summary":"Delete Connected Account","operationId":"delete_connected_account_connected_accounts__account_id__delete","security":[{"ApiKey":[]}],"parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/connected-accounts/{account_id}/devices":{"get":{"tags":["connected-accounts"],"summary":"List Account Devices","description":"The devices onboarded under this taxpayer (any status), oldest first.","operationId":"list_account_devices_connected_accounts__account_id__devices_get","security":[{"ApiKey":[]}],"parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DeviceSummaryModel"},"title":"Response List Account Devices Connected Accounts  Account Id  Devices Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/devices/register":{"post":{"tags":["devices"],"summary":"Register Device","description":"Register a device in one shot (OTP -> compliance CSID -> NBR compliance checks -> production\nCSID -> ACTIVE).\n\nThe taxpayer is the `X-NBR-Connected-Account-Id` header; its identity feeds the CSR and the\ncompliance sample invoices. If NBR rejects a compliance sample the call answers 409 with the\nrule codes and the device is left in COMPLIANCE.","operationId":"register_device_devices_register_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceRegistrationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSummaryModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/devices/{device_id}/activate":{"post":{"tags":["devices"],"summary":"Activate Device","description":"Complete onboarding for a device stuck in COMPLIANCE (a failed register/renew): re-run the\nNBR compliance checks with its stored compliance CSID and obtain the production CSID. No OTP\nneeded — the compliance CSID is valid for 30 days.","operationId":"activate_device_devices__device_id__activate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"device_id","in":"path","required":true,"schema":{"type":"string","title":"Device Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSummaryModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/devices":{"get":{"tags":["devices"],"summary":"List Devices","description":"List the devices under one of your connected accounts, optionally filtered by branch (sub_cr).","operationId":"list_devices_devices_get","security":[{"ApiKey":[]}],"parameters":[{"name":"connected_account_id","in":"query","required":true,"schema":{"type":"string","description":"Taxpayer whose devices to list","title":"Connected Account Id"},"description":"Taxpayer whose devices to list"},{"name":"sub_cr","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Narrow to one branch","title":"Sub Cr"},"description":"Narrow to one branch"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DeviceSummaryModel"},"title":"Response List Devices Devices Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/devices/deactivate-all":{"post":{"tags":["devices"],"summary":"Deactivate All Devices","description":"Bulk soft-revoke every non-REVOKED device **of your organization** (test-env reset). NBR\nhas no deregister API, so this is local state only — mirrors ZATCA Device.deactivate.","operationId":"deactivate_all_devices_devices_deactivate_all_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DeactivateRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeactivateAllResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":[]}]}},"/devices/{device_id}/deactivate":{"post":{"tags":["devices"],"summary":"Deactivate Device","description":"Soft-revoke one of your devices: status -> REVOKED, drop its stored CSID so it can no\nlonger sign. Also deregister it in the NBR portal if the key may be compromised (R-15).","operationId":"deactivate_device_devices__device_id__deactivate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"device_id","in":"path","required":true,"schema":{"type":"string","title":"Device Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DeactivateRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceStatusModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/devices/{device_id}/renew":{"post":{"tags":["devices"],"summary":"Renew Device","description":"Renew a device's CSID (NBR spec §1.4): fresh keypair, NBR revokes the current production\nCSID and issues a compliance CSID, the compliance checks are re-run, and a new production CSID\nis obtained — all in this call. Identity + branch come from the device's connected account.\nIf the checks fail the device is left in COMPLIANCE (409) and cannot sign until re-run.","operationId":"renew_device_devices__device_id__renew_post","security":[{"ApiKey":[]}],"parameters":[{"name":"device_id","in":"path","required":true,"schema":{"type":"string","title":"Device Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceRenewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSummaryModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices":{"post":{"tags":["Invoices"],"summary":"Clear invoice","description":"Clear a standard (B2B) invoice — signed then cleared by NBR (returns the cleared XML + QR).","operationId":"submit_invoice_invoices_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Invoices"],"summary":"List invoices","operationId":"invoices_list_invoices_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search document number / customer / tax id / reference","title":"Keyword"},"description":"Search document number / customer / tax id / reference"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedInvoices"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-invoices":{"post":{"tags":["Simplified invoices"],"summary":"Report invoice","description":"Report a simplified (B2C) invoice — signed locally (QR stamp applied), then reported to NBR.","operationId":"submit_simplified_invoice_simplified_invoices_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Simplified invoices"],"summary":"List invoices","operationId":"simplified_invoices_list_simplified_invoices_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search document number / customer / tax id / reference","title":"Keyword"},"description":"Search document number / customer / tax id / reference"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedInvoices"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/credit-notes":{"post":{"tags":["Credit notes"],"summary":"Clear credit note","description":"Sign and clear an NBR standard credit note (type 381).","operationId":"submit_credit_note_credit_notes_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Credit notes"],"summary":"List credit notes","operationId":"credit_notes_list_credit_notes_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search document number / customer / tax id / reference","title":"Keyword"},"description":"Search document number / customer / tax id / reference"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedInvoices"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-credit-notes":{"post":{"tags":["Simplified credit notes"],"summary":"Report credit note","description":"Sign and report an NBR simplified credit note (type 381).","operationId":"submit_simplified_credit_note_simplified_credit_notes_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Simplified credit notes"],"summary":"List credit notes","operationId":"simplified_credit_notes_list_simplified_credit_notes_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search document number / customer / tax id / reference","title":"Keyword"},"description":"Search document number / customer / tax id / reference"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedInvoices"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/debit-notes":{"post":{"tags":["Debit notes"],"summary":"Clear debit note","description":"Sign and clear an NBR standard debit note (type 383).","operationId":"submit_debit_note_debit_notes_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DebitNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Debit notes"],"summary":"List debit notes","operationId":"debit_notes_list_debit_notes_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search document number / customer / tax id / reference","title":"Keyword"},"description":"Search document number / customer / tax id / reference"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedInvoices"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-debit-notes":{"post":{"tags":["Simplified debit notes"],"summary":"Report debit note","description":"Sign and report an NBR simplified debit note (type 383).","operationId":"submit_simplified_debit_note_simplified_debit_notes_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DebitNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Simplified debit notes"],"summary":"List debit notes","operationId":"simplified_debit_notes_list_simplified_debit_notes_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search document number / customer / tax id / reference","title":"Keyword"},"description":"Search document number / customer / tax id / reference"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedInvoices"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-invoices":{"post":{"tags":["Prepayment invoices"],"summary":"Clear prepayment invoice","description":"Sign and clear an NBR standard prepayment invoice (type 386).","operationId":"submit_prepayment_invoice_prepayment_invoices_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrepaymentInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Prepayment invoices"],"summary":"List prepayment invoices","operationId":"prepayment_invoices_list_prepayment_invoices_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search document number / customer / tax id / reference","title":"Keyword"},"description":"Search document number / customer / tax id / reference"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedInvoices"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-simplified-invoices":{"post":{"tags":["Simplified prepayment invoices"],"summary":"Report prepayment invoice","description":"Sign and report an NBR simplified prepayment invoice (type 386).","operationId":"submit_prepayment_simplified_invoice_prepayment_simplified_invoices_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrepaymentInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Simplified prepayment invoices"],"summary":"List prepayment invoices","operationId":"prepayment_simplified_invoices_list_prepayment_simplified_invoices_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search document number / customer / tax id / reference","title":"Keyword"},"description":"Search document number / customer / tax id / reference"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Page Size"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedInvoices"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/validate":{"post":{"tags":["Invoices"],"summary":"Validate invoice","description":"Dry-run validate a standard invoice against the BR-BH rule set (not submitted to NBR).","operationId":"validate_invoice_invoices_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-invoices/validate":{"post":{"tags":["Simplified invoices"],"summary":"Validate invoice","description":"Dry-run validate a simplified invoice against the BR-BH rule set (not reported to NBR).","operationId":"validate_simplified_invoice_simplified_invoices_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/credit-notes/validate":{"post":{"tags":["Credit notes"],"summary":"Validate credit note","description":"Dry-run validate a standard credit note (type 381) against the BR-BH rule set.","operationId":"validate_credit_note_credit_notes_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-credit-notes/validate":{"post":{"tags":["Simplified credit notes"],"summary":"Validate credit note","description":"Dry-run validate a simplified credit note (type 381) against the BR-BH rule set.","operationId":"validate_simplified_credit_note_simplified_credit_notes_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/debit-notes/validate":{"post":{"tags":["Debit notes"],"summary":"Validate debit note","description":"Dry-run validate a standard debit note (type 383) against the BR-BH rule set.","operationId":"validate_debit_note_debit_notes_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DebitNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-debit-notes/validate":{"post":{"tags":["Simplified debit notes"],"summary":"Validate debit note","description":"Dry-run validate a simplified debit note (type 383) against the BR-BH rule set.","operationId":"validate_simplified_debit_note_simplified_debit_notes_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DebitNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-invoices/validate":{"post":{"tags":["Prepayment invoices"],"summary":"Validate prepayment invoice","description":"Dry-run validate a standard prepayment invoice (type 386) against the BR-BH rule set.","operationId":"validate_prepayment_invoice_prepayment_invoices_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrepaymentInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-simplified-invoices/validate":{"post":{"tags":["Simplified prepayment invoices"],"summary":"Validate prepayment invoice","description":"Dry-run validate a simplified prepayment invoice (type 386) against the BR-BH rule set.","operationId":"validate_prepayment_simplified_invoice_prepayment_simplified_invoices_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrepaymentInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/bulk":{"post":{"tags":["Invoices"],"summary":"Clear invoices (bulk)","description":"Clear a batch of standard invoices; each document is processed independently.","operationId":"bulk_submit_invoices_invoices_bulk_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSubmissionResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-invoices/bulk":{"post":{"tags":["Simplified invoices"],"summary":"Report invoices (bulk)","description":"Report a batch of simplified invoices; each document is processed independently.","operationId":"bulk_submit_simplified_invoices_simplified_invoices_bulk_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSubmissionResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/bulk-validate":{"post":{"tags":["Invoices"],"summary":"Validate invoices (bulk)","description":"Dry-run validate a batch of standard invoices (nothing is submitted or stored).","operationId":"bulk_validate_invoices_invoices_bulk_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkValidationResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-invoices/bulk-validate":{"post":{"tags":["Simplified invoices"],"summary":"Validate invoices (bulk)","description":"Dry-run validate a batch of simplified invoices (nothing is submitted or stored).","operationId":"bulk_validate_simplified_invoices_simplified_invoices_bulk_validate_post","security":[{"ApiKey":[]}],"parameters":[{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkValidationResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/summary":{"get":{"tags":["Invoices"],"summary":"Get status summary","operationId":"invoices_summary_invoices_summary_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keyword"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}":{"get":{"tags":["Invoices"],"summary":"Retrieve invoice","operationId":"invoices_retrieve_invoices__invoice_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/download":{"get":{"tags":["Invoices"],"summary":"Download XML or PDF","operationId":"invoices_download_invoices__invoice_id__download_get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)","default":"xml","title":"Type"},"description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/retry":{"post":{"tags":["Invoices"],"summary":"Retry invoice","operationId":"invoices_retry_invoices__invoice_id__retry_post","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-invoices/summary":{"get":{"tags":["Simplified invoices"],"summary":"Get status summary","operationId":"simplified_invoices_summary_simplified_invoices_summary_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keyword"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-invoices/{invoice_id}":{"get":{"tags":["Simplified invoices"],"summary":"Retrieve invoice","operationId":"simplified_invoices_retrieve_simplified_invoices__invoice_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-invoices/{invoice_id}/download":{"get":{"tags":["Simplified invoices"],"summary":"Download XML or PDF","operationId":"simplified_invoices_download_simplified_invoices__invoice_id__download_get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)","default":"xml","title":"Type"},"description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-invoices/{invoice_id}/retry":{"post":{"tags":["Simplified invoices"],"summary":"Retry invoice","operationId":"simplified_invoices_retry_simplified_invoices__invoice_id__retry_post","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/credit-notes/summary":{"get":{"tags":["Credit notes"],"summary":"Get status summary","operationId":"credit_notes_summary_credit_notes_summary_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keyword"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/credit-notes/{invoice_id}":{"get":{"tags":["Credit notes"],"summary":"Retrieve credit note","operationId":"credit_notes_retrieve_credit_notes__invoice_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/credit-notes/{invoice_id}/download":{"get":{"tags":["Credit notes"],"summary":"Download XML or PDF","operationId":"credit_notes_download_credit_notes__invoice_id__download_get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)","default":"xml","title":"Type"},"description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/credit-notes/{invoice_id}/retry":{"post":{"tags":["Credit notes"],"summary":"Retry credit note","operationId":"credit_notes_retry_credit_notes__invoice_id__retry_post","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-credit-notes/summary":{"get":{"tags":["Simplified credit notes"],"summary":"Get status summary","operationId":"simplified_credit_notes_summary_simplified_credit_notes_summary_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keyword"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-credit-notes/{invoice_id}":{"get":{"tags":["Simplified credit notes"],"summary":"Retrieve credit note","operationId":"simplified_credit_notes_retrieve_simplified_credit_notes__invoice_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-credit-notes/{invoice_id}/download":{"get":{"tags":["Simplified credit notes"],"summary":"Download XML or PDF","operationId":"simplified_credit_notes_download_simplified_credit_notes__invoice_id__download_get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)","default":"xml","title":"Type"},"description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-credit-notes/{invoice_id}/retry":{"post":{"tags":["Simplified credit notes"],"summary":"Retry credit note","operationId":"simplified_credit_notes_retry_simplified_credit_notes__invoice_id__retry_post","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/debit-notes/summary":{"get":{"tags":["Debit notes"],"summary":"Get status summary","operationId":"debit_notes_summary_debit_notes_summary_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keyword"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/debit-notes/{invoice_id}":{"get":{"tags":["Debit notes"],"summary":"Retrieve debit note","operationId":"debit_notes_retrieve_debit_notes__invoice_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/debit-notes/{invoice_id}/download":{"get":{"tags":["Debit notes"],"summary":"Download XML or PDF","operationId":"debit_notes_download_debit_notes__invoice_id__download_get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)","default":"xml","title":"Type"},"description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/debit-notes/{invoice_id}/retry":{"post":{"tags":["Debit notes"],"summary":"Retry debit note","operationId":"debit_notes_retry_debit_notes__invoice_id__retry_post","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-debit-notes/summary":{"get":{"tags":["Simplified debit notes"],"summary":"Get status summary","operationId":"simplified_debit_notes_summary_simplified_debit_notes_summary_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keyword"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-debit-notes/{invoice_id}":{"get":{"tags":["Simplified debit notes"],"summary":"Retrieve debit note","operationId":"simplified_debit_notes_retrieve_simplified_debit_notes__invoice_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-debit-notes/{invoice_id}/download":{"get":{"tags":["Simplified debit notes"],"summary":"Download XML or PDF","operationId":"simplified_debit_notes_download_simplified_debit_notes__invoice_id__download_get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)","default":"xml","title":"Type"},"description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/simplified-debit-notes/{invoice_id}/retry":{"post":{"tags":["Simplified debit notes"],"summary":"Retry debit note","operationId":"simplified_debit_notes_retry_simplified_debit_notes__invoice_id__retry_post","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-invoices/summary":{"get":{"tags":["Prepayment invoices"],"summary":"Get status summary","operationId":"prepayment_invoices_summary_prepayment_invoices_summary_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keyword"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-invoices/{invoice_id}":{"get":{"tags":["Prepayment invoices"],"summary":"Retrieve prepayment invoice","operationId":"prepayment_invoices_retrieve_prepayment_invoices__invoice_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-invoices/{invoice_id}/download":{"get":{"tags":["Prepayment invoices"],"summary":"Download XML or PDF","operationId":"prepayment_invoices_download_prepayment_invoices__invoice_id__download_get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)","default":"xml","title":"Type"},"description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-invoices/{invoice_id}/retry":{"post":{"tags":["Prepayment invoices"],"summary":"Retry prepayment invoice","operationId":"prepayment_invoices_retry_prepayment_invoices__invoice_id__retry_post","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-simplified-invoices/summary":{"get":{"tags":["Simplified prepayment invoices"],"summary":"Get status summary","operationId":"prepayment_simplified_invoices_summary_prepayment_simplified_invoices_summary_get","security":[{"ApiKey":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keyword"}},{"name":"issue_datetime_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime After"}},{"name":"issue_datetime_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issue Datetime Before"}},{"name":"supply_date_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date After"}},{"name":"supply_date_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Supply Date Before"}},{"name":"X-NBR-Connected-Account-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Connected-Account-Id"}},{"name":"X-NBR-Sub-CR","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nbr-Sub-Cr"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-simplified-invoices/{invoice_id}":{"get":{"tags":["Simplified prepayment invoices"],"summary":"Retrieve prepayment invoice","operationId":"prepayment_simplified_invoices_retrieve_prepayment_simplified_invoices__invoice_id__get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-simplified-invoices/{invoice_id}/download":{"get":{"tags":["Simplified prepayment invoices"],"summary":"Download XML or PDF","operationId":"prepayment_simplified_invoices_download_prepayment_simplified_invoices__invoice_id__download_get","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)","default":"xml","title":"Type"},"description":"Download format: 'xml' (signed/cleared UBL) or 'pdf' (human-readable)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prepayment-simplified-invoices/{invoice_id}/retry":{"post":{"tags":["Simplified prepayment invoices"],"summary":"Retry prepayment invoice","operationId":"prepayment_simplified_invoices_retry_prepayment_simplified_invoices__invoice_id__retry_post","security":[{"ApiKey":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResultModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AdjustmentTax":{"properties":{"type":{"type":"string","enum":["S","Z","E","O"],"title":"Type"},"percent":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,4}|(?=[\\d.]{1,11}0*$)\\d{0,4}\\.\\d{0,6}0*$)"}],"title":"Percent"},"exemption_reason":{"anyOf":[{"type":"string","maxLength":1000,"minLength":1},{"type":"null"}],"title":"Exemption Reason"}},"additionalProperties":false,"type":"object","required":["type","percent"],"title":"AdjustmentTax"},"BulkInvoiceRequest":{"properties":{"invoices":{"items":{"$ref":"#/components/schemas/InvoiceRequest"},"type":"array","maxItems":100,"minItems":1,"title":"Invoices","description":"1–100 documents"}},"type":"object","required":["invoices"],"title":"BulkInvoiceRequest","description":"A batch of documents for a single taxpayer/branch (routed by the same headers as one)."},"BulkSubmissionItem":{"properties":{"index":{"type":"integer","title":"Index","description":"0-based position in the request"},"document_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Number"},"uuid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uuid"},"accepted":{"type":"boolean","title":"Accepted","default":false},"duplicate":{"type":"boolean","title":"Duplicate","description":"True when this document was already submitted — the stored result is replayed","default":false},"validation_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validation Status"},"clearance_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clearance Status"},"reporting_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reporting Status"},"qr_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qr Code"},"errors":{"items":{"$ref":"#/components/schemas/ValidationMessageModel"},"type":"array","title":"Errors"},"warnings":{"items":{"$ref":"#/components/schemas/ValidationMessageModel"},"type":"array","title":"Warnings"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["index"],"title":"BulkSubmissionItem","description":"One document's outcome within a bulk submission. `error` is set when the document could not\nbe processed at all (assembly rejection / NBR transport failure), distinct from validation\nfindings in `errors`."},"BulkSubmissionResult":{"properties":{"count":{"type":"integer","title":"Count","description":"Documents in the request"},"accepted":{"type":"integer","title":"Accepted","description":"How many were cleared/reported by NBR"},"results":{"items":{"$ref":"#/components/schemas/BulkSubmissionItem"},"type":"array","title":"Results"}},"type":"object","required":["count","accepted"],"title":"BulkSubmissionResult"},"BulkValidationItem":{"properties":{"index":{"type":"integer","title":"Index"},"document_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Number"},"valid":{"type":"boolean","title":"Valid","default":false},"validation_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validation Status"},"errors":{"items":{"$ref":"#/components/schemas/ValidationMessageModel"},"type":"array","title":"Errors"},"warnings":{"items":{"$ref":"#/components/schemas/ValidationMessageModel"},"type":"array","title":"Warnings"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["index"],"title":"BulkValidationItem"},"BulkValidationResult":{"properties":{"count":{"type":"integer","title":"Count"},"valid":{"type":"integer","title":"Valid","description":"How many passed with no ERROR-level findings"},"results":{"items":{"$ref":"#/components/schemas/BulkValidationItem"},"type":"array","title":"Results"}},"type":"object","required":["count","valid"],"title":"BulkValidationResult"},"Charge":{"properties":{"amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"},{"type":"null"}],"title":"Amount"},"base_amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"},{"type":"null"}],"title":"Base Amount"},"percent":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,8}|(?=[\\d.]{1,11}0*$)\\d{0,8}\\.\\d{0,2}0*$)"},{"type":"null"}],"title":"Percent"},"reason":{"$ref":"#/components/schemas/ChargeReasonCode"},"reason_text":{"type":"string","maxLength":1000,"title":"Reason Text","default":""}},"additionalProperties":false,"type":"object","required":["reason"],"title":"Charge"},"ChargeReasonCode":{"type":"string","enum":["AA","AAA","AAC","AAD","AAE","AAF","AAH","AAI","AAS","AAT","AAV","AAY","AAZ","ABA","ABB","ABC","ABD","ABF","ABK","ABL","ABN","ABR","ABS","ABT","ABU","ACF","ACG","ACH","ACI","ACJ","ACK","ACL","ACM","ACS","ADC","ADE","ADJ","ADK","ADL","ADM","ADN","ADO","ADP","ADQ","ADR","ADT","ADW","ADY","ADZ","AEA","AEB","AEC","AED","AEF","AEH","AEI","AEJ","AEK","AEL","AEM","AEN","AEO","AEP","AES","AET","AEU","AEV","AEW","AEX","AEY","AEZ","AJ","AU","CA","CAB","CAD","CAE","CAF","CAI","CAJ","CAK","CAL","CAM","CAN","CAO","CAP","CAQ","CAR","CAS","CAT","CAU","CAV","CAW","CD","CG","CS","CT","DAB","DAD","DL","EG","EP","ER","FAA","FAB","FAC","FC","FH","FI","GAA","HAA","HD","HH","IAA","ID","IF","IR","IS","KO","L1","LA","LAA","LAB","LF","MAE","MI","ML","NAA","OA","PA","PAA","PC","PL","RAB","RAC","RAD","RAF","RE","RF","RH","RV","SA","SAA","SAD","SAE","SAI","SG","SH","SM","SU","TAB","TT","TV","V1","V2","WH","XAA","YY","ZZZ"],"title":"ChargeReasonCode"},"ConnectedAccountCreate":{"properties":{"onboarding":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/DirectAccountOnboarding"},{"$ref":"#/components/schemas/ThirdPartyAccountOnboarding"}],"discriminator":{"propertyName":"mode","mapping":{"DIRECT":"#/components/schemas/DirectAccountOnboarding","THIRD_PARTY":"#/components/schemas/ThirdPartyAccountOnboarding"}}},{"type":"null"}],"title":"Onboarding","description":"DIRECT uses the supplier OTP; THIRD_PARTY uses the organization's device. Omit for legacy account-only creation."},"metadata":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"type":"null"}],"title":"Metadata","description":"Arbitrary account metadata, stored locally and not sent to NBR"},"identification":{"anyOf":[{"$ref":"#/components/schemas/SupplierIdentification"},{"type":"null"}],"description":"Supplier identifier used in invoice XML. Required for third-party submissions; direct accounts can fall back to the selected supplier device Sub-CR."},"name":{"type":"string","title":"Name","description":"Taxpayer legal name"},"tax_registration_number":{"type":"string","title":"Tax Registration Number","description":"VAT / TIN"},"business_category":{"type":"string","title":"Business Category","description":"Business category / industry"},"street_name":{"type":"string","title":"Street Name","description":"Address line 1 — street"},"block":{"type":"string","title":"Block","description":"Address line 2 — block"},"building_name":{"type":"string","title":"Building Name","description":"Address line 3 — building name"},"flat":{"type":"string","title":"Flat","description":"Address line 4 — flat / shop no"},"city":{"type":"string","title":"City","description":"City"},"postal_zone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Postal Zone"},"country":{"type":"string","title":"Country","default":"BH"},"logo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo","description":"Optional brand logo shown on the invoice PDF — base64 of a PNG/JPEG/GIF/WebP image (or a data: URI), within the size limit"}},"additionalProperties":false,"type":"object","required":["name","tax_registration_number","business_category","street_name","block","building_name","flat","city"],"title":"ConnectedAccountCreate","description":"Full-representation body for create (POST). The structured seller address\nfeeds the invoice's BG-05 seller PostalAddress, so invoices never carry the supplier."},"ConnectedAccountModel":{"properties":{"id":{"type":"string","title":"Id"},"invoicing_mode":{"type":"string","enum":["DIRECT","THIRD_PARTY"],"title":"Invoicing Mode","default":"DIRECT"},"metadata":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"type":"null"}],"title":"Metadata"},"identification":{"anyOf":[{"$ref":"#/components/schemas/SupplierIdentification"},{"type":"null"}]},"name":{"type":"string","title":"Name"},"tax_registration_number":{"type":"string","title":"Tax Registration Number"},"business_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Category"},"street_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Street Name"},"block":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Block"},"building_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Building Name"},"flat":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flat"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"postal_zone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Postal Zone"},"country":{"type":"string","title":"Country"},"has_logo":{"type":"boolean","title":"Has Logo","description":"Whether a brand logo is stored for this account (shown on the invoice PDF)","default":false}},"type":"object","required":["id","name","tax_registration_number","country"],"title":"ConnectedAccountModel"},"ConnectedAccountUpdate":{"properties":{"identification":{"anyOf":[{"$ref":"#/components/schemas/SupplierIdentification"},{"type":"null"}]},"metadata":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"type":"null"}],"title":"Metadata"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"tax_registration_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Registration Number"},"business_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Category"},"street_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Street Name"},"block":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Block"},"building_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Building Name"},"flat":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flat"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"postal_zone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Postal Zone"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"logo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo","description":"Optional brand logo shown on the invoice PDF — base64 of a PNG/JPEG/GIF/WebP image (or a data: URI), within the size limit; send null to remove"}},"additionalProperties":false,"type":"object","title":"ConnectedAccountUpdate","description":"Partial body for PATCH — every field optional."},"CounterpartyIdentification":{"properties":{"type":{"$ref":"#/components/schemas/IdScheme"},"value":{"type":"string","title":"Value","description":"Identifier value. NBR requires alphanumeric identifiers (BR-BH-CL-03), so any other characters are dropped: a sub-CR written `999999-99` is sent as `99999999`."}},"type":"object","required":["type","value"],"title":"CounterpartyIdentification"},"CreditNoteDocument":{"properties":{"discounts":{"items":{"$ref":"#/components/schemas/DocumentDiscount"},"type":"array","title":"Discounts","description":"Document discounts, each with its VAT category and rate"},"charges":{"items":{"$ref":"#/components/schemas/DocumentCharge"},"type":"array","title":"Charges","description":"Document charges, each with its VAT category and rate"},"document_number":{"type":"string","title":"Document Number","description":"Your invoice number (BT-1)"},"tax_amount_type":{"$ref":"#/components/schemas/TaxAmountType","description":"whether unit prices include VAT","default":"exclusive"},"indicators":{"items":{"$ref":"#/components/schemas/TransactionIndicator"},"type":"array","uniqueItems":true,"title":"Indicators","description":"Supported NBR flags: EXPORT, SUMMARY, CONTINUOUS_SUPPLY, DEEMED_SUPPLY, DOMESTIC_RCM, SELF_BILLING, IMPORT_SERVICES_RCM; third-party status is derived from the connected account"},"invoice_period":{"anyOf":[{"$ref":"#/components/schemas/InvoicePeriod"},{"type":"null"}],"description":"Invoicing period (BT-073/074); required for SUMMARY, within one calendar month"},"currency":{"type":"string","title":"Currency","description":"Document currency (BT-5), from the supplied NBR SDK currency code list","default":"BHD"},"exchange_rate":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,15}|(?=[\\d.]{1,16}0*$)\\d*\\.\\d*0*$)"},{"type":"null"}],"title":"Exchange Rate","description":"BHD per one unit of document currency; required for non-BHD (BT-BH-003)"},"tax_total":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,17}|(?=[\\d.]{1,21}0*$)\\d{0,17}\\.\\d{0,3}0*$)"},{"type":"null"}],"title":"Tax Total","description":"Optional BHD VAT total, checked against the calculated total (BT-111)"},"supply_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supply Date","description":"Supply (delivery) date, YYYY-MM-DD (BT-72). Stored and emitted as cac:Delivery; the issue date (BT-2) is always the submission date."},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"payment_means":{"$ref":"#/components/schemas/CreditNotePaymentMeans"},"prepayments":{"items":{"$ref":"#/components/schemas/InvoicePrepayment"},"type":"array","title":"Prepayments","description":"Applied prepayments with their original document identity and VAT"},"counterparty":{"$ref":"#/components/schemas/InvoiceCounterparty","description":"The other party: buyer for ordinary sales (including third-party billing), seller for SELF_BILLING and IMPORT_SERVICES_RCM. The connected account supplies its own party's identity and address; AgentParty comes from the organization."},"line_items":{"items":{"$ref":"#/components/schemas/InvoiceLineItem"},"type":"array","minItems":1,"title":"Line Items"},"reference_document_number":{"type":"string","maxLength":50,"minLength":1,"title":"Reference Document Number","description":"Original invoice number (BT-025); resolved within this connected account"},"reference_document_uuid":{"anyOf":[{"type":"string","minLength":1,"pattern":"^[A-Za-z0-9-]+$"},{"type":"null"}],"title":"Reference Document Uuid","description":"Original UUID, required for external invoices"},"reference_document_issue_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Reference Document Issue Date","description":"Original issue date, required for external invoices"}},"additionalProperties":false,"type":"object","required":["document_number","payment_means","counterparty","line_items","reference_document_number"],"title":"CreditNoteDocument"},"CreditNotePaymentMeans":{"properties":{"code":{"type":"string","enum":["10","20","21","30","49","54","55"],"title":"Code"},"account_id":{"anyOf":[{"type":"string","maxLength":34,"minLength":1},{"type":"null"}],"title":"Account Id"},"account_name":{"anyOf":[{"type":"string","maxLength":1000,"minLength":1},{"type":"null"}],"title":"Account Name"},"payment_terms":{"anyOf":[{"type":"string","maxLength":1000,"minLength":1},{"type":"null"}],"title":"Payment Terms"},"issue_reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Issue Reason","description":"Reason for issuing the credit/debit note, as in the ZATCA API"},"issue_reason_code":{"type":"string","enum":["RA","RB","RC","RD","RE","RF","RG","RH","RI","OTH"],"title":"Issue Reason Code","description":"NBR note reason code (BT-BH-030, BR-BH-CL-09); no code is inferred from the text"}},"additionalProperties":false,"type":"object","required":["code","issue_reason","issue_reason_code"],"title":"CreditNotePaymentMeans"},"CreditNoteRequest":{"properties":{"document":{"$ref":"#/components/schemas/CreditNoteDocument"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata"}},"type":"object","required":["document"],"title":"CreditNoteRequest"},"DeactivateAllResponse":{"properties":{"deactivated":{"type":"integer","title":"Deactivated"},"devices":{"items":{"$ref":"#/components/schemas/DeviceStatusModel"},"type":"array","title":"Devices"}},"type":"object","required":["deactivated"],"title":"DeactivateAllResponse"},"DeactivateRequest":{"properties":{"reason":{"type":"string","title":"Reason","description":"Why the device is being revoked (audit)","default":"manual deactivation"}},"type":"object","title":"DeactivateRequest"},"DebitNoteDocument":{"properties":{"discounts":{"items":{"$ref":"#/components/schemas/DocumentDiscount"},"type":"array","title":"Discounts","description":"Document discounts, each with its VAT category and rate"},"charges":{"items":{"$ref":"#/components/schemas/DocumentCharge"},"type":"array","title":"Charges","description":"Document charges, each with its VAT category and rate"},"document_number":{"type":"string","title":"Document Number","description":"Your invoice number (BT-1)"},"tax_amount_type":{"$ref":"#/components/schemas/TaxAmountType","description":"whether unit prices include VAT","default":"exclusive"},"indicators":{"items":{"$ref":"#/components/schemas/TransactionIndicator"},"type":"array","uniqueItems":true,"title":"Indicators","description":"Supported NBR flags: EXPORT, SUMMARY, CONTINUOUS_SUPPLY, DEEMED_SUPPLY, DOMESTIC_RCM, SELF_BILLING, IMPORT_SERVICES_RCM; third-party status is derived from the connected account"},"invoice_period":{"anyOf":[{"$ref":"#/components/schemas/InvoicePeriod"},{"type":"null"}],"description":"Invoicing period (BT-073/074); required for SUMMARY, within one calendar month"},"currency":{"type":"string","title":"Currency","description":"Document currency (BT-5), from the supplied NBR SDK currency code list","default":"BHD"},"exchange_rate":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,15}|(?=[\\d.]{1,16}0*$)\\d*\\.\\d*0*$)"},{"type":"null"}],"title":"Exchange Rate","description":"BHD per one unit of document currency; required for non-BHD (BT-BH-003)"},"tax_total":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,17}|(?=[\\d.]{1,21}0*$)\\d{0,17}\\.\\d{0,3}0*$)"},{"type":"null"}],"title":"Tax Total","description":"Optional BHD VAT total, checked against the calculated total (BT-111)"},"supply_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supply Date","description":"Supply (delivery) date, YYYY-MM-DD (BT-72). Stored and emitted as cac:Delivery; the issue date (BT-2) is always the submission date."},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"payment_means":{"$ref":"#/components/schemas/DebitNotePaymentMeans"},"prepayments":{"items":{"$ref":"#/components/schemas/InvoicePrepayment"},"type":"array","title":"Prepayments","description":"Applied prepayments with their original document identity and VAT"},"counterparty":{"$ref":"#/components/schemas/InvoiceCounterparty","description":"The other party: buyer for ordinary sales (including third-party billing), seller for SELF_BILLING and IMPORT_SERVICES_RCM. The connected account supplies its own party's identity and address; AgentParty comes from the organization."},"line_items":{"items":{"$ref":"#/components/schemas/InvoiceLineItem"},"type":"array","minItems":1,"title":"Line Items"},"reference_document_number":{"type":"string","maxLength":50,"minLength":1,"title":"Reference Document Number","description":"Original invoice number (BT-025); resolved within this connected account"},"reference_document_uuid":{"anyOf":[{"type":"string","minLength":1,"pattern":"^[A-Za-z0-9-]+$"},{"type":"null"}],"title":"Reference Document Uuid","description":"Original UUID, required for external invoices"},"reference_document_issue_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Reference Document Issue Date","description":"Original issue date, required for external invoices"}},"additionalProperties":false,"type":"object","required":["document_number","payment_means","counterparty","line_items","reference_document_number"],"title":"DebitNoteDocument"},"DebitNotePaymentMeans":{"properties":{"code":{"type":"string","enum":["10","20","21","30","49","54","55"],"title":"Code"},"account_id":{"anyOf":[{"type":"string","maxLength":34,"minLength":1},{"type":"null"}],"title":"Account Id"},"account_name":{"anyOf":[{"type":"string","maxLength":1000,"minLength":1},{"type":"null"}],"title":"Account Name"},"payment_terms":{"anyOf":[{"type":"string","maxLength":1000,"minLength":1},{"type":"null"}],"title":"Payment Terms"},"issue_reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Issue Reason","description":"Reason for issuing the credit/debit note, as in the ZATCA API"},"issue_reason_code":{"type":"string","enum":["RA","RB","RC","RD","RE","RF","RG","RH","RI","OTH"],"title":"Issue Reason Code","description":"NBR note reason code (BT-BH-030, BR-BH-CL-09); no code is inferred from the text"}},"additionalProperties":false,"type":"object","required":["code","issue_reason","issue_reason_code"],"title":"DebitNotePaymentMeans"},"DebitNoteRequest":{"properties":{"document":{"$ref":"#/components/schemas/DebitNoteDocument"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata"}},"type":"object","required":["document"],"title":"DebitNoteRequest"},"DeviceRegistrationRequest":{"properties":{"otp":{"type":"string","title":"Otp","description":"One-time password from the NBR portal"},"sub_cr":{"type":"string","title":"Sub Cr","description":"Sub-commercial-registration number — the branch (CSR SAN OU)"},"common_name":{"type":"string","title":"Common Name","description":"EGS common name for the CSR","default":"Wafeq EGS"}},"type":"object","required":["otp","sub_cr"],"title":"DeviceRegistrationRequest","description":"The taxpayer is the `X-NBR-Connected-Account-Id` header — its identity feeds the CSR, so it\nis never repeated here."},"DeviceRenewRequest":{"properties":{"otp":{"type":"string","title":"Otp","description":"One-time password from the NBR portal"},"common_name":{"type":"string","title":"Common Name","description":"EGS common name for the CSR","default":"Wafeq EGS"}},"type":"object","required":["otp"],"title":"DeviceRenewRequest"},"DeviceStatusModel":{"properties":{"device_id":{"type":"string","title":"Device Id"},"status":{"type":"string","title":"Status"},"deactivation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deactivation Reason"}},"type":"object","required":["device_id","status"],"title":"DeviceStatusModel"},"DeviceSummaryModel":{"properties":{"device_id":{"type":"string","title":"Device Id"},"status":{"type":"string","title":"Status"},"environment":{"type":"string","title":"Environment"},"connected_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected Account Id"},"organization_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Organization Id"},"sub_cr":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sub Cr"},"vat_number":{"type":"string","title":"Vat Number"}},"type":"object","required":["device_id","status","environment","vat_number"],"title":"DeviceSummaryModel"},"DirectAccountOnboarding":{"properties":{"mode":{"type":"string","const":"DIRECT","title":"Mode"},"otp":{"type":"string","minLength":1,"format":"password","title":"Otp","description":"Supplier OTP, consumed during registration and never persisted","writeOnly":true},"sub_cr":{"type":"string","maxLength":64,"minLength":1,"title":"Sub Cr"},"common_name":{"type":"string","minLength":1,"title":"Common Name","default":"Wafeq EGS"}},"additionalProperties":false,"type":"object","required":["mode","otp","sub_cr"],"title":"DirectAccountOnboarding"},"Discount":{"properties":{"amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"},{"type":"null"}],"title":"Amount"},"base_amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"},{"type":"null"}],"title":"Base Amount"},"percent":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,8}|(?=[\\d.]{1,11}0*$)\\d{0,8}\\.\\d{0,2}0*$)"},{"type":"null"}],"title":"Percent"},"reason":{"$ref":"#/components/schemas/DiscountReasonCode"}},"additionalProperties":false,"type":"object","required":["reason"],"title":"Discount"},"DiscountReasonCode":{"type":"string","enum":["41","42","60","62","63","64","65","66","67","68","70","71","88","95","100","102","103","104","105"],"title":"DiscountReasonCode"},"DocumentCharge":{"properties":{"amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"},{"type":"null"}],"title":"Amount"},"base_amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"},{"type":"null"}],"title":"Base Amount"},"percent":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,8}|(?=[\\d.]{1,11}0*$)\\d{0,8}\\.\\d{0,2}0*$)"},{"type":"null"}],"title":"Percent"},"reason":{"$ref":"#/components/schemas/ChargeReasonCode"},"reason_text":{"type":"string","maxLength":1000,"title":"Reason Text","default":""},"tax":{"$ref":"#/components/schemas/AdjustmentTax"}},"additionalProperties":false,"type":"object","required":["reason","tax"],"title":"DocumentCharge"},"DocumentDiscount":{"properties":{"amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"},{"type":"null"}],"title":"Amount"},"base_amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"},{"type":"null"}],"title":"Base Amount"},"percent":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,8}|(?=[\\d.]{1,11}0*$)\\d{0,8}\\.\\d{0,2}0*$)"},{"type":"null"}],"title":"Percent"},"reason":{"$ref":"#/components/schemas/DiscountReasonCode"},"tax":{"$ref":"#/components/schemas/AdjustmentTax"}},"additionalProperties":false,"type":"object","required":["reason","tax"],"title":"DocumentDiscount"},"DocumentRef":{"properties":{"id":{"type":"string","title":"Id","description":"Stable document id (UUID)"},"document_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Number","description":"Your invoice number (BT-1)"},"issue_datetime":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issue Datetime"},"supply_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supply Date"}},"type":"object","required":["id"],"title":"DocumentRef","description":"The document sub-object echoed in list/retrieve (ZATCA-shaped)."},"DocumentStatus":{"type":"string","enum":["CLEARED","REPORTED","ERROR","FAILED","PENDING"],"title":"DocumentStatus","description":"Single derived status for a submitted document (mirrors ZATCA's list `status`)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IdScheme":{"type":"string","enum":["SUBCRN","IGA","GOVEN","CPRID","GCCID","OTH"],"title":"IdScheme","description":"Party identifier scheme code list — same set for seller (BT-029-1) and buyer (BT-046-1)."},"InvoiceCounterparty":{"properties":{"name":{"type":"string","title":"Name"},"address":{"anyOf":[{"$ref":"#/components/schemas/InvoiceCounterpartyAddress"},{"type":"null"}],"description":"Optional for simplified buyers; standard domestic buyers and seller counterparties require a full address. Export buyers require country only."},"tax_registration_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Registration Number","description":"Counterparty VAT number. Required for SELF_BILLING; optional Bahrain VAT for IMPORT_SERVICES_RCM. Domestic buyers need VAT or identification."},"identification":{"anyOf":[{"$ref":"#/components/schemas/CounterpartyIdentification"},{"type":"null"}],"description":"Required for seller counterparties; domestic buyers need identification or VAT."}},"additionalProperties":false,"type":"object","required":["name"],"title":"InvoiceCounterparty","description":"The other party: buyer for sales, seller for buyer-issued documents."},"InvoiceCounterpartyAddress":{"properties":{"street":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Street"},"block":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Block"},"building_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Building Name"},"flat":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flat"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"country":{"type":"string","title":"Country","default":"BH"},"postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Postal Code"}},"type":"object","title":"InvoiceCounterpartyAddress","description":"Counterparty address; completeness depends on its role and the endpoint."},"InvoiceDetail":{"properties":{"status":{"$ref":"#/components/schemas/DocumentStatus"},"created_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created Ts"},"sent_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sent Ts"},"reported_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reported Ts"},"document":{"$ref":"#/components/schemas/DocumentRef"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata"},"qr_code_data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qr Code Data"},"validation_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validation Status"},"clearance_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clearance Status"},"reporting_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reporting Status"}},"type":"object","required":["status","document"],"title":"InvoiceDetail","description":"Full document — the retrieve response."},"InvoiceDocument":{"properties":{"discounts":{"items":{"$ref":"#/components/schemas/DocumentDiscount"},"type":"array","title":"Discounts","description":"Document discounts, each with its VAT category and rate"},"charges":{"items":{"$ref":"#/components/schemas/DocumentCharge"},"type":"array","title":"Charges","description":"Document charges, each with its VAT category and rate"},"document_number":{"type":"string","title":"Document Number","description":"Your invoice number (BT-1)"},"tax_amount_type":{"$ref":"#/components/schemas/TaxAmountType","description":"whether unit prices include VAT","default":"exclusive"},"indicators":{"items":{"$ref":"#/components/schemas/TransactionIndicator"},"type":"array","uniqueItems":true,"title":"Indicators","description":"Supported NBR flags: EXPORT, SUMMARY, CONTINUOUS_SUPPLY, DEEMED_SUPPLY, DOMESTIC_RCM, SELF_BILLING, IMPORT_SERVICES_RCM; third-party status is derived from the connected account"},"invoice_period":{"anyOf":[{"$ref":"#/components/schemas/InvoicePeriod"},{"type":"null"}],"description":"Invoicing period (BT-073/074); required for SUMMARY, within one calendar month"},"currency":{"type":"string","title":"Currency","description":"Document currency (BT-5), from the supplied NBR SDK currency code list","default":"BHD"},"exchange_rate":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,15}|(?=[\\d.]{1,16}0*$)\\d*\\.\\d*0*$)"},{"type":"null"}],"title":"Exchange Rate","description":"BHD per one unit of document currency; required for non-BHD (BT-BH-003)"},"tax_total":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,17}|(?=[\\d.]{1,21}0*$)\\d{0,17}\\.\\d{0,3}0*$)"},{"type":"null"}],"title":"Tax Total","description":"Optional BHD VAT total, checked against the calculated total (BT-111)"},"supply_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supply Date","description":"Supply (delivery) date, YYYY-MM-DD (BT-72). Stored and emitted as cac:Delivery; the issue date (BT-2) is always the submission date."},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"payment_means":{"anyOf":[{"$ref":"#/components/schemas/PaymentMeans"},{"type":"null"}]},"prepayments":{"items":{"$ref":"#/components/schemas/InvoicePrepayment"},"type":"array","title":"Prepayments","description":"Applied prepayments with their original document identity and VAT"},"counterparty":{"$ref":"#/components/schemas/InvoiceCounterparty","description":"The other party: buyer for ordinary sales (including third-party billing), seller for SELF_BILLING and IMPORT_SERVICES_RCM. The connected account supplies its own party's identity and address; AgentParty comes from the organization."},"line_items":{"items":{"$ref":"#/components/schemas/InvoiceLineItem"},"type":"array","minItems":1,"title":"Line Items"}},"additionalProperties":false,"type":"object","required":["document_number","counterparty","line_items"],"title":"InvoiceDocument"},"InvoiceLineItem":{"properties":{"discounts":{"items":{"$ref":"#/components/schemas/Discount"},"type":"array","title":"Discounts","description":"Line discounts; reason codes follow NBR BR-CL-19"},"charges":{"items":{"$ref":"#/components/schemas/Charge"},"type":"array","title":"Charges","description":"Line charges; reason codes follow NBR BR-CL-20"},"item":{"type":"string","title":"Item","description":"Item name"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description","description":"Item description (BT-154)"},"unit_price":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Unit Price","description":"Price per unit (tax-exclusive, or inclusive if tax_amount_type=inclusive)"},"quantity":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Quantity","default":"1"},"tax":{"$ref":"#/components/schemas/InvoiceTax"},"unit_of_measure":{"type":"string","title":"Unit Of Measure","default":"EA"}},"additionalProperties":false,"type":"object","required":["item","unit_price","tax"],"title":"InvoiceLineItem","description":"Only the essentials — net/VAT/gross/line-id are computed server-side."},"InvoiceListItem":{"properties":{"status":{"$ref":"#/components/schemas/DocumentStatus"},"created_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created Ts"},"sent_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sent Ts"},"reported_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reported Ts"},"document":{"$ref":"#/components/schemas/DocumentRef"}},"type":"object","required":["status","document"],"title":"InvoiceListItem","description":"One row in the invoice list."},"InvoicePeriod":{"properties":{"start_date":{"type":"string","format":"date","title":"Start Date"},"end_date":{"type":"string","format":"date","title":"End Date"}},"additionalProperties":false,"type":"object","required":["start_date","end_date"],"title":"InvoicePeriod"},"InvoicePrepayment":{"properties":{"reference":{"type":"string","minLength":1,"title":"Reference","description":"Original prepayment document number (BT-BH-016)"},"uuid":{"type":"string","minLength":1,"pattern":"^[A-Za-z0-9-]+$","title":"Uuid","description":"Original issuer's UUID (BT-BH-017); never generated from the reference"},"issue_datetime":{"type":"string","format":"date-time","title":"Issue Datetime","description":"Original issue timestamp with timezone; emitted in UTC"},"amount":{"anyOf":[{"type":"number","minimum":0.001},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,21}0*$)\\d{0,10}\\.\\d{0,10}0*$)"}],"title":"Amount","description":"Applied amount, exclusive or inclusive according to document.tax_amount_type"},"tax":{"$ref":"#/components/schemas/PrepaymentTax"}},"additionalProperties":false,"type":"object","required":["reference","uuid","issue_datetime","amount","tax"],"title":"InvoicePrepayment"},"InvoiceRequest":{"properties":{"document":{"$ref":"#/components/schemas/InvoiceDocument"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata"}},"type":"object","required":["document"],"title":"InvoiceRequest","description":"ZATCA-platform-shaped: a `document` plus optional caller metadata."},"InvoiceStatusSummary":{"properties":{"summary":{"additionalProperties":{"type":"integer"},"type":"object","title":"Summary"}},"type":"object","required":["summary"],"title":"InvoiceStatusSummary"},"InvoiceTax":{"properties":{"type":{"$ref":"#/components/schemas/TaxCategory","default":"S"},"percent":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,4}|(?=[\\d.]{1,11}0*$)\\d{0,4}\\.\\d{0,6}0*$)"},{"type":"null"}],"title":"Percent","description":"S: 5 or 10; Z/E/O: 0. Omitted S uses the configured standard rate."},"exemption_reason_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exemption Reason Code","description":"BT-121, e.g. VATEX-BH-OS (required for Z/E/O)"},"exemption_reason":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Exemption Reason"}},"additionalProperties":false,"type":"object","title":"InvoiceTax","description":"NBR VAT category and rate; omitted rates retain the configured default.\n\nexemption_reason accepts the ZATCA-shaped reason code, or free text for O.\nThe existing exemption_reason_code plus explanatory text form remains supported."},"JsonValue":{},"OrganizationModel":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"api_key_hint":{"type":"string","title":"Api Key Hint"},"api_key_mode":{"anyOf":[{"type":"string","enum":["test","live"]},{"type":"null"}],"title":"Api Key Mode","description":"Mode of the issued API key: test targets NBR sandbox, live targets NBR core. Legacy pilot keys are test.","readOnly":true},"tax_registration_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Registration Number"},"identification":{"anyOf":[{"$ref":"#/components/schemas/ThirdPartyIdentification"},{"type":"null"}]},"address":{"anyOf":[{"$ref":"#/components/schemas/ThirdPartyAddress"},{"type":"null"}]},"business_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Category"}},"type":"object","required":["id","name","api_key_hint"],"title":"OrganizationModel"},"OrganizationUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":60,"minLength":1},{"type":"null"}],"title":"Name","description":"Organization legal name, used as the issuing-agent name"},"tax_registration_number":{"anyOf":[{"type":"string","pattern":"^(20|21|22)[0-9]{13}$"},{"type":"null"}],"title":"Tax Registration Number"},"identification":{"anyOf":[{"$ref":"#/components/schemas/ThirdPartyIdentification"},{"type":"null"}]},"address":{"anyOf":[{"$ref":"#/components/schemas/ThirdPartyAddress"},{"type":"null"}],"description":"Complete replacement address when provided"},"business_category":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Business Category","description":"Required for onboarding the organization's signing device"}},"additionalProperties":false,"type":"object","title":"OrganizationUpdate"},"PaginatedConnectedAccounts":{"properties":{"count":{"type":"integer","title":"Count"},"next":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next"},"previous":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous"},"results":{"items":{"$ref":"#/components/schemas/ConnectedAccountModel"},"type":"array","title":"Results"}},"type":"object","required":["count"],"title":"PaginatedConnectedAccounts","description":"ZATCA-style page envelope for list responses."},"PaginatedInvoices":{"properties":{"count":{"type":"integer","title":"Count"},"next":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next"},"previous":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous"},"results":{"items":{"$ref":"#/components/schemas/InvoiceListItem"},"type":"array","title":"Results"}},"type":"object","required":["count"],"title":"PaginatedInvoices"},"PaymentMeans":{"properties":{"code":{"anyOf":[{"type":"string","enum":["10","20","21","30","49","54","55"]},{"type":"null"}],"title":"Code","description":"NBR BR-CL-16: 10 cash, 20 cheque, 21 banker's draft, 30 credit transfer, 49 direct debit, 54 credit card, 55 debit card"},"account_id":{"anyOf":[{"type":"string","maxLength":34,"minLength":1},{"type":"null"}],"title":"Account Id"},"account_name":{"anyOf":[{"type":"string","maxLength":1000,"minLength":1},{"type":"null"}],"title":"Account Name"},"payment_terms":{"anyOf":[{"type":"string","maxLength":1000,"minLength":1},{"type":"null"}],"title":"Payment Terms"}},"additionalProperties":false,"type":"object","title":"PaymentMeans"},"PrepaymentInvoiceDocument":{"properties":{"discounts":{"items":{"$ref":"#/components/schemas/DocumentDiscount"},"type":"array","title":"Discounts","description":"Document discounts, each with its VAT category and rate"},"charges":{"items":{"$ref":"#/components/schemas/DocumentCharge"},"type":"array","title":"Charges","description":"Document charges, each with its VAT category and rate"},"document_number":{"type":"string","title":"Document Number","description":"Your invoice number (BT-1)"},"tax_amount_type":{"$ref":"#/components/schemas/TaxAmountType","description":"whether unit prices include VAT","default":"exclusive"},"indicators":{"items":{"$ref":"#/components/schemas/TransactionIndicator"},"type":"array","uniqueItems":true,"title":"Indicators","description":"Supported NBR flags: EXPORT, SUMMARY, CONTINUOUS_SUPPLY, DEEMED_SUPPLY, DOMESTIC_RCM, SELF_BILLING, IMPORT_SERVICES_RCM; third-party status is derived from the connected account"},"invoice_period":{"anyOf":[{"$ref":"#/components/schemas/InvoicePeriod"},{"type":"null"}],"description":"Invoicing period (BT-073/074); required for SUMMARY, within one calendar month"},"currency":{"type":"string","title":"Currency","description":"Document currency (BT-5), from the supplied NBR SDK currency code list","default":"BHD"},"exchange_rate":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,15}|(?=[\\d.]{1,16}0*$)\\d*\\.\\d*0*$)"},{"type":"null"}],"title":"Exchange Rate","description":"BHD per one unit of document currency; required for non-BHD (BT-BH-003)"},"tax_total":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,17}|(?=[\\d.]{1,21}0*$)\\d{0,17}\\.\\d{0,3}0*$)"},{"type":"null"}],"title":"Tax Total","description":"Optional BHD VAT total, checked against the calculated total (BT-111)"},"supply_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supply Date","description":"Supply (delivery) date, YYYY-MM-DD (BT-72). Stored and emitted as cac:Delivery; the issue date (BT-2) is always the submission date."},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"payment_means":{"anyOf":[{"$ref":"#/components/schemas/PaymentMeans"},{"type":"null"}]},"prepayments":{"items":{"$ref":"#/components/schemas/InvoicePrepayment"},"type":"array","maxItems":0,"title":"Prepayments","description":"Issuing a prepayment invoice does not support applying other prepayments; omit or send an empty list"},"counterparty":{"$ref":"#/components/schemas/InvoiceCounterparty","description":"The other party: buyer for ordinary sales (including third-party billing), seller for SELF_BILLING and IMPORT_SERVICES_RCM. The connected account supplies its own party's identity and address; AgentParty comes from the organization."},"line_items":{"items":{"$ref":"#/components/schemas/InvoiceLineItem"},"type":"array","minItems":1,"title":"Line Items"}},"additionalProperties":false,"type":"object","required":["document_number","counterparty","line_items"],"title":"PrepaymentInvoiceDocument"},"PrepaymentInvoiceRequest":{"properties":{"document":{"$ref":"#/components/schemas/PrepaymentInvoiceDocument"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata"}},"type":"object","required":["document"],"title":"PrepaymentInvoiceRequest"},"PrepaymentTax":{"properties":{"type":{"$ref":"#/components/schemas/TaxCategory","default":"S"},"percent":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,4}|(?=[\\d.]{1,11}0*$)\\d{0,4}\\.\\d{0,6}0*$)"}],"title":"Percent","description":"VAT rate of the original prepayment"},"exemption_reason_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exemption Reason Code","description":"BT-121, e.g. VATEX-BH-OS (required for Z/E/O)"},"exemption_reason":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Exemption Reason"}},"additionalProperties":false,"type":"object","required":["percent"],"title":"PrepaymentTax"},"SubmissionResultModel":{"properties":{"uuid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uuid","description":"The document's stable id — use it with GET /{family}/{uuid} to retrieve or link the invoice"},"validation_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validation Status","description":"PASS | WARNING | ERROR"},"clearance_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clearance Status","description":"CLEARED | NOT_CLEARED (standard invoices)"},"reporting_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reporting Status","description":"REPORTED | NOT_REPORTED (simplified invoices)"},"qr_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qr Code"},"cleared_invoice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cleared Invoice"},"accepted":{"type":"boolean","title":"Accepted","default":false},"duplicate":{"type":"boolean","title":"Duplicate","description":"True when this invoice (same document number) was already submitted — the stored result is replayed, not re-sent to NBR","default":false},"errors":{"items":{"$ref":"#/components/schemas/ValidationMessageModel"},"type":"array","title":"Errors"},"warnings":{"items":{"$ref":"#/components/schemas/ValidationMessageModel"},"type":"array","title":"Warnings"}},"type":"object","title":"SubmissionResultModel"},"SupplierIdentification":{"properties":{"type":{"$ref":"#/components/schemas/IdScheme","default":"SUBCRN"},"value":{"type":"string","minLength":1,"title":"Value","description":"Identifier value. NBR requires alphanumeric identifiers (BR-BH-CL-03), so any other characters are dropped: a sub-CR written `999999-99` is sent as `99999999`."}},"additionalProperties":false,"type":"object","required":["value"],"title":"SupplierIdentification"},"TaxAmountType":{"type":"string","enum":["exclusive","inclusive"],"title":"TaxAmountType","description":"Whether line unit prices are tax-EXCLUSIVE or tax-INCLUSIVE (net is back-computed)."},"TaxCategory":{"type":"string","enum":["S","Z","E","O"],"title":"TaxCategory","description":"UN/ECE 5305 VAT category (BT-118)."},"ThirdPartyAccountOnboarding":{"properties":{"mode":{"type":"string","const":"THIRD_PARTY","title":"Mode"}},"additionalProperties":false,"type":"object","required":["mode"],"title":"ThirdPartyAccountOnboarding"},"ThirdPartyAddress":{"properties":{"street":{"type":"string","maxLength":60,"minLength":1,"title":"Street"},"block":{"type":"string","maxLength":10,"minLength":1,"title":"Block"},"building_name":{"type":"string","maxLength":40,"minLength":1,"title":"Building Name"},"flat":{"type":"string","maxLength":10,"minLength":1,"title":"Flat"},"city":{"type":"string","maxLength":40,"minLength":1,"title":"City"},"country":{"type":"string","pattern":"^[A-Z]{2}$","title":"Country","default":"BH"},"postal_code":{"anyOf":[{"type":"string","maxLength":15},{"type":"null"}],"title":"Postal Code"},"country_subdivision":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Country Subdivision"}},"additionalProperties":false,"type":"object","required":["street","block","building_name","flat","city"],"title":"ThirdPartyAddress","description":"NBR BG-BH-07; agent address has different XML elements and limits from seller/buyer."},"ThirdPartyIdentification":{"properties":{"type":{"type":"string","const":"TIN","title":"Type"},"value":{"type":"string","pattern":"^(20|22)[0-9]{8}$","title":"Value","description":"Third party TIN: 10 digits starting with 20 or 22 (BR-BH-39/40)"}},"additionalProperties":false,"type":"object","required":["type","value"],"title":"ThirdPartyIdentification"},"TransactionIndicator":{"type":"string","enum":["EXPORT","SUMMARY","CONTINUOUS_SUPPLY","DEEMED_SUPPLY","DOMESTIC_RCM","SELF_BILLING","IMPORT_SERVICES_RCM"],"title":"TransactionIndicator","description":"Supported public API indicators; names match ZATCA where applicable."},"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"},"ValidationMessageModel":{"properties":{"code":{"type":"string","title":"Code","description":"Rule id, e.g. BR-BH-35, or an NBR VLD.* code"},"message":{"type":"string","title":"Message"},"category":{"type":"string","title":"Category","description":"LOCAL_VALIDATION when caught before submission; NBR's category otherwise","default":""}},"type":"object","required":["code","message"],"title":"ValidationMessageModel"},"ValidationResultModel":{"properties":{"valid":{"type":"boolean","title":"Valid","description":"True when there are no ERROR-level findings"},"validation_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validation Status","description":"PASS | WARNING | ERROR"},"errors":{"items":{"$ref":"#/components/schemas/ValidationMessageModel"},"type":"array","title":"Errors"},"warnings":{"items":{"$ref":"#/components/schemas/ValidationMessageModel"},"type":"array","title":"Warnings"}},"type":"object","required":["valid"],"title":"ValidationResultModel","description":"Dry-run validation outcome: the document is assembled, signed locally and checked against\nthe BR-BH rule set, but never submitted to NBR or stored."}},"securitySchemes":{"ApiKey":{"type":"apiKey","description":"Enter the complete Authorization header value: `Api-Key <your-api-key>`. `pk_test_` keys target NBR sandbox; `pk_live_` keys target NBR core. The key mode must match the service's NBR target.","in":"header","name":"Authorization"}}},"tags":[{"name":"organizations","description":"Identify your API organization and configure its invoicing details for third-party documents."},{"name":"connected-accounts","description":"Taxpayers you report on behalf of (CRUD, unique per VAT/TRN)."},{"name":"devices","description":"Register a device per branch (one call), list, renew, deactivate."},{"name":"Invoices","description":"Standard invoices (type 388): clear with NBR, then list, retrieve and download."},{"name":"Simplified invoices","description":"Simplified invoices (type 388): sign locally and report to NBR."},{"name":"Credit notes","description":"Standard credit notes (type 381): credit an original invoice and clear with NBR."},{"name":"Simplified credit notes","description":"Simplified credit notes (type 381): credit an original invoice and report to NBR."},{"name":"Debit notes","description":"Standard debit notes (type 383): debit an original invoice and clear with NBR."},{"name":"Simplified debit notes","description":"Simplified debit notes (type 383): debit an original invoice and report to NBR."},{"name":"Prepayment invoices","description":"Standard prepayment invoices (type 386): issue an advance invoice and clear with NBR."},{"name":"Simplified prepayment invoices","description":"Simplified prepayment invoices (type 386): issue an advance invoice and report to NBR."}],"servers":[{"url":"https://api.wafeq.com/bh/v1","description":"Wafeq Bahrain e-invoicing API"}]}