{"openapi":"3.0.3","info":{"title":"Account & Billing API","version":"1","description":"API for managing accounts, billing contacts, invoice setup, payment setup, and invoices.\n"},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/test-b86-865/Accounting/1"},{"url":"https://api.example.com/v1"}],"tags":[{"name":"Accounts","description":"Account list and summary"},{"name":"Account Info","description":"Account address, AP email, and billing contacts"},{"name":"Invoice Setup","description":"Invoice preferences and document delivery configuration"},{"name":"Payment Setup","description":"Auto-pay settings and payment methods"},{"name":"Invoices","description":"Invoice records for an account"},{"name":"Activity Log","description":"Audit trail of changes made to an account"}],"paths":{"/accounts":{"get":{"tags":["Accounts"],"summary":"List all accounts","responses":{"200":{"description":"Array of account summaries","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountSummary"}}}}}}}},"/accounts/{accountId}":{"get":{"tags":["Accounts"],"summary":"Get a single account summary","parameters":[{"$ref":"#/components/parameters/accountId"}],"responses":{"200":{"description":"Account summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountSummary"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/accounts/{accountId}/account-info":{"get":{"tags":["Account Info"],"summary":"Get account info (address, AP email, billing contacts)","parameters":[{"$ref":"#/components/parameters/accountId"}],"responses":{"200":{"description":"Full account info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInfo"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Account Info"],"summary":"Update account info","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInfoUpdate"}}}},"responses":{"200":{"description":"Updated account info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInfo"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/accounts/{accountId}/account-info/billing-contacts":{"post":{"tags":["Account Info"],"summary":"Add a billing contact","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingContactWrite"}}}},"responses":{"201":{"description":"Created billing contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingContact"}}}},"400":{"$ref":"#/components/responses/BadRequest"}}}},"/accounts/{accountId}/account-info/billing-contacts/{contactId}":{"put":{"tags":["Account Info"],"summary":"Update a billing contact","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/contactId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingContactWrite"}}}},"responses":{"200":{"description":"Updated billing contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingContact"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Account Info"],"summary":"Remove a billing contact","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/contactId"}],"responses":{"204":{"description":"Deleted"}}}},"/accounts/{accountId}/invoice-setup":{"get":{"tags":["Invoice Setup"],"summary":"Get invoice setup configuration","parameters":[{"$ref":"#/components/parameters/accountId"}],"responses":{"200":{"description":"Invoice setup","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceSetup"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Invoice Setup"],"summary":"Update invoice setup configuration","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceSetupUpdate"}}}},"responses":{"200":{"description":"Updated invoice setup","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceSetup"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/accounts/{accountId}/invoice-setup/document-delivery":{"get":{"tags":["Invoice Setup"],"summary":"List document delivery rules","parameters":[{"$ref":"#/components/parameters/accountId"}],"responses":{"200":{"description":"List of document delivery rows","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentDelivery"}}}}}}},"post":{"tags":["Invoice Setup"],"summary":"Add a document delivery rule","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDeliveryWrite"}}}},"responses":{"201":{"description":"Created document delivery rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDelivery"}}}}}}},"/accounts/{accountId}/invoice-setup/document-delivery/{deliveryId}":{"put":{"tags":["Invoice Setup"],"summary":"Update a document delivery rule","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/deliveryId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDeliveryWrite"}}}},"responses":{"200":{"description":"Updated document delivery rule","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDelivery"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Invoice Setup"],"summary":"Delete a document delivery rule","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/deliveryId"}],"responses":{"204":{"description":"Deleted"}}}},"/accounts/{accountId}/payment-setup":{"get":{"tags":["Payment Setup"],"summary":"Get payment setup (auto-pay + payment methods)","parameters":[{"$ref":"#/components/parameters/accountId"}],"responses":{"200":{"description":"Payment setup","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentSetup"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Payment Setup"],"summary":"Update auto-pay settings and default payment method","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentSetupUpdate"}}}},"responses":{"200":{"description":"Updated payment setup","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentSetup"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/accounts/{accountId}/payment-setup/payment-methods":{"post":{"tags":["Payment Setup"],"summary":"Add a payment method","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodWrite"}}}},"responses":{"201":{"description":"Created payment method","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethod"}}}},"400":{"$ref":"#/components/responses/BadRequest"}}}},"/accounts/{accountId}/payment-setup/payment-methods/{paymentMethodId}":{"put":{"tags":["Payment Setup"],"summary":"Update a payment method","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/paymentMethodId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodWrite"}}}},"responses":{"200":{"description":"Updated payment method","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethod"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Payment Setup"],"summary":"Delete a payment method","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/paymentMethodId"}],"responses":{"204":{"description":"Deleted"}}}},"/accounts/{accountId}/invoices":{"get":{"tags":["Invoices"],"summary":"List invoices for an account","parameters":[{"$ref":"#/components/parameters/accountId"},{"name":"status","in":"query","description":"Filter by invoice status","schema":{"type":"string","enum":["pending","paid","overdue","cancelled"]}},{"name":"from","in":"query","description":"Start date filter (ISO 8601)","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","description":"End date filter (ISO 8601)","schema":{"type":"string","format":"date"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"pageSize","in":"query","schema":{"type":"integer","default":25}}],"responses":{"200":{"description":"Paginated list of invoices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoicePage"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/accounts/{accountId}/invoices/{invoiceId}":{"get":{"tags":["Invoices"],"summary":"Get a single invoice","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/invoiceId"}],"responses":{"200":{"description":"Invoice detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/accounts/{accountId}/activity-log":{"get":{"tags":["Activity Log"],"summary":"Get activity log for an account","parameters":[{"$ref":"#/components/parameters/accountId"},{"name":"search","in":"query","description":"Filter entries by user, date, or description text","schema":{"type":"string"}},{"name":"category","in":"query","description":"Filter by activity category","schema":{"type":"string","enum":["Payment","Account Details","Invoice Setup"]}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"pageSize","in":"query","schema":{"type":"integer","default":25}}],"responses":{"200":{"description":"Paginated activity log","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityLogPage"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}}},"components":{"parameters":{"accountId":{"name":"accountId","in":"path","required":true,"description":"Unique account identifier (e.g. 1797600)","schema":{"type":"string"}},"contactId":{"name":"contactId","in":"path","required":true,"schema":{"type":"integer"}},"deliveryId":{"name":"deliveryId","in":"path","required":true,"schema":{"type":"integer"}},"paymentMethodId":{"name":"paymentMethodId","in":"path","required":true,"schema":{"type":"string"}},"invoiceId":{"name":"invoiceId","in":"path","required":true,"schema":{"type":"string"}}},"responses":{"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"BadRequest":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"AccountSummary":{"type":"object","properties":{"id":{"type":"string","example":"1797600"},"name":{"type":"string","example":"Renown Health"},"address":{"type":"string","example":"1500 E. Duarte Road, Duarte, CA 91010, ATTN AP"},"primaryContact":{"type":"string","example":"Dr. AP AP"},"email":{"type":"string","format":"email","example":"apinquiry@coh.org"},"type":{"type":"string","example":"AR"}},"required":["id","name"]},"AccountInfo":{"type":"object","properties":{"accountId":{"type":"string","example":"1797600"},"accountName":{"type":"string","example":"Renown Health"},"apEmail":{"type":"string","format":"email","example":"accountspayable@renown.com"},"address":{"$ref":"#/components/schemas/Address"},"billingContacts":{"type":"array","items":{"$ref":"#/components/schemas/BillingContact"}},"primaryContactId":{"type":"integer","example":1}},"required":["accountId","accountName","apEmail","address","billingContacts"]},"AccountInfoUpdate":{"type":"object","properties":{"apEmail":{"type":"string","format":"email"},"address":{"$ref":"#/components/schemas/Address"}}},"Address":{"type":"object","properties":{"street":{"type":"string","example":"1500 E. Duarte Road"},"aptSuite":{"type":"string","example":"APP 24"},"city":{"type":"string","example":"Duarte"},"state":{"type":"string","example":"CA"},"zipCode":{"type":"string","example":"91010"},"phone":{"type":"string","example":"(111) 111 1111"},"isDefault":{"type":"boolean","example":true}},"required":["street","city","state","zipCode"]},"BillingContact":{"type":"object","properties":{"id":{"type":"integer","example":1},"firstName":{"type":"string","example":"Steve"},"lastName":{"type":"string","example":"Johnson"},"email":{"type":"string","format":"email","example":"steve.johnson@renown.com"},"phones":{"type":"array","items":{"$ref":"#/components/schemas/Phone"}},"isPrimary":{"type":"boolean","example":true}},"required":["id","firstName","lastName","email","phones"]},"BillingContactWrite":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"phones":{"type":"array","items":{"$ref":"#/components/schemas/Phone"}},"isPrimary":{"type":"boolean"}},"required":["firstName","lastName","email","phones"]},"Phone":{"type":"object","properties":{"type":{"type":"string","enum":["Cell","Home","Work"],"example":"Cell"},"areaCode":{"type":"string","example":"111"},"number":{"type":"string","example":"111-1111"}},"required":["type","areaCode","number"]},"InvoiceSetup":{"type":"object","properties":{"accountId":{"type":"string","example":"1797600"},"invoiceByPO":{"type":"boolean","description":"Whether invoices are grouped by purchase order","example":true},"invoiceTemplate":{"type":"string","description":"Selected invoice template name","example":"Template 1"},"emailNotificationsEnabled":{"type":"boolean","example":true},"notificationEmails":{"type":"array","description":"Email addresses that receive invoice notifications","items":{"type":"string","format":"email"},"example":["info@renown.com","info2@renown.com","info3@renown.com"]},"documentDelivery":{"type":"array","items":{"$ref":"#/components/schemas/DocumentDelivery"}}},"required":["accountId","invoiceByPO","invoiceTemplate","emailNotificationsEnabled","notificationEmails"]},"InvoiceSetupUpdate":{"type":"object","properties":{"invoiceByPO":{"type":"boolean"},"invoiceTemplate":{"type":"string"},"emailNotificationsEnabled":{"type":"boolean"},"notificationEmails":{"type":"array","items":{"type":"string","format":"email"}}}},"DocumentDelivery":{"type":"object","properties":{"id":{"type":"integer","example":1},"docType":{"type":"string","description":"Document type identifier","example":"basic_template"},"fileFormat":{"type":"string","enum":["PDF","CSV","Excel"],"example":"PDF"},"primaryEmail":{"type":"string","format":"email","example":"ap@renown.com"},"ccEmails":{"type":"array","items":{"type":"string","format":"email"},"example":["billing@renown.com"]}},"required":["id","docType","fileFormat","primaryEmail"]},"DocumentDeliveryWrite":{"type":"object","properties":{"docType":{"type":"string"},"fileFormat":{"type":"string","enum":["PDF","CSV","Excel"]},"primaryEmail":{"type":"string","format":"email"},"ccEmails":{"type":"array","items":{"type":"string","format":"email"}}},"required":["docType","fileFormat","primaryEmail"]},"PaymentSetup":{"type":"object","properties":{"accountId":{"type":"string","example":"1797600"},"autoPayEnabled":{"type":"boolean","description":"Whether automatic payment on invoice due date is enabled","example":true},"defaultPaymentMethodId":{"type":"string","description":"ID of the payment method used for auto-pay","example":"0"},"paymentMethods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethod"}}},"required":["accountId","autoPayEnabled","paymentMethods"]},"PaymentSetupUpdate":{"type":"object","properties":{"autoPayEnabled":{"type":"boolean"},"defaultPaymentMethodId":{"type":"string"}}},"PaymentMethod":{"type":"object","properties":{"id":{"type":"string","example":"0"},"name":{"type":"string","description":"User-facing card label","example":"COH Card 1"},"type":{"type":"string","description":"Card network","enum":["VISA","Mastercard","Amex","Discover"],"example":"VISA"},"last4":{"type":"string","description":"Last four digits of the card number","example":"4242"},"expiry":{"type":"string","description":"Expiration date (MM/YY)","example":"12/25"}},"required":["id","name","type","last4","expiry"]},"PaymentMethodWrite":{"type":"object","description":"Card details for adding or updating a payment method. The full card number is only accepted on write; responses always return last4.\n","properties":{"name":{"type":"string","example":"COH Card 1"},"cardNumber":{"type":"string","description":"Full card number (write-only)","example":"4111111111114242"},"expirationDate":{"type":"string","description":"Expiration date (MM/YY)","example":"12/25"},"securityCode":{"type":"string","description":"CVV/CVC (write-only)","example":"123"},"country":{"type":"string","example":"United States"},"zipCode":{"type":"string","example":"91010"}},"required":["name","cardNumber","expirationDate","securityCode","country","zipCode"]},"InvoicePage":{"type":"object","properties":{"total":{"type":"integer","example":48},"page":{"type":"integer","example":1},"pageSize":{"type":"integer","example":25},"items":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}}},"required":["total","page","pageSize","items"]},"Invoice":{"type":"object","properties":{"id":{"type":"string","example":"INV-2025-001"},"accountId":{"type":"string","example":"1797600"},"issueDate":{"type":"string","format":"date","example":"2025-01-01"},"dueDate":{"type":"string","format":"date","example":"2025-01-31"},"amount":{"type":"number","format":"float","example":1250.0},"status":{"type":"string","enum":["pending","paid","overdue","cancelled"],"example":"paid"},"poNumber":{"type":"string","description":"Purchase order number if invoiced by PO","example":"PO-98765"}},"required":["id","accountId","issueDate","dueDate","amount","status"]},"ActivityLogPage":{"type":"object","properties":{"total":{"type":"integer","example":6},"page":{"type":"integer","example":1},"pageSize":{"type":"integer","example":25},"items":{"type":"array","items":{"$ref":"#/components/schemas/ActivityLogEntry"}}},"required":["total","page","pageSize","items"]},"ActivityLogEntry":{"type":"object","properties":{"id":{"type":"integer","example":1},"user":{"type":"string","example":"John Doe"},"date":{"type":"string","format":"date-time","example":"2025-01-05T00:00:00Z"},"text":{"type":"string","description":"Human-readable description of the change","example":"Auto-pay was turned off."},"category":{"type":"string","enum":["Payment","Account Details","Invoice Setup"],"example":"Payment"}},"required":["id","user","date","text","category"]}}}}