{"openapi":"3.1.0","info":{"title":"BillingEase API","version":"1","description":"Read a business's books and suggest changes. Money is in whole minor units (pence, cents). Suggestions (proposals) wait for a person to approve them; nothing an app sends changes the books on its own."},"servers":[{"url":"https://billingease.app"}],"paths":{"/v1/me":{"get":{"operationId":"whoami","summary":"The business, person and permissions this token acts for","security":[{"bearer":[]},{"oauth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"business":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"currency":{"type":"string"}},"required":["id","name","country","currency"],"additionalProperties":false},"user":{"type":"object","properties":{"name":{"type":"string"},"role":{"type":"string"}},"required":["name","role"],"additionalProperties":false},"scopes":{"type":"array","items":{"type":"string","enum":["books:read","books:propose"]}},"token":{"type":"object","properties":{"kind":{"type":"string","enum":["personal","access"]},"name":{"type":"string"},"app":{"type":["string","null"]},"expiresAt":{"type":["string","null"]}},"required":["kind","name","app","expiresAt"],"additionalProperties":false},"callsLeftToday":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["business","user","scopes","token","callsLeftToday"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/business":{"get":{"operationId":"get_business","summary":"The business: name, country, currency, tax registrations and settings","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"country":{"type":"string","enum":["uk","lk","us"]},"currency":{"type":"string","enum":["GBP","LKR","USD"]},"name":{"type":"string"},"legalName":{"type":["string","null"]},"kind":{"type":"string","enum":["sole_trader","landlord","both","sole_proprietor","partnership"]},"ownerName":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"addressLine1":{"type":["string","null"]},"addressLine2":{"type":["string","null"]},"town":{"type":["string","null"]},"region":{"type":["string","null"]},"postcode":{"type":["string","null"]},"taxId":{"type":["string","null"]},"vatRegistered":{"type":"boolean"},"vatNumber":{"type":["string","null"]},"ssclRegistered":{"type":"boolean"},"basis":{"type":"string","enum":["cash","accrual"]},"quarterType":{"type":"string","enum":["standard","calendar"]},"invoicePrefix":{"type":"string"},"termsDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoiceNote":{"type":["string","null"]},"paymentDetails":{"type":["string","null"]},"accent":{"type":"string"},"template":{"type":"string","enum":["classic","modern","minimal"]},"font":{"type":"string","enum":["sans","serif","mono"]},"footer":{"type":["string","null"]},"logoSize":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"titleStyle":{"type":"string","enum":["tax","plain"]},"hasLogo":{"type":"boolean"},"logoVersion":{"type":["string","null"]},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"role":{"type":"string","enum":["owner","accountant","admin"]},"closedAt":{"type":["string","null"]},"purgeAfter":{"type":["string","null"]}},"required":["id","country","currency","name","legalName","kind","ownerName","email","phone","addressLine1","addressLine2","town","region","postcode","taxId","vatRegistered","vatNumber","ssclRegistered","basis","quarterType","invoicePrefix","termsDays","invoiceNote","paymentDetails","accent","template","font","footer","logoSize","titleStyle","hasLogo","logoVersion","settings","role","closedAt","purgeAfter"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/home":{"get":{"operationId":"get_home","summary":"Money in, money out, profit and the tax estimate for a period","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","enum":["month","quarter","year"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"today":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"currency":{"type":"string","enum":["GBP","LKR","USD"]},"period":{"type":"object","properties":{"key":{"type":"string","enum":["month","quarter","year"]},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"label":{"type":"string"},"soFar":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["key","from","to","label","soFar"],"additionalProperties":false},"periods":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","enum":["month","quarter","year"]},"label":{"type":"string"}},"required":["key","label"],"additionalProperties":false}},"comingIn":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"received":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"onTheWay":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"late":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lateCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","received","onTheWay","late","lateCount"],"additionalProperties":false},"goingOut":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"toPay":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"dueSoon":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"dueSoonCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","paid","toPay","dueSoon","dueSoonCount"],"additionalProperties":false},"tax":{"type":"object","properties":{"label":{"type":"string"},"share":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"yearEstimate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"yearToDateProfit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"projectedProfit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"taxYear":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":"string"}},"required":["label","amount","note"],"additionalProperties":false}},"wording":{"type":"string"},"verified":{"type":"boolean"}},"required":["label","share","yearEstimate","yearToDateProfit","projectedProfit","taxYear","lines","wording","verified"],"additionalProperties":false},"keep":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"periodCard":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"quarter"},"current":{"type":"object","properties":{"label":{"type":"string"},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"due":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"daysToDue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"income":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"expenses":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"profit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["label","from","to","due","daysToDue","income","expenses","profit"],"additionalProperties":false},"previous":{"anyOf":[{"type":"object","properties":{"label":{"type":"string"},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"due":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"daysToDue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"income":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"expenses":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"profit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["label","from","to","due","daysToDue","income","expenses","profit"],"additionalProperties":false},{"type":"null"}]}},"required":["kind","current","previous"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"vat-month"},"title":{"type":"string"},"vat":{"type":"boolean"},"sscl":{"type":"boolean"},"current":{"type":"object","properties":{"label":{"type":"string"},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"due":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"daysToDue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"outputVat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inputVat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vatPayable":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["label","from","to","due","daysToDue","outputVat","inputVat","vatPayable","sscl"],"additionalProperties":false},"previous":{"anyOf":[{"type":"object","properties":{"label":{"type":"string"},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"due":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"daysToDue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"outputVat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inputVat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vatPayable":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["label","from","to","due","daysToDue","outputVat","inputVat","vatPayable","sscl"],"additionalProperties":false},{"type":"null"}]}},"required":["kind","title","vat","sscl","current","previous"],"additionalProperties":false}]},{"type":"null"}]},"needs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["late","draft","bill","uncategorised","tax_id","vat_number","vat_threshold"]},"title":{"type":"string"},"body":{"type":"string"},"href":{"type":"string"},"cta":{"type":"string"},"tone":{"type":"string","enum":["late","due","info","neutral"]},"amount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","kind","title","body","href","cta","tone","amount"],"additionalProperties":false}},"activity":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"},"link":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","message","link","createdAt"],"additionalProperties":false}},"deadlines":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"label":{"type":"string"},"detail":{"type":"string"},"daysAway":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["date","label","detail","daysAway"],"additionalProperties":false}},"empty":{"type":"boolean"},"firstSteps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"hint":{"type":"string"},"href":{"type":"string"},"done":{"type":"boolean"}},"required":["id","label","hint","href","done"],"additionalProperties":false}}},"required":["today","currency","period","periods","comingIn","goingOut","tax","keep","periodCard","needs","activity","deadlines","empty","firstSteps"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/search":{"get":{"operationId":"search","summary":"Search customers, invoices, quotes, suppliers, bills and expenses","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"q","in":"query","required":false,"schema":{"default":"","type":"string","maxLength":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"q":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["customer","invoice","supplier","expense","bill"]},"id":{"type":"string"},"title":{"type":"string"},"subtitle":{"type":"string"},"href":{"type":"string"},"amount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]}},"required":["type","id","title","subtitle","href","amount","date"],"additionalProperties":false}}},"required":["q","results"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/in/summary":{"get":{"operationId":"money_in_summary","summary":"What's owed, late and on the way, and recent invoices","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","enum":["month","quarter","year"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"period":{"type":"object","properties":{"key":{"type":"string","enum":["month","quarter","year"]},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"label":{"type":"string"}},"required":["key","from","to","label"],"additionalProperties":false},"periods":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","enum":["month","quarter","year"]},"label":{"type":"string"}},"required":["key","label"],"additionalProperties":false}},"received":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"onTheWay":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"late":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lateCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lateInvoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","part_paid","paid","void"]},"shown":{"type":"string","enum":["draft","sent","part_paid","paid","void","late"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"credited":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeOpen":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daysLate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remindersSent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","kind","number","status","shown","customerId","customerName","issueDate","dueDate","summary","currency","fxRate","net","vat","sscl","total","paid","credited","open","homeTotal","homeOpen","daysLate","remindersSent"],"additionalProperties":false}},"onTheWayInvoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","part_paid","paid","void"]},"shown":{"type":"string","enum":["draft","sent","part_paid","paid","void","late"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"credited":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeOpen":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daysLate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remindersSent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","kind","number","status","shown","customerId","customerName","issueDate","dueDate","summary","currency","fxRate","net","vat","sscl","total","paid","credited","open","homeTotal","homeOpen","daysLate","remindersSent"],"additionalProperties":false}},"recent":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","part_paid","paid","void"]},"shown":{"type":"string","enum":["draft","sent","part_paid","paid","void","late"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"credited":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeOpen":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daysLate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remindersSent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","kind","number","status","shown","customerId","customerName","issueDate","dueDate","summary","currency","fxRate","net","vat","sscl","total","paid","credited","open","homeTotal","homeOpen","daysLate","remindersSent"],"additionalProperties":false}},"counts":{"type":"object","properties":{"unpaid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"late":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"drafts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"quotesWaiting":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"recurringActive":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customers":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"items":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["unpaid","late","drafts","quotesWaiting","recurringActive","customers","items"],"additionalProperties":false},"numbers":{"type":"object","properties":{"invoice":{"type":"string"},"quote":{"type":"string"},"creditNote":{"type":"string"}},"required":["invoice","quote","creditNote"],"additionalProperties":false}},"required":["period","periods","received","onTheWay","total","late","lateCount","lateInvoices","onTheWayInvoices","recent","counts","numbers"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/customers":{"get":{"operationId":"list_customers","summary":"Customers, optionally matching a search","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":100}},{"name":"archived","in":"query","required":false,"schema":{"default":"false","type":"string","enum":["true","false","all"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"customers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"contactName":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"type":["string","null"]},"taxId":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"notes":{"type":["string","null"]},"currency":{"type":["string","null"]},"archived":{"type":"boolean"},"createdAt":{"type":"string"},"owed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"late":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"openCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","contactName","email","phone","address","taxId","vatNumber","notes","currency","archived","createdAt","owed","late","paid","openCount"],"additionalProperties":false}}},"required":["customers"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/customers/{id}":{"get":{"operationId":"get_customer","summary":"One customer with their invoices, quotes and what they paid this year","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"contactName":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"type":["string","null"]},"taxId":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"notes":{"type":["string","null"]},"currency":{"type":["string","null"]},"archived":{"type":"boolean"},"createdAt":{"type":"string"},"owed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"late":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"openCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","contactName","email","phone","address","taxId","vatNumber","notes","currency","archived","createdAt","owed","late","paid","openCount"],"additionalProperties":false},"paidThisYear":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"yearLabel":{"type":"string"},"invoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","part_paid","paid","void"]},"shown":{"type":"string","enum":["draft","sent","part_paid","paid","void","late"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"credited":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeOpen":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daysLate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remindersSent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","kind","number","status","shown","customerId","customerName","issueDate","dueDate","summary","currency","fxRate","net","vat","sscl","total","paid","credited","open","homeTotal","homeOpen","daysLate","remindersSent"],"additionalProperties":false}},"creditNotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","part_paid","paid","void"]},"shown":{"type":"string","enum":["draft","sent","part_paid","paid","void","late"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"credited":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeOpen":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daysLate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remindersSent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","kind","number","status","shown","customerId","customerName","issueDate","dueDate","summary","currency","fxRate","net","vat","sscl","total","paid","credited","open","homeTotal","homeOpen","daysLate","remindersSent"],"additionalProperties":false}},"quotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","accepted","declined","invoiced"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"expiryDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoiceId":{"type":["string","null"]},"invoiceNumber":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"decidedAt":{"type":["string","null"]}},"required":["id","number","status","customerId","customerName","issueDate","expiryDate","summary","currency","fxRate","net","vat","sscl","total","homeTotal","invoiceId","invoiceNumber","sentAt","decidedAt"],"additionalProperties":false}},"recurring":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"customerId":{"type":"string"},"customerName":{"type":"string"},"frequency":{"type":"string","enum":["weekly","monthly","quarterly","yearly"]},"nextRun":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endDate":{"type":["string","null"]},"mode":{"type":"string","enum":["draft","send"]},"currency":{"type":"string"},"active":{"type":"boolean"},"lastRunAt":{"type":["string","null"]},"termsDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"notes":{"type":["string","null"]},"reference":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"itemId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"description":{"type":"string","minLength":1,"maxLength":500},"quantityMilli":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"unitPrice":{"type":"integer","minimum":0,"maximum":9007199254740991},"discount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vatRateId":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"sscl":{"type":"boolean"},"section":{"anyOf":[{"type":"string","enum":["time","materials"]},{"type":"null"}]},"workDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"person":{},"costPrice":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"markupBps":{"anyOf":[{"type":"integer","minimum":0,"maximum":100000},{"type":"null"}]}},"required":["description","quantityMilli","unitPrice","discount","sscl","person"],"additionalProperties":false}},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoiceCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"upcoming":{"type":"array","items":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}},"required":["id","name","customerId","customerName","frequency","nextRun","endDate","mode","currency","active","lastRunAt","termsDays","notes","reference","lines","net","vat","sscl","total","invoiceCount","upcoming"],"additionalProperties":false}}},"required":["customer","paidThisYear","yearLabel","invoices","creditNotes","quotes","recurring"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/items":{"get":{"operationId":"list_items","summary":"Saved products and services","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":100}},{"name":"archived","in":"query","required":false,"schema":{"default":"false","type":"string","enum":["true","false","all"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"unit":{"type":["string","null"]},"unitPrice":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vatRateId":{"type":["string","null"]},"sscl":{"type":"boolean"},"archived":{"type":"boolean"},"usedCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","description","unit","unitPrice","vatRateId","sscl","archived","usedCount"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/invoices":{"get":{"operationId":"list_invoices","summary":"Invoices and credit notes, filtered by status or customer","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"default":"all","type":"string","enum":["all","draft","unpaid","late","paid","void","sent","part_paid"]}},{"name":"kind","in":"query","required":false,"schema":{"default":"invoice","type":"string","enum":["invoice","credit_note"]}},{"name":"customerId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"invoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","part_paid","paid","void"]},"shown":{"type":"string","enum":["draft","sent","part_paid","paid","void","late"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"credited":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeOpen":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daysLate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remindersSent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","kind","number","status","shown","customerId","customerName","issueDate","dueDate","summary","currency","fxRate","net","vat","sscl","total","paid","credited","open","homeTotal","homeOpen","daysLate","remindersSent"],"additionalProperties":false}},"totals":{"type":"object","properties":{"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"late":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["count","total","open","late","paid"],"additionalProperties":false},"counts":{"type":"object","properties":{"all":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"draft":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unpaid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"late":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"void":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["all","draft","unpaid","late","paid","void"],"additionalProperties":false}},"required":["invoices","totals","counts"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/invoices/{id}":{"get":{"operationId":"get_invoice","summary":"One invoice with its lines, payments and history","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","part_paid","paid","void"]},"shown":{"type":"string","enum":["draft","sent","part_paid","paid","void","late"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"credited":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeOpen":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daysLate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remindersSent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"title":{"type":"string"},"billing":{"type":"string","enum":["items","time_materials","fixed"]},"supplyDate":{"type":["string","null"]},"reference":{"type":["string","null"]},"notes":{"type":["string","null"]},"vatRegistered":{"type":"boolean"},"snapshot":{"anyOf":[{"type":"object","properties":{"title":{"type":"string"},"seller":{"type":"object","properties":{"name":{"type":"string"},"legalName":{"type":["string","null"]},"address":{"type":"string"},"taxId":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]}},"required":["name","address"],"additionalProperties":false},"buyer":{"type":"object","properties":{"name":{"type":"string"},"address":{"type":["string","null"]},"taxId":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["name"],"additionalProperties":false},"paymentDetails":{"type":["string","null"]},"note":{"type":["string","null"]}},"required":["title","seller","buyer"],"additionalProperties":false},{"type":"null"}]},"customer":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"type":["string","null"]},"taxId":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"currency":{"type":["string","null"]}},"required":["id","name","email","phone","address","taxId","vatNumber","currency"],"additionalProperties":false},"homeNet":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeVat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeSscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"itemId":{"type":["string","null"]},"description":{"type":"string"},"quantityMilli":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unitPrice":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vatRateId":{"type":["string","null"]},"vatBps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"boolean"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ssclAmount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"section":{"anyOf":[{"type":"string","enum":["time","materials"]},{"type":"null"}]},"workDate":{"type":["string","null"]},"person":{"type":["string","null"]},"costPrice":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"markupBps":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","position","itemId","description","quantityMilli","unitPrice","discount","vatRateId","vatBps","sscl","net","ssclAmount","vat","total","section","workDate","person","costPrice","markupBps"],"additionalProperties":false}},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeAmount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"fxGain":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"method":{"type":"string"},"receivedOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"reference":{"type":["string","null"]},"chequeNumber":{"type":["string","null"]},"chequeDate":{"type":["string","null"]},"chequeBank":{"type":["string","null"]},"voided":{"type":"boolean"}},"required":["id","amount","homeAmount","fxGain","method","receivedOn","reference","chequeNumber","chequeDate","chequeBank","voided"],"additionalProperties":false}},"creditNotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","number","issueDate","total"],"additionalProperties":false}},"creditFor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]}},"required":["id","number"],"additionalProperties":false},{"type":"null"}]},"quote":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]}},"required":["id","number"],"additionalProperties":false},{"type":"null"}]},"recurringId":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"lastReminderAt":{"type":["string","null"]},"activity":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"at":{"type":"string"}},"required":["message","at"],"additionalProperties":false}},"emails":{"type":"array","items":{"type":"object","properties":{"to":{"type":"string"},"subject":{"type":"string"},"status":{"type":"string"},"at":{"type":"string"}},"required":["to","subject","status","at"],"additionalProperties":false}}},"required":["id","kind","number","status","shown","customerId","customerName","issueDate","dueDate","summary","currency","fxRate","net","vat","sscl","total","paid","credited","open","homeTotal","homeOpen","daysLate","remindersSent","title","billing","supplyDate","reference","notes","vatRegistered","snapshot","customer","homeNet","homeVat","homeSscl","lines","receipts","creditNotes","creditFor","quote","recurringId","sentAt","lastReminderAt","activity","emails"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/quotes":{"get":{"operationId":"list_quotes","summary":"Quotes","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"default":"all","type":"string","enum":["all","draft","sent","accepted","declined","invoiced"]}},{"name":"customerId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"quotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","accepted","declined","invoiced"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"expiryDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoiceId":{"type":["string","null"]},"invoiceNumber":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"decidedAt":{"type":["string","null"]}},"required":["id","number","status","customerId","customerName","issueDate","expiryDate","summary","currency","fxRate","net","vat","sscl","total","homeTotal","invoiceId","invoiceNumber","sentAt","decidedAt"],"additionalProperties":false}},"totals":{"type":"object","properties":{"waiting":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"draft":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"accepted":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["waiting","draft","accepted"],"additionalProperties":false}},"required":["quotes","totals"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/quotes/{id}":{"get":{"operationId":"get_quote","summary":"One quote with its lines","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","accepted","declined","invoiced"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"expiryDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoiceId":{"type":["string","null"]},"invoiceNumber":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"notes":{"type":["string","null"]},"vatRegistered":{"type":"boolean"},"customer":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"type":["string","null"]},"taxId":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"currency":{"type":["string","null"]}},"required":["id","name","email","phone","address","taxId","vatNumber","currency"],"additionalProperties":false},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"itemId":{"type":["string","null"]},"description":{"type":"string"},"quantityMilli":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unitPrice":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"discount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vatRateId":{"type":["string","null"]},"vatBps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"boolean"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ssclAmount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"section":{"anyOf":[{"type":"string","enum":["time","materials"]},{"type":"null"}]},"workDate":{"type":["string","null"]},"person":{"type":["string","null"]},"costPrice":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"markupBps":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","position","itemId","description","quantityMilli","unitPrice","discount","vatRateId","vatBps","sscl","net","ssclAmount","vat","total","section","workDate","person","costPrice","markupBps"],"additionalProperties":false}},"activity":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"at":{"type":"string"}},"required":["message","at"],"additionalProperties":false}}},"required":["id","number","status","customerId","customerName","issueDate","expiryDate","summary","currency","fxRate","net","vat","sscl","total","homeTotal","invoiceId","invoiceNumber","sentAt","decidedAt","notes","vatRegistered","customer","lines","activity"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/recurring":{"get":{"operationId":"list_recurring_invoices","summary":"Invoices that repeat on a schedule","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"recurring":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"customerId":{"type":"string"},"customerName":{"type":"string"},"frequency":{"type":"string","enum":["weekly","monthly","quarterly","yearly"]},"nextRun":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endDate":{"type":["string","null"]},"mode":{"type":"string","enum":["draft","send"]},"currency":{"type":"string"},"active":{"type":"boolean"},"lastRunAt":{"type":["string","null"]},"termsDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"notes":{"type":["string","null"]},"reference":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"itemId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"description":{"type":"string","minLength":1,"maxLength":500},"quantityMilli":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"unitPrice":{"type":"integer","minimum":0,"maximum":9007199254740991},"discount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vatRateId":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"sscl":{"type":"boolean"},"section":{"anyOf":[{"type":"string","enum":["time","materials"]},{"type":"null"}]},"workDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"person":{},"costPrice":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"markupBps":{"anyOf":[{"type":"integer","minimum":0,"maximum":100000},{"type":"null"}]}},"required":["description","quantityMilli","unitPrice","discount","sscl","person"],"additionalProperties":false}},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoiceCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"upcoming":{"type":"array","items":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}},"required":["id","name","customerId","customerName","frequency","nextRun","endDate","mode","currency","active","lastRunAt","termsDays","notes","reference","lines","net","vat","sscl","total","invoiceCount","upcoming"],"additionalProperties":false}},"monthly":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["recurring","monthly"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/recurring/{id}":{"get":{"operationId":"get_recurring_invoice","summary":"One repeating invoice and the invoices it made","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"customerId":{"type":"string"},"customerName":{"type":"string"},"frequency":{"type":"string","enum":["weekly","monthly","quarterly","yearly"]},"nextRun":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endDate":{"type":["string","null"]},"mode":{"type":"string","enum":["draft","send"]},"currency":{"type":"string"},"active":{"type":"boolean"},"lastRunAt":{"type":["string","null"]},"termsDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"notes":{"type":["string","null"]},"reference":{"type":["string","null"]},"lines":{"type":"array","items":{"type":"object","properties":{"itemId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"description":{"type":"string","minLength":1,"maxLength":500},"quantityMilli":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"unitPrice":{"type":"integer","minimum":0,"maximum":9007199254740991},"discount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vatRateId":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"sscl":{"type":"boolean"},"section":{"anyOf":[{"type":"string","enum":["time","materials"]},{"type":"null"}]},"workDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"person":{},"costPrice":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"markupBps":{"anyOf":[{"type":"integer","minimum":0,"maximum":100000},{"type":"null"}]}},"required":["description","quantityMilli","unitPrice","discount","sscl","person"],"additionalProperties":false}},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invoiceCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"upcoming":{"type":"array","items":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"invoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":["string","null"]},"status":{"type":"string","enum":["draft","sent","part_paid","paid","void"]},"shown":{"type":"string","enum":["draft","sent","part_paid","paid","void","late"]},"customerId":{"type":"string"},"customerName":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sscl":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"credited":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeOpen":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"daysLate":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remindersSent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","kind","number","status","shown","customerId","customerName","issueDate","dueDate","summary","currency","fxRate","net","vat","sscl","total","paid","credited","open","homeTotal","homeOpen","daysLate","remindersSent"],"additionalProperties":false}}},"required":["id","name","customerId","customerName","frequency","nextRun","endDate","mode","currency","active","lastRunAt","termsDays","notes","reference","lines","net","vat","sscl","total","invoiceCount","upcoming","invoices"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/summary":{"get":{"operationId":"money_out_summary","summary":"Spending by category, bills to pay and suppliers for a period","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","enum":["month","quarter","year"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"today":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"period":{"type":"object","properties":{"key":{"type":"string","enum":["month","quarter","year"]},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"label":{"type":"string"}},"required":["key","from","to","label"],"additionalProperties":false},"periods":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","enum":["month","quarter","year"]},"label":{"type":"string"}},"required":["key","label"],"additionalProperties":false}},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"toPay":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"dueSoon":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"dueSoonCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"needs":{"type":"object","properties":{"uncategorised":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"dueSoonBills":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"overdueBills":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["uncategorised","dueSoonBills","overdueBills"],"additionalProperties":false},"counts":{"type":"object","properties":{"suppliers":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"openBills":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"openBillsTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthlyCosts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"monthlyToPay":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["suppliers","openBills","openBillsTotal","monthlyCosts","monthlyToPay"],"additionalProperties":false}},"required":["today","period","periods","paid","toPay","total","dueSoon","dueSoonCount","needs","counts"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/money":{"get":{"operationId":"money_out","summary":"Money paid out and still to pay","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","enum":["month","quarter","year"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"paid":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["expense","bill_payment","bill","monthly"]},"id":{"type":"string"},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"name":{"type":"string"},"detail":{"type":"string"},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"href":{"type":"string"},"due":{"anyOf":[{"type":"string","enum":["overdue","due_soon","due","late"]},{"type":"null"}]},"billId":{"type":["string","null"]},"monthlyCostId":{"type":["string","null"]},"uncategorised":{"type":"boolean"}},"required":["kind","id","date","name","detail","amount","href","due","billId","monthlyCostId","uncategorised"],"additionalProperties":false}},"toPay":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["expense","bill_payment","bill","monthly"]},"id":{"type":"string"},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"name":{"type":"string"},"detail":{"type":"string"},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"href":{"type":"string"},"due":{"anyOf":[{"type":"string","enum":["overdue","due_soon","due","late"]},{"type":"null"}]},"billId":{"type":["string","null"]},"monthlyCostId":{"type":["string","null"]},"uncategorised":{"type":"boolean"}},"required":["kind","id","date","name","detail","amount","href","due","billId","monthlyCostId","uncategorised"],"additionalProperties":false}}},"required":["paid","toPay"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/categories":{"get":{"operationId":"list_categories","summary":"Spending categories and payment methods for the business's country","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"country":{"type":"string","enum":["uk","lk","us"]},"currency":{"type":"string","enum":["GBP","LKR","USD"]},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"official":{"type":"string"},"allowable":{"type":"boolean"},"scope":{"type":"string","enum":["business","property"]},"capital":{"type":"boolean"}},"required":["id","name","official","allowable","scope","capital"],"additionalProperties":false}},"payMethods":{"type":"array","items":{"type":"string"}},"vatRegistered":{"type":"boolean"},"hasProperty":{"type":"boolean"},"businessUse":{"type":"boolean"},"categorySource":{"type":"string"},"vatRates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"bps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","label","bps"],"additionalProperties":false}},"defaultVatBps":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"today":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["country","currency","categories","payMethods","vatRegistered","hasProperty","businessUse","categorySource","vatRates","defaultVatBps","today"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/suppliers":{"get":{"operationId":"list_suppliers","summary":"Suppliers","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":100}},{"name":"archived","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"suppliers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"contactName":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"defaultCategoryId":{"type":["string","null"]},"defaultCategoryName":{"type":["string","null"]},"notes":{"type":["string","null"]},"currency":{"type":["string","null"]},"archived":{"type":"boolean"},"paidThisYear":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"owed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"openBills":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","contactName","email","phone","address","vatNumber","defaultCategoryId","defaultCategoryName","notes","currency","archived","paidThisYear","owed","openBills"],"additionalProperties":false}},"taxYear":{"type":"string"},"paidThisYear":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"owed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"openBills":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["suppliers","taxYear","paidThisYear","owed","openBills"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/suppliers/{id}":{"get":{"operationId":"get_supplier","summary":"One supplier with their expenses, bills and payments","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"supplier":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"contactName":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"type":["string","null"]},"vatNumber":{"type":["string","null"]},"defaultCategoryId":{"type":["string","null"]},"defaultCategoryName":{"type":["string","null"]},"notes":{"type":["string","null"]},"currency":{"type":["string","null"]},"archived":{"type":"boolean"},"paidThisYear":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"owed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"openBills":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","contactName","email","phone","address","vatNumber","defaultCategoryId","defaultCategoryName","notes","currency","archived","paidThisYear","owed","openBills"],"additionalProperties":false},"expenses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"spentOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"supplierId":{"type":["string","null"]},"payee":{"type":"string"},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categoryOfficial":{"type":["string","null"]},"gross":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"currency":{"type":["string","null"]},"fxRate":{"type":["string","null"]},"originalGross":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"originalVat":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"bizPct":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"businessShare":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"method":{"type":"string"},"chequeNumber":{"type":["string","null"]},"chequeDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"chequeBank":{"type":["string","null"]},"note":{"type":["string","null"]},"monthlyCostId":{"type":["string","null"]},"attachmentCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdByName":{"type":["string","null"]},"createdVia":{"type":"string","enum":["manual","agent","api"]},"createdAt":{"type":"string"}},"required":["id","spentOn","supplierId","payee","categoryId","categoryName","categoryOfficial","gross","vat","currency","fxRate","originalGross","originalVat","bizPct","businessShare","method","chequeNumber","chequeDate","chequeBank","note","monthlyCostId","attachmentCount","createdByName","createdVia","createdAt"],"additionalProperties":false}},"bills":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"supplierId":{"type":"string"},"supplierName":{"type":"string"},"reference":{"type":["string","null"]},"billDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"left":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeLeft":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string","enum":["unpaid","part_paid","paid","void"]},"due":{"type":"string","enum":["paid","void","overdue","due_soon","due"]},"daysToDue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastPaidOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","supplierId","supplierName","reference","billDate","dueDate","description","currency","fxRate","net","vat","total","paid","left","homeTotal","homeLeft","status","due","daysToDue","lastPaidOn","attachmentCount"],"additionalProperties":false}},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeAmount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"fxGain":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paidOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"method":{"type":"string"},"chequeNumber":{"type":["string","null"]},"chequeDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"chequeBank":{"type":["string","null"]},"reference":{"type":["string","null"]},"billId":{"type":"string"},"billReference":{"type":["string","null"]}},"required":["id","amount","homeAmount","fxGain","paidOn","method","chequeNumber","chequeDate","chequeBank","reference","billId","billReference"],"additionalProperties":false}},"monthlyCosts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"supplierId":{"type":["string","null"]},"supplierName":{"type":["string","null"]},"categoryId":{"type":"string"},"categoryName":{"type":"string"},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"method":{"type":"string"},"dayOfMonth":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"state":{"type":"string","enum":["recorded","due","late","paused"]},"dueOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"recordedOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"recordedExpenseId":{"type":["string","null"]},"nextOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","name","supplierId","supplierName","categoryId","categoryName","amount","vat","method","dayOfMonth","active","state","dueOn","recordedOn","recordedExpenseId","nextOn"],"additionalProperties":false}},"taxYear":{"type":"string"}},"required":["supplier","expenses","bills","payments","monthlyCosts","taxYear"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/expenses":{"get":{"operationId":"list_expenses","summary":"Expenses, filtered by category, supplier or dates","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"uncategorised","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"name":"supplierId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"expenses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"spentOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"supplierId":{"type":["string","null"]},"payee":{"type":"string"},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categoryOfficial":{"type":["string","null"]},"gross":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"currency":{"type":["string","null"]},"fxRate":{"type":["string","null"]},"originalGross":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"originalVat":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"bizPct":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"businessShare":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"method":{"type":"string"},"chequeNumber":{"type":["string","null"]},"chequeDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"chequeBank":{"type":["string","null"]},"note":{"type":["string","null"]},"monthlyCostId":{"type":["string","null"]},"attachmentCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdByName":{"type":["string","null"]},"createdVia":{"type":"string","enum":["manual","agent","api"]},"createdAt":{"type":"string"}},"required":["id","spentOn","supplierId","payee","categoryId","categoryName","categoryOfficial","gross","vat","currency","fxRate","originalGross","originalVat","bizPct","businessShare","method","chequeNumber","chequeDate","chequeBank","note","monthlyCostId","attachmentCount","createdByName","createdVia","createdAt"],"additionalProperties":false}},"totals":{"type":"object","properties":{"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"gross":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"businessShare":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["count","gross","vat","businessShare"],"additionalProperties":false}},"required":["expenses","totals"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/expenses/{id}":{"get":{"operationId":"get_expense","summary":"One expense","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"expense":{"type":"object","properties":{"id":{"type":"string"},"spentOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"supplierId":{"type":["string","null"]},"payee":{"type":"string"},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categoryOfficial":{"type":["string","null"]},"gross":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"currency":{"type":["string","null"]},"fxRate":{"type":["string","null"]},"originalGross":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"originalVat":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"bizPct":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"businessShare":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"method":{"type":"string"},"chequeNumber":{"type":["string","null"]},"chequeDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"chequeBank":{"type":["string","null"]},"note":{"type":["string","null"]},"monthlyCostId":{"type":["string","null"]},"attachmentCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdByName":{"type":["string","null"]},"createdVia":{"type":"string","enum":["manual","agent","api"]},"createdAt":{"type":"string"}},"required":["id","spentOn","supplierId","payee","categoryId","categoryName","categoryOfficial","gross","vat","currency","fxRate","originalGross","originalVat","bizPct","businessShare","method","chequeNumber","chequeDate","chequeBank","note","monthlyCostId","attachmentCount","createdByName","createdVia","createdAt"],"additionalProperties":false},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ownerType":{"type":"string","enum":["expense","bill"]},"ownerId":{"type":"string"},"filename":{"type":"string"},"mime":{"type":"string"},"size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"}},"required":["id","ownerType","ownerId","filename","mime","size","createdAt"],"additionalProperties":false}}},"required":["expense","attachments"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/bills":{"get":{"operationId":"list_bills","summary":"Bills from suppliers","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["unpaid","part_paid","paid","void","open","all"]}},{"name":"due","in":"query","required":false,"schema":{"type":"string","enum":["soon","overdue"]}},{"name":"supplierId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"bills":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"supplierId":{"type":"string"},"supplierName":{"type":"string"},"reference":{"type":["string","null"]},"billDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"left":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeLeft":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string","enum":["unpaid","part_paid","paid","void"]},"due":{"type":"string","enum":["paid","void","overdue","due_soon","due"]},"daysToDue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastPaidOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","supplierId","supplierName","reference","billDate","dueDate","description","currency","fxRate","net","vat","total","paid","left","homeTotal","homeLeft","status","due","daysToDue","lastPaidOn","attachmentCount"],"additionalProperties":false}},"totals":{"type":"object","properties":{"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"openCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"overdue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"overdueCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"dueSoon":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"dueSoonCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["open","openCount","overdue","overdueCount","dueSoon","dueSoonCount"],"additionalProperties":false}},"required":["bills","totals"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/bills/{id}":{"get":{"operationId":"get_bill","summary":"One bill with its payments","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"bill":{"type":"object","properties":{"id":{"type":"string"},"supplierId":{"type":"string"},"supplierName":{"type":"string"},"reference":{"type":["string","null"]},"billDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":{"type":"string"},"currency":{"type":"string"},"fxRate":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"left":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeTotal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeLeft":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string","enum":["unpaid","part_paid","paid","void"]},"due":{"type":"string","enum":["paid","void","overdue","due_soon","due"]},"daysToDue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastPaidOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","supplierId","supplierName","reference","billDate","dueDate","description","currency","fxRate","net","vat","total","paid","left","homeTotal","homeLeft","status","due","daysToDue","lastPaidOn","attachmentCount"],"additionalProperties":false},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"},"categoryId":{"type":"string"},"categoryName":{"type":"string"},"categoryOfficial":{"type":"string"},"net":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","description","categoryId","categoryName","categoryOfficial","net","vat"],"additionalProperties":false}},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"homeAmount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"fxGain":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"paidOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"method":{"type":"string"},"chequeNumber":{"type":["string","null"]},"chequeDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"chequeBank":{"type":["string","null"]},"reference":{"type":["string","null"]}},"required":["id","amount","homeAmount","fxGain","paidOn","method","chequeNumber","chequeDate","chequeBank","reference"],"additionalProperties":false}},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ownerType":{"type":"string","enum":["expense","bill"]},"ownerId":{"type":"string"},"filename":{"type":"string"},"mime":{"type":"string"},"size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"}},"required":["id","ownerType","ownerId","filename","mime","size","createdAt"],"additionalProperties":false}},"history":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"text":{"type":"string"}},"required":["date","text"],"additionalProperties":false}}},"required":["bill","lines","payments","attachments","history"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/out/monthly":{"get":{"operationId":"list_monthly_costs","summary":"Costs that repeat every month","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"month":{"type":"object","properties":{"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"label":{"type":"string"}},"required":["from","to","label"],"additionalProperties":false},"costs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"supplierId":{"type":["string","null"]},"supplierName":{"type":["string","null"]},"categoryId":{"type":"string"},"categoryName":{"type":"string"},"amount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"vat":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"method":{"type":"string"},"dayOfMonth":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"state":{"type":"string","enum":["recorded","due","late","paused"]},"dueOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"recordedOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"recordedExpenseId":{"type":["string","null"]},"nextOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","name","supplierId","supplierName","categoryId","categoryName","amount","vat","method","dayOfMonth","active","state","dueOn","recordedOn","recordedExpenseId","nextOn"],"additionalProperties":false}},"totals":{"type":"object","properties":{"perMonth":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"recorded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"toPay":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"toPayCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["perMonth","recorded","toPay","toPayCount"],"additionalProperties":false}},"required":["month","costs","totals"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/proposals":{"get":{"operationId":"list_proposals","summary":"Suggestions waiting for a person, or already decided","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"status","in":"query","required":false,"schema":{"default":"pending","type":"string","enum":["pending","decided","all"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"proposals":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"agent":{"type":"string"},"agentName":{"type":"string"},"kind":{"type":"string","enum":["expense.create","bill.create","receipt.create","bill_payment.create","invoice.remind"]},"targetId":{"type":["string","null"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"title":{"type":"string"},"summary":{"type":"string"},"confidence":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"sources":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["attachment","statement_line","invoice","bill","expense","note"]},"id":{"type":"string"},"label":{"type":"string"},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["kind","label"],"additionalProperties":false}},"status":{"type":"string","enum":["pending","applying","applied","rejected","expired","failed"]},"proposedBy":{"type":"string","enum":["agent","api_client","practice"]},"edits":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","prefixItems":[{},{}],"items":false,"minItems":2,"maxItems":2}},{"type":"null"}]},"decidedBy":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"reason":{"type":["string","null"]},"appliedHref":{"type":["string","null"]},"error":{"type":["string","null"]},"result":{"anyOf":[{"type":"object","properties":{"whatsappUrl":{"type":["string","null"]},"emailed":{"type":"boolean"}},"additionalProperties":{}},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","agent","agentName","kind","targetId","payload","title","summary","confidence","sources","status","proposedBy","edits","decidedBy","decidedAt","reason","appliedHref","error","result","createdAt"],"additionalProperties":false}},"pending":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["proposals","pending"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"propose","summary":"Suggest an expense, bill, payment or reminder for a person to approve","security":[{"bearer":[]},{"oauth":["books:propose"]}],"x-scope":"books:propose","requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"expense.create"},"payload":{"type":"object","properties":{"spentOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"supplierId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string","maxLength":160},{"type":"null"}]},"categoryId":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"gross":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"vat":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991},"currency":{"type":["string","null"]},"fxRate":{"type":["string","number","null"]},"homeGross":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"bizPct":{"default":100,"type":"integer","minimum":1,"maximum":100},"method":{"type":"string","minLength":1},"chequeNumber":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"chequeDate":{"anyOf":[{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"string","const":""}]},{"type":"null"}]},"chequeBank":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}]},"note":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]}},"required":["spentOn","gross","method"]},"title":{"type":"string","minLength":3,"maxLength":200,"description":"One line the person sees, e.g. “Ochre Café, £12.40”"},"summary":{"type":"string","minLength":1,"maxLength":1000,"description":"Why: where it came from and anything to check"},"confidence":{"description":"How sure you are, 0–100","type":"integer","minimum":0,"maximum":100}},"required":["kind","payload","title","summary"]},{"type":"object","properties":{"kind":{"type":"string","const":"bill.create"},"payload":{"type":"object","properties":{"supplierId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"supplierName":{"anyOf":[{"type":"string","maxLength":160},{"type":"null"}]},"reference":{"anyOf":[{"type":"string","maxLength":60},{"type":"null"}]},"billDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"currency":{"type":["string","null"]},"fxRate":{"type":["string","number","null"]},"lines":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":300},"categoryId":{"type":"string","minLength":1,"maxLength":40},"net":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"vat":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["description","categoryId","net"]}}},"required":["billDate","dueDate","lines"]},"title":{"type":"string","minLength":3,"maxLength":200,"description":"One line the person sees, e.g. “Ochre Café, £12.40”"},"summary":{"type":"string","minLength":1,"maxLength":1000,"description":"Why: where it came from and anything to check"},"confidence":{"description":"How sure you are, 0–100","type":"integer","minimum":0,"maximum":100}},"required":["kind","payload","title","summary"]},{"type":"object","properties":{"kind":{"type":"string","const":"receipt.create"},"invoiceId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The invoice that was paid"},"payload":{"type":"object","properties":{"amount":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"homeAmount":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"receivedOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"method":{"type":"string","minLength":1},"reference":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"chequeNumber":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"chequeDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"chequeBank":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}]}},"required":["amount","receivedOn","method"]},"title":{"type":"string","minLength":3,"maxLength":200,"description":"One line the person sees, e.g. “Ochre Café, £12.40”"},"summary":{"type":"string","minLength":1,"maxLength":1000,"description":"Why: where it came from and anything to check"},"confidence":{"description":"How sure you are, 0–100","type":"integer","minimum":0,"maximum":100}},"required":["kind","invoiceId","payload","title","summary"]},{"type":"object","properties":{"kind":{"type":"string","const":"bill_payment.create"},"billId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The bill that was paid"},"payload":{"type":"object","properties":{"amount":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"homeAmount":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"paidOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"method":{"type":"string","minLength":1},"chequeNumber":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"chequeDate":{"anyOf":[{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"string","const":""}]},{"type":"null"}]},"chequeBank":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}]},"reference":{"anyOf":[{"type":"string","maxLength":60},{"type":"null"}]}},"required":["amount","paidOn","method"]},"title":{"type":"string","minLength":3,"maxLength":200,"description":"One line the person sees, e.g. “Ochre Café, £12.40”"},"summary":{"type":"string","minLength":1,"maxLength":1000,"description":"Why: where it came from and anything to check"},"confidence":{"description":"How sure you are, 0–100","type":"integer","minimum":0,"maximum":100}},"required":["kind","billId","payload","title","summary"]},{"type":"object","properties":{"kind":{"type":"string","const":"invoice.remind"},"invoiceId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The late invoice"},"payload":{"type":"object","properties":{"message":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"email":{"default":true,"type":"boolean"}}},"title":{"type":"string","minLength":3,"maxLength":200,"description":"One line the person sees, e.g. “Ochre Café, £12.40”"},"summary":{"type":"string","minLength":1,"maxLength":1000,"description":"Why: where it came from and anything to check"},"confidence":{"description":"How sure you are, 0–100","type":"integer","minimum":0,"maximum":100}},"required":["kind","invoiceId","payload","title","summary"]}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"agent":{"type":"string"},"agentName":{"type":"string"},"kind":{"type":"string","enum":["expense.create","bill.create","receipt.create","bill_payment.create","invoice.remind"]},"targetId":{"type":["string","null"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"title":{"type":"string"},"summary":{"type":"string"},"confidence":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"sources":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["attachment","statement_line","invoice","bill","expense","note"]},"id":{"type":"string"},"label":{"type":"string"},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["kind","label"],"additionalProperties":false}},"status":{"type":"string","enum":["pending","applying","applied","rejected","expired","failed"]},"proposedBy":{"type":"string","enum":["agent","api_client","practice"]},"edits":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","prefixItems":[{},{}],"items":false,"minItems":2,"maxItems":2}},{"type":"null"}]},"decidedBy":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"reason":{"type":["string","null"]},"appliedHref":{"type":["string","null"]},"error":{"type":["string","null"]},"result":{"anyOf":[{"type":"object","properties":{"whatsappUrl":{"type":["string","null"]},"emailed":{"type":"boolean"}},"additionalProperties":{}},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","agent","agentName","kind","targetId","payload","title","summary","confidence","sources","status","proposedBy","edits","decidedBy","decidedAt","reason","appliedHref","error","result","createdAt"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/proposals/{id}":{"get":{"operationId":"get_proposal","summary":"One suggestion: whether it was approved, and where it landed","security":[{"bearer":[]},{"oauth":["books:read"]}],"x-scope":"books:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"agent":{"type":"string"},"agentName":{"type":"string"},"kind":{"type":"string","enum":["expense.create","bill.create","receipt.create","bill_payment.create","invoice.remind"]},"targetId":{"type":["string","null"]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"title":{"type":"string"},"summary":{"type":"string"},"confidence":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"sources":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["attachment","statement_line","invoice","bill","expense","note"]},"id":{"type":"string"},"label":{"type":"string"},"page":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["kind","label"],"additionalProperties":false}},"status":{"type":"string","enum":["pending","applying","applied","rejected","expired","failed"]},"proposedBy":{"type":"string","enum":["agent","api_client","practice"]},"edits":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","prefixItems":[{},{}],"items":false,"minItems":2,"maxItems":2}},{"type":"null"}]},"decidedBy":{"type":["string","null"]},"decidedAt":{"type":["string","null"]},"reason":{"type":["string","null"]},"appliedHref":{"type":["string","null"]},"error":{"type":["string","null"]},"result":{"anyOf":[{"type":"object","properties":{"whatsappUrl":{"type":["string","null"]},"emailed":{"type":"boolean"}},"additionalProperties":{}},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","agent","agentName","kind","targetId","payload","title","summary","confidence","sources","status","proposedBy","edits","decidedBy","decidedAt","reason","appliedHref","error","result","createdAt"],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Refused, with the reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"A personal access token from Settings → Apps and API, or an OAuth access token."},"oauth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://billingease.app/oauth/authorize","tokenUrl":"https://billingease.app/oauth/token","refreshUrl":"https://billingease.app/oauth/token","scopes":{"books:read":"Read your books","books:propose":"Suggest changes for you to approve"}}}}}}}