{"info":{"title":"Allmoni API","version":"1"},"servers":[{"url":"https://api.allmoni.com/api"}],"openapi":"3.1.1","paths":{"/system/health":{"get":{"operationId":"system.health","summary":"Check the API is up, its build, the worker’s last heartbeat and attachments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true},"build":{"type":"string"},"heartbeatAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"attachments":{"enum":["ready","unavailable"],"type":"string"},"maintenance":{"type":"boolean"},"edgeAttested":{"type":"boolean"}},"required":["ok","build","heartbeatAt","attachments","maintenance"]}}}}}}},"/access/me":{"get":{"operationId":"access.me","summary":"Get the signed-in person, their household and the books they can open","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"}},"required":["id","name","email"]},"tenant":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"hasBooks":{"type":"boolean"}},"required":["id","name","hasBooks"]},"books":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"enum":["owner","editor","viewer"],"type":"string"}},"required":["id","name","role"]}}},"required":["user","tenant","books"]}}}}}}},"/books/list":{"get":{"operationId":"books.list","summary":"List the caller’s books, archived ones too, oldest first","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"memberCount":{"type":"integer","minimum":1,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","pattern":"^data:image\\/.*"}},"required":["kind","image"]}]},"linksBanks":{"type":"boolean"}},"required":["id","name","baseCurrency","role","memberCount","createdAt","archivedAt","icon","linksBanks"]}}}}}}}},"/books/create":{"post":{"operationId":"books.create","summary":"Start a new book; the caller becomes its owner","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["name","baseCurrency"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"memberCount":{"type":"integer","minimum":1,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","pattern":"^data:image\\/.*"}},"required":["kind","image"]}]},"linksBanks":{"type":"boolean"}},"required":["id","name","baseCurrency","role","memberCount","createdAt","archivedAt","icon","linksBanks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/books/rename":{"post":{"operationId":"books.rename","summary":"Rename a book, unless someone else renamed it since","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":80},"fromName":{"type":"string"}},"required":["bookId","name","fromName"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"memberCount":{"type":"integer","minimum":1,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","pattern":"^data:image\\/.*"}},"required":["kind","image"]}]},"linksBanks":{"type":"boolean"}},"required":["id","name","baseCurrency","role","memberCount","createdAt","archivedAt","icon","linksBanks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/books/archive":{"post":{"operationId":"books.archive","summary":"Archive a book: still readable, no longer changeable","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1}},"required":["bookId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"memberCount":{"type":"integer","minimum":1,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","pattern":"^data:image\\/.*"}},"required":["kind","image"]}]},"linksBanks":{"type":"boolean"}},"required":["id","name","baseCurrency","role","memberCount","createdAt","archivedAt","icon","linksBanks"]}}}}}}},"/books/unarchive":{"post":{"operationId":"books.unarchive","summary":"Bring an archived book back, open to changes again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1}},"required":["bookId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"memberCount":{"type":"integer","minimum":1,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","pattern":"^data:image\\/.*"}},"required":["kind","image"]}]},"linksBanks":{"type":"boolean"}},"required":["id","name","baseCurrency","role","memberCount","createdAt","archivedAt","icon","linksBanks"]}}}}}}},"/books/changeCurrency":{"post":{"operationId":"books.changeCurrency","summary":"Change a book’s base currency and work out every base amount again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"fromBaseCurrency":{"type":"string"}},"required":["bookId","baseCurrency","fromBaseCurrency"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"memberCount":{"type":"integer","minimum":1,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","pattern":"^data:image\\/.*"}},"required":["kind","image"]}]},"linksBanks":{"type":"boolean"}},"required":["id","name","baseCurrency","role","memberCount","createdAt","archivedAt","icon","linksBanks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/books/setIcon":{"post":{"operationId":"books.setIcon","summary":"Set a book’s icon: its letter, a colour with a glyph, or a picture","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","minLength":1,"maxLength":700000,"contentEncoding":"base64"}},"required":["kind","image"]}]}},"required":["bookId","icon"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"memberCount":{"type":"integer","minimum":1,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","pattern":"^data:image\\/.*"}},"required":["kind","image"]}]},"linksBanks":{"type":"boolean"}},"required":["id","name","baseCurrency","role","memberCount","createdAt","archivedAt","icon","linksBanks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ICON_UNREADABLE"},"status":{"const":422},"message":{"type":"string","default":"ICON_UNREADABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/books/members/list":{"get":{"operationId":"books.members.list","summary":"List a book’s members and, for those who manage them, open invitations","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"joinedAt":{"type":"string","format":"date-time"},"you":{"type":"boolean"}},"required":["userId","name","email","role","joinedAt","you"]}},"invites":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","email","role","expiresAt"]}}},"required":["members","invites"]}}}}}}},"/books/members/invite":{"post":{"operationId":"books.members.invite","summary":"Email someone a link to join a book in a role, open for 7 days","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1},"email":{"type":"string","maxLength":254,"format":"email"},"role":{"enum":["owner","editor","viewer"],"type":"string"}},"required":["bookId","email","role"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","email","role","expiresAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ALREADY_MEMBER"},"status":{"const":409},"message":{"type":"string","default":"ALREADY_MEMBER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/books/members/cancelInvite":{"post":{"operationId":"books.members.cancelInvite","summary":"Cancel an open invitation so its link stops working","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1},"inviteId":{"type":"string","minLength":1}},"required":["bookId","inviteId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"cancelled":{"type":"boolean"}},"required":["cancelled"]}}}}}}},"/books/members/remove":{"post":{"operationId":"books.members.remove","summary":"Remove another member from a book at once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1}},"required":["bookId","userId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"boolean"}},"required":["removed"]}}}}}}},"/books/members/leave":{"post":{"operationId":"books.members.leave","summary":"Leave a book, handing it on if you are its only owner","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1}},"required":["bookId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"left":{"type":"boolean"}},"required":["left"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LAST_MEMBER"},"status":{"const":409},"message":{"type":"string","default":"LAST_MEMBER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/books/join":{"post":{"operationId":"books.join","summary":"Accept an invitation and join its book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":16,"maxLength":128}},"required":["token"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"memberCount":{"type":"integer","minimum":1,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"icon":{"anyOf":[{"type":"object","properties":{"kind":{"const":"letter"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"glyph"},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"glyph":{"enum":["house","users","heart","baby","dog","briefcase","store","building-2","landmark","piggy-bank","wallet","coins","trending-up","plane","tree-palm","car","graduation-cap","gift","coffee","music","sun","leaf","star","sparkles"],"type":"string"}},"required":["kind","hue","glyph"]},{"type":"object","properties":{"kind":{"const":"image"},"image":{"type":"string","pattern":"^data:image\\/.*"}},"required":["kind","image"]}]},"linksBanks":{"type":"boolean"}},"required":["id","name","baseCurrency","role","memberCount","createdAt","archivedAt","icon","linksBanks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVITATION_INVALID"},"status":{"const":409},"message":{"type":"string","default":"INVITATION_INVALID"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVITE_OTHER_HOUSEHOLD"},"status":{"const":409},"message":{"type":"string","default":"INVITE_OTHER_HOUSEHOLD"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/connections/request":{"get":{"operationId":"connections.request","summary":"Show who asks to connect an agent, for what, and the books it could see","parameters":[{"name":"signedRequest","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":4096},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"client":{"type":"object","properties":{"name":{"type":"string"},"host":{"type":"string"}},"required":["name","host"]},"scopes":{"type":"array","minItems":1,"items":{"enum":["finance:read","finance:write"],"type":"string"}},"books":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"enum":["owner","editor","viewer"],"type":"string"},"canWrite":{"type":"boolean"}},"required":["id","name","role","canWrite"]}}},"required":["client","scopes","books"]},{"type":"null"}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNT_LEAVING"},"status":{"const":409},"message":{"type":"string","default":"ACCOUNT_LEAVING"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/connections/decide":{"post":{"operationId":"connections.decide","summary":"Allow or refuse an agent’s request to connect, with its books and scopes","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"signedRequest":{"type":"string","minLength":1,"maxLength":4096},"allow":{"type":"boolean"},"bookIds":{"type":"array","maxItems":100,"items":{"type":"string","minLength":1}},"scopes":{"type":"array","maxItems":2,"items":{"enum":["finance:read","finance:write"],"type":"string"}}},"required":["signedRequest","allow","bookIds","scopes"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"redirectTo":{"type":"string"}},"required":["redirectTo"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SESSION_NOT_FRESH"},"status":{"const":403},"message":{"type":"string","default":"SESSION_NOT_FRESH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TOO_MANY_CONNECTIONS"},"status":{"const":409},"message":{"type":"string","default":"TOO_MANY_CONNECTIONS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNT_LEAVING"},"status":{"const":409},"message":{"type":"string","default":"ACCOUNT_LEAVING"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"410":{"description":"410","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONNECTION_REQUEST_EXPIRED"},"status":{"const":410},"message":{"type":"string","default":"CONNECTION_REQUEST_EXPIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/connections/list":{"get":{"operationId":"connections.list","summary":"List your live agent connections and personal access tokens, newest first","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"available":{"type":"boolean"},"tokens":{"type":"boolean"},"connections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["oauth","token"],"type":"string"},"name":{"type":"string"},"host":{"anyOf":[{"type":"string"},{"type":"null"}]},"scopes":{"type":"array","items":{"enum":["finance:read","finance:write"],"type":"string"}},"books":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}},"createdAt":{"type":"string","format":"date-time"},"lastUsedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","kind","name","host","scopes","books","createdAt","lastUsedAt","expiresAt"]}}},"required":["available","tokens","connections"]}}}}}}},"/connections/revoke":{"post":{"operationId":"connections.revoke","summary":"Disconnect an agent or revoke a personal access token at once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/connections/tokens/create":{"post":{"operationId":"connections.tokens.create","summary":"Create a personal access token for chosen books, shown only once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"scopes":{"type":"array","minItems":1,"maxItems":2,"items":{"enum":["finance:read","finance:write"],"type":"string"}},"bookIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1}},"expiresInDays":{"type":"integer","minimum":1,"maximum":365,"default":30},"reauth":{"anyOf":[{"type":"object","properties":{"password":{"type":"string","minLength":1,"maxLength":128}},"required":["password"],"additionalProperties":false},{"type":"object","properties":{"passkey":{"type":"object","properties":{"id":{"type":"string","maxLength":1024},"rawId":{"type":"string","maxLength":1024},"type":{"const":"public-key"},"response":{"type":"object","properties":{"clientDataJSON":{"type":"string","maxLength":4096},"authenticatorData":{"type":"string","maxLength":4096},"signature":{"type":"string","maxLength":1024},"userHandle":{"type":"string","maxLength":1024}},"required":["clientDataJSON","authenticatorData","signature"]},"clientExtensionResults":{"type":"object"}},"required":["id","rawId","type","response","clientExtensionResults"]}},"required":["passkey"],"additionalProperties":false}]}},"required":["name","scopes","bookIds","reauth"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"token":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","token","expiresAt"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_PASSWORD"},"status":{"const":400},"message":{"type":"string","default":"INVALID_PASSWORD"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AUTHENTICATION_FAILED"},"status":{"const":400},"message":{"type":"string","default":"AUTHENTICATION_FAILED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SESSION_NOT_FRESH"},"status":{"const":403},"message":{"type":"string","default":"SESSION_NOT_FRESH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TOO_MANY_CONNECTIONS"},"status":{"const":409},"message":{"type":"string","default":"TOO_MANY_CONNECTIONS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNT_LEAVING"},"status":{"const":409},"message":{"type":"string","default":"ACCOUNT_LEAVING"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TOKENS_UNAVAILABLE"},"status":{"const":409},"message":{"type":"string","default":"TOKENS_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"429":{"description":"429","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TOO_MANY_ATTEMPTS"},"status":{"const":429},"message":{"type":"string","default":"TOO_MANY_ATTEMPTS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/connections/tokens/revoke":{"post":{"operationId":"connections.tokens.revoke","summary":"Revoke one of your personal access tokens at once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/ledger/assets/list":{"get":{"operationId":"ledger.assets.list","summary":"List a book’s currencies, coins and securities with their decimal places","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"kind":{"enum":["fiat","crypto","security"],"type":"string"},"precision":{"type":"integer","minimum":0,"maximum":18},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","kind","precision","name"]}}}}}}}},"/ledger/assets/create":{"post":{"operationId":"ledger.assets.create","summary":"Add a currency, coin or security to a book; adding it again changes nothing","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"code":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"kind":{"enum":["fiat","crypto","security"],"type":"string"},"precision":{"type":"integer","minimum":0,"maximum":18},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["bookId","code"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"kind":{"enum":["fiat","crypto","security"],"type":"string"},"precision":{"type":"integer","minimum":0,"maximum":18},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","kind","precision","name"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ASSET_EXISTS"},"status":{"const":409},"message":{"type":"string","default":"ASSET_EXISTS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ASSET_KNOWN"},"status":{"const":409},"message":{"type":"string","default":"ASSET_KNOWN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/persons/list":{"get":{"operationId":"ledger.persons.list","summary":"List the people of a book who own pockets, archived ones too, in the book’s order","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","archivedAt","updatedAt"]}}}}}}}},"/ledger/persons/create":{"post":{"operationId":"ledger.persons.create","summary":"Add a person who owns pockets to a book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":80},"id":{"type":"string","format":"uuid"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/persons/rename":{"post":{"operationId":"ledger.persons.rename","summary":"Rename a person of a book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"personId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["bookId","personId","expectedUpdatedAt","name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PERSON_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"PERSON_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/persons/archive":{"post":{"operationId":"ledger.persons.archive","summary":"Archive a person, keeping them and their pockets but hiding them from pickers","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"personId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","personId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PERSON_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"PERSON_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/persons/unarchive":{"post":{"operationId":"ledger.persons.unarchive","summary":"Bring an archived person back into the pickers","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"personId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","personId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PERSON_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"PERSON_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/persons/reorder":{"post":{"operationId":"ledger.persons.reorder","summary":"Set the order of a book’s active people","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"ids":{"type":"array","maxItems":500,"items":{"type":"string","minLength":1,"maxLength":100}}},"required":["bookId","ids"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","archivedAt","updatedAt"]}}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ORDER_MISMATCH"},"status":{"const":409},"message":{"type":"string","default":"ORDER_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/pockets/list":{"get":{"operationId":"ledger.pockets.list","summary":"List a book’s pockets, closed ones too, with each one’s balance per asset","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["asset","liability"],"type":"string"},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other","contact","book"],"type":"string"},"personId":{"anyOf":[{"type":"string"},{"type":"null"}]},"institution":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalRefs":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":120}},"status":{"enum":["active","closed"],"type":"string"},"enamel":{"enum":["jade","cobalt","rose","marine","sky","marigold","stone","tangerine","graphite","crimson","plum"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","pocketKind","personId","institution","externalRefs","status","enamel","balances","lastActiveOn","updatedAt"]}}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/pockets/create":{"post":{"operationId":"ledger.pockets.create","summary":"Create a pocket in a book, owned by a person or shared","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":80},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"},"type":{"enum":["asset","liability"],"type":"string"},"personId":{"type":"string","minLength":1,"maxLength":100},"institution":{"type":"string","minLength":1,"maxLength":80},"externalRefs":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":120}},"enamel":{"enum":["jade","cobalt","rose","marine","sky","marigold","stone","tangerine","graphite","crimson","plum"],"type":"string"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","name","pocketKind","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["asset","liability"],"type":"string"},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other","contact","book"],"type":"string"},"personId":{"anyOf":[{"type":"string"},{"type":"null"}]},"institution":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalRefs":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":120}},"status":{"enum":["active","closed"],"type":"string"},"enamel":{"enum":["jade","cobalt","rose","marine","sky","marigold","stone","tangerine","graphite","crimson","plum"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","pocketKind","personId","institution","externalRefs","status","enamel","balances","lastActiveOn","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PERSON_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"PERSON_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/pockets/update":{"post":{"operationId":"ledger.pockets.update","summary":"Change a pocket’s name, kind, owner, institution, identifiers or colour","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"pocketId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"requestId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":80},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"},"personId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"institution":{"anyOf":[{"type":"string","minLength":1,"maxLength":80},{"type":"null"}]},"externalRefs":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":120}},"enamel":{"enum":["jade","cobalt","rose","marine","sky","marigold","stone","tangerine","graphite","crimson","plum"],"type":"string"}},"required":["bookId","pocketId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["asset","liability"],"type":"string"},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other","contact","book"],"type":"string"},"personId":{"anyOf":[{"type":"string"},{"type":"null"}]},"institution":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalRefs":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":120}},"status":{"enum":["active","closed"],"type":"string"},"enamel":{"enum":["jade","cobalt","rose","marine","sky","marigold","stone","tangerine","graphite","crimson","plum"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","pocketKind","personId","institution","externalRefs","status","enamel","balances","lastActiveOn","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_POCKET"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_POCKET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PERSON_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"PERSON_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/pockets/close":{"post":{"operationId":"ledger.pockets.close","summary":"Close a pocket, only once it holds nothing in any asset","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"pocketId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","pocketId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["asset","liability"],"type":"string"},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other","contact","book"],"type":"string"},"personId":{"anyOf":[{"type":"string"},{"type":"null"}]},"institution":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalRefs":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":120}},"status":{"enum":["active","closed"],"type":"string"},"enamel":{"enum":["jade","cobalt","rose","marine","sky","marigold","stone","tangerine","graphite","crimson","plum"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","pocketKind","personId","institution","externalRefs","status","enamel","balances","lastActiveOn","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_POCKET"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_POCKET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_NOT_EMPTY"},"status":{"const":409},"message":{"type":"string","default":"POCKET_NOT_EMPTY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/pockets/reopen":{"post":{"operationId":"ledger.pockets.reopen","summary":"Reopen a closed pocket","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"pocketId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","pocketId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["asset","liability"],"type":"string"},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other","contact","book"],"type":"string"},"personId":{"anyOf":[{"type":"string"},{"type":"null"}]},"institution":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalRefs":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":120}},"status":{"enum":["active","closed"],"type":"string"},"enamel":{"enum":["jade","cobalt","rose","marine","sky","marigold","stone","tangerine","graphite","crimson","plum"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","pocketKind","personId","institution","externalRefs","status","enamel","balances","lastActiveOn","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_POCKET"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_POCKET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/pockets/reorder":{"post":{"operationId":"ledger.pockets.reorder","summary":"Set the order of a group’s open pockets in the book’s pocket list","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"group":{"enum":["bank","card","cash","crypto","broker","loan","other","contact"],"type":"string"},"ids":{"type":"array","maxItems":500,"items":{"type":"string","minLength":1,"maxLength":100}}},"required":["bookId","group","ids"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["asset","liability"],"type":"string"},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other","contact","book"],"type":"string"},"personId":{"anyOf":[{"type":"string"},{"type":"null"}]},"institution":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalRefs":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":120}},"status":{"enum":["active","closed"],"type":"string"},"enamel":{"enum":["jade","cobalt","rose","marine","sky","marigold","stone","tangerine","graphite","crimson","plum"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","pocketKind","personId","institution","externalRefs","status","enamel","balances","lastActiveOn","updatedAt"]}}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ORDER_MISMATCH"},"status":{"const":409},"message":{"type":"string","default":"ORDER_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/pockets/merge":{"post":{"operationId":"ledger.pockets.merge","summary":"Merge one pocket into another, as one change that can be undone","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"intoPocketId":{"type":"string","minLength":1,"maxLength":100},"dryRun":{"type":"boolean"},"previewToken":{"type":"string","maxLength":200},"checkBalances":{"type":"boolean"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","fromPocketId","intoPocketId","dryRun"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"previewToken":{"type":"string"},"moves":{"type":"object","properties":{"transactions":{"type":"integer","minimum":0,"maximum":9007199254740991},"currencies":{"type":"array","items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"exchanges":{"type":"integer","minimum":0,"maximum":9007199254740991},"balanceChecks":{"type":"integer","minimum":0,"maximum":9007199254740991},"bankAccounts":{"type":"integer","minimum":0,"maximum":9007199254740991},"statementRecords":{"type":"integer","minimum":0,"maximum":9007199254740991},"recurringSeries":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["transactions","currencies","exchanges","balanceChecks","bankAccounts","statementRecords","recurringSeries"]},"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["changeSetId","previewToken","moves"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_POCKET"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_POCKET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKETS_NOT_MERGEABLE"},"status":{"const":409},"message":{"type":"string","default":"POCKETS_NOT_MERGEABLE"},"data":{"type":"object","properties":{"reason":{"enum":["same","not-own","closed","owner","side","shared-currency","too-large"],"type":"string"},"traceId":{"type":"string"}},"required":["reason","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/categories/list":{"get":{"operationId":"ledger.categories.list","summary":"List a book’s categories, archived ones too, each followed by its subcategories","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"systemKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"seedKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"budget":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","parentId","systemKey","seedKey","hue","icon","position","budget","archivedAt","updatedAt"]}}}}}}}},"/ledger/categories/usage":{"get":{"operationId":"ledger.categories.usage","summary":"Count the live transactions in each category, with and without its subcategories","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"categoryIds","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":500,"items":{"type":"string","minLength":1,"maxLength":100}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"transactionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"subtreeTransactionCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["categoryId","transactionCount","subtreeTransactionCount"]}}}}}}}},"/ledger/categories/create":{"post":{"operationId":"ledger.categories.create","summary":"Create a category, at the top level or under a top-level one","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":80},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"}},"required":["bookId","name","type"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"systemKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"seedKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"budget":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","parentId","systemKey","seedKey","hue","icon","position","budget","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_PARENT"},"status":{"const":409},"message":{"type":"string","default":"INVALID_PARENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_NAME_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_NAME_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_HUE_ON_CHILD"},"status":{"const":422},"message":{"type":"string","default":"CATEGORY_HUE_ON_CHILD"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/categories/update":{"post":{"operationId":"ledger.categories.update","summary":"Change a category’s name, colour or icon","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"requestId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":80},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"}},"required":["bookId","categoryId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"systemKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"seedKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"budget":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","parentId","systemKey","seedKey","hue","icon","position","budget","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SYSTEM_CATEGORY"},"status":{"const":409},"message":{"type":"string","default":"SYSTEM_CATEGORY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_HUE_ON_CHILD"},"status":{"const":422},"message":{"type":"string","default":"CATEGORY_HUE_ON_CHILD"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/categories/move":{"post":{"operationId":"ledger.categories.move","summary":"Move a category under another top-level one of its type, or to the top","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"requestId":{"type":"string","format":"uuid"},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["bookId","categoryId","expectedUpdatedAt","parentId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"systemKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"seedKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"budget":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","parentId","systemKey","seedKey","hue","icon","position","budget","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SYSTEM_CATEGORY"},"status":{"const":409},"message":{"type":"string","default":"SYSTEM_CATEGORY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_PARENT"},"status":{"const":409},"message":{"type":"string","default":"INVALID_PARENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/categories/setBudget":{"post":{"operationId":"ledger.categories.setBudget","summary":"Set or clear an expense category’s monthly budget","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"requestId":{"type":"string","format":"uuid"},"budget":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["bookId","categoryId","expectedUpdatedAt","budget"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"systemKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"seedKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"budget":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","parentId","systemKey","seedKey","hue","icon","position","budget","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SYSTEM_CATEGORY"},"status":{"const":409},"message":{"type":"string","default":"SYSTEM_CATEGORY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BUDGET_ON_INCOME"},"status":{"const":422},"message":{"type":"string","default":"BUDGET_ON_INCOME"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/categories/archive":{"post":{"operationId":"ledger.categories.archive","summary":"Archive a category and its subcategories, hiding them from pickers","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","categoryId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"systemKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"seedKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"budget":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","parentId","systemKey","seedKey","hue","icon","position","budget","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SYSTEM_CATEGORY"},"status":{"const":409},"message":{"type":"string","default":"SYSTEM_CATEGORY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/categories/unarchive":{"post":{"operationId":"ledger.categories.unarchive","summary":"Bring an archived category back, with the subcategories archived with it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","categoryId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"systemKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"seedKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"budget":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","parentId","systemKey","seedKey","hue","icon","position","budget","archivedAt","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SYSTEM_CATEGORY"},"status":{"const":409},"message":{"type":"string","default":"SYSTEM_CATEGORY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PARENT_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"PARENT_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/categories/reorder":{"post":{"operationId":"ledger.categories.reorder","summary":"Set the order of a category’s subcategories, or of the top-level categories","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"ids":{"type":"array","maxItems":500,"items":{"type":"string","minLength":1,"maxLength":100}}},"required":["bookId","parentId","ids"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"systemKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"seedKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"budget":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","parentId","systemKey","seedKey","hue","icon","position","budget","archivedAt","updatedAt"]}}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ORDER_MISMATCH"},"status":{"const":409},"message":{"type":"string","default":"ORDER_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/createDryRun":{"post":{"operationId":"ledger.transactions.createDryRun","summary":"Check what creating a transaction would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transaction":{"anyOf":[{"type":"object","properties":{"type":{"const":"expense"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"income"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"relatedAsset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"refund"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"refundOf":{"type":"string","minLength":1,"maxLength":100},"rateDifference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"transfer"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false},"contactAs":{"enum":["loan","repayment"],"type":"string"}},"required":["type","bookingDate","fromPocketId","toPocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"exchange"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"sell":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"buy":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false}},"required":["type","bookingDate","pocketId","sell","buy"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"postings"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"postings":{"type":"array","minItems":2,"maxItems":100,"items":{"anyOf":[{"type":"object","properties":{"accountId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["accountId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"system":{"enum":["opening-balances","currency-exchange","unexplained-change"],"type":"string"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["system","amount","asset"],"additionalProperties":false}]}}},"required":["type","bookingDate","postings"],"additionalProperties":false}]}},"required":["bookId","transaction"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_DELETED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_DELETED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/updateDryRun":{"post":{"operationId":"ledger.transactions.updateDryRun","summary":"Check what editing a transaction would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"changes":{"type":"object","properties":{"payee":{"type":"object","properties":{"from":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"to":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["from","to"],"additionalProperties":false},"bookingDate":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"],"additionalProperties":false},"notes":{"type":"object","properties":{"from":{"anyOf":[{"type":"string","minLength":1,"maxLength":5000},{"type":"null"}]},"to":{"anyOf":[{"type":"string","minLength":1,"maxLength":5000},{"type":"null"}]}},"required":["from","to"],"additionalProperties":false},"tags":{"type":"object","properties":{"from":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"to":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["from","to"],"additionalProperties":false},"category":{"type":"object","properties":{"from":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["categoryId"],"additionalProperties":false},{"type":"object","properties":{"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}}},"required":["splits"],"additionalProperties":false},{"type":"object","properties":{"none":{"type":"boolean"}},"required":["none"],"additionalProperties":false},{"type":"object","properties":{"loan":{"type":"object","properties":{"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"contactAs":{"enum":["loan","repayment"],"type":"string"}},"required":["fromPocketId","toPocketId","contactAs"],"additionalProperties":false}},"required":["loan"],"additionalProperties":false}]},"to":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["categoryId"],"additionalProperties":false},{"type":"object","properties":{"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}}},"required":["splits"],"additionalProperties":false},{"type":"object","properties":{"none":{"type":"boolean"}},"required":["none"],"additionalProperties":false},{"type":"object","properties":{"newCategory":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"}},"required":["name","type","parentId"],"additionalProperties":false}},"required":["newCategory"],"additionalProperties":false}]}},"required":["from","to"],"additionalProperties":false},"pocket":{"type":"object","properties":{"from":{"type":"string","minLength":1,"maxLength":100},"to":{"type":"string","minLength":1,"maxLength":100}},"required":["from","to"],"additionalProperties":false},"amount":{"type":"object","properties":{"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["from","to"],"additionalProperties":false},"asset":{"type":"object","properties":{"from":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"to":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["from","to"],"additionalProperties":false},"baseAmount":{"type":"object","properties":{"from":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"to":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["from","to"],"additionalProperties":false},"pockets":{"type":"object","properties":{"from":{"type":"object","properties":{"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["fromPocketId","toPocketId"],"additionalProperties":false},"to":{"type":"object","properties":{"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["fromPocketId","toPocketId"],"additionalProperties":false}},"required":["from","to"],"additionalProperties":false},"contactAs":{"type":"object","properties":{"from":{"enum":["loan","repayment"],"type":"string"},"to":{"enum":["loan","repayment"],"type":"string"}},"required":["from","to"],"additionalProperties":false},"refundOf":{"type":"object","properties":{"from":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"to":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["from","to"],"additionalProperties":false}},"additionalProperties":false}},"required":["bookId","transactionId","changes"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_PARENT"},"status":{"const":409},"message":{"type":"string","default":"INVALID_PARENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_NAME_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_NAME_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{"type":"object","properties":{"fields":{"type":"array","minItems":1,"maxItems":12,"items":{"enum":["payee","bookingDate","notes","tags","category","pocket","amount","asset","baseAmount","pockets","contactAs","refundOf"],"type":"string"}},"traceId":{"type":"string"}},"required":["fields","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"USE_BOOK_TRANSFER"},"status":{"const":409},"message":{"type":"string","default":"USE_BOOK_TRANSFER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORTED_CURRENCY"},"status":{"const":409},"message":{"type":"string","default":"IMPORTED_CURRENCY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/deleteDryRun":{"post":{"operationId":"ledger.transactions.deleteDryRun","summary":"Check what deleting a transaction would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","transactionId","ifChangeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"USE_BOOK_TRANSFER"},"status":{"const":409},"message":{"type":"string","default":"USE_BOOK_TRANSFER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/joinTransferDryRun":{"post":{"operationId":"ledger.transactions.joinTransferDryRun","summary":"Check what joining two rows as a transfer would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"withId":{"type":"string","minLength":1,"maxLength":100},"withIfChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","transactionId","ifChangeSetId","withId","withIfChangeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/list":{"get":{"operationId":"ledger.transactions.list","summary":"List a book’s transactions, filtered, newest first, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"pocketIds","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"categoryIds","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"personIds","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":100,"items":{"anyOf":[{"const":"shared"},{"type":"string","minLength":1,"maxLength":100}]}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"assets","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"kinds","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":8,"items":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"exchangeSides","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":3,"items":{"enum":["invested","divested","other"],"type":"string"}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"spending","in":"query","required":false,"schema":{"const":true},"allowEmptyValue":true,"allowReserved":true},{"name":"search","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"needsReview","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true},{"name":"tags","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"learned","in":"query","required":false,"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"direction":{"enum":["in","out"],"type":"string"}},"required":["key","direction"],"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"merchant","in":"query","required":false,"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200}},"required":["key"],"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"guesses","in":"query","required":false,"schema":{"type":"object","properties":{"from":{"type":"integer","minimum":0,"maximum":100},"to":{"type":"integer","minimum":0,"maximum":100}},"required":["from","to"],"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"contactAs","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":2,"items":{"enum":["loan","repayment"],"type":"string"}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"moves","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":3,"items":{"enum":["loan","repayment","contribution"],"type":"string"}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]}},"nextCursor":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["items","nextCursor"]}}}}}}},"/ledger/transactions/get":{"get":{"operationId":"ledger.transactions.get","summary":"Read one transaction with its canonical input","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]},"input":{"anyOf":[{"type":"object","properties":{"type":{"const":"expense"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"income"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"relatedAsset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"refund"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"refundOf":{"type":"string","minLength":1,"maxLength":100},"rateDifference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"transfer"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false},"contactAs":{"enum":["loan","repayment"],"type":"string"}},"required":["type","bookingDate","fromPocketId","toPocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"exchange"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"sell":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"buy":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false}},"required":["type","bookingDate","pocketId","sell","buy"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"postings"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"postings":{"type":"array","minItems":2,"maxItems":100,"items":{"anyOf":[{"type":"object","properties":{"accountId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["accountId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"system":{"enum":["opening-balances","currency-exchange","unexplained-change"],"type":"string"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["system","amount","asset"],"additionalProperties":false}]}}},"required":["type","bookingDate","postings"],"additionalProperties":false}]},"refundOf":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedBy":{"type":"array","items":{"type":"string"}},"refundable":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"entered":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"funded":{"anyOf":[{"type":"object","properties":{"paymentId":{"type":"string"},"payment":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"moves":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pocketId":{"type":"string"},"from":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"into":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"fee":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]}},"required":["id","pocketId","from","into","fee"]}}},"required":["paymentId","payment","payee","moves"]},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs","input","refundOf","refundedBy","refundable","entered","funded"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/create":{"post":{"operationId":"ledger.transactions.create","summary":"Create a payment, income, refund, transfer or exchange","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"id":{"type":"string","format":"uuid"},"transaction":{"anyOf":[{"type":"object","properties":{"type":{"const":"expense"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"income"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"relatedAsset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"refund"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false}},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"refundOf":{"type":"string","minLength":1,"maxLength":100},"rateDifference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["type","bookingDate","pocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"transfer"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false},"contactAs":{"enum":["loan","repayment"],"type":"string"}},"required":["type","bookingDate","fromPocketId","toPocketId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"exchange"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"sell":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"buy":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false}},"required":["type","bookingDate","pocketId","sell","buy"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"postings"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"postings":{"type":"array","minItems":2,"maxItems":100,"items":{"anyOf":[{"type":"object","properties":{"accountId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["accountId","amount","asset"],"additionalProperties":false},{"type":"object","properties":{"system":{"enum":["opening-balances","currency-exchange","unexplained-change"],"type":"string"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"original":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"baseAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["system","amount","asset"],"additionalProperties":false}]}}},"required":["type","bookingDate","postings"],"additionalProperties":false}]}},"required":["bookId","requestId","transaction"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_DELETED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_DELETED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/update":{"post":{"operationId":"ledger.transactions.update","summary":"Edit a transaction field by field, refused where someone changed it since","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"changes":{"type":"object","properties":{"payee":{"type":"object","properties":{"from":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"to":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["from","to"],"additionalProperties":false},"bookingDate":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"],"additionalProperties":false},"notes":{"type":"object","properties":{"from":{"anyOf":[{"type":"string","minLength":1,"maxLength":5000},{"type":"null"}]},"to":{"anyOf":[{"type":"string","minLength":1,"maxLength":5000},{"type":"null"}]}},"required":["from","to"],"additionalProperties":false},"tags":{"type":"object","properties":{"from":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"to":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["from","to"],"additionalProperties":false},"category":{"type":"object","properties":{"from":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["categoryId"],"additionalProperties":false},{"type":"object","properties":{"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}}},"required":["splits"],"additionalProperties":false},{"type":"object","properties":{"none":{"type":"boolean"}},"required":["none"],"additionalProperties":false},{"type":"object","properties":{"loan":{"type":"object","properties":{"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"contactAs":{"enum":["loan","repayment"],"type":"string"}},"required":["fromPocketId","toPocketId","contactAs"],"additionalProperties":false}},"required":["loan"],"additionalProperties":false}]},"to":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["categoryId"],"additionalProperties":false},{"type":"object","properties":{"splits":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false},{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contact","amount"],"additionalProperties":false}]}}},"required":["splits"],"additionalProperties":false},{"type":"object","properties":{"none":{"type":"boolean"}},"required":["none"],"additionalProperties":false},{"type":"object","properties":{"newCategory":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"}},"required":["name","type","parentId"],"additionalProperties":false}},"required":["newCategory"],"additionalProperties":false}]}},"required":["from","to"],"additionalProperties":false},"pocket":{"type":"object","properties":{"from":{"type":"string","minLength":1,"maxLength":100},"to":{"type":"string","minLength":1,"maxLength":100}},"required":["from","to"],"additionalProperties":false},"amount":{"type":"object","properties":{"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["from","to"],"additionalProperties":false},"asset":{"type":"object","properties":{"from":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"to":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["from","to"],"additionalProperties":false},"baseAmount":{"type":"object","properties":{"from":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"to":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["from","to"],"additionalProperties":false},"pockets":{"type":"object","properties":{"from":{"type":"object","properties":{"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["fromPocketId","toPocketId"],"additionalProperties":false},"to":{"type":"object","properties":{"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["fromPocketId","toPocketId"],"additionalProperties":false}},"required":["from","to"],"additionalProperties":false},"contactAs":{"type":"object","properties":{"from":{"enum":["loan","repayment"],"type":"string"},"to":{"enum":["loan","repayment"],"type":"string"}},"required":["from","to"],"additionalProperties":false},"refundOf":{"type":"object","properties":{"from":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"to":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["from","to"],"additionalProperties":false}},"additionalProperties":false}},"required":["bookId","requestId","transactionId","changes"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_PARENT"},"status":{"const":409},"message":{"type":"string","default":"INVALID_PARENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_NAME_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_NAME_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{"type":"object","properties":{"fields":{"type":"array","minItems":1,"maxItems":12,"items":{"enum":["payee","bookingDate","notes","tags","category","pocket","amount","asset","baseAmount","pockets","contactAs","refundOf"],"type":"string"}},"traceId":{"type":"string"}},"required":["fields","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"USE_BOOK_TRANSFER"},"status":{"const":409},"message":{"type":"string","default":"USE_BOOK_TRANSFER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORTED_CURRENCY"},"status":{"const":409},"message":{"type":"string","default":"IMPORTED_CURRENCY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/toTransferDryRun":{"post":{"operationId":"ledger.transactions.toTransferDryRun","summary":"Check what turning a transaction into a transfer would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false},"contactAs":{"enum":["loan","repayment"],"type":"string"}},"required":["bookId","transactionId","ifChangeSetId","toPocketId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/toTransfer":{"post":{"operationId":"ledger.transactions.toTransfer","summary":"Turn a payment or income into a transfer, joining a matching other side","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false},"contactAs":{"enum":["loan","repayment"],"type":"string"}},"required":["bookId","requestId","transactionId","ifChangeSetId","toPocketId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"},"merged":{"type":"boolean"}},"required":["transaction","changeSetId","merged"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/toPaymentDryRun":{"post":{"operationId":"ledger.transactions.toPaymentDryRun","summary":"Check what turning a transfer into a payment would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","transactionId","ifChangeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/toPayment":{"post":{"operationId":"ledger.transactions.toPayment","summary":"Turn a transfer back into one payment or income in its own pocket","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","requestId","transactionId","ifChangeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/transferPreview":{"get":{"operationId":"ledger.transactions.transferPreview","summary":"Preview what turning a transaction into a transfer would join, writing nothing","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"otherBookId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"toPocketId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"received","in":"query","required":false,"schema":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"fee","in":"query","required":false,"schema":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["amount","asset"],"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"joins":{"anyOf":[{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"bookingDate":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["transactionId","bookingDate","amount","asset"]},{"type":"null"}]},"feeCategoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["joins","feeCategoryId"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SEVERAL_COUNTERPARTS"},"status":{"const":409},"message":{"type":"string","default":"SEVERAL_COUNTERPARTS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/transferCandidates":{"get":{"operationId":"ledger.transactions.transferCandidates","summary":"List the rows a payment or income could be joined with as one transfer","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"otherBookId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"pocketId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"search","in":"query","required":false,"schema":{"type":"string","maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"candidates":{"type":"array","items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"lastChangeSetId":{"type":"string","minLength":1,"maxLength":100},"bookingDate":{"type":"string","format":"date"},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"likely":{"anyOf":[{"enum":["same","near"],"type":"string"},{"type":"null"}]}},"required":["transactionId","lastChangeSetId","bookingDate","payee","description","amount","asset","likely"]}}},"required":["candidates"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/refundCandidates":{"get":{"operationId":"ledger.transactions.refundCandidates","summary":"List the payments a refund could give back, or the refunds of a payment","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"search","in":"query","required":false,"schema":{"type":"string","maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"refundsIncome","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"candidates":{"type":"array","items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"lastChangeSetId":{"type":"string","minLength":1,"maxLength":100},"bookingDate":{"type":"string","format":"date"},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"left":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"likely":{"anyOf":[{"enum":["same","merchant"],"type":"string"},{"type":"null"}]},"samePocket":{"type":"boolean"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"income":{"type":"boolean"}},"required":["transactionId","lastChangeSetId","bookingDate","payee","description","amount","asset","left","likely","samePocket","pocketId","income"]}}},"required":["candidates"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/joinTransfer":{"post":{"operationId":"ledger.transactions.joinTransfer","summary":"Join a payment and an income of two pockets as one transfer, by hand","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"withId":{"type":"string","minLength":1,"maxLength":100},"withIfChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","requestId","transactionId","ifChangeSetId","withId","withIfChangeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BASE_AMOUNT_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"BASE_AMOUNT_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/paymentPreview":{"get":{"operationId":"ledger.transactions.paymentPreview","summary":"Preview the payment or income a transfer would become, writing nothing","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"out":{"type":"boolean"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["out","pocketId","amount","asset"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{"type":"object","properties":{"mergedInto":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["mergedInto","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/relabel":{"post":{"operationId":"ledger.transactions.relabel","summary":"Set the category, payee or tags of up to 100 transactions, or preview it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"ids":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"category":{"anyOf":[{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["categoryId"],"additionalProperties":false},{"type":"object","properties":{"split":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","amount"],"additionalProperties":false}}},"required":["split"],"additionalProperties":false},{"type":"object","properties":{"newCategory":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"}},"required":["name","type","parentId"],"additionalProperties":false}},"required":["newCategory"],"additionalProperties":false}]},"payee":{"type":"string","minLength":1,"maxLength":200},"addTags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"dryRun":{"type":"boolean"},"ifChangeSetIds":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":100},"additionalProperties":{"type":"string","minLength":1,"maxLength":100}}},"required":["bookId","requestId","ids","ifChangeSetIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"changed":{"type":"array","items":{"type":"string"}},"unchanged":{"type":"array","items":{"type":"string"}},"skipped":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"reason":{"enum":["not-found","deleted","merged","not-categorisable","split-mismatch","changed","invalid"],"type":"string"}},"required":["id","reason"]}},"categories":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["changeSetId","changed","unchanged","skipped"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_PARENT"},"status":{"const":409},"message":{"type":"string","default":"INVALID_PARENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_NAME_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_NAME_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTIONS_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTIONS_CHANGED"},"data":{"type":"object","properties":{"ids":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string"}},"traceId":{"type":"string"}},"required":["ids","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/transactions/delete":{"post":{"operationId":"ledger.transactions.delete","summary":"Delete a transaction; undo brings it back with the same id","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","requestId","transactionId","ifChangeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transactionId":{"type":"string"},"changeSetId":{"type":"string"}},"required":["transactionId","changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"USE_BOOK_TRANSFER"},"status":{"const":409},"message":{"type":"string","default":"USE_BOOK_TRANSFER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/balances/at":{"get":{"operationId":"ledger.balances.at","summary":"Read each pocket’s and category’s balance per asset at the end of a day","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"date","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"accountIds","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":200,"items":{"type":"string","minLength":1,"maxLength":100}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["accountId","asset","amount"]}}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/history/list":{"get":{"operationId":"ledger.history.list","summary":"List a book’s change sets, newest first, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"via","in":"query","required":false,"schema":{"enum":["user","rule","import","agent","system"],"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"via":{"enum":["user","rule","import","agent","system"],"type":"string"},"summary":{"type":"string"},"actorId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"undoneById":{"anyOf":[{"type":"string"},{"type":"null"}]},"undoesId":{"anyOf":[{"type":"string"},{"type":"null"}]},"transactionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"transactionIds":{"type":"array","maxItems":20,"items":{"type":"string"}},"undoableByYou":{"type":"boolean"}},"required":["id","via","summary","actorId","createdAt","undoneById","undoesId","transactionCount","transactionIds","undoableByYou"]}},"nextCursor":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["items","nextCursor"]}}}}}}},"/ledger/history/get":{"get":{"operationId":"ledger.history.get","summary":"Read one change set and a page of the revisions it made","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"changeSetId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"via":{"enum":["user","rule","import","agent","system"],"type":"string"},"summary":{"type":"string"},"actorId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"undoneById":{"anyOf":[{"type":"string"},{"type":"null"}]},"undoesId":{"anyOf":[{"type":"string"},{"type":"null"}]},"transactionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"transactionIds":{"type":"array","maxItems":20,"items":{"type":"string"}},"undoableByYou":{"type":"boolean"},"revisions":{"type":"array","maxItems":100,"items":{"type":"object","properties":{"transactionId":{"type":"string"},"op":{"enum":["create","update","delete","restore"],"type":"string"},"before":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},{"type":"null"}]},"after":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},{"type":"null"}]}},"required":["transactionId","op","before","after"]}},"nextCursor":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["id","via","summary","actorId","createdAt","undoneById","undoesId","transactionCount","transactionIds","undoableByYou","revisions","nextCursor"]}}}}}}},"/ledger/history/forTransaction":{"get":{"operationId":"ledger.history.forTransaction","summary":"Read one transaction’s history, newest revision first, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","maxItems":100,"items":{"type":"object","properties":{"transactionId":{"type":"string"},"op":{"enum":["create","update","delete","restore"],"type":"string"},"before":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},{"type":"null"}]},"after":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},{"type":"null"}]},"changeSet":{"type":"object","properties":{"id":{"type":"string"},"via":{"enum":["user","rule","import","agent","system"],"type":"string"},"summary":{"type":"string"},"actorId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"undoneById":{"anyOf":[{"type":"string"},{"type":"null"}]},"undoesId":{"anyOf":[{"type":"string"},{"type":"null"}]},"transactionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"transactionIds":{"type":"array","maxItems":20,"items":{"type":"string"}}},"required":["id","via","summary","actorId","createdAt","undoneById","undoesId","transactionCount","transactionIds"]}},"required":["transactionId","op","before","after","changeSet"]}},"nextCursor":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["items","nextCursor"]}}}}}}},"/ledger/history/undoDryRun":{"post":{"operationId":"ledger.history.undoDryRun","summary":"Check what undoing a change set would do to the bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"changeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","changeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AGENT_UNDO_ONLY"},"status":{"const":403},"message":{"type":"string","default":"AGENT_UNDO_ONLY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ALREADY_UNDONE"},"status":{"const":409},"message":{"type":"string","default":"ALREADY_UNDONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CHANGE_SET_SUPERSEDED"},"status":{"const":409},"message":{"type":"string","default":"CHANGE_SET_SUPERSEDED"},"data":{"type":"object","properties":{"laterChangeSetIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string"}},"traceId":{"type":"string"}},"required":["laterChangeSetIds","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"USE_IMPORT_UNDO"},"status":{"const":409},"message":{"type":"string","default":"USE_IMPORT_UNDO"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_EXISTS"},"status":{"const":409},"message":{"type":"string","default":"RULE_EXISTS"},"data":{"type":"object","properties":{"ruleId":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["ruleId","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNDO_CHAIN_BROKEN"},"status":{"const":409},"message":{"type":"string","default":"UNDO_CHAIN_BROKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERGE_NOT_NEWEST"},"status":{"const":409},"message":{"type":"string","default":"MERGE_NOT_NEWEST"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERGE_STANDS"},"status":{"const":409},"message":{"type":"string","default":"MERGE_STANDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERGE_UNDONE"},"status":{"const":409},"message":{"type":"string","default":"MERGE_UNDONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/history/undo":{"post":{"operationId":"ledger.history.undo","summary":"Undo a change set by writing one that reverses it; undoing an undo redoes it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"changeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","requestId","changeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"via":{"enum":["user","rule","import","agent","system"],"type":"string"},"summary":{"type":"string"},"actorId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"undoneById":{"anyOf":[{"type":"string"},{"type":"null"}]},"undoesId":{"anyOf":[{"type":"string"},{"type":"null"}]},"transactionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"transactionIds":{"type":"array","maxItems":20,"items":{"type":"string"}}},"required":["id","via","summary","actorId","createdAt","undoneById","undoesId","transactionCount","transactionIds"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AGENT_UNDO_ONLY"},"status":{"const":403},"message":{"type":"string","default":"AGENT_UNDO_ONLY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ALREADY_UNDONE"},"status":{"const":409},"message":{"type":"string","default":"ALREADY_UNDONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CHANGE_SET_SUPERSEDED"},"status":{"const":409},"message":{"type":"string","default":"CHANGE_SET_SUPERSEDED"},"data":{"type":"object","properties":{"laterChangeSetIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string"}},"traceId":{"type":"string"}},"required":["laterChangeSetIds","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"USE_IMPORT_UNDO"},"status":{"const":409},"message":{"type":"string","default":"USE_IMPORT_UNDO"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_EXISTS"},"status":{"const":409},"message":{"type":"string","default":"RULE_EXISTS"},"data":{"type":"object","properties":{"ruleId":{"type":"string","minLength":1,"maxLength":100},"traceId":{"type":"string"}},"required":["ruleId","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNDO_CHAIN_BROKEN"},"status":{"const":409},"message":{"type":"string","default":"UNDO_CHAIN_BROKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERGE_NOT_NEWEST"},"status":{"const":409},"message":{"type":"string","default":"MERGE_NOT_NEWEST"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERGE_STANDS"},"status":{"const":409},"message":{"type":"string","default":"MERGE_STANDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERGE_UNDONE"},"status":{"const":409},"message":{"type":"string","default":"MERGE_UNDONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/assertions/list":{"get":{"operationId":"ledger.assertions.list","summary":"List a book’s recorded balances, newest date first, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"pocketId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"asset","in":"query","required":false,"schema":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"latest","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pocketId":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"source":{"enum":["manual","import","sync"],"type":"string"},"status":{"enum":["ok","adjusted","broken"],"type":"string"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"adjustmentTransactionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"edited":{"type":"array","items":{"type":"object","properties":{"transactionId":{"type":"string"},"stated":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"here":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"movedTo":{"type":"array","items":{"type":"string"}}},"required":["transactionId","stated","here","movedTo"]}}},"required":["id","pocketId","date","amount","source","status","difference","adjustmentTransactionId","createdAt","edited"]}},"nextCursor":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["items","nextCursor"]}}}}}}},"/ledger/assertions/create":{"post":{"operationId":"ledger.assertions.create","summary":"Record a pocket’s balance on a day, posting an adjustment for any difference","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"pocketId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"replaces":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","pocketId","date","amount","replaces","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"assertion":{"type":"object","properties":{"id":{"type":"string"},"pocketId":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"source":{"enum":["manual","import","sync"],"type":"string"},"status":{"enum":["ok","adjusted","broken"],"type":"string"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"adjustmentTransactionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"edited":{"type":"array","items":{"type":"object","properties":{"transactionId":{"type":"string"},"stated":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"here":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"movedTo":{"type":"array","items":{"type":"string"}}},"required":["transactionId","stated","here","movedTo"]}}},"required":["id","pocketId","date","amount","source","status","difference","adjustmentTransactionId","createdAt","edited"]},"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["assertion","changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ASSERTION_EXISTS"},"status":{"const":409},"message":{"type":"string","default":"ASSERTION_EXISTS"},"data":{"type":"object","properties":{"assertionId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"traceId":{"type":"string"}},"required":["assertionId","amount","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ASSERTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"ASSERTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"DATE_IN_FUTURE"},"status":{"const":422},"message":{"type":"string","default":"DATE_IN_FUTURE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/assertions/createMany":{"post":{"operationId":"ledger.assertions.createMany","summary":"Record a pocket’s balance in several assets on one day, all or nothing","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"pocketId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"balances":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"object","properties":{"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"replaces":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["amount","replaces"],"additionalProperties":false}},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","pocketId","date","balances","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"assertions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pocketId":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"source":{"enum":["manual","import","sync"],"type":"string"},"status":{"enum":["ok","adjusted","broken"],"type":"string"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"adjustmentTransactionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"edited":{"type":"array","items":{"type":"object","properties":{"transactionId":{"type":"string"},"stated":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"here":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"movedTo":{"type":"array","items":{"type":"string"}}},"required":["transactionId","stated","here","movedTo"]}}},"required":["id","pocketId","date","amount","source","status","difference","adjustmentTransactionId","createdAt","edited"]}},"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["assertions","changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ASSERTION_EXISTS"},"status":{"const":409},"message":{"type":"string","default":"ASSERTION_EXISTS"},"data":{"type":"object","properties":{"standing":{"type":"array","minItems":1,"items":{"type":"object","properties":{"assertionId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["assertionId","amount"]}},"traceId":{"type":"string"}},"required":["standing","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ASSERTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"ASSERTION_CHANGED"},"data":{"type":"object","properties":{"assets":{"type":"array","minItems":1,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"traceId":{"type":"string"}},"required":["assets","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"DATE_IN_FUTURE"},"status":{"const":422},"message":{"type":"string","default":"DATE_IN_FUTURE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/assertions/preview":{"get":{"operationId":"ledger.assertions.preview","summary":"Preview the adjustment recording a pocket’s balances on a day would post","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"pocketId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"date","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"amounts","in":"query","required":true,"schema":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"standing":{"anyOf":[{"type":"object","properties":{"assertionId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["assertionId","amount"]},{"type":"null"}]},"stated":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"adjustment":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unchanged":{"type":"boolean"}},"required":["amount","standing","stated","adjustment","unchanged"]}}},"required":["balances"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"DATE_IN_FUTURE"},"status":{"const":422},"message":{"type":"string","default":"DATE_IN_FUTURE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/assertions/delete":{"post":{"operationId":"ledger.assertions.delete","summary":"Delete a recorded balance and its adjustment","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"assertionId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","assertionId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"assertionId":{"type":"string"},"changeSetId":{"type":"string"}},"required":["assertionId","changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/createDryRun":{"post":{"operationId":"ledger.bookTransfers.createDryRun","summary":"Check what moving money between books would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"toBookId":{"type":"string","minLength":1,"maxLength":100},"id":{"type":"string","format":"uuid"},"toId":{"type":"string","format":"uuid"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","toBookId","bookingDate","fromPocketId","toPocketId","amount","asset","as"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/create":{"post":{"operationId":"ledger.bookTransfers.create","summary":"Move money from a pocket in one book to a pocket in another","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"toBookId":{"type":"string","minLength":1,"maxLength":100},"id":{"type":"string","format":"uuid"},"toId":{"type":"string","format":"uuid"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","requestId","toBookId","bookingDate","fromPocketId","toPocketId","amount","asset","as"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]},"to":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]}},"required":["from","to"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/updateDryRun":{"post":{"operationId":"ledger.bookTransfers.updateDryRun","summary":"Check what changing a transfer between books would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"transfer":{"type":"object","properties":{"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookingDate","fromPocketId","toPocketId","amount","asset","as"],"additionalProperties":false}},"required":["bookId","transactionId","ifChangeSetId","transfer"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CHANGE_SET_SUPERSEDED"},"status":{"const":409},"message":{"type":"string","default":"CHANGE_SET_SUPERSEDED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/update":{"post":{"operationId":"ledger.bookTransfers.update","summary":"Change both sides of a transfer between books","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"transfer":{"type":"object","properties":{"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"fromPocketId":{"type":"string","minLength":1,"maxLength":100},"toPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookingDate","fromPocketId","toPocketId","amount","asset","as"],"additionalProperties":false}},"required":["bookId","requestId","transactionId","ifChangeSetId","transfer"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]},"to":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]}},"required":["from","to"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CHANGE_SET_SUPERSEDED"},"status":{"const":409},"message":{"type":"string","default":"CHANGE_SET_SUPERSEDED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/fromTransactionDryRun":{"post":{"operationId":"ledger.bookTransfers.fromTransactionDryRun","summary":"Check what turning a payment into a transfer between books would do to balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"otherBookId":{"type":"string","minLength":1,"maxLength":100},"otherPocketId":{"type":"string","minLength":1,"maxLength":100},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","ifChangeSetId","otherBookId","otherPocketId","as"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SEVERAL_COUNTERPARTS"},"status":{"const":409},"message":{"type":"string","default":"SEVERAL_COUNTERPARTS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/fromTransaction":{"post":{"operationId":"ledger.bookTransfers.fromTransaction","summary":"Turn a payment or income into a transfer with another book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"otherBookId":{"type":"string","minLength":1,"maxLength":100},"otherPocketId":{"type":"string","minLength":1,"maxLength":100},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","requestId","transactionId","ifChangeSetId","otherBookId","otherPocketId","as"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]},"to":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]},"joined":{"type":"boolean"}},"required":["from","to","joined"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SEVERAL_COUNTERPARTS"},"status":{"const":409},"message":{"type":"string","default":"SEVERAL_COUNTERPARTS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/joinDryRun":{"post":{"operationId":"ledger.bookTransfers.joinDryRun","summary":"Check what joining rows of two books would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"otherBookId":{"type":"string","minLength":1,"maxLength":100},"otherTransactionId":{"type":"string","minLength":1,"maxLength":100},"otherIfChangeSetId":{"type":"string","minLength":1,"maxLength":100},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","ifChangeSetId","otherBookId","otherTransactionId","otherIfChangeSetId","as"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/join":{"post":{"operationId":"ledger.bookTransfers.join","summary":"Join a row of this book and one of another as a transfer, by hand","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100},"otherBookId":{"type":"string","minLength":1,"maxLength":100},"otherTransactionId":{"type":"string","minLength":1,"maxLength":100},"otherIfChangeSetId":{"type":"string","minLength":1,"maxLength":100},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","requestId","transactionId","ifChangeSetId","otherBookId","otherTransactionId","otherIfChangeSetId","as"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]},"to":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"}},"required":["transaction","changeSetId"]}},"required":["from","to"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/deleteDryRun":{"post":{"operationId":"ledger.bookTransfers.deleteDryRun","summary":"Check what deleting a transfer between books would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","transactionId","ifChangeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CHANGE_SET_SUPERSEDED"},"status":{"const":409},"message":{"type":"string","default":"CHANGE_SET_SUPERSEDED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/delete":{"post":{"operationId":"ledger.bookTransfers.delete","summary":"Delete both sides of a transfer between books","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","requestId","transactionId","ifChangeSetId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"object","properties":{"transactionId":{"type":"string"},"changeSetId":{"type":"string"}},"required":["transactionId","changeSetId"]},"to":{"type":"object","properties":{"transactionId":{"type":"string"},"changeSetId":{"type":"string"}},"required":["transactionId","changeSetId"]}},"required":["from","to"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CHANGE_SET_SUPERSEDED"},"status":{"const":409},"message":{"type":"string","default":"CHANGE_SET_SUPERSEDED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/bookTransfers/between":{"get":{"operationId":"ledger.bookTransfers.between","summary":"Sum what a book put into another, took back and is owed, per asset","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"otherBookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"putIn":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"takenBack":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"owed":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["asset","putIn","takenBack","owed"]}}}}}}}},"/ledger/contacts/list":{"get":{"operationId":"ledger.contacts.list","summary":"List a book’s contacts, the most owed first, then settled and archived ones","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}}}}}}}},"/ledger/contacts/get":{"get":{"operationId":"ledger.contacts.get","summary":"Get one contact and what is owed with them","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"contactId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}}}}}}},"/ledger/contacts/lend":{"post":{"operationId":"ledger.contacts.lend","summary":"Record money lent to or borrowed from a contact","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"direction":{"enum":["lent","borrowed"],"type":"string"}},"required":["bookId","requestId","bookingDate","contact","pocketId","amount","asset","direction"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"},"contact":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}},"required":["transaction","changeSetId","contact"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/contacts/settle":{"post":{"operationId":"ledger.contacts.settle","summary":"Record money paid back to or by a contact, all that is open by default","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"contactId":{"type":"string","minLength":1,"maxLength":100},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"direction":{"enum":["to-you","by-you"],"type":"string"},"bookingDate":{"type":"string","format":"date"},"way":{"anyOf":[{"type":"object","properties":{"into":{"type":"object","properties":{"pocketId":{"type":"string","minLength":1,"maxLength":100},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false}},"required":["pocketId"],"additionalProperties":false}},"required":["into"],"additionalProperties":false},{"type":"object","properties":{"transaction":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["transactionId","ifChangeSetId"],"additionalProperties":false}},"required":["transaction"],"additionalProperties":false},{"type":"object","properties":{"paidFor":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["categoryId"],"additionalProperties":false}},"required":["paidFor"],"additionalProperties":false}]}},"required":["bookId","requestId","contactId","asset","bookingDate","way"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"},"contact":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}},"required":["transaction","changeSetId","contact"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_SETTLED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_SETTLED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/contacts/forgive":{"post":{"operationId":"ledger.contacts.forgive","summary":"Write off what a contact owes you, or what you owe them","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"contactId":{"type":"string","minLength":1,"maxLength":100},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"bookingDate":{"type":"string","format":"date"}},"required":["bookId","requestId","contactId","asset","bookingDate"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"},"contact":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}},"required":["transaction","changeSetId","contact"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_SETTLED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_SETTLED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/contacts/rename":{"post":{"operationId":"ledger.contacts.rename","summary":"Rename a contact","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"contactId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["bookId","contactId","expectedUpdatedAt","contactName"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_NAME_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_NAME_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/contacts/archive":{"post":{"operationId":"ledger.contacts.archive","summary":"Archive a settled contact, hiding it from the open ones","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"contactId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","contactId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_NOT_SETTLED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_NOT_SETTLED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/contacts/linkDryRun":{"post":{"operationId":"ledger.contacts.linkDryRun","summary":"Check what turning payments into transfers with a contact would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"as":{"enum":["loan","repayment"],"type":"string"},"items":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["transactionId","ifChangeSetId"],"additionalProperties":false}}},"required":["bookId","contact","as","items"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/contacts/link":{"post":{"operationId":"ledger.contacts.link","summary":"Turn up to 1,000 payments and income into transfers with a contact at once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"as":{"enum":["loan","repayment"],"type":"string"},"items":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["transactionId","ifChangeSetId"],"additionalProperties":false}}},"required":["bookId","requestId","contact","as","items"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"type":"string"},"changed":{"type":"array","items":{"type":"string"}},"contact":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}},"required":["changeSetId","changed","contact"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/contacts/merge":{"post":{"operationId":"ledger.contacts.merge","summary":"Merge one contact into another, moving all its transactions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"contactId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"intoId":{"type":"string","minLength":1,"maxLength":100},"intoExpectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","contactId","expectedUpdatedAt","intoId","intoExpectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"contact":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}},"required":["changeSetId","contact"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"CONTACT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/contacts/unarchive":{"post":{"operationId":"ledger.contacts.unarchive","summary":"Show an archived contact again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"contactId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"}},"required":["bookId","contactId","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","balances","total","lastActiveOn","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/owed/list":{"get":{"operationId":"ledger.owed.list","summary":"List the people and other books money is owed with, books first","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"counterparty":{"type":"object","properties":{"kind":{"enum":["contact","book"],"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"]},"pocketId":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["counterparty","pocketId","status","balances","total","lastActiveOn","updatedAt"]}}}}}}}},"/ledger/owed/get":{"get":{"operationId":"ledger.owed.get","summary":"Get what is owed with a person or another book, and its balance over time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"contactId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"otherBookId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"counterparty":{"type":"object","properties":{"kind":{"enum":["contact","book"],"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"]},"pocketId":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"},"over":{"type":"array","items":{"type":"object","properties":{"on":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["on","amount","asset"]}}},"required":["counterparty","pocketId","status","balances","total","lastActiveOn","updatedAt","over"]}}}}}}},"/ledger/owed/lendDryRun":{"post":{"operationId":"ledger.owed.lendDryRun","summary":"Check what lending or borrowing would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"counterparty":{"anyOf":[{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]}},"required":["contact"],"additionalProperties":false},{"type":"object","properties":{"book":{"type":"string","minLength":1,"maxLength":100}},"required":["book"],"additionalProperties":false}]},"pocketId":{"type":"string","minLength":1,"maxLength":100},"otherPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"direction":{"enum":["lent","borrowed"],"type":"string"}},"required":["bookId","bookingDate","counterparty","pocketId","amount","asset","direction"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COUNTERPARTY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COUNTERPARTY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/owed/lend":{"post":{"operationId":"ledger.owed.lend","summary":"Record money lent to or borrowed from a person or another book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"type":"string","format":"date-time"},"payee":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string","minLength":1,"maxLength":5000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"status":{"enum":["pending","posted"],"type":"string"},"counterparty":{"anyOf":[{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]}},"required":["contact"],"additionalProperties":false},{"type":"object","properties":{"book":{"type":"string","minLength":1,"maxLength":100}},"required":["book"],"additionalProperties":false}]},"pocketId":{"type":"string","minLength":1,"maxLength":100},"otherPocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false},"direction":{"enum":["lent","borrowed"],"type":"string"}},"required":["bookId","requestId","bookingDate","counterparty","pocketId","amount","asset","direction"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"},"owed":{"type":"object","properties":{"counterparty":{"type":"object","properties":{"kind":{"enum":["contact","book"],"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"]},"pocketId":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["counterparty","pocketId","status","balances","total","lastActiveOn","updatedAt"]}},"required":["transaction","changeSetId","owed"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COUNTERPARTY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COUNTERPARTY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ID_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"ID_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/owed/settleDryRun":{"post":{"operationId":"ledger.owed.settleDryRun","summary":"Check what settling up would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"counterparty":{"anyOf":[{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]}},"required":["contact"],"additionalProperties":false},{"type":"object","properties":{"book":{"type":"string","minLength":1,"maxLength":100}},"required":["book"],"additionalProperties":false}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"direction":{"enum":["to-you","by-you"],"type":"string"},"bookingDate":{"type":"string","format":"date"},"way":{"anyOf":[{"type":"object","properties":{"into":{"type":"object","properties":{"pocketId":{"type":"string","minLength":1,"maxLength":100},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false}},"required":["pocketId"],"additionalProperties":false}},"required":["into"],"additionalProperties":false},{"type":"object","properties":{"transaction":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["transactionId","ifChangeSetId"],"additionalProperties":false}},"required":["transaction"],"additionalProperties":false},{"type":"object","properties":{"paidFor":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["categoryId"],"additionalProperties":false}},"required":["paidFor"],"additionalProperties":false}]},"otherPocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","counterparty","asset","bookingDate","way"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COUNTERPARTY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COUNTERPARTY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOTHING_OWED"},"status":{"const":409},"message":{"type":"string","default":"NOTHING_OWED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/owed/settle":{"post":{"operationId":"ledger.owed.settle","summary":"Record money paid back to or by a person or another book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"counterparty":{"anyOf":[{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]}},"required":["contact"],"additionalProperties":false},{"type":"object","properties":{"book":{"type":"string","minLength":1,"maxLength":100}},"required":["book"],"additionalProperties":false}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"direction":{"enum":["to-you","by-you"],"type":"string"},"bookingDate":{"type":"string","format":"date"},"way":{"anyOf":[{"type":"object","properties":{"into":{"type":"object","properties":{"pocketId":{"type":"string","minLength":1,"maxLength":100},"received":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"],"additionalProperties":false}},"required":["pocketId"],"additionalProperties":false}},"required":["into"],"additionalProperties":false},{"type":"object","properties":{"transaction":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"ifChangeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["transactionId","ifChangeSetId"],"additionalProperties":false}},"required":["transaction"],"additionalProperties":false},{"type":"object","properties":{"paidFor":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["categoryId"],"additionalProperties":false}},"required":["paidFor"],"additionalProperties":false}]},"otherPocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","requestId","counterparty","asset","bookingDate","way"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"},"owed":{"type":"object","properties":{"counterparty":{"type":"object","properties":{"kind":{"enum":["contact","book"],"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"]},"pocketId":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["counterparty","pocketId","status","balances","total","lastActiveOn","updatedAt"]}},"required":["transaction","changeSetId","owed"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_MERGED"},"status":{"const":404},"message":{"type":"string","default":"TRANSACTION_MERGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COUNTERPARTY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COUNTERPARTY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOTHING_OWED"},"status":{"const":409},"message":{"type":"string","default":"NOTHING_OWED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"TRANSACTION_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_A_TRANSFER_PAIR"},"status":{"const":422},"message":{"type":"string","default":"NOT_A_TRANSFER_PAIR"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/owed/forgiveDryRun":{"post":{"operationId":"ledger.owed.forgiveDryRun","summary":"Check what writing off what is owed would do to bank balances","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"counterparty":{"anyOf":[{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]}},"required":["contact"],"additionalProperties":false},{"type":"object","properties":{"book":{"type":"string","minLength":1,"maxLength":100}},"required":["book"],"additionalProperties":false}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"bookingDate":{"type":"string","format":"date"}},"required":["bookId","counterparty","asset","bookingDate"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["balanceChecks"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COUNTERPARTY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COUNTERPARTY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOTHING_OWED"},"status":{"const":409},"message":{"type":"string","default":"NOTHING_OWED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/owed/forgive":{"post":{"operationId":"ledger.owed.forgive","summary":"Write off what is owed with a person or another book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"},"counterparty":{"anyOf":[{"type":"object","properties":{"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]}},"required":["contact"],"additionalProperties":false},{"type":"object","properties":{"book":{"type":"string","minLength":1,"maxLength":100}},"required":["book"],"additionalProperties":false}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"bookingDate":{"type":"string","format":"date"}},"required":["bookId","requestId","counterparty","asset","bookingDate"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transaction":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]},"changeSetId":{"type":"string"},"owed":{"type":"object","properties":{"counterparty":{"type":"object","properties":{"kind":{"enum":["contact","book"],"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"]},"pocketId":{"type":"string"},"status":{"enum":["open","settled","archived"],"type":"string"},"balances":{"type":"array","items":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"since":{"type":"string","format":"date"}},"required":["amount","asset","since"]}},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastActiveOn":{"type":"string","format":"date"},"updatedAt":{"type":"string","format":"date-time"}},"required":["counterparty","pocketId","status","balances","total","lastActiveOn","updatedAt"]}},"required":["transaction","changeSetId","owed"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COUNTERPARTY_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COUNTERPARTY_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOTHING_OWED"},"status":{"const":409},"message":{"type":"string","default":"NOTHING_OWED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_ACCOUNT"},"status":{"const":422},"message":{"type":"string","default":"INVALID_ACCOUNT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/ledger/tags/list":{"get":{"operationId":"ledger.tags.list","summary":"List the tags on a book’s transactions","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"q","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"tag":{"type":"string"},"count":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["tag","count"]}}}}}}}},"/rates/list":{"get":{"operationId":"rates.list","summary":"List market rates and a book’s own rates over a period, newest first","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"base","in":"query","required":false,"schema":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"allowEmptyValue":true,"allowReserved":true},{"name":"quote","in":"query","required":false,"schema":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"allowEmptyValue":true,"allowReserved":true},{"name":"source","in":"query","required":false,"schema":{"const":"manual"},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"base":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"quote":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"date":{"type":"string","format":"date"},"rate":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,30})?$"},"source":{"type":"string","minLength":1,"maxLength":40},"unused":{"type":"boolean"}},"required":["base","quote","date","rate","source","unused"]}}}}}}}},"/rates/setManual":{"post":{"operationId":"rates.setManual","summary":"Set a book’s own rate for a pair and day the market has no rate for","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"base":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"quote":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"date":{"type":"string","format":"date"},"rate":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,30})?$"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","base","quote","date","rate","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"base":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"quote":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"date":{"type":"string","format":"date"},"rate":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,30})?$"},"source":{"type":"string","minLength":1,"maxLength":40}},"required":["base","quote","date","rate","source"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RATE_NOT_POSITIVE"},"status":{"const":422},"message":{"type":"string","default":"RATE_NOT_POSITIVE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MARKET_HAS_RATE"},"status":{"const":422},"message":{"type":"string","default":"MARKET_HAS_RATE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/rates/removeManual":{"post":{"operationId":"rates.removeManual","summary":"Remove a book’s own rate for a pair and day","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"base":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"quote":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"date":{"type":"string","format":"date"}},"required":["bookId","base","quote","date"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"boolean"}},"required":["removed"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/rates/coins":{"post":{"operationId":"rates.coins","summary":"List the coins each crypto ticker could be and the one the book prices","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"assets":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}}},"required":["bookId","assets"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"coinId":{"anyOf":[{"type":"string"},{"type":"null"}]},"pinnedBy":{"anyOf":[{"enum":["auto","venue","chosen","unpriced"],"type":"string"},{"type":"null"}]},"candidates":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"name":{"type":"string"},"marketCap":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"price":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,30})?$"},{"type":"null"}]}},"required":["id","name","marketCap","price"]}}},"required":["asset","coinId","pinnedBy","candidates"]}}}}}}}},"/rates/pinCoin":{"post":{"operationId":"rates.pinCoin","summary":"Choose which coin a book prices a crypto ticker as, or none, and re-price it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"coinId":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["bookId","asset","coinId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"coinId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["asset","coinId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COIN_NOT_LISTED"},"status":{"const":422},"message":{"type":"string","default":"COIN_NOT_LISTED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/holdings/list":{"get":{"operationId":"holdings.list","summary":"List what each pocket holds of each investment, valued on a date","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"date","in":"query","required":false,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"date":{"type":"string","format":"date"},"holdings":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"pocketId":{"type":"string"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"kind":{"enum":["crypto","security"],"type":"string"},"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unknownCostQuantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"costBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"quote":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"price":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"priceDate":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"value":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"unrealisedBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"incomeBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"incomeUnconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["pocketId","asset","kind","quantity","unknownCostQuantity","costBase","quote","price","priceDate","value","unrealisedBase","incomeBase","incomeUnconverted"]}},"byAsset":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"kind":{"enum":["crypto","security"],"type":"string"},"pocketIds":{"type":"array","maxItems":1000,"items":{"type":"string"}},"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unknownCostQuantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"costBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"quote":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"price":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"priceDate":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"value":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"unrealisedBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"unrealisedShare":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"incomeBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["asset","kind","pocketIds","quantity","unknownCostQuantity","costBase","quote","price","priceDate","value","unrealisedBase","unrealisedShare","incomeBase"]}},"totals":{"type":"object","properties":{"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unrealised":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"costOfUnrealised":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unpriced":{"type":"array","maxItems":1000,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"unknownCost":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["asset","quantity"]}},"byKind":{"type":"array","maxItems":2,"items":{"type":"object","properties":{"kind":{"enum":["crypto","security"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["kind","value"]}},"stale":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"priceDate":{"type":"string","format":"date"}},"required":["asset","priceDate"]}}},"required":["value","unrealised","costOfUnrealised","unpriced","unknownCost","byKind","stale"]}},"required":["baseCurrency","date","holdings","byAsset","totals"]}}}}}}},"/holdings/lots":{"get":{"operationId":"holdings.lots","summary":"List an asset’s lots, oldest first","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"asset","in":"query","required":true,"schema":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"allowEmptyValue":true,"allowReserved":true},{"name":"pocketId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":500},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"items":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"pocketId":{"type":"string"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"acquiredOn":{"type":"string","format":"date"},"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"remaining":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"cost":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"costBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"feesBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"remainingCostBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"costUnknown":{"type":"boolean"},"costStated":{"type":"boolean"},"costFromIncome":{"type":"boolean"},"costVersion":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"purchaseId":{"anyOf":[{"type":"string"},{"type":"null"}]},"restUnknown":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"purchase":{"anyOf":[{"type":"object","properties":{"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"boughtOn":{"type":"string","format":"date"},"cost":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]}},"required":["quantity","boughtOn","cost"]},{"type":"null"}]},"takesPurchase":{"type":"boolean"},"worthBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"gainBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["id","transactionId","pocketId","asset","acquiredOn","quantity","remaining","cost","costBase","feesBase","remainingCostBase","costUnknown","costStated","costFromIncome","costVersion","purchaseId","restUnknown","purchase","takesPurchase","worthBase","gainBase"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"unknown":{"type":"object","properties":{"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"worthBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["quantity","worthBase"]},"priceDate":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]}},"required":["baseCurrency","items","nextCursor","unknown","priceDate"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_AN_INVESTMENT_ASSET"},"status":{"const":409},"message":{"type":"string","default":"NOT_AN_INVESTMENT_ASSET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/holdings/realised":{"get":{"operationId":"holdings.realised","summary":"List sales between two dates with their realised gain or loss","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":500},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"items":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"transactionId":{"type":"string"},"lotId":{"anyOf":[{"type":"string"},{"type":"null"}]},"pocketId":{"type":"string"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"disposedOn":{"type":"string","format":"date"},"acquiredOn":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"costBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"proceedsBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"feesBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"realisedBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"short":{"type":"boolean"},"costUnknown":{"type":"boolean"},"proceedsUnknown":{"type":"boolean"}},"required":["transactionId","lotId","pocketId","asset","disposedOn","acquiredOn","quantity","costBase","proceedsBase","feesBase","realisedBase","short","costUnknown","proceedsUnknown"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"firstOn":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"totals":{"type":"object","properties":{"proceedsBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"costBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"feesBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"realisedBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unknownCost":{"type":"integer","minimum":0,"maximum":9007199254740991},"unknownProceeds":{"type":"integer","minimum":0,"maximum":9007199254740991},"short":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["proceedsBase","costBase","feesBase","realisedBase","unknownCost","unknownProceeds","short"]}},"required":["baseCurrency","items","nextCursor","firstOn","totals"]}}}}}}},"/holdings/income":{"get":{"operationId":"holdings.income","summary":"List dividends, interest and staking rewards between two dates","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":500},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"allowEmptyValue":true,"allowReserved":true},{"name":"asset","in":"query","required":false,"schema":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"allowEmptyValue":true,"allowReserved":true},{"name":"pocketId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"items":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"transactionId":{"type":"string"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"pocketId":{"type":"string"},"kind":{"enum":["dividend","interest","staking"],"type":"string"},"receivedOn":{"type":"string","format":"date"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"amountBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["transactionId","asset","pocketId","kind","receivedOn","amount","amountBase"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"firstOn":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"totals":{"type":"object","properties":{"amountBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["amountBase","unconverted"]}},"required":["baseCurrency","items","nextCursor","firstOn","totals"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_AN_INVESTMENT_ASSET"},"status":{"const":409},"message":{"type":"string","default":"NOT_AN_INVESTMENT_ASSET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/holdings/setLotCost":{"post":{"operationId":"holdings.setLotCost","summary":"State or clear the cost of an acquisition the ledger cannot price","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"costVersion":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"cost":{"anyOf":[{"type":"object","properties":{"total":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["total"],"additionalProperties":false},{"type":"object","properties":{"unitPrice":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["unitPrice"],"additionalProperties":false}]},"costBase":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"fees":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","transactionId","asset","costVersion","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"lots":{"type":"array","maxItems":100,"items":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"pocketId":{"type":"string"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"acquiredOn":{"type":"string","format":"date"},"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"remaining":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"cost":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"costBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"feesBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"remainingCostBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"costUnknown":{"type":"boolean"},"costStated":{"type":"boolean"},"costFromIncome":{"type":"boolean"},"costVersion":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"purchaseId":{"anyOf":[{"type":"string"},{"type":"null"}]},"restUnknown":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"purchase":{"anyOf":[{"type":"object","properties":{"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"boughtOn":{"type":"string","format":"date"},"cost":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]}},"required":["quantity","boughtOn","cost"]},{"type":"null"}]},"takesPurchase":{"type":"boolean"},"worthBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"gainBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["id","transactionId","pocketId","asset","acquiredOn","quantity","remaining","cost","costBase","feesBase","remainingCostBase","costUnknown","costStated","costFromIncome","costVersion","purchaseId","restUnknown","purchase","takesPurchase","worthBase","gainBase"]}}},"required":["baseCurrency","lots"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_AN_INVESTMENT_ASSET"},"status":{"const":409},"message":{"type":"string","default":"NOT_AN_INVESTMENT_ASSET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_AN_ACQUISITION"},"status":{"const":409},"message":{"type":"string","default":"NOT_AN_ACQUISITION"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COST_KNOWN"},"status":{"const":409},"message":{"type":"string","default":"COST_KNOWN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COST_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COST_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_BASE_CURRENCY"},"status":{"const":422},"message":{"type":"string","default":"NOT_BASE_CURRENCY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RATE_MISSING"},"status":{"const":422},"message":{"type":"string","default":"RATE_MISSING"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/holdings/statePurchase":{"post":{"operationId":"holdings.statePurchase","summary":"State a known purchase inside a lot of unknown cost, or change one","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"lotId":{"type":"string","minLength":1,"maxLength":100},"purchaseId":{"type":"string","minLength":1,"maxLength":100},"version":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"quantity":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"boughtOn":{"type":"string","format":"date"},"cost":{"anyOf":[{"type":"object","properties":{"total":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["total"],"additionalProperties":false},{"type":"object","properties":{"unitPrice":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["unitPrice"],"additionalProperties":false}]},"costBase":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"fees":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","asset","version","quantity","boughtOn","cost","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"purchaseId":{"type":"string"}},"required":["purchaseId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_AN_INVESTMENT_ASSET"},"status":{"const":409},"message":{"type":"string","default":"NOT_AN_INVESTMENT_ASSET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_AN_ACQUISITION"},"status":{"const":409},"message":{"type":"string","default":"NOT_AN_ACQUISITION"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COST_KNOWN"},"status":{"const":409},"message":{"type":"string","default":"COST_KNOWN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COST_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COST_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MORE_THAN_UNKNOWN"},"status":{"const":409},"message":{"type":"string","default":"MORE_THAN_UNKNOWN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_BASE_CURRENCY"},"status":{"const":422},"message":{"type":"string","default":"NOT_BASE_CURRENCY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RATE_MISSING"},"status":{"const":422},"message":{"type":"string","default":"RATE_MISSING"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOUGHT_AFTER_ARRIVAL"},"status":{"const":422},"message":{"type":"string","default":"BOUGHT_AFTER_ARRIVAL"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/holdings/removePurchase":{"post":{"operationId":"holdings.removePurchase","summary":"Remove a known purchase: its quantity is of unknown cost again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"purchaseId":{"type":"string","minLength":1,"maxLength":100},"version":{"type":"string","minLength":1,"maxLength":500},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","asset","purchaseId","version","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_AN_INVESTMENT_ASSET"},"status":{"const":409},"message":{"type":"string","default":"NOT_AN_INVESTMENT_ASSET"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COST_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"COST_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"COST_KNOWN"},"status":{"const":409},"message":{"type":"string","default":"COST_KNOWN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/reports/flows":{"get":{"operationId":"reports.flows","summary":"Sum a book’s spending and income over a period, split up to three ways","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"groupBy","in":"query","required":false,"schema":{"type":"array","maxItems":3,"items":{"enum":["category","parentCategory","pocket","person","month","day","asset"],"type":"string"},"default":[]},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"filters","in":"query","required":false,"schema":{"type":"object","properties":{"pocketIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"categoryIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"personIds":{"type":"array","minItems":1,"maxItems":100,"items":{"anyOf":[{"const":"shared"},{"type":"string","minLength":1,"maxLength":100}]}},"assets":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"kinds":{"type":"array","minItems":1,"maxItems":8,"items":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"}},"exchangeSides":{"type":"array","minItems":1,"maxItems":3,"items":{"enum":["invested","divested","other"],"type":"string"}},"spending":{"const":true},"search":{"type":"string","minLength":1,"maxLength":200},"needsReview":{"type":"boolean"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"learned":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"direction":{"enum":["in","out"],"type":"string"}},"required":["key","direction"],"additionalProperties":false},"merchant":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200}},"required":["key"],"additionalProperties":false},"guesses":{"type":"object","properties":{"from":{"type":"integer","minimum":0,"maximum":100},"to":{"type":"integer","minimum":0,"maximum":100}},"required":["from","to"],"additionalProperties":false},"contactAs":{"type":"array","minItems":1,"maxItems":2,"items":{"enum":["loan","repayment"],"type":"string"}},"moves":{"type":"array","minItems":1,"maxItems":3,"items":{"enum":["loan","repayment","contribution"],"type":"string"}}},"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"includePending","in":"query","required":false,"schema":{"type":"boolean","default":false},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"rows":{"type":"array","maxItems":10000,"items":{"type":"object","properties":{"keys":{"type":"object","properties":{"category":{"type":"string","minLength":1,"maxLength":100},"parentCategory":{"type":"string","minLength":1,"maxLength":100},"pocket":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"person":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"month":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"day":{"type":"string","format":"date"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"additionalProperties":false},"expense":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"income":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["keys","expense","income","count","unconverted"]}},"totals":{"type":"object","properties":{"expense":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"income":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"net":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["expense","income","net","count"]},"unconverted":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"count":{"type":"integer","minimum":1,"maximum":9007199254740991},"expense":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"income":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["asset","count","expense","income"]}}},"required":["baseCurrency","rows","totals","unconverted"]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REPORT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"REPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/reports/netWorth":{"get":{"operationId":"reports.netWorth","summary":"Value every pocket’s balances at the end of a day in the base currency","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"date","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"owner","in":"query","required":false,"schema":{"anyOf":[{"const":"shared"},{"type":"string","minLength":1,"maxLength":100}]},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"date":{"type":"string","format":"date"},"holdings":{"type":"array","maxItems":10000,"items":{"type":"object","properties":{"pocketId":{"type":"string","minLength":1,"maxLength":100},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"value":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"rateDate":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]}},"required":["pocketId","asset","amount","value","rateDate"]}},"pockets":{"type":"array","maxItems":10000,"items":{"type":"object","properties":{"pocketId":{"type":"string","minLength":1,"maxLength":100},"total":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"unconverted":{"type":"array","maxItems":200,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}}},"required":["pocketId","total","unconverted"]}},"byKind":{"type":"object","properties":{"fiat":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"crypto":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"security":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"cash":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["fiat","crypto","security","cash"]},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"owedToYou":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"youOwe":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"count":{"type":"integer","minimum":1,"maximum":9007199254740991},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["asset","count","amount"]}},"rates":{"type":"array","maxItems":10000,"items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"rate":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,30})?$"},"date":{"type":"string","format":"date"},"own":{"type":"boolean"}},"required":["asset","rate","date","own"]}}},"required":["baseCurrency","date","holdings","pockets","byKind","total","owedToYou","youOwe","unconverted","rates"]}}}}}}},"/reports/netWorthSeries":{"get":{"operationId":"reports.netWorthSeries","summary":"List net worth at each day, week or month end of a period","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"step","in":"query","required":false,"schema":{"enum":["month","week","day"],"type":"string","default":"month"},"allowEmptyValue":true,"allowReserved":true},{"name":"owner","in":"query","required":false,"schema":{"anyOf":[{"const":"shared"},{"type":"string","minLength":1,"maxLength":100}]},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"points":{"type":"array","maxItems":400,"items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"byKind":{"type":"object","properties":{"fiat":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"crypto":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"security":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"cash":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["fiat","crypto","security","cash"]},"unconverted":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"count":{"type":"integer","minimum":1,"maximum":9007199254740991},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["asset","count","amount"]}}},"required":["date","total","byKind","unconverted"]}}},"required":["baseCurrency","points"]}}}}}}},"/reports/usual":{"get":{"operationId":"reports.usual","summary":"Work out a month’s usual spending: the median of the 12 months before","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"month","in":"query","required":true,"schema":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"allowEmptyValue":true,"allowReserved":true},{"name":"through","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":31},"allowEmptyValue":true,"allowReserved":true},{"name":"since","in":"query","required":false,"schema":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"allowEmptyValue":true,"allowReserved":true},{"name":"groupBy","in":"query","required":false,"schema":{"type":"array","maxItems":3,"items":{"enum":["parentCategory","category","pocket","person"],"type":"string"},"default":[]},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"filters","in":"query","required":false,"schema":{"type":"object","properties":{"pocketIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"categoryIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"personIds":{"type":"array","minItems":1,"maxItems":100,"items":{"anyOf":[{"const":"shared"},{"type":"string","minLength":1,"maxLength":100}]}},"assets":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"kinds":{"type":"array","minItems":1,"maxItems":8,"items":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"}},"exchangeSides":{"type":"array","minItems":1,"maxItems":3,"items":{"enum":["invested","divested","other"],"type":"string"}},"spending":{"const":true},"search":{"type":"string","minLength":1,"maxLength":200},"needsReview":{"type":"boolean"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}},"learned":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"direction":{"enum":["in","out"],"type":"string"}},"required":["key","direction"],"additionalProperties":false},"merchant":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200}},"required":["key"],"additionalProperties":false},"guesses":{"type":"object","properties":{"from":{"type":"integer","minimum":0,"maximum":100},"to":{"type":"integer","minimum":0,"maximum":100}},"required":["from","to"],"additionalProperties":false},"contactAs":{"type":"array","minItems":1,"maxItems":2,"items":{"enum":["loan","repayment"],"type":"string"}},"moves":{"type":"array","minItems":1,"maxItems":3,"items":{"enum":["loan","repayment","contribution"],"type":"string"}}},"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"includePending","in":"query","required":false,"schema":{"type":"boolean","default":false},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"months":{"type":"integer","minimum":0,"maximum":12},"window":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"to":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"}},"required":["from","to"]},{"type":"null"}]},"firstSpending":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"rows":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"keys":{"type":"object","properties":{"parentCategory":{"type":"string","minLength":1,"maxLength":100},"category":{"type":"string","minLength":1,"maxLength":100},"pocket":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"person":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"additionalProperties":false},"median":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["keys","median"]}},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"mean":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["baseCurrency","months","window","firstSpending","rows","total","mean","unconverted"]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REPORT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"REPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/reports/moved":{"get":{"operationId":"reports.moved","summary":"Total a period’s transfers, exchanges, investments, loans and repayments","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"includePending","in":"query","required":false,"schema":{"type":"boolean","default":false},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"transfers":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"base":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","base","unconverted"]},"exchanges":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count"]},"invested":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"base":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","base","unconverted"]},"divested":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"base":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","base","unconverted"]},"toOtherBooks":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"base":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","base","unconverted"]},"fromOtherBooks":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"base":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","base","unconverted"]},"contributions":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"base":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","base","unconverted"]},"loans":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"base":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","base","unconverted"]},"repayments":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"base":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","base","unconverted"]}},"required":["baseCurrency","transfers","exchanges","invested","divested","toOtherBooks","fromOtherBooks","contributions","loans","repayments"]}}}}}}},"/reports/year":{"get":{"operationId":"reports.year","summary":"Get a year’s figures by month, category, pocket and owner, with changes","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"year","in":"query","required":true,"schema":{"type":"integer","minimum":1970,"maximum":9999},"allowEmptyValue":true,"allowReserved":true},{"name":"today","in":"query","required":false,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"includePending","in":"query","required":false,"schema":{"type":"boolean","default":false},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"year":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"grids":{"type":"object","properties":{"category":{"type":"object","properties":{"rows":{"type":"array","maxItems":2000,"items":{"type":"object","properties":{"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"months":{"type":"array","minItems":12,"maxItems":12,"items":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991},"share":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["id","months","total","unconverted","share"]}},"monthTotals":{"type":"array","minItems":12,"maxItems":12,"items":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"top":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["rows","monthTotals","total","top"]},"pocket":{"type":"object","properties":{"rows":{"type":"array","maxItems":2000,"items":{"type":"object","properties":{"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"months":{"type":"array","minItems":12,"maxItems":12,"items":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991},"share":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["id","months","total","unconverted","share"]}},"monthTotals":{"type":"array","minItems":12,"maxItems":12,"items":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"top":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["rows","monthTotals","total","top"]},"person":{"type":"object","properties":{"rows":{"type":"array","maxItems":2000,"items":{"type":"object","properties":{"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"months":{"type":"array","minItems":12,"maxItems":12,"items":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991},"share":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["id","months","total","unconverted","share"]}},"monthTotals":{"type":"array","minItems":12,"maxItems":12,"items":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"top":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["rows","monthTotals","total","top"]}},"required":["category","pocket","person"]},"comparableMonths":{"type":"array","maxItems":12,"items":{"type":"integer","minimum":1,"maximum":12}},"categories":{"type":"array","maxItems":2000,"items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"now":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"comparison":{"anyOf":[{"type":"object","properties":{"kind":{"const":"no-history"}},"required":["kind"]},{"type":"object","properties":{"kind":{"enum":["about","more","less"],"type":"string"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["kind","difference"]}]}},"required":["id","now","before","comparison"]}},"movers":{"type":"array","maxItems":3,"items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"now":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"change":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["id","now","before","change"]}},"top":{"type":"array","maxItems":5,"items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"total":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"share":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["id","total","share"]}},"topTwoHalf":{"type":"boolean"},"topThreeHalf":{"type":"boolean"},"average":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"lastYear":{"anyOf":[{"type":"object","properties":{"spent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"through":{"type":"string","format":"date"}},"required":["spent","through"]},{"type":"null"}]}},"required":["baseCurrency","year","grids","comparableMonths","categories","movers","top","topTwoHalf","topThreeHalf","average","lastYear"]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REPORT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"REPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/reports/trends":{"get":{"operationId":"reports.trends","summary":"Get which categories are rising or falling and the new recurring payments","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"today","in":"query","required":false,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"includePending","in":"query","required":false,"schema":{"type":"boolean","default":false},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"today":{"type":"string","format":"date"},"months":{"type":"object","properties":{"recent":{"type":"integer","minimum":0,"maximum":3},"before":{"type":"integer","minimum":0,"maximum":6}},"required":["recent","before"]},"categories":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"recent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"comparison":{"anyOf":[{"type":"object","properties":{"kind":{"const":"no-history"}},"required":["kind"]},{"type":"object","properties":{"kind":{"enum":["about","more","less"],"type":"string"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["kind","difference"]}]}},"required":["categoryId","recent","before","comparison"]}},"usualMonths":{"type":"integer","minimum":0,"maximum":12},"thisMonth":{"type":"array","maxItems":3,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"spent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"usual":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"comparison":{"type":"object","properties":{"kind":{"enum":["more","less"],"type":"string"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["kind","difference"]}},"required":["categoryId","spent","usual","comparison"]}},"newRecurring":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"merchantKey":{"type":"string"},"name":{"type":"string"},"status":{"enum":["suggested","confirmed","dismissed"],"type":"string"},"state":{"enum":["active","changed","missed","stopped"],"type":"string"},"direction":{"enum":["in","out"],"type":"string"},"cadence":{"enum":["weekly","biweekly","monthly","quarterly","yearly"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"usualAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"expected":{"anyOf":[{"type":"object","properties":{"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["date","amount"]},{"type":"null"}]},"last":{"type":"array","maxItems":6,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["transactionId","date","amount"]}},"priceChange":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"at":{"type":"string","format":"date"}},"required":["from","to","at"]},{"type":"null"}]},"missed":{"type":"array","maxItems":3,"items":{"type":"string","format":"date"}},"occurrences":{"type":"integer","minimum":2,"maximum":9007199254740991},"firstDate":{"type":"string","format":"date"},"lastDate":{"type":"string","format":"date"},"confidence":{"type":"number","minimum":0,"maximum":1},"yearlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"yearlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"stillPaying":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","merchantKey","name","status","state","direction","cadence","pocketId","categoryId","asset","usualAmount","expected","last","priceChange","missed","occurrences","firstDate","lastDate","confidence","yearlyCost","monthlyCost","monthlyBase","yearlyBase","stillPaying","updatedAt"]}}},"required":["baseCurrency","today","months","categories","usualMonths","thisMonth","newRecurring"]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REPORT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"REPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/reports/budgets":{"get":{"operationId":"reports.budgets","summary":"Get each budgeted category’s spending this month and a suggested budget","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"month","in":"query","required":true,"schema":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"allowEmptyValue":true,"allowReserved":true},{"name":"today","in":"query","required":false,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"includePending","in":"query","required":false,"schema":{"type":"boolean","default":false},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"month":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"days":{"type":"object","properties":{"inMonth":{"type":"integer","minimum":28,"maximum":31},"gone":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["inMonth","gone"]},"budgets":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"budget":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"spent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"left":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"pace":{"anyOf":[{"type":"object","properties":{"expected":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"ahead":{"type":"boolean"}},"required":["expected","ahead"]},{"type":"null"}]}},"required":["categoryId","budget","spent","left","pace"]}},"suggestions":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"suggested":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","suggested"]}},"usualMonths":{"type":"integer","minimum":0,"maximum":12},"unconverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["baseCurrency","month","days","budgets","suggestions","usualMonths","unconverted"]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REPORT_TOO_LARGE"},"status":{"const":422},"message":{"type":"string","default":"REPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/reports/merchant":{"get":{"operationId":"reports.merchant","summary":"Get what one merchant cost over all time, by its key or one of its transactions","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"key","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"today","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"merchant":{"anyOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1},"firstDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"lastDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"spent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"thisYear":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"lastYear":{"anyOf":[{"type":"object","properties":{"spent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"through":{"type":"string","format":"date"}},"required":["spent","through"]},{"type":"null"}]},"visits":{"type":"integer","minimum":0,"maximum":9007199254740991},"typical":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"months":{"type":"array","minItems":12,"maxItems":12,"items":{"type":"object","properties":{"month":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"spent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["month","spent"]}},"perMonth":{"anyOf":[{"type":"object","properties":{"average":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"anyOf":[{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},{"type":"null"}]}},"required":["average","since"]},{"type":"null"}]},"categories":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"spent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["categoryId","spent","count"]}},"unconverted":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"count":{"type":"integer","minimum":1,"maximum":9007199254740991},"expense":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["asset","count","expense"]}},"bankNames":{"type":"array","maxItems":50,"items":{"type":"string"}},"bankNameCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["key","name","firstDay","lastDay","spent","thisYear","lastYear","visits","typical","months","perMonth","categories","unconverted","bankNames","bankNameCount"]},{"type":"null"}]}},"required":["baseCurrency","merchant"]}}}}}}},"/reports/unusual":{"get":{"operationId":"reports.unusual","summary":"List a period’s payments over three times their merchant’s usual","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"payments":{"type":"array","items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"merchant":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1}},"required":["key","name"]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"usual":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"ratio":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["transactionId","date","merchant","asset","amount","usual","ratio"]}}},"required":["baseCurrency","payments"]}}}}}}},"/attachments/startUpload":{"post":{"operationId":"attachments.startUpload","summary":"Start adding a photo or PDF to a transaction and get where to upload it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"enum":["image/jpeg","image/png","image/webp","image/gif","image/heic","image/heif","image/avif","image/tiff","application/pdf"],"type":"string"},"size":{"type":"integer","minimum":1,"maximum":26214400},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","transactionId","fileName","mediaType","size","sha256","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"attachmentId":{"type":"string"},"upload":{"anyOf":[{"type":"object","properties":{"url":{"type":"string","maxLength":4096,"pattern":"^\\/uploads\\/[A-Za-z0-9_-][A-Za-z0-9._-]*(\\/[A-Za-z0-9_-][A-Za-z0-9._-]*)?(\\?[A-Za-z0-9._~%&=-]*)?$"},"headers":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":100},"additionalProperties":{"type":"string","maxLength":4096}},"expiresAt":{"type":"string","format":"date-time"}},"required":["url","headers","expiresAt"]},{"type":"null"}]}},"required":["attachmentId","upload"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TOO_MANY_ATTACHMENTS"},"status":{"const":409},"message":{"type":"string","default":"TOO_MANY_ATTACHMENTS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"415":{"description":"415","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MEDIA_TYPE_NOT_ACCEPTED"},"status":{"const":415},"message":{"type":"string","default":"MEDIA_TYPE_NOT_ACCEPTED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ATTACHMENTS_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"ATTACHMENTS_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/attachments/completeUpload":{"post":{"operationId":"attachments.completeUpload","summary":"Finish an upload and have the file checked in the background","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"attachmentId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","attachmentId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"fileName":{"type":"string"},"mediaType":{"enum":["image/jpeg","image/png","image/webp","image/gif","image/heic","image/heif","image/avif","image/tiff","application/pdf"],"type":"string"},"sizeBytes":{"type":"integer","minimum":1,"maximum":26214400},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"status":{"enum":["awaiting-upload","processing","ready","rejected"],"type":"string"},"rejection":{"anyOf":[{"enum":["size","hash","type-mismatch","not-allowed","malware","expired","failed"],"type":"string"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasThumbnail":{"type":"boolean"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"readyAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"deletedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"purgeAfter":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","transactionId","fileName","mediaType","sizeBytes","sha256","status","rejection","caption","hasThumbnail","uploadedBy","createdAt","readyAt","deletedAt","purgeAfter"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_NOT_RECEIVED"},"status":{"const":409},"message":{"type":"string","default":"UPLOAD_NOT_RECEIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ATTACHMENTS_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"ATTACHMENTS_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/attachments/list":{"get":{"operationId":"attachments.list","summary":"List the attachments a transaction shows, oldest first","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","maxItems":100,"items":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"fileName":{"type":"string"},"mediaType":{"enum":["image/jpeg","image/png","image/webp","image/gif","image/heic","image/heif","image/avif","image/tiff","application/pdf"],"type":"string"},"sizeBytes":{"type":"integer","minimum":1,"maximum":26214400},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"status":{"enum":["awaiting-upload","processing","ready","rejected"],"type":"string"},"rejection":{"anyOf":[{"enum":["size","hash","type-mismatch","not-allowed","malware","expired","failed"],"type":"string"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasThumbnail":{"type":"boolean"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"readyAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"deletedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"purgeAfter":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","transactionId","fileName","mediaType","sizeBytes","sha256","status","rejection","caption","hasThumbnail","uploadedBy","createdAt","readyAt","deletedAt","purgeAfter"]}}}}}}}},"/attachments/get":{"get":{"operationId":"attachments.get","summary":"Get one attachment, deleted ones too until they are purged","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"attachmentId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"fileName":{"type":"string"},"mediaType":{"enum":["image/jpeg","image/png","image/webp","image/gif","image/heic","image/heif","image/avif","image/tiff","application/pdf"],"type":"string"},"sizeBytes":{"type":"integer","minimum":1,"maximum":26214400},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"status":{"enum":["awaiting-upload","processing","ready","rejected"],"type":"string"},"rejection":{"anyOf":[{"enum":["size","hash","type-mismatch","not-allowed","malware","expired","failed"],"type":"string"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasThumbnail":{"type":"boolean"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"readyAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"deletedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"purgeAfter":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","transactionId","fileName","mediaType","sizeBytes","sha256","status","rejection","caption","hasThumbnail","uploadedBy","createdAt","readyAt","deletedAt","purgeAfter"]}}}}}}},"/attachments/updateCaption":{"post":{"operationId":"attachments.updateCaption","summary":"Set or clear an attachment’s caption","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"attachmentId":{"type":"string","minLength":1,"maxLength":100},"caption":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]}},"required":["bookId","attachmentId","caption"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"fileName":{"type":"string"},"mediaType":{"enum":["image/jpeg","image/png","image/webp","image/gif","image/heic","image/heif","image/avif","image/tiff","application/pdf"],"type":"string"},"sizeBytes":{"type":"integer","minimum":1,"maximum":26214400},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"status":{"enum":["awaiting-upload","processing","ready","rejected"],"type":"string"},"rejection":{"anyOf":[{"enum":["size","hash","type-mismatch","not-allowed","malware","expired","failed"],"type":"string"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasThumbnail":{"type":"boolean"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"readyAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"deletedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"purgeAfter":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","transactionId","fileName","mediaType","sizeBytes","sha256","status","rejection","caption","hasThumbnail","uploadedBy","createdAt","readyAt","deletedAt","purgeAfter"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/attachments/delete":{"post":{"operationId":"attachments.delete","summary":"Delete an attachment, restorable for 30 days","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"attachmentId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","attachmentId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"fileName":{"type":"string"},"mediaType":{"enum":["image/jpeg","image/png","image/webp","image/gif","image/heic","image/heif","image/avif","image/tiff","application/pdf"],"type":"string"},"sizeBytes":{"type":"integer","minimum":1,"maximum":26214400},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"status":{"enum":["awaiting-upload","processing","ready","rejected"],"type":"string"},"rejection":{"anyOf":[{"enum":["size","hash","type-mismatch","not-allowed","malware","expired","failed"],"type":"string"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasThumbnail":{"type":"boolean"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"readyAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"deletedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"purgeAfter":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","transactionId","fileName","mediaType","sizeBytes","sha256","status","rejection","caption","hasThumbnail","uploadedBy","createdAt","readyAt","deletedAt","purgeAfter"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/attachments/restore":{"post":{"operationId":"attachments.restore","summary":"Restore a deleted attachment within 30 days of deleting it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"attachmentId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","attachmentId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"fileName":{"type":"string"},"mediaType":{"enum":["image/jpeg","image/png","image/webp","image/gif","image/heic","image/heif","image/avif","image/tiff","application/pdf"],"type":"string"},"sizeBytes":{"type":"integer","minimum":1,"maximum":26214400},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"status":{"enum":["awaiting-upload","processing","ready","rejected"],"type":"string"},"rejection":{"anyOf":[{"enum":["size","hash","type-mismatch","not-allowed","malware","expired","failed"],"type":"string"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasThumbnail":{"type":"boolean"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"readyAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"deletedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"purgeAfter":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","transactionId","fileName","mediaType","sizeBytes","sha256","status","rejection","caption","hasThumbnail","uploadedBy","createdAt","readyAt","deletedAt","purgeAfter"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TOO_MANY_ATTACHMENTS"},"status":{"const":409},"message":{"type":"string","default":"TOO_MANY_ATTACHMENTS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"410":{"description":"410","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RESTORE_EXPIRED"},"status":{"const":410},"message":{"type":"string","default":"RESTORE_EXPIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/attachments/download":{"get":{"operationId":"attachments.download","summary":"Download an attachment’s file, or its thumbnail, decrypted","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"attachmentId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"variant","in":"query","required":false,"schema":{"enum":["original","thumbnail"],"type":"string","default":"original"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","headers":{"content-disposition":{"schema":{"type":"string","pattern":"^(inline|attachment); filename="},"required":true},"cache-control":{"schema":{"const":"private, no-store"},"required":true},"x-content-type-options":{"schema":{"const":"nosniff"},"required":true},"content-security-policy":{"schema":{"const":"sandbox"},"required":true}},"content":{"image/jpeg":{"schema":{"type":"string","contentMediaType":"image/jpeg"}},"image/png":{"schema":{"type":"string","contentMediaType":"image/png"}},"image/webp":{"schema":{"type":"string","contentMediaType":"image/webp"}},"image/gif":{"schema":{"type":"string","contentMediaType":"image/gif"}},"image/heic":{"schema":{"type":"string","contentMediaType":"image/heic"}},"image/heif":{"schema":{"type":"string","contentMediaType":"image/heif"}},"image/avif":{"schema":{"type":"string","contentMediaType":"image/avif"}},"image/tiff":{"schema":{"type":"string","contentMediaType":"image/tiff"}},"application/pdf":{"schema":{"type":"string","contentMediaType":"application/pdf"}},"application/json":{"schema":{"anyOf":[]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ATTACHMENT_NOT_READY"},"status":{"const":409},"message":{"type":"string","default":"ATTACHMENT_NOT_READY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"415":{"description":"415","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MEDIA_TYPE_NOT_ACCEPTED"},"status":{"const":415},"message":{"type":"string","default":"MEDIA_TYPE_NOT_ACCEPTED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ATTACHMENTS_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"ATTACHMENTS_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/imports/startUpload":{"post":{"operationId":"imports.startUpload","summary":"Start uploading a statement and get a presigned address to PUT its bytes","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"fileName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":"string","minLength":1,"maxLength":100},"size":{"type":"integer","minimum":1,"maximum":20971520},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","fileName","mediaType","size","sha256","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"uploadId":{"type":"string"},"upload":{"anyOf":[{"type":"object","properties":{"url":{"type":"string","maxLength":4096,"pattern":"^\\/uploads\\/[A-Za-z0-9_-][A-Za-z0-9._-]*(\\/[A-Za-z0-9_-][A-Za-z0-9._-]*)?(\\?[A-Za-z0-9._~%&=-]*)?$"},"headers":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":100},"additionalProperties":{"type":"string","maxLength":4096}},"expiresAt":{"type":"string","format":"date-time"}},"required":["url","headers","expiresAt"]},{"type":"null"}]}},"required":["uploadId","upload"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"413":{"description":"413","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"IMPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/imports/putUpload":{"post":{"operationId":"imports.putUpload","summary":"Send an upload’s bytes in the request, in place of the presigned PUT","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"uploadId":{"type":"string","minLength":1,"maxLength":100},"content":{"type":"string","maxLength":27962028,"pattern":"^[A-Za-z0-9+/]*={0,2}$"}},"required":["bookId","uploadId","content"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"uploadId":{"type":"string"}},"required":["uploadId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"UPLOAD_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/imports/detect":{"post":{"operationId":"imports.detect","summary":"Detect who wrote an uploaded statement and its accounts; poll until ready","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"uploadId":{"type":"string","minLength":1,"maxLength":100},"password":{"type":"string","minLength":1,"maxLength":200},"account":{"type":"string","minLength":1,"maxLength":120}},"required":["bookId","uploadId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"enum":["detecting","ready","refused"],"type":"string"},"refusal":{"enum":["ACCOUNT_REQUIRED","IMPORT_UNREADABLE","IMPORT_TOO_LARGE","IMPORT_UNSUPPORTED","DETECT_FAILED"],"type":"string"},"detections":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"reason":{"type":"string"}},"required":["provider","confidence","reason"],"additionalProperties":false}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string","minLength":1},"name":{"type":"string"},"institution":{"type":"string","minLength":1},"assets":{"type":"array","items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"kind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"},"externalRefs":{"type":"array","items":{"type":"string"}},"product":{"type":"string","minLength":1},"transactions":{"type":"integer","minimum":0,"maximum":9007199254740991},"span":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"],"additionalProperties":false},{"type":"null"}]}},"required":["ref","institution","assets","transactions","span"],"additionalProperties":false}},"links":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"pocketId":{"type":"string"}},"required":["ref","pocketId"]}},"skipped":{"type":"array","items":{"type":"string"}},"needsPassword":{"type":"boolean"}},"required":["status","detections","accounts","links","skipped","needsPassword"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_PENDING"},"status":{"const":409},"message":{"type":"string","default":"UPLOAD_PENDING"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_LOCKED"},"status":{"const":409},"message":{"type":"string","default":"UPLOAD_LOCKED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"413":{"description":"413","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNLOCK_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"UNLOCK_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"IMPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"415":{"description":"415","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_UNSUPPORTED"},"status":{"const":415},"message":{"type":"string","default":"IMPORT_UNSUPPORTED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"UPLOAD_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PASSWORD_REQUIRED"},"status":{"const":422},"message":{"type":"string","default":"PASSWORD_REQUIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PASSWORD_WRONG"},"status":{"const":422},"message":{"type":"string","default":"PASSWORD_WRONG"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNT_REQUIRED"},"status":{"const":422},"message":{"type":"string","default":"ACCOUNT_REQUIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_UNREADABLE"},"status":{"const":422},"message":{"type":"string","default":"IMPORT_UNREADABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNLOCK_BUSY"},"status":{"const":503},"message":{"type":"string","default":"UNLOCK_BUSY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/imports/suggestMapping":{"post":{"operationId":"imports.suggestMapping","summary":"Read the column-mapping suggestion for a CSV or XLSX no importer claims; poll","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"uploadId":{"type":"string","minLength":1,"maxLength":100},"encoding":{"enum":["windows-1252","iso-8859-8","windows-1255","iso-8859-7","windows-1253"],"type":"string"}},"required":["bookId","uploadId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"enum":["detecting","ready","refused"],"type":"string"},"refusal":{"enum":["ACCOUNT_REQUIRED","IMPORT_UNREADABLE","IMPORT_TOO_LARGE","IMPORT_UNSUPPORTED","DETECT_FAILED","ENCODING_REQUIRED"],"type":"string"},"suggestion":{"anyOf":[{"type":"object","properties":{"file":{"type":"object","properties":{"kind":{"enum":["csv","xlsx"],"type":"string"},"encoding":{"enum":["windows-1252","iso-8859-8","windows-1255","iso-8859-7","windows-1253"],"type":"string"},"delimiter":{"enum":[",",";","\t","|"],"type":"string"},"sheet":{"type":"string"}},"required":["kind"]},"headers":{"type":"array","items":{"type":"string"}},"headerRow":{"type":"integer","minimum":1,"maximum":9007199254740991},"footerRows":{"type":"integer","minimum":0,"maximum":9007199254740991},"candidates":{"type":"array","items":{"type":"object","properties":{"field":{"enum":["date","amount","debit","credit","asset","description","balance","externalId"],"type":"string"},"column":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["field","column","confidence"]}},"dateFormats":{"type":"array","items":{"enum":["YYYY-MM-DD","DD-MM-YYYY","DD/MM/YYYY","MM/DD/YYYY","DD.MM.YYYY","DD/MM","DDMMYY","Month D, YYYY"],"type":"string"}},"number":{"type":"array","items":{"type":"object","properties":{"decimal":{"enum":[".",","],"type":"string"},"thousands":{"enum":[",","."," ","'"],"type":"string"},"currencySymbols":{"type":"array","items":{"type":"string"}}},"required":["decimal"]}},"ambiguous":{"type":"array","items":{"enum":["date","number"],"type":"string"}}},"required":["file","headers","headerRow","footerRows","candidates","dateFormats","number","ambiguous"]},{"type":"null"}]}},"required":["status","suggestion"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_PENDING"},"status":{"const":409},"message":{"type":"string","default":"UPLOAD_PENDING"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_LOCKED"},"status":{"const":409},"message":{"type":"string","default":"UPLOAD_LOCKED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"413":{"description":"413","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNLOCK_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"UNLOCK_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"IMPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"415":{"description":"415","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_UNSUPPORTED"},"status":{"const":415},"message":{"type":"string","default":"IMPORT_UNSUPPORTED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"UPLOAD_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PASSWORD_REQUIRED"},"status":{"const":422},"message":{"type":"string","default":"PASSWORD_REQUIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PASSWORD_WRONG"},"status":{"const":422},"message":{"type":"string","default":"PASSWORD_WRONG"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNT_REQUIRED"},"status":{"const":422},"message":{"type":"string","default":"ACCOUNT_REQUIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_UNREADABLE"},"status":{"const":422},"message":{"type":"string","default":"IMPORT_UNREADABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNLOCK_BUSY"},"status":{"const":503},"message":{"type":"string","default":"UNLOCK_BUSY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/imports/mappings/list":{"get":{"operationId":"imports.mappings.list","summary":"List a book’s saved column mappings","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"name":{"type":"string","minLength":1,"maxLength":100},"version":{"const":1},"file":{"type":"object","properties":{"kind":{"enum":["csv","xlsx"],"type":"string"},"encoding":{"enum":["windows-1252","iso-8859-8","windows-1255","iso-8859-7","windows-1253"],"type":"string"},"delimiter":{"enum":[",",";","\t","|"],"type":"string"},"sheet":{"type":"string","minLength":1},"headerRow":{"type":"integer","minimum":1,"maximum":1000},"skipFooterRows":{"type":"integer","minimum":0,"maximum":100,"default":0}},"required":["kind","headerRow"],"additionalProperties":false},"match":{"type":"object","properties":{"headers":{"type":"array","minItems":2,"maxItems":200,"items":{"type":"string","maxLength":200}}},"required":["headers"],"additionalProperties":false},"date":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"format":{"enum":["YYYY-MM-DD","DD-MM-YYYY","DD/MM/YYYY","MM/DD/YYYY","DD.MM.YYYY","DD/MM","DDMMYY","Month D, YYYY"],"type":"string"}},"required":["column","format"],"additionalProperties":false},"valueDate":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"format":{"enum":["YYYY-MM-DD","DD-MM-YYYY","DD/MM/YYYY","MM/DD/YYYY","DD.MM.YYYY","DD/MM","DDMMYY","Month D, YYYY"],"type":"string"}},"required":["column","format"],"additionalProperties":false},"amount":{"anyOf":[{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"negate":{"type":"boolean","default":false}},"required":["column"],"additionalProperties":false},{"type":"object","properties":{"debit":{"type":"string","minLength":1,"maxLength":200},"credit":{"type":"string","minLength":1,"maxLength":200}},"required":["debit","credit"],"additionalProperties":false}]},"number":{"type":"object","properties":{"decimal":{"enum":[".",","],"type":"string"},"thousands":{"enum":[",","."," ","'"],"type":"string"},"currencySymbols":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":8}}},"required":["decimal"],"additionalProperties":false},"asset":{"anyOf":[{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},{"type":"object","properties":{"fixed":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["fixed"],"additionalProperties":false}]},"description":{"type":"object","properties":{"columns":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"string","minLength":1,"maxLength":200}}},"required":["columns"],"additionalProperties":false},"counterparty":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"externalId":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"balance":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"category":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"account":{"type":"object","properties":{"ref":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"}},"required":["ref","kind"],"additionalProperties":false}},"required":["id","name","version","file","match","date","amount","number","asset","description","account"],"additionalProperties":false}}}}}}}},"/imports/mappings/save":{"post":{"operationId":"imports.mappings.save","summary":"Save a column mapping, and detect the statement it was made for again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"mapping":{"type":"object","properties":{"id":{"type":"string","maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"name":{"type":"string","minLength":1,"maxLength":100},"version":{"const":1},"file":{"type":"object","properties":{"kind":{"enum":["csv","xlsx"],"type":"string"},"encoding":{"enum":["windows-1252","iso-8859-8","windows-1255","iso-8859-7","windows-1253"],"type":"string"},"delimiter":{"enum":[",",";","\t","|"],"type":"string"},"sheet":{"type":"string","minLength":1},"headerRow":{"type":"integer","minimum":1,"maximum":1000},"skipFooterRows":{"type":"integer","minimum":0,"maximum":100,"default":0}},"required":["kind","headerRow"],"additionalProperties":false},"match":{"type":"object","properties":{"headers":{"type":"array","minItems":2,"maxItems":200,"items":{"type":"string","maxLength":200}}},"required":["headers"],"additionalProperties":false},"date":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"format":{"enum":["YYYY-MM-DD","DD-MM-YYYY","DD/MM/YYYY","MM/DD/YYYY","DD.MM.YYYY","DD/MM","DDMMYY","Month D, YYYY"],"type":"string"}},"required":["column","format"],"additionalProperties":false},"valueDate":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"format":{"enum":["YYYY-MM-DD","DD-MM-YYYY","DD/MM/YYYY","MM/DD/YYYY","DD.MM.YYYY","DD/MM","DDMMYY","Month D, YYYY"],"type":"string"}},"required":["column","format"],"additionalProperties":false},"amount":{"anyOf":[{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"negate":{"type":"boolean","default":false}},"required":["column"],"additionalProperties":false},{"type":"object","properties":{"debit":{"type":"string","minLength":1,"maxLength":200},"credit":{"type":"string","minLength":1,"maxLength":200}},"required":["debit","credit"],"additionalProperties":false}]},"number":{"type":"object","properties":{"decimal":{"enum":[".",","],"type":"string"},"thousands":{"enum":[",","."," ","'"],"type":"string"},"currencySymbols":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":8}}},"required":["decimal"],"additionalProperties":false},"asset":{"anyOf":[{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},{"type":"object","properties":{"fixed":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["fixed"],"additionalProperties":false}]},"description":{"type":"object","properties":{"columns":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"string","minLength":1,"maxLength":200}}},"required":["columns"],"additionalProperties":false},"counterparty":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"externalId":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"balance":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"category":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"account":{"type":"object","properties":{"ref":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"}},"required":["ref","kind"],"additionalProperties":false}},"required":["id","name","version","file","match","date","amount","number","asset","description","account"],"additionalProperties":false},"uploadId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","mapping","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"name":{"type":"string","minLength":1,"maxLength":100},"version":{"const":1},"file":{"type":"object","properties":{"kind":{"enum":["csv","xlsx"],"type":"string"},"encoding":{"enum":["windows-1252","iso-8859-8","windows-1255","iso-8859-7","windows-1253"],"type":"string"},"delimiter":{"enum":[",",";","\t","|"],"type":"string"},"sheet":{"type":"string","minLength":1},"headerRow":{"type":"integer","minimum":1,"maximum":1000},"skipFooterRows":{"type":"integer","minimum":0,"maximum":100,"default":0}},"required":["kind","headerRow"],"additionalProperties":false},"match":{"type":"object","properties":{"headers":{"type":"array","minItems":2,"maxItems":200,"items":{"type":"string","maxLength":200}}},"required":["headers"],"additionalProperties":false},"date":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"format":{"enum":["YYYY-MM-DD","DD-MM-YYYY","DD/MM/YYYY","MM/DD/YYYY","DD.MM.YYYY","DD/MM","DDMMYY","Month D, YYYY"],"type":"string"}},"required":["column","format"],"additionalProperties":false},"valueDate":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"format":{"enum":["YYYY-MM-DD","DD-MM-YYYY","DD/MM/YYYY","MM/DD/YYYY","DD.MM.YYYY","DD/MM","DDMMYY","Month D, YYYY"],"type":"string"}},"required":["column","format"],"additionalProperties":false},"amount":{"anyOf":[{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"negate":{"type":"boolean","default":false}},"required":["column"],"additionalProperties":false},{"type":"object","properties":{"debit":{"type":"string","minLength":1,"maxLength":200},"credit":{"type":"string","minLength":1,"maxLength":200}},"required":["debit","credit"],"additionalProperties":false}]},"number":{"type":"object","properties":{"decimal":{"enum":[".",","],"type":"string"},"thousands":{"enum":[",","."," ","'"],"type":"string"},"currencySymbols":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":8}}},"required":["decimal"],"additionalProperties":false},"asset":{"anyOf":[{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},{"type":"object","properties":{"fixed":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["fixed"],"additionalProperties":false}]},"description":{"type":"object","properties":{"columns":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"string","minLength":1,"maxLength":200}}},"required":["columns"],"additionalProperties":false},"counterparty":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"externalId":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"balance":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"category":{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200}},"required":["column"],"additionalProperties":false},"account":{"type":"object","properties":{"ref":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"}},"required":["ref","kind"],"additionalProperties":false}},"required":["id","name","version","file","match","date","amount","number","asset","description","account"],"additionalProperties":false}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_LOCKED"},"status":{"const":409},"message":{"type":"string","default":"UPLOAD_LOCKED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"413":{"description":"413","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNLOCK_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"UNLOCK_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"415":{"description":"415","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_UNSUPPORTED"},"status":{"const":415},"message":{"type":"string","default":"IMPORT_UNSUPPORTED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"UPLOAD_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/imports/mappings/delete":{"post":{"operationId":"imports.mappings.delete","summary":"Delete a saved column mapping; imports that used it stay","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"mappingId":{"type":"string","maxLength":64,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","mappingId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"mappingId":{"type":"string"}},"required":["mappingId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/imports/start":{"post":{"operationId":"imports.start","summary":"Import a detected statement, a pocket or a skip for each account, as a job","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"uploadId":{"type":"string","minLength":1,"maxLength":100},"provider":{"type":"string","minLength":1,"maxLength":100},"password":{"type":"string","minLength":1,"maxLength":200},"account":{"type":"string","minLength":1,"maxLength":120},"accounts":{"type":"array","minItems":1,"maxItems":50,"items":{"anyOf":[{"type":"object","properties":{"ref":{"type":"string","minLength":1},"pocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["ref","pocketId"],"additionalProperties":false},{"type":"object","properties":{"ref":{"type":"string","minLength":1},"create":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"},"personId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["name","pocketKind","personId"],"additionalProperties":false}},"required":["ref","create"],"additionalProperties":false},{"type":"object","properties":{"ref":{"type":"string","minLength":1},"skip":{"const":true}},"required":["ref","skip"],"additionalProperties":false}]}},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","uploadId","provider","accounts","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}},"required":["runId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_PENDING"},"status":{"const":409},"message":{"type":"string","default":"UPLOAD_PENDING"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_LOCKED"},"status":{"const":409},"message":{"type":"string","default":"UPLOAD_LOCKED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNTS_UNMAPPED"},"status":{"const":409},"message":{"type":"string","default":"ACCOUNTS_UNMAPPED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PERSON_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"PERSON_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PROVIDER_MISMATCH"},"status":{"const":409},"message":{"type":"string","default":"PROVIDER_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"413":{"description":"413","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNLOCK_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"UNLOCK_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"IMPORT_TOO_LARGE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"415":{"description":"415","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_UNSUPPORTED"},"status":{"const":415},"message":{"type":"string","default":"IMPORT_UNSUPPORTED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UPLOAD_MISMATCH"},"status":{"const":422},"message":{"type":"string","default":"UPLOAD_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PASSWORD_REQUIRED"},"status":{"const":422},"message":{"type":"string","default":"PASSWORD_REQUIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PASSWORD_WRONG"},"status":{"const":422},"message":{"type":"string","default":"PASSWORD_WRONG"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNT_REQUIRED"},"status":{"const":422},"message":{"type":"string","default":"ACCOUNT_REQUIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"IMPORT_UNREADABLE"},"status":{"const":422},"message":{"type":"string","default":"IMPORT_UNREADABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNLOCK_BUSY"},"status":{"const":503},"message":{"type":"string","default":"UNLOCK_BUSY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/imports/statementsByPocket":{"get":{"operationId":"imports.statementsByPocket","summary":"List each pocket’s last import and the newest statement day it posted","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"lastRunAt":{"type":"string","format":"date-time"},"lastStatementDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]}},"required":["pocketId","lastRunAt","lastStatementDay"]}}},"required":["items"]}}}}}}},"/imports/waiting":{"get":{"operationId":"imports.waiting","summary":"List the uploaded statements waiting to be finished in the wizard, newest first","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","maxItems":50,"items":{"type":"object","properties":{"uploadId":{"type":"string"},"file":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["name","size"]},"source":{"enum":["email","upload"],"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["uploadId","file","source","createdAt"]}}},"required":["items"]}}}}}}},"/imports/runs/list":{"get":{"operationId":"imports.runs.list","summary":"List a book’s imports, newest first, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":500},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":true,"schema":{"type":"integer","minimum":1,"maximum":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["queued","running","done","failed"],"type":"string"},"provider":{"type":"string"},"source":{"enum":["file","mail","bank"],"type":"string"},"file":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["name","size"]},"startedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"counts":{"type":"object","properties":{"new":{"type":"integer","minimum":0,"maximum":9007199254740991},"alreadyHad":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"integer","minimum":0,"maximum":9007199254740991},"toCheck":{"type":"integer","minimum":0,"maximum":9007199254740991},"duplicates":{"type":"integer","minimum":0,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["new","alreadyHad","labelled","toCheck","duplicates","skipped"]},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"enum":["ROW_SKIPPED_BLANK","ROW_UNPARSEABLE","AMOUNT_UNPARSEABLE","DATE_UNPARSEABLE","UNKNOWN_TYPE","BALANCE_MISMATCH","ORPHAN_LEG","CATEGORY_UNMAPPED","HEADER_MOVED","PRECISION_EXCEEDS_ASSET","NEGATIVE_BALANCE","TOTALS_MISMATCH","MONTH_MISSING","ZONE_UNKNOWN","INSTRUMENT_UNMAPPED","GROUP_AMBIGUOUS","BALANCE_UNCHECKED"],"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"locations":{"type":"array","items":{"type":"object","properties":{"file":{"type":"integer","minimum":0,"maximum":9007199254740991},"line":{"type":"integer","minimum":1,"maximum":9007199254740991},"page":{"type":"integer","minimum":1,"maximum":9007199254740991}},"additionalProperties":false}}},"required":["code","count","locations"]}},"balances":{"type":"object","properties":{"stated":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"asset":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","asset","date","amount"]}},"heldBack":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"asset":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","asset","date","amount"]}}},"required":["stated","heldBack"]},"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"undoneAt":{"type":"string","format":"date-time"},"undoableByYou":{"type":"boolean"}},"required":["id","status","provider","source","file","startedAt","finishedAt","counts","warnings","balances","changeSetId","undoableByYou"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"]}}}}}}},"/imports/runs/get":{"get":{"operationId":"imports.runs.get","summary":"Get one import with its counts and warnings","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"runId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["queued","running","done","failed"],"type":"string"},"provider":{"type":"string"},"source":{"enum":["file","mail","bank"],"type":"string"},"file":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["name","size"]},"startedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"counts":{"type":"object","properties":{"new":{"type":"integer","minimum":0,"maximum":9007199254740991},"alreadyHad":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"integer","minimum":0,"maximum":9007199254740991},"toCheck":{"type":"integer","minimum":0,"maximum":9007199254740991},"duplicates":{"type":"integer","minimum":0,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["new","alreadyHad","labelled","toCheck","duplicates","skipped"]},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"enum":["ROW_SKIPPED_BLANK","ROW_UNPARSEABLE","AMOUNT_UNPARSEABLE","DATE_UNPARSEABLE","UNKNOWN_TYPE","BALANCE_MISMATCH","ORPHAN_LEG","CATEGORY_UNMAPPED","HEADER_MOVED","PRECISION_EXCEEDS_ASSET","NEGATIVE_BALANCE","TOTALS_MISMATCH","MONTH_MISSING","ZONE_UNKNOWN","INSTRUMENT_UNMAPPED","GROUP_AMBIGUOUS","BALANCE_UNCHECKED"],"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"locations":{"type":"array","items":{"type":"object","properties":{"file":{"type":"integer","minimum":0,"maximum":9007199254740991},"line":{"type":"integer","minimum":1,"maximum":9007199254740991},"page":{"type":"integer","minimum":1,"maximum":9007199254740991}},"additionalProperties":false}}},"required":["code","count","locations"]}},"balances":{"type":"object","properties":{"stated":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"asset":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","asset","date","amount"]}},"heldBack":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"asset":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","asset","date","amount"]}}},"required":["stated","heldBack"]},"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"undoneAt":{"type":"string","format":"date-time"},"undoableByYou":{"type":"boolean"}},"required":["id","status","provider","source","file","startedAt","finishedAt","counts","warnings","balances","changeSetId","undoableByYou"]}}}}}}},"/imports/runs/undo":{"post":{"operationId":"imports.runs.undo","summary":"Undo an import’s transactions, and the later changes built on them if asked","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"runId":{"type":"string","minLength":1,"maxLength":100},"withDependants":{"type":"boolean"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","runId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["queued","running","done","failed"],"type":"string"},"provider":{"type":"string"},"source":{"enum":["file","mail","bank"],"type":"string"},"file":{"type":"object","properties":{"name":{"type":"string"},"size":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["name","size"]},"startedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"counts":{"type":"object","properties":{"new":{"type":"integer","minimum":0,"maximum":9007199254740991},"alreadyHad":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"integer","minimum":0,"maximum":9007199254740991},"toCheck":{"type":"integer","minimum":0,"maximum":9007199254740991},"duplicates":{"type":"integer","minimum":0,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["new","alreadyHad","labelled","toCheck","duplicates","skipped"]},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"enum":["ROW_SKIPPED_BLANK","ROW_UNPARSEABLE","AMOUNT_UNPARSEABLE","DATE_UNPARSEABLE","UNKNOWN_TYPE","BALANCE_MISMATCH","ORPHAN_LEG","CATEGORY_UNMAPPED","HEADER_MOVED","PRECISION_EXCEEDS_ASSET","NEGATIVE_BALANCE","TOTALS_MISMATCH","MONTH_MISSING","ZONE_UNKNOWN","INSTRUMENT_UNMAPPED","GROUP_AMBIGUOUS","BALANCE_UNCHECKED"],"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"locations":{"type":"array","items":{"type":"object","properties":{"file":{"type":"integer","minimum":0,"maximum":9007199254740991},"line":{"type":"integer","minimum":1,"maximum":9007199254740991},"page":{"type":"integer","minimum":1,"maximum":9007199254740991}},"additionalProperties":false}}},"required":["code","count","locations"]}},"balances":{"type":"object","properties":{"stated":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"asset":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","asset","date","amount"]}},"heldBack":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"asset":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","asset","date","amount"]}}},"required":["stated","heldBack"]},"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"undoneAt":{"type":"string","format":"date-time"},"undoableByYou":{"type":"boolean"}},"required":["id","status","provider","source","file","startedAt","finishedAt","counts","warnings","balances","changeSetId","undoableByYou"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AGENT_UNDO_ONLY"},"status":{"const":403},"message":{"type":"string","default":"AGENT_UNDO_ONLY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAIR_NOT_WRITABLE"},"status":{"const":403},"message":{"type":"string","default":"PAIR_NOT_WRITABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RUN_NOT_DONE"},"status":{"const":409},"message":{"type":"string","default":"RUN_NOT_DONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ALREADY_UNDONE"},"status":{"const":409},"message":{"type":"string","default":"ALREADY_UNDONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HAS_REFUNDS"},"status":{"const":409},"message":{"type":"string","default":"HAS_REFUNDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REFUND_EXCEEDS_PAYMENT"},"status":{"const":409},"message":{"type":"string","default":"REFUND_EXCEEDS_PAYMENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNDO_CHAIN_BROKEN"},"status":{"const":409},"message":{"type":"string","default":"UNDO_CHAIN_BROKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERGE_NOT_NEWEST"},"status":{"const":409},"message":{"type":"string","default":"MERGE_NOT_NEWEST"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERGE_STANDS"},"status":{"const":409},"message":{"type":"string","default":"MERGE_STANDS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RUN_SUPERSEDED"},"status":{"const":409},"message":{"type":"string","default":"RUN_SUPERSEDED"},"data":{"type":"object","properties":{"laterChangeSets":{"type":"integer","minimum":1,"maximum":9007199254740991},"laterRuns":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["laterChangeSets","laterRuns"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_REFUNDABLE"},"status":{"const":422},"message":{"type":"string","default":"NOT_REFUNDABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/emailIn/get":{"post":{"operationId":"emailIn.get","summary":"Get the book’s email-in address and allowed senders, creating the address once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","format":"email"},"allowedSenders":{"type":"array","items":{"type":"string","format":"email"}}},"required":["address","allowedSenders"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EMAIL_IN_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"EMAIL_IN_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/emailIn/rotate":{"post":{"operationId":"emailIn.rotate","summary":"Replace the book’s email-in address; the old one stops accepting mail at once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"string","maxLength":254,"format":"email"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","address","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","format":"email"},"allowedSenders":{"type":"array","items":{"type":"string","format":"email"}}},"required":["address","allowedSenders"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ADDRESS_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"ADDRESS_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EMAIL_IN_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"EMAIL_IN_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/emailIn/allow":{"post":{"operationId":"emailIn.allow","summary":"Allow a sender whose forwarded statements import into the book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"sender":{"type":"string","maxLength":254,"format":"email"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","sender","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","format":"email"},"allowedSenders":{"type":"array","items":{"type":"string","format":"email"}}},"required":["address","allowedSenders"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SENDERS_FULL"},"status":{"const":409},"message":{"type":"string","default":"SENDERS_FULL"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EMAIL_IN_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"EMAIL_IN_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/emailIn/history":{"get":{"operationId":"emailIn.history","summary":"List the book’s mail of the last 30 days and what came of each","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"mails":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"receivedAt":{"type":"string","format":"date-time"},"sender":{"type":"string"},"attachments":{"type":"array","items":{"type":"string"}},"outcome":{"anyOf":[{"type":"object","properties":{"kind":{"const":"imported"},"file":{"type":"string"},"runId":{"type":"string"},"newCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["kind","file","runId","newCount"]},{"type":"object","properties":{"kind":{"const":"reading"},"file":{"type":"string"}},"required":["kind","file"]},{"type":"object","properties":{"kind":{"const":"waiting"},"file":{"type":"string"},"uploadId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","file","uploadId"]},{"type":"object","properties":{"kind":{"const":"notImported"},"file":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"enum":["PASSWORD_REQUIRED","IMPORT_TOO_LARGE","IMPORT_UNSUPPORTED","IMPORT_UNREADABLE","IMPORT_FAILED","TOO_MANY_ATTACHMENTS","NO_ATTACHMENT"],"type":"string"}},"required":["kind","file","reason"]},{"type":"object","properties":{"kind":{"const":"ignored"},"reason":{"enum":["SENDER_NOT_ALLOWED","NOT_AUTHENTICATED"],"type":"string"}},"required":["kind","reason"]}]}},"required":["id","receivedAt","sender","attachments","outcome"]}}},"required":["mails"]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EMAIL_IN_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"EMAIL_IN_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/emailIn/disallow":{"post":{"operationId":"emailIn.disallow","summary":"Stop importing a sender’s mail; it is ignored from now","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"sender":{"type":"string","maxLength":254,"format":"email"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","sender","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","format":"email"},"allowedSenders":{"type":"array","items":{"type":"string","format":"email"}}},"required":["address","allowedSenders"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EMAIL_IN_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"EMAIL_IN_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/connectors":{"get":{"operationId":"banklinks.connectors","summary":"List the bank connectors and whether you need a setup of your own for each","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connectors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"displayName":{"type":"string"},"covers":{"type":"string"},"setup":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"kind":{"enum":["text","secret","secret-file"],"type":"string"},"label":{"type":"string"}},"required":["key","kind","label"]}},"grant":{"enum":["redirect","secret","none"],"type":"string"},"secret":{"anyOf":[{"type":"string"},{"type":"null"}]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"kind":{"enum":["text","secret"],"type":"string"},"label":{"type":"string"},"help":{"anyOf":[{"type":"string"},{"type":"null"}]},"pattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"problem":{"type":"string"}},"required":["key","kind","label","help","pattern","problem"]}},"hasSetup":{"type":"boolean"}},"required":["id","displayName","covers","setup","grant","secret","fields","hasSetup"]}}},"required":["connectors"]}}}}}}},"/banklinks/saveSetup":{"post":{"operationId":"banklinks.saveSetup","summary":"Check and save your own setup of a bank connector, then list a country’s banks","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connectorId":{"type":"string","maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":60},"additionalProperties":{"type":"string","minLength":1,"maxLength":16384}},"requestId":{"type":"string","format":"uuid"}},"required":["connectorId","country","fields","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"institutions":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"beta":{"type":"boolean"},"logo":{"anyOf":[{"type":"string","minLength":1,"maxLength":300},{"type":"null"}]}},"required":["name","country","beta","logo"],"additionalProperties":false}}},"required":["institutions"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SESSION_NOT_FRESH"},"status":{"const":403},"message":{"type":"string","default":"SESSION_NOT_FRESH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SETUP_REFUSED"},"status":{"const":422},"message":{"type":"string","default":"SETUP_REFUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BANK_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"BANK_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/removeSetup":{"post":{"operationId":"banklinks.removeSetup","summary":"Remove your connector setup and the bank links made with it, keeping transactions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connectorId":{"type":"string","maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"requestId":{"type":"string","format":"uuid"}},"required":["connectorId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SESSION_NOT_FRESH"},"status":{"const":403},"message":{"type":"string","default":"SESSION_NOT_FRESH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/institutions":{"get":{"operationId":"banklinks.institutions","summary":"List a country’s banks a connector reaches, through Allmoni’s setup or yours","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"connectorId","in":"query","required":true,"schema":{"type":"string","maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"allowEmptyValue":true,"allowReserved":true},{"name":"country","in":"query","required":true,"schema":{"type":"string","pattern":"^[A-Z]{2}$"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"institutions":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"beta":{"type":"boolean"},"logo":{"anyOf":[{"type":"string","minLength":1,"maxLength":300},{"type":"null"}]}},"required":["name","country","beta","logo"],"additionalProperties":false}}},"required":["institutions"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NO_SETUP"},"status":{"const":409},"message":{"type":"string","default":"NO_SETUP"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SETUP_REFUSED"},"status":{"const":422},"message":{"type":"string","default":"SETUP_REFUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BANK_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"BANK_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/logo":{"get":{"operationId":"banklinks.logo","summary":"Get a bank’s logo, as its connector’s list of banks names it","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"connectorId","in":"query","required":true,"schema":{"type":"string","maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"allowEmptyValue":true,"allowReserved":true},{"name":"logo","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":300},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","headers":{"cache-control":{"schema":{"const":"private, max-age=86400"},"required":true},"x-content-type-options":{"schema":{"const":"nosniff"},"required":true}},"content":{"image/webp":{"schema":{"type":"string","contentMediaType":"image/webp"}}}}}}},"/banklinks/offers":{"get":{"operationId":"banklinks.offers","summary":"List the banks of a country’s region and the ways each can be connected","parameters":[{"name":"country","in":"query","required":true,"schema":{"type":"string","pattern":"^[A-Z]{2}$"},"allowEmptyValue":true,"allowReserved":true},{"name":"accountKind","in":"query","required":true,"schema":{"enum":["personal","business"],"type":"string"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"institutions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"aliases":{"type":"array","items":{"type":"string"}},"logo":{"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"setup":{"type":"string"},"gaps":{"type":"array","items":{"type":"string"}},"verified":{"type":"boolean"},"offered":{"type":"boolean"}},"required":["id","kind","role","via","setup","gaps","verified","offered"]}}},"required":["id","name","aliases","logo","routes"]}}},"required":["institutions"]}}}}}}},"/banklinks/begin":{"post":{"operationId":"banklinks.begin","summary":"Start connecting a bank, or approve a link again, and get the bank’s address","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"connectorId":{"type":"string","maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"institution":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"beta":{"type":"boolean"},"logo":{"anyOf":[{"type":"string","minLength":1,"maxLength":300},{"type":"null"}]}},"required":["name","country","beta","logo"],"additionalProperties":false},"routeId":{"type":"string","maxLength":60,"pattern":"^[a-z][a-z0-9-]*$"},"accountKind":{"enum":["personal","business"],"type":"string"},"linkId":{"type":"string","minLength":1,"maxLength":100},"nickname":{"type":"string","minLength":1,"maxLength":30},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","connectorId","institution","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"linkId":{"type":"string"},"url":{"type":"string","format":"uri"}},"required":["linkId","url"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NO_SETUP"},"status":{"const":409},"message":{"type":"string","default":"NO_SETUP"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LINK_BUSY"},"status":{"const":409},"message":{"type":"string","default":"LINK_BUSY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ROUTE_NOT_OFFERED"},"status":{"const":409},"message":{"type":"string","default":"ROUTE_NOT_OFFERED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SETUP_REFUSED"},"status":{"const":422},"message":{"type":"string","default":"SETUP_REFUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BANK_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"BANK_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/connect":{"post":{"operationId":"banklinks.connect","summary":"Connect a wallet or a broker by what its grant asks for; its history is fetched at once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"institutionId":{"type":"string","minLength":1,"maxLength":200},"fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":100},"additionalProperties":{"type":"string","minLength":1,"maxLength":4000}},"address":{"type":"string","minLength":1,"maxLength":4000},"nickname":{"type":"string","minLength":1,"maxLength":30},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","institutionId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ROUTE_NOT_OFFERED"},"status":{"const":409},"message":{"type":"string","default":"ROUTE_NOT_OFFERED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ALREADY_LINKED"},"status":{"const":409},"message":{"type":"string","default":"ALREADY_LINKED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SETUP_REFUSED"},"status":{"const":422},"message":{"type":"string","default":"SETUP_REFUSED"},"data":{"type":"object","properties":{"field":{"anyOf":[{"type":"string"},{"type":"null"}]},"traceId":{"type":"string"}},"required":["field","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BANK_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"BANK_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/complete":{"post":{"operationId":"banklinks.complete","summary":"Finish a bank’s approval, then fetch its accounts’ history or sync it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"state":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","minLength":1,"maxLength":4096},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","state","code","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"STATE_UNKNOWN"},"status":{"const":409},"message":{"type":"string","default":"STATE_UNKNOWN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/list":{"get":{"operationId":"banklinks.list","summary":"List a book’s bank links with their accounts, balances and what each asks","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}},"required":["links"]}}}}}}},"/banklinks/pocketRoutes":{"get":{"operationId":"banklinks.pocketRoutes","summary":"List how each pocket stays current and when it last did","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"route":{"enum":["live","imported","by-hand"],"type":"string"},"at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"quiet":{"type":"boolean"},"linkId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["pocketId","route","at","quiet","linkId"]}}},"required":["items"]}}}}}}},"/banklinks/get":{"get":{"operationId":"banklinks.get","summary":"Get one bank link with its accounts, balances and what it asks","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"linkId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}}}}}},"/banklinks/map":{"post":{"operationId":"banklinks.map","summary":"Choose a pocket and first day for each bank account and import its history","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"routeId":{"type":"string","maxLength":60,"pattern":"^[a-z][a-z0-9-]*$"},"accounts":{"type":"array","minItems":1,"maxItems":100,"items":{"anyOf":[{"type":"object","properties":{"ref":{"type":"string","minLength":1},"pocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["ref","pocketId"],"additionalProperties":false},{"type":"object","properties":{"ref":{"type":"string","minLength":1},"create":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"},"personId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["name","pocketKind","personId"],"additionalProperties":false}},"required":["ref","create"],"additionalProperties":false},{"type":"object","properties":{"ref":{"type":"string","minLength":1},"skip":{"const":true}},"required":["ref","skip"],"additionalProperties":false}]}},"from":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":200},"additionalProperties":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]}},"matches":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":200},"additionalProperties":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","accounts","from","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}},"required":["runId"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LINK_BUSY"},"status":{"const":409},"message":{"type":"string","default":"LINK_BUSY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ALREADY_MAPPED"},"status":{"const":409},"message":{"type":"string","default":"ALREADY_MAPPED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNT_UNMATCHED"},"status":{"const":409},"message":{"type":"string","default":"ACCOUNT_UNMATCHED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PERSON_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"PERSON_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"410":{"description":"410","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HISTORY_GONE"},"status":{"const":410},"message":{"type":"string","default":"HISTORY_GONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACCOUNTS_UNMAPPED"},"status":{"const":422},"message":{"type":"string","default":"ACCOUNTS_UNMAPPED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/addRoute":{"post":{"operationId":"banklinks.addRoute","summary":"Add a statement or token route to your bank link; a token route fetches at once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"routeId":{"type":"string","maxLength":60,"pattern":"^[a-z][a-z0-9-]*$"},"fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":100},"additionalProperties":{"type":"string","minLength":1,"maxLength":4000}},"secret":{"type":"string","minLength":1,"maxLength":4000},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","routeId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SESSION_NOT_FRESH"},"status":{"const":403},"message":{"type":"string","default":"SESSION_NOT_FRESH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ROUTE_NOT_OFFERED"},"status":{"const":409},"message":{"type":"string","default":"ROUTE_NOT_OFFERED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NO_SETUP"},"status":{"const":409},"message":{"type":"string","default":"NO_SETUP"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SETUP_REFUSED"},"status":{"const":422},"message":{"type":"string","default":"SETUP_REFUSED"},"data":{"type":"object","properties":{"field":{"anyOf":[{"type":"string"},{"type":"null"}]},"traceId":{"type":"string"}},"required":["field","traceId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"OTHER_LOGIN"},"status":{"const":422},"message":{"type":"string","default":"OTHER_LOGIN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BANK_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"BANK_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/removeRoute":{"post":{"operationId":"banklinks.removeRoute","summary":"Remove one route of a bank link; removing its main route removes the link","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"routeId":{"type":"string","maxLength":60,"pattern":"^[a-z][a-z0-9-]*$"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","routeId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ROUTE_NOT_OFFERED"},"status":{"const":409},"message":{"type":"string","default":"ROUTE_NOT_OFFERED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/rename":{"post":{"operationId":"banklinks.rename","summary":"Give a bank link you connected its own short name, or clear it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"nickname":{"anyOf":[{"type":"string","minLength":1,"maxLength":30},{"type":"null"}]},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","nickname","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/pause":{"post":{"operationId":"banklinks.pause","summary":"Pause the syncs of a bank link you connected","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/resume":{"post":{"operationId":"banklinks.resume","summary":"Resume the syncs of a paused bank link you connected","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/syncNow":{"post":{"operationId":"banklinks.syncNow","summary":"Sync a bank link you connected now, within the fetches its bank allows a day","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"connectorId":{"type":"string"},"institution":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string"},"logo":{"type":"string"}},"required":["name","country","logo"]},"institutionId":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountKind":{"enum":["personal","business"],"type":"string"},"routes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["open-banking","source-api","statement"],"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"via":{"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"syncing":{"anyOf":[{"type":"object","properties":{"since":{"type":"string","format":"date-time"}},"required":["since"]},{"type":"null"}]},"canSyncNow":{"type":"boolean"},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","sourceAccountId"]}}},"required":["id","kind","role","via","grant","state","lastSync","syncing","canSyncNow","asks","accounts"]}},"sourceAccounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]}},"required":["id","asset","pocketId","balance","differs","check"]}},"state":{"enum":["connecting","active","needs-approval","failing","paused"],"type":"string"},"mine":{"type":"boolean"},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastSync":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"outcome":{"type":"string"}},"required":["at","outcome"]},{"type":"null"}]},"accounts":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"numberEnding":{"anyOf":[{"type":"string"},{"type":"null"}]},"asset":{"type":"string"},"fetched":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"choice":{"enum":["unmapped","imported","skipped"],"type":"string"},"pocketId":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDay":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"balance":{"anyOf":[{"type":"object","properties":{"bank":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"kind":{"enum":["booked","available"],"type":"string"},"at":{"type":"string","format":"date-time"},"day":{"type":"string","format":"date"}},"required":["amount","kind","at","day"]},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["bank","allmoni"]},{"type":"null"}]},"differs":{"type":"boolean"},"check":{"anyOf":[{"anyOf":[{"type":"object","properties":{"state":{"const":"matches"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"last-matched"},"day":{"type":"string","format":"date"}},"required":["state","day"]},{"type":"object","properties":{"state":{"const":"missing"},"missing":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"since":{"type":"string","format":"date"},"day":{"type":"string","format":"date"},"fix":{"anyOf":[{"type":"object","properties":{"kind":{"const":"add-route"},"routeId":{"type":"string"}},"required":["kind","routeId"]},{"type":"object","properties":{"kind":{"const":"statement"},"days":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]}},"required":["kind","days"]},{"type":"object","properties":{"kind":{"const":"set-balance"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["kind","amount","day"]}]}},"required":["state","missing","since","day","fix"]}]},{"type":"null"}]},"sourceAccountId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ref","name","numberEnding","asset","fetched","choice","pocketId","startDay","balance","differs","check","sourceAccountId"]}},"asks":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","format":"date"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","connectorId","institution","institutionId","nickname","accountKind","routes","sourceAccounts","state","mine","validUntil","lastSync","accounts","asks","createdAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FETCHES_USED_TODAY"},"status":{"const":409},"message":{"type":"string","default":"FETCHES_USED_TODAY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/follow":{"post":{"operationId":"banklinks.follow","summary":"Follow a skipped account of a link (a wallet’s hidden coin): import it into a pocket and sync it from now on","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"account":{"anyOf":[{"type":"object","properties":{"ref":{"type":"string","minLength":1},"pocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["ref","pocketId"],"additionalProperties":false},{"type":"object","properties":{"ref":{"type":"string","minLength":1},"create":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"pocketKind":{"enum":["bank","card","cash","wallet","exchange","broker","loan","other"],"type":"string"},"personId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["name","pocketKind","personId"],"additionalProperties":false}},"required":["ref","create"],"additionalProperties":false}]},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","account","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}},"required":["runId"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ALREADY_FOLLOWED"},"status":{"const":409},"message":{"type":"string","default":"ALREADY_FOLLOWED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_SKIPPED"},"status":{"const":409},"message":{"type":"string","default":"NOT_SKIPPED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PERSON_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"PERSON_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PLAN_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"PLAN_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"410":{"description":"410","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"HISTORY_GONE"},"status":{"const":410},"message":{"type":"string","default":"HISTORY_GONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/banklinks/remove":{"post":{"operationId":"banklinks.remove","summary":"Remove a bank link and end its consent at the bank; its transactions stay","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"linkId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","linkId","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_LINK_OWNER"},"status":{"const":403},"message":{"type":"string","default":"NOT_LINK_OWNER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/inbox/summary":{"get":{"operationId":"inbox.summary","summary":"Count a book’s inbox items to check and what changed since your last visit","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"bankLinks","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true},{"name":"quiet","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true},{"name":"refunds","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"toCheck":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastVisitAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"sinceLastVisit":{"type":"object","properties":{"new":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["new","labelled"]},"olderThan60":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["toCheck","lastVisitAt","sinceLastVisit","olderThan60"]}}}}}}},"/inbox/list":{"get":{"operationId":"inbox.list","summary":"List the open items of a book’s inbox, a page at a time, biggest first","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"bankLinks","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true},{"name":"quiet","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true},{"name":"refunds","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true},{"name":"guesses","in":"query","required":false,"schema":{"type":"object","properties":{"from":{"type":"integer","minimum":0,"maximum":100},"to":{"type":"integer","minimum":0,"maximum":100}},"required":["from","to"],"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"order","in":"query","required":false,"schema":{"enum":["impact","least-sure"],"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"runId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":500},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":true,"schema":{"type":"integer","minimum":1,"maximum":100},"allowEmptyValue":true,"allowReserved":true},{"name":"visit","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["guessed","low-confidence","uncategorised","duplicate","refund-candidate","unexplained-change","import-problem","bank-link","quiet"],"type":"string"},"transactionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"otherTransactionId":{"type":"string"},"impactBase":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"affectsTotals":{"type":"boolean"},"suggestion":{"type":"object","properties":{"categoryId":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1},"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"likelyRight":{"type":"integer","minimum":0,"maximum":100}},"required":["categoryId","confidence","how"]},"runId":{"type":"string"},"problem":{"type":"object","properties":{"code":{"enum":["PASSWORD_REQUIRED","PASSWORD_WRONG","ACCOUNT_REQUIRED","IMPORT_UNREADABLE","IMPORT_TOO_LARGE","IMPORT_UNSUPPORTED","ENCODING_REQUIRED","ACCOUNTS_UNMAPPED","PROVIDER_MISMATCH","UNDONE_BY_FAILED_RUN","FAILED_WITH_POSTINGS","DUPLICATE_GONE","COUNTERPART_UNKNOWN","ROW_SKIPPED_BLANK","ROW_UNPARSEABLE","AMOUNT_UNPARSEABLE","DATE_UNPARSEABLE","UNKNOWN_TYPE","BALANCE_MISMATCH","ORPHAN_LEG","CATEGORY_UNMAPPED","HEADER_MOVED","PRECISION_EXCEEDS_ASSET","NEGATIVE_BALANCE","TOTALS_MISMATCH","MONTH_MISSING","ZONE_UNKNOWN","INSTRUMENT_UNMAPPED","GROUP_AMBIGUOUS","BALANCE_UNCHECKED"],"type":"string"},"relatedRunId":{"type":"string"},"uploadId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["code","uploadId"]},"balance":{"type":"object","properties":{"pocketId":{"type":"string"},"date":{"type":"string","format":"date"},"difference":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"diverged":{"type":"object","properties":{"since":{"type":"string","format":"date"},"date":{"type":"string","format":"date"},"difference":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"movements":{"type":"array","items":{"type":"object","properties":{"transactionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"statement":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"ledger":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]}},"required":["transactionId","name","statement","ledger"]}}},"required":["since","date","difference","movements"]}},"required":["pocketId","date","difference"]},"contact":{"type":"object","properties":{"contactId":{"type":"string"},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["contactId","as"]},"similar":{"type":"integer","minimum":0,"maximum":9007199254740991},"bankLink":{"type":"object","properties":{"linkId":{"type":"string"},"institution":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"validUntil":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"ask":{"type":"object","properties":{"kind":{"enum":["approve-again","failing","statement-needed","differs"],"type":"string"},"days":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["from","to"]},{"type":"null"}]},"since":{"type":"string","format":"date-time"},"pocket":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"asset":{"type":"string"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"allmoni":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"day":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","asset","bank","allmoni","day"]},{"type":"null"}]}},"required":["kind","days","since","pocket"]},"differing":{"type":"integer","minimum":0,"maximum":9007199254740991},"route":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"role":{"enum":["main","gap-filler","close"],"type":"string"},"grant":{"enum":["redirect","secret","none"],"type":"string"}},"required":["id","role","grant"]},{"type":"null"}]}},"required":["linkId","institution","nickname","validUntil","ask","differing","route"]},"quiet":{"type":"object","properties":{"route":{"enum":["live","imported"],"type":"string"},"since":{"type":"string","format":"date-time"},"pocketId":{"type":"string"},"link":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"institution":{"type":"string"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","institution","nickname"]},{"type":"null"}]}},"required":["route","since","pocketId","link"]},"rate":{"type":"object","properties":{"from":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"to":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"booked":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"market":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["from","to","booked","market","date"]},"transaction":{"type":"object","properties":{"bookingDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"pocketId":{"type":"string"}},"required":["bookingDate","payee","description","kind","amount","pocketId"]}},"required":["id","kind","transactionId","impactBase","affectsTotals","similar"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"]}}}}}}},"/inbox/resolve":{"post":{"operationId":"inbox.resolve","summary":"Resolve an inbox item, and if asked every open item like it, as one change","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"itemId":{"type":"string","minLength":1,"maxLength":100},"action":{"anyOf":[{"type":"object","properties":{"type":{"const":"confirm"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"categorise"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"categorise-new"},"newCategory":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"}},"required":["name","type","parentId"],"additionalProperties":false}},"required":["type","newCategory"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"merge"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"not-duplicate"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"match-transfer"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"link-refund"},"paymentId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","paymentId"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"move-to-pocket"},"pocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","pocketId"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"with-contact"},"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["type","contact","as"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"dismiss"}},"required":["type"],"additionalProperties":false}]},"applyToSimilar":{"type":"boolean"},"remember":{"type":"boolean","default":true},"previewToken":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","itemId","action","applyToSimilar","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"applied":{"type":"integer","minimum":1,"maximum":9007199254740991},"learned":{"type":"object","properties":{"key":{"type":"string"},"categoryId":{"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["key","categoryId","count"]},"changeSetId":{"type":"string"}},"required":["applied","changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACTION_NOT_FOR_KIND"},"status":{"const":409},"message":{"type":"string","default":"ACTION_NOT_FOR_KIND"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SIMILAR_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"SIMILAR_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_PARENT"},"status":{"const":409},"message":{"type":"string","default":"INVALID_PARENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_NAME_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_NAME_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/inbox/resolveDryRun":{"post":{"operationId":"inbox.resolveDryRun","summary":"Check what resolving an inbox item would do, changing nothing","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"itemId":{"type":"string","minLength":1,"maxLength":100},"action":{"anyOf":[{"type":"object","properties":{"type":{"const":"confirm"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"categorise"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"categorise-new"},"newCategory":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"type":{"enum":["income","expense"],"type":"string"},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"hue":{"enum":["food","leisure","travel","health","transport","home","subscriptions","shopping","family","education","other"],"type":"string"},"icon":{"enum":["circle","circle-question-mark","utensils","shopping-cart","utensils-crossed","bike","coffee","pizza","wine","cake","shopping-basket","beer","carrot","popcorn","house","key-round","plug-zap","sofa","wrench","hammer","flame","droplet","lightbulb","armchair","bed-double","lamp-desk","refrigerator","bath","paintbrush","drill","flower-2","sprout","trees","spray-can","washing-machine","trash","recycle","car","fuel","bus","train-front","car-taxi-front","square-parking","car-front","ev-charger","battery-charging","parking-meter","route","motorbike","truck","ship","sailboat","cable-car","plane","plane-takeoff","hotel","luggage","map-pin","globe","tree-palm","tent","mountain-snow","shopping-bag","shirt","laptop","smartphone","package","scissors","handbag","tag","gem","glasses","watch","monitor","headphones","camera","printer","heart-pulse","pill","stethoscope","shield-plus","pill-bottle","syringe","hospital","thermometer","bandage","toothbrush","brain","eye","sparkles","ticket","clapperboard","dumbbell","palette","gamepad-2","book-open","trophy","volleyball","footprints","waves-ladder","target","medal","party-popper","eighth-notes","guitar","piano","mic","dices","puzzle","cigarette","repeat","app-window","tv","wifi","phone","router","tv-minimal-play","radio","cloud","newspaper","users","baby","gift","paw-print","dog","heart","cat","fish","bird","rabbit","turtle","user","balloon","graduation-cap","school","backpack","pencil","book","library","languages","notebook","landmark","receipt","percent","scale","credit-card","wallet","calculator","file-text","shield-check","umbrella","id-card","mail","lock","hand-heart","heart-handshake","calendar","briefcase","store","piggy-bank","trending-up","coins","undo-2","hand-coins","banknote","star","bitcoin","chart-candlestick","chart-pie","briefcase-business","building","rotate-ccw","badge-dollar-sign"],"type":"string"}},"required":["name","type","parentId"],"additionalProperties":false}},"required":["type","newCategory"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"merge"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"not-duplicate"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"match-transfer"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"link-refund"},"paymentId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","paymentId"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"move-to-pocket"},"pocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","pocketId"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"with-contact"},"contact":{"anyOf":[{"type":"object","properties":{"contactId":{"type":"string","minLength":1,"maxLength":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"newContactId":{"type":"string","format":"uuid"},"contactName":{"type":"string","minLength":1,"maxLength":80}},"required":["newContactId","contactName"],"additionalProperties":false}]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["type","contact","as"],"additionalProperties":false},{"type":"object","properties":{"type":{"const":"dismiss"}},"required":["type"],"additionalProperties":false}]},"applyToSimilar":{"type":"boolean"},"remember":{"type":"boolean","default":true},"previewToken":{"type":"string","minLength":1,"maxLength":200}},"required":["bookId","itemId","action","applyToSimilar"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"applied":{"type":"integer","minimum":1,"maximum":9007199254740991},"learned":{"type":"object","properties":{"key":{"type":"string"},"categoryId":{"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["key","categoryId","count"]},"balanceChecks":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"pocketName":{"type":"string"},"asset":{"type":"string"},"day":{"type":"string","format":"date"},"bank":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"before":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"after":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"difference":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["pocketId","pocketName","asset","day","bank","before","after","difference"]}}},"required":["applied","balanceChecks"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ACTION_NOT_FOR_KIND"},"status":{"const":409},"message":{"type":"string","default":"ACTION_NOT_FOR_KIND"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SIMILAR_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"SIMILAR_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"POCKET_CLOSED"},"status":{"const":409},"message":{"type":"string","default":"POCKET_CLOSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"INVALID_PARENT"},"status":{"const":409},"message":{"type":"string","default":"INVALID_PARENT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CATEGORY_NAME_TAKEN"},"status":{"const":409},"message":{"type":"string","default":"CATEGORY_NAME_TAKEN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/inbox/similar":{"get":{"operationId":"inbox.similar","summary":"Preview which open inbox items are like this one","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"itemId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"categoryId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"newCategoryType","in":"query","required":false,"schema":{"enum":["income","expense"],"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"withContact","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"sample":{"type":"array","maxItems":5,"items":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]}},"previewToken":{"type":"string"},"rule":{"type":"object","properties":{"summary":{"type":"string"}},"required":["summary"]},"options":{"type":"array","maxItems":2,"items":{"type":"object","properties":{"breadth":{"enum":["name","key"],"type":"string"},"match":{"type":"string","minLength":1},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"sample":{"type":"array","maxItems":5,"items":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]}},"previewToken":{"type":"string"}},"required":["breadth","match","count","sample","previewToken"]}},"future":{"anyOf":[{"type":"object","properties":{"direction":{"enum":["in","out"],"type":"string"},"match":{"type":"string","minLength":1}},"required":["direction","match"]},{"type":"null"}]}},"required":["count","sample","previewToken","rule","options","future"]}}}}}}},"/inbox/similarRows":{"get":{"operationId":"inbox.similarRows","summary":"List every payment of a previewed similar set, newest first, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"itemId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"categoryId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"newCategoryType","in":"query","required":false,"schema":{"enum":["income","expense"],"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"withContact","in":"query","required":false,"schema":{"type":"boolean"},"allowEmptyValue":true,"allowReserved":true},{"name":"previewToken","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{1,6}$"},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":true,"schema":{"type":"integer","minimum":1,"maximum":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["rows","nextCursor"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SIMILAR_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"SIMILAR_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/inbox/guesses":{"get":{"operationId":"inbox.guesses","summary":"Preview the open AI guesses in a range that confirming them all would confirm","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"guesses","in":"query","required":true,"schema":{"type":"object","properties":{"from":{"type":"integer","minimum":0,"maximum":100},"to":{"type":"integer","minimum":0,"maximum":100}},"required":["from","to"],"additionalProperties":false},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"previewToken":{"type":"string"}},"required":["count","previewToken"]}}}}}}},"/inbox/confirmGuesses":{"post":{"operationId":"inbox.confirmGuesses","summary":"Confirm every previewed AI guess in a range with its category, as one change","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"guesses":{"type":"object","properties":{"from":{"type":"integer","minimum":0,"maximum":100},"to":{"type":"integer","minimum":0,"maximum":100}},"required":["from","to"],"additionalProperties":false},"previewToken":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","guesses","previewToken","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"confirmed":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["changeSetId","confirmed"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"GUESSES_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"GUESSES_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/inbox/oldItems":{"get":{"operationId":"inbox.oldItems","summary":"Preview the open inbox items older than a number of days, to mark reviewed","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"olderThanDays","in":"query","required":true,"schema":{"type":"integer","minimum":1,"maximum":3650},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"firstIds":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":100}},"previewToken":{"type":"string"}},"required":["count","firstIds","previewToken"]}}}}}}},"/inbox/markReviewed":{"post":{"operationId":"inbox.markReviewed","summary":"Mark open inbox items older than a number of days as reviewed, as they are","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"olderThanDays":{"type":"integer","minimum":1,"maximum":3650},"previewToken":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","olderThanDays","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"marked":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["changeSetId","marked"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SWEEP_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"SWEEP_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/rules/list":{"get":{"operationId":"rules.list","summary":"List the book’s rules in priority order","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"enabled":{"type":"boolean"},"match":{"enum":["all","any"],"type":"string"},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"anyOf":[{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},{"type":"object","properties":{"field":{"const":"description"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":200}},"negate":{"type":"boolean"}},"required":["field","op","values"]},{"type":"object","properties":{"field":{"const":"amount"},"op":{"enum":["gt","gte","lt","lte","eq","between","about"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"min":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"max":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"tolerance":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["field","op","asset"]},{"type":"object","properties":{"field":{"const":"pocket"},"pocketIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100}},"negate":{"type":"boolean"}},"required":["field","pocketIds"]},{"type":"object","properties":{"field":{"const":"asset"},"assets":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"negate":{"type":"boolean"}},"required":["field","assets"]},{"type":"object","properties":{"field":{"const":"direction"},"value":{"enum":["in","out"],"type":"string"}},"required":["field","value"]},{"type":"object","properties":{"field":{"const":"typeHint"},"op":{"enum":["any","none"],"type":"string"},"hints":{"type":"array","minItems":1,"maxItems":17,"items":{"enum":["card","atm","fee","transfer","exchange","refund","topup","interest","cashback","trade","debt","reversal","dividend","tax","reward","internal","direct_debit"],"type":"string"}}},"required":["field","hints"]},{"type":"object","properties":{"field":{"const":"date"},"dayOfMonth":{"type":"object","properties":{"from":{"type":"integer","minimum":1,"maximum":31},"to":{"type":"integer","minimum":1,"maximum":31}},"required":["from","to"]},"weekdays":{"type":"array","minItems":1,"maxItems":7,"items":{"enum":["mon","tue","wed","thu","fri","sat","sun"],"type":"string"}}},"required":["field"]}]}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"anyOf":[{"type":"object","properties":{"type":{"const":"category"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"]},{"type":"object","properties":{"type":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["type","name"]},{"type":"object","properties":{"type":{"const":"tags"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["type","tags"]},{"type":"object","properties":{"type":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"fee":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"fixed"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","amount","categoryId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"round"},"step":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","step","categoryId"],"additionalProperties":false}]}},"required":["type","pocketId","fee"]},{"type":"object","properties":{"type":{"const":"split"},"parts":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"percent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","percent"]}}},"required":["type","parts"]}]}},"origin":{"enum":["user","similar","seed"],"type":"string"},"matches":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"named":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","lastAt","named"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","position","enabled","match","conditions","actions","origin","matches","createdAt","updatedAt"]}}}}}}}},"/rules/create":{"post":{"operationId":"rules.create","summary":"Create a rule, and label matching past transactions unless told not to","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":80},"match":{"enum":["all","any"],"type":"string","default":"all"},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"anyOf":[{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},{"type":"object","properties":{"field":{"const":"description"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":200}},"negate":{"type":"boolean"}},"required":["field","op","values"]},{"type":"object","properties":{"field":{"const":"amount"},"op":{"enum":["gt","gte","lt","lte","eq","between","about"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"min":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"max":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"tolerance":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["field","op","asset"]},{"type":"object","properties":{"field":{"const":"pocket"},"pocketIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100}},"negate":{"type":"boolean"}},"required":["field","pocketIds"]},{"type":"object","properties":{"field":{"const":"asset"},"assets":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"negate":{"type":"boolean"}},"required":["field","assets"]},{"type":"object","properties":{"field":{"const":"direction"},"value":{"enum":["in","out"],"type":"string"}},"required":["field","value"]},{"type":"object","properties":{"field":{"const":"typeHint"},"op":{"enum":["any","none"],"type":"string"},"hints":{"type":"array","minItems":1,"maxItems":17,"items":{"enum":["card","atm","fee","transfer","exchange","refund","topup","interest","cashback","trade","debt","reversal","dividend","tax","reward","internal","direct_debit"],"type":"string"}}},"required":["field","hints"]},{"type":"object","properties":{"field":{"const":"date"},"dayOfMonth":{"type":"object","properties":{"from":{"type":"integer","minimum":1,"maximum":31},"to":{"type":"integer","minimum":1,"maximum":31}},"required":["from","to"]},"weekdays":{"type":"array","minItems":1,"maxItems":7,"items":{"enum":["mon","tue","wed","thu","fri","sat","sun"],"type":"string"}}},"required":["field"]}]}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"anyOf":[{"type":"object","properties":{"type":{"const":"category"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"]},{"type":"object","properties":{"type":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["type","name"]},{"type":"object","properties":{"type":{"const":"tags"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["type","tags"]},{"type":"object","properties":{"type":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"fee":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"fixed"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","amount","categoryId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"round"},"step":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","step","categoryId"],"additionalProperties":false}]}},"required":["type","pocketId","fee"]},{"type":"object","properties":{"type":{"const":"split"},"parts":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"percent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","percent"]}}},"required":["type","parts"]}]}},"enabled":{"type":"boolean","default":true},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"applyToPast":{"type":"boolean","default":true},"previewToken":{"type":"string","maxLength":100},"fromLearned":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"direction":{"enum":["in","out"],"type":"string"}},"required":["key","direction"]},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","name","conditions","actions","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"relabelling":{"type":"boolean"},"changeSetId":{"type":"string","minLength":1,"maxLength":100},"labelled":{"type":"integer","minimum":0,"maximum":9007199254740991},"rule":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"enabled":{"type":"boolean"},"match":{"enum":["all","any"],"type":"string"},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"anyOf":[{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},{"type":"object","properties":{"field":{"const":"description"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":200}},"negate":{"type":"boolean"}},"required":["field","op","values"]},{"type":"object","properties":{"field":{"const":"amount"},"op":{"enum":["gt","gte","lt","lte","eq","between","about"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"min":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"max":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"tolerance":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["field","op","asset"]},{"type":"object","properties":{"field":{"const":"pocket"},"pocketIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100}},"negate":{"type":"boolean"}},"required":["field","pocketIds"]},{"type":"object","properties":{"field":{"const":"asset"},"assets":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"negate":{"type":"boolean"}},"required":["field","assets"]},{"type":"object","properties":{"field":{"const":"direction"},"value":{"enum":["in","out"],"type":"string"}},"required":["field","value"]},{"type":"object","properties":{"field":{"const":"typeHint"},"op":{"enum":["any","none"],"type":"string"},"hints":{"type":"array","minItems":1,"maxItems":17,"items":{"enum":["card","atm","fee","transfer","exchange","refund","topup","interest","cashback","trade","debt","reversal","dividend","tax","reward","internal","direct_debit"],"type":"string"}}},"required":["field","hints"]},{"type":"object","properties":{"field":{"const":"date"},"dayOfMonth":{"type":"object","properties":{"from":{"type":"integer","minimum":1,"maximum":31},"to":{"type":"integer","minimum":1,"maximum":31}},"required":["from","to"]},"weekdays":{"type":"array","minItems":1,"maxItems":7,"items":{"enum":["mon","tue","wed","thu","fri","sat","sun"],"type":"string"}}},"required":["field"]}]}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"anyOf":[{"type":"object","properties":{"type":{"const":"category"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"]},{"type":"object","properties":{"type":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["type","name"]},{"type":"object","properties":{"type":{"const":"tags"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["type","tags"]},{"type":"object","properties":{"type":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"fee":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"fixed"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","amount","categoryId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"round"},"step":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","step","categoryId"],"additionalProperties":false}]}},"required":["type","pocketId","fee"]},{"type":"object","properties":{"type":{"const":"split"},"parts":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"percent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","percent"]}}},"required":["type","parts"]}]}},"origin":{"enum":["user","similar","seed"],"type":"string"},"matches":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"named":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","lastAt","named"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","position","enabled","match","conditions","actions","origin","matches","createdAt","updatedAt"]}},"required":["relabelling","changeSetId","labelled","rule"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TARGET_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"TARGET_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"RULE_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_EXISTS"},"status":{"const":409},"message":{"type":"string","default":"RULE_EXISTS"},"data":{"type":"object","properties":{"ruleId":{"type":"string","minLength":1,"maxLength":100}},"required":["ruleId"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_PREVIEW_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"RULE_PREVIEW_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/rules/update":{"post":{"operationId":"rules.update","summary":"Change a rule, and label the past again by it unless told not to","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"ruleId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"name":{"type":"string","minLength":1,"maxLength":80},"match":{"enum":["all","any"],"type":"string"},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"anyOf":[{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},{"type":"object","properties":{"field":{"const":"description"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":200}},"negate":{"type":"boolean"}},"required":["field","op","values"]},{"type":"object","properties":{"field":{"const":"amount"},"op":{"enum":["gt","gte","lt","lte","eq","between","about"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"min":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"max":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"tolerance":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["field","op","asset"]},{"type":"object","properties":{"field":{"const":"pocket"},"pocketIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100}},"negate":{"type":"boolean"}},"required":["field","pocketIds"]},{"type":"object","properties":{"field":{"const":"asset"},"assets":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"negate":{"type":"boolean"}},"required":["field","assets"]},{"type":"object","properties":{"field":{"const":"direction"},"value":{"enum":["in","out"],"type":"string"}},"required":["field","value"]},{"type":"object","properties":{"field":{"const":"typeHint"},"op":{"enum":["any","none"],"type":"string"},"hints":{"type":"array","minItems":1,"maxItems":17,"items":{"enum":["card","atm","fee","transfer","exchange","refund","topup","interest","cashback","trade","debt","reversal","dividend","tax","reward","internal","direct_debit"],"type":"string"}}},"required":["field","hints"]},{"type":"object","properties":{"field":{"const":"date"},"dayOfMonth":{"type":"object","properties":{"from":{"type":"integer","minimum":1,"maximum":31},"to":{"type":"integer","minimum":1,"maximum":31}},"required":["from","to"]},"weekdays":{"type":"array","minItems":1,"maxItems":7,"items":{"enum":["mon","tue","wed","thu","fri","sat","sun"],"type":"string"}}},"required":["field"]}]}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"anyOf":[{"type":"object","properties":{"type":{"const":"category"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"]},{"type":"object","properties":{"type":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["type","name"]},{"type":"object","properties":{"type":{"const":"tags"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["type","tags"]},{"type":"object","properties":{"type":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"fee":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"fixed"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","amount","categoryId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"round"},"step":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","step","categoryId"],"additionalProperties":false}]}},"required":["type","pocketId","fee"]},{"type":"object","properties":{"type":{"const":"split"},"parts":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"percent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","percent"]}}},"required":["type","parts"]}]}},"enabled":{"type":"boolean"},"applyToPast":{"type":"boolean","default":true},"previewToken":{"type":"string","maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","ruleId","expectedUpdatedAt","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"relabelling":{"type":"boolean"},"changeSetId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"rule":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"enabled":{"type":"boolean"},"match":{"enum":["all","any"],"type":"string"},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"anyOf":[{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},{"type":"object","properties":{"field":{"const":"description"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":200}},"negate":{"type":"boolean"}},"required":["field","op","values"]},{"type":"object","properties":{"field":{"const":"amount"},"op":{"enum":["gt","gte","lt","lte","eq","between","about"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"min":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"max":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"tolerance":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["field","op","asset"]},{"type":"object","properties":{"field":{"const":"pocket"},"pocketIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100}},"negate":{"type":"boolean"}},"required":["field","pocketIds"]},{"type":"object","properties":{"field":{"const":"asset"},"assets":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"negate":{"type":"boolean"}},"required":["field","assets"]},{"type":"object","properties":{"field":{"const":"direction"},"value":{"enum":["in","out"],"type":"string"}},"required":["field","value"]},{"type":"object","properties":{"field":{"const":"typeHint"},"op":{"enum":["any","none"],"type":"string"},"hints":{"type":"array","minItems":1,"maxItems":17,"items":{"enum":["card","atm","fee","transfer","exchange","refund","topup","interest","cashback","trade","debt","reversal","dividend","tax","reward","internal","direct_debit"],"type":"string"}}},"required":["field","hints"]},{"type":"object","properties":{"field":{"const":"date"},"dayOfMonth":{"type":"object","properties":{"from":{"type":"integer","minimum":1,"maximum":31},"to":{"type":"integer","minimum":1,"maximum":31}},"required":["from","to"]},"weekdays":{"type":"array","minItems":1,"maxItems":7,"items":{"enum":["mon","tue","wed","thu","fri","sat","sun"],"type":"string"}}},"required":["field"]}]}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"anyOf":[{"type":"object","properties":{"type":{"const":"category"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"]},{"type":"object","properties":{"type":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["type","name"]},{"type":"object","properties":{"type":{"const":"tags"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["type","tags"]},{"type":"object","properties":{"type":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"fee":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"fixed"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","amount","categoryId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"round"},"step":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","step","categoryId"],"additionalProperties":false}]}},"required":["type","pocketId","fee"]},{"type":"object","properties":{"type":{"const":"split"},"parts":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"percent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","percent"]}}},"required":["type","parts"]}]}},"origin":{"enum":["user","similar","seed"],"type":"string"},"matches":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"named":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","lastAt","named"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","position","enabled","match","conditions","actions","origin","matches","createdAt","updatedAt"]}},"required":["relabelling","changeSetId","rule"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TARGET_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"TARGET_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"RULE_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"RULE_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_PREVIEW_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"RULE_PREVIEW_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/rules/delete":{"post":{"operationId":"rules.delete","summary":"Delete a rule; its transactions keep their category or are labelled again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"ruleId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"relabel":{"type":"boolean","default":true},"bankNames":{"type":"boolean"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","ruleId","expectedUpdatedAt","bankNames","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"relabelling":{"type":"boolean"},"changeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["relabelling","changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"RULE_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/rules/reorder":{"post":{"operationId":"rules.reorder","summary":"Set the order in which the book’s rules apply","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"ids":{"type":"array","minItems":1,"maxItems":500,"items":{"type":"string","minLength":1,"maxLength":100}},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","ids","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"relabelling":{"type":"boolean"},"changeSetId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"rules":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"enabled":{"type":"boolean"},"match":{"enum":["all","any"],"type":"string"},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"anyOf":[{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},{"type":"object","properties":{"field":{"const":"description"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":200}},"negate":{"type":"boolean"}},"required":["field","op","values"]},{"type":"object","properties":{"field":{"const":"amount"},"op":{"enum":["gt","gte","lt","lte","eq","between","about"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"min":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"max":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"tolerance":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["field","op","asset"]},{"type":"object","properties":{"field":{"const":"pocket"},"pocketIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100}},"negate":{"type":"boolean"}},"required":["field","pocketIds"]},{"type":"object","properties":{"field":{"const":"asset"},"assets":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"negate":{"type":"boolean"}},"required":["field","assets"]},{"type":"object","properties":{"field":{"const":"direction"},"value":{"enum":["in","out"],"type":"string"}},"required":["field","value"]},{"type":"object","properties":{"field":{"const":"typeHint"},"op":{"enum":["any","none"],"type":"string"},"hints":{"type":"array","minItems":1,"maxItems":17,"items":{"enum":["card","atm","fee","transfer","exchange","refund","topup","interest","cashback","trade","debt","reversal","dividend","tax","reward","internal","direct_debit"],"type":"string"}}},"required":["field","hints"]},{"type":"object","properties":{"field":{"const":"date"},"dayOfMonth":{"type":"object","properties":{"from":{"type":"integer","minimum":1,"maximum":31},"to":{"type":"integer","minimum":1,"maximum":31}},"required":["from","to"]},"weekdays":{"type":"array","minItems":1,"maxItems":7,"items":{"enum":["mon","tue","wed","thu","fri","sat","sun"],"type":"string"}}},"required":["field"]}]}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"anyOf":[{"type":"object","properties":{"type":{"const":"category"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"]},{"type":"object","properties":{"type":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["type","name"]},{"type":"object","properties":{"type":{"const":"tags"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["type","tags"]},{"type":"object","properties":{"type":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"fee":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"fixed"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","amount","categoryId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"round"},"step":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","step","categoryId"],"additionalProperties":false}]}},"required":["type","pocketId","fee"]},{"type":"object","properties":{"type":{"const":"split"},"parts":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"percent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","percent"]}}},"required":["type","parts"]}]}},"origin":{"enum":["user","similar","seed"],"type":"string"},"matches":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"named":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count","lastAt","named"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","position","enabled","match","conditions","actions","origin","matches","createdAt","updatedAt"]}}},"required":["relabelling","changeSetId","rules"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"ORDER_MISMATCH"},"status":{"const":409},"message":{"type":"string","default":"ORDER_MISMATCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/rules/planFromPayment":{"get":{"operationId":"rules.planFromPayment","summary":"Preview the rule a payment’s new payee or transfer would make, writing nothing","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"change","in":"query","required":true,"schema":{"anyOf":[{"type":"object","properties":{"kind":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["kind","name"]},{"type":"object","properties":{"kind":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["kind","pocketId"]}]},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true},{"name":"condition","in":"query","required":false,"schema":{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},"style":"deepObject","explode":true,"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"]},{"type":"object","properties":{"kind":{"const":"rule"},"key":{"type":"string","minLength":1},"extends":{"anyOf":[{"type":"object","properties":{"ruleId":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"}},"required":["ruleId","name","updatedAt"]},{"type":"null"}]},"draft":{"type":"object","properties":{"match":{"enum":["all","any"],"type":"string"},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"anyOf":[{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},{"type":"object","properties":{"field":{"const":"description"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":200}},"negate":{"type":"boolean"}},"required":["field","op","values"]},{"type":"object","properties":{"field":{"const":"amount"},"op":{"enum":["gt","gte","lt","lte","eq","between","about"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"min":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"max":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"tolerance":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["field","op","asset"]},{"type":"object","properties":{"field":{"const":"pocket"},"pocketIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100}},"negate":{"type":"boolean"}},"required":["field","pocketIds"]},{"type":"object","properties":{"field":{"const":"asset"},"assets":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"negate":{"type":"boolean"}},"required":["field","assets"]},{"type":"object","properties":{"field":{"const":"direction"},"value":{"enum":["in","out"],"type":"string"}},"required":["field","value"]},{"type":"object","properties":{"field":{"const":"typeHint"},"op":{"enum":["any","none"],"type":"string"},"hints":{"type":"array","minItems":1,"maxItems":17,"items":{"enum":["card","atm","fee","transfer","exchange","refund","topup","interest","cashback","trade","debt","reversal","dividend","tax","reward","internal","direct_debit"],"type":"string"}}},"required":["field","hints"]},{"type":"object","properties":{"field":{"const":"date"},"dayOfMonth":{"type":"object","properties":{"from":{"type":"integer","minimum":1,"maximum":31},"to":{"type":"integer","minimum":1,"maximum":31}},"required":["from","to"]},"weekdays":{"type":"array","minItems":1,"maxItems":7,"items":{"enum":["mon","tue","wed","thu","fri","sat","sun"],"type":"string"}}},"required":["field"]}]}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"anyOf":[{"type":"object","properties":{"type":{"const":"category"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"]},{"type":"object","properties":{"type":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["type","name"]},{"type":"object","properties":{"type":{"const":"tags"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["type","tags"]},{"type":"object","properties":{"type":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"fee":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"fixed"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","amount","categoryId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"round"},"step":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","step","categoryId"],"additionalProperties":false}]}},"required":["type","pocketId","fee"]},{"type":"object","properties":{"type":{"const":"split"},"parts":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"percent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","percent"]}}},"required":["type","parts"]}]}},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["match","conditions","actions","name"]},"matched":{"type":"integer","minimum":0,"maximum":9007199254740991},"changes":{"type":"integer","minimum":0,"maximum":9007199254740991},"kept":{"type":"integer","minimum":0,"maximum":9007199254740991},"sample":{"type":"array","maxItems":3,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"bookingDate":{"type":"string","format":"date"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"description":{"type":"string"},"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"before":{"type":"object","properties":{"categories":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["categoryId","amount"]}},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","maxItems":40,"items":{"type":"string"}},"transferPocketId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["categories","payee","tags","transferPocketId"]},"after":{"type":"object","properties":{"categories":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["categoryId","amount"]}},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","maxItems":40,"items":{"type":"string"}},"transferPocketId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["categories","payee","tags","transferPocketId"]}},"required":["transactionId","bookingDate","pocketId","amount","description","how","before","after"]}},"previewToken":{"type":"string"},"atRuleLimit":{"type":"boolean"}},"required":["kind","key","extends","draft","matched","changes","kept","sample","previewToken","atRuleLimit"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TARGET_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"TARGET_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/rules/preview":{"post":{"operationId":"rules.preview","summary":"Preview what a draft rule would change, without changing anything","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"ruleId":{"type":"string","minLength":1,"maxLength":100},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"match":{"enum":["all","any"],"type":"string","default":"all"},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"anyOf":[{"type":"object","properties":{"field":{"const":"merchant"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":100}},"source":{"enum":["typed","key"],"type":"string"},"negate":{"type":"boolean"}},"required":["field","op","values","source"]},{"type":"object","properties":{"field":{"const":"description"},"op":{"enum":["is","startsWith","endsWith","contains","matches"],"type":"string"},"values":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":200}},"negate":{"type":"boolean"}},"required":["field","op","values"]},{"type":"object","properties":{"field":{"const":"amount"},"op":{"enum":["gt","gte","lt","lte","eq","between","about"],"type":"string"},"value":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"min":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"max":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"tolerance":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["field","op","asset"]},{"type":"object","properties":{"field":{"const":"pocket"},"pocketIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100}},"negate":{"type":"boolean"}},"required":["field","pocketIds"]},{"type":"object","properties":{"field":{"const":"asset"},"assets":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"negate":{"type":"boolean"}},"required":["field","assets"]},{"type":"object","properties":{"field":{"const":"direction"},"value":{"enum":["in","out"],"type":"string"}},"required":["field","value"]},{"type":"object","properties":{"field":{"const":"typeHint"},"op":{"enum":["any","none"],"type":"string"},"hints":{"type":"array","minItems":1,"maxItems":17,"items":{"enum":["card","atm","fee","transfer","exchange","refund","topup","interest","cashback","trade","debt","reversal","dividend","tax","reward","internal","direct_debit"],"type":"string"}}},"required":["field","hints"]},{"type":"object","properties":{"field":{"const":"date"},"dayOfMonth":{"type":"object","properties":{"from":{"type":"integer","minimum":1,"maximum":31},"to":{"type":"integer","minimum":1,"maximum":31}},"required":["from","to"]},"weekdays":{"type":"array","minItems":1,"maxItems":7,"items":{"enum":["mon","tue","wed","thu","fri","sat","sun"],"type":"string"}}},"required":["field"]}]}},"actions":{"type":"array","minItems":1,"maxItems":5,"items":{"anyOf":[{"type":"object","properties":{"type":{"const":"category"},"categoryId":{"type":"string","minLength":1,"maxLength":100}},"required":["type","categoryId"]},{"type":"object","properties":{"type":{"const":"payee"},"name":{"type":"string","minLength":1,"maxLength":80}},"required":["type","name"]},{"type":"object","properties":{"type":{"const":"tags"},"tags":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","minLength":1,"maxLength":40}}},"required":["type","tags"]},{"type":"object","properties":{"type":{"const":"transfer"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"fee":{"anyOf":[{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"fixed"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","amount","categoryId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"const":"round"},"step":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["kind","step","categoryId"],"additionalProperties":false}]}},"required":["type","pocketId","fee"]},{"type":"object","properties":{"type":{"const":"split"},"parts":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"percent":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["categoryId","percent"]}}},"required":["type","parts"]}]}},"enabled":{"type":"boolean","default":true},"fromLearned":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"direction":{"enum":["in","out"],"type":"string"}},"required":["key","direction"]},"limit":{"type":"integer","minimum":1,"maximum":50,"default":20}},"required":["bookId","conditions","actions"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"matched":{"type":"integer","minimum":0,"maximum":9007199254740991},"changes":{"type":"integer","minimum":0,"maximum":9007199254740991},"kept":{"type":"object","properties":{"manual":{"type":"integer","minimum":0,"maximum":9007199254740991},"import":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["manual","import"]},"sample":{"type":"array","maxItems":50,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"bookingDate":{"type":"string","format":"date"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"description":{"type":"string"},"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"before":{"type":"object","properties":{"categories":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["categoryId","amount"]}},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","maxItems":40,"items":{"type":"string"}},"transferPocketId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["categories","payee","tags","transferPocketId"]},"after":{"type":"object","properties":{"categories":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["categoryId","amount"]}},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","maxItems":40,"items":{"type":"string"}},"transferPocketId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["categories","payee","tags","transferPocketId"]}},"required":["transactionId","bookingDate","pocketId","amount","description","how","before","after"]}},"previewToken":{"type":"string"},"takesOverLearned":{"type":"boolean"},"clashes":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["merchant-start","merchant","amount","currency","direction"],"type":"string"},"first":{"type":"integer","minimum":0,"maximum":9007199254740991},"second":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["kind","first","second"]}}},"required":["matched","changes","kept","sample","previewToken","takesOverLearned","clashes"]}}}}}}},"/recurring/summary":{"get":{"operationId":"recurring.summary","summary":"Total the book’s monthly recurring payments and what changed this month","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"baseCurrency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"monthly":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"yearly":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"suggested":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"monthly":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["count","monthly"]},"unconverted":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"count":{"type":"integer","minimum":1,"maximum":9007199254740991},"monthly":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["asset","count","monthly"]}},"changes":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"seriesId":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"what":{"enum":["up","down","new","stopped","missed"],"type":"string"},"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"at":{"type":"string","format":"date"}},"required":["seriesId","name","asset","what","at"]}}},"required":["baseCurrency","monthly","yearly","count","suggested","unconverted","changes"]}}}}}}},"/recurring/payments":{"get":{"operationId":"recurring.payments","summary":"List a recurring series’ payments, newest first, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"seriesId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"bookingDate":{"type":"string","format":"date"},"occurredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"merchantName":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"status":{"enum":["pending","posted"],"type":"string"},"kind":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"},"needsReview":{"type":"boolean"},"pockets":{"type":"array","items":{"type":"object","properties":{"pocketId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"as":{"enum":["loan","repayment"],"type":"string"}},"required":["pocketId","amount"]}},"categories":{"type":"array","items":{"type":"object","properties":{"categoryId":{"type":"string"},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]}},"required":["categoryId","amount","base"]}},"base":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"original":{"anyOf":[{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},{"type":"null"}]},"relatedAsset":{"anyOf":[{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},{"type":"null"}]},"attachmentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelled":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"ruleId":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"likelyRight":{"type":"integer","minimum":1,"maximum":99}},"required":["how"],"additionalProperties":false},"lastChangeSetId":{"type":"string"},"pair":{"anyOf":[{"type":"object","properties":{"bookId":{"type":"string"},"transactionId":{"type":"string"},"as":{"enum":["contribution","loan"],"type":"string"}},"required":["bookId","transactionId","as"]},{"type":"null"}]},"contactAs":{"anyOf":[{"enum":["loan","repayment"],"type":"string"},{"type":"null"}]}},"required":["id","bookingDate","occurredAt","payee","description","notes","tags","status","kind","needsReview","pockets","categories","base","original","relatedAsset","attachmentCount","labelled","lastChangeSetId","pair","contactAs"]}},"nextCursor":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["items","nextCursor"]}}}}}}},"/recurring/list":{"get":{"operationId":"recurring.list","summary":"List the book’s recurring series by next expected date","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"show","in":"query","required":false,"schema":{"enum":["current","dismissed","all"],"type":"string","default":"current"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"merchantKey":{"type":"string"},"name":{"type":"string"},"status":{"enum":["suggested","confirmed","dismissed"],"type":"string"},"state":{"enum":["active","changed","missed","stopped"],"type":"string"},"direction":{"enum":["in","out"],"type":"string"},"cadence":{"enum":["weekly","biweekly","monthly","quarterly","yearly"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"usualAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"expected":{"anyOf":[{"type":"object","properties":{"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["date","amount"]},{"type":"null"}]},"last":{"type":"array","maxItems":6,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["transactionId","date","amount"]}},"priceChange":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"at":{"type":"string","format":"date"}},"required":["from","to","at"]},{"type":"null"}]},"missed":{"type":"array","maxItems":3,"items":{"type":"string","format":"date"}},"occurrences":{"type":"integer","minimum":2,"maximum":9007199254740991},"firstDate":{"type":"string","format":"date"},"lastDate":{"type":"string","format":"date"},"confidence":{"type":"number","minimum":0,"maximum":1},"yearlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"yearlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"stillPaying":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","merchantKey","name","status","state","direction","cadence","pocketId","categoryId","asset","usualAmount","expected","last","priceChange","missed","occurrences","firstDate","lastDate","confidence","yearlyCost","monthlyCost","monthlyBase","yearlyBase","stillPaying","updatedAt"]}}}}}}}},"/recurring/confirm":{"post":{"operationId":"recurring.confirm","summary":"Confirm a suggested or dismissed recurring series","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"seriesId":{"type":"string","minLength":1,"maxLength":100},"expectedStatus":{"enum":["suggested","confirmed","dismissed"],"type":"string"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","seriesId","expectedStatus","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"merchantKey":{"type":"string"},"name":{"type":"string"},"status":{"enum":["suggested","confirmed","dismissed"],"type":"string"},"state":{"enum":["active","changed","missed","stopped"],"type":"string"},"direction":{"enum":["in","out"],"type":"string"},"cadence":{"enum":["weekly","biweekly","monthly","quarterly","yearly"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"usualAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"expected":{"anyOf":[{"type":"object","properties":{"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["date","amount"]},{"type":"null"}]},"last":{"type":"array","maxItems":6,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["transactionId","date","amount"]}},"priceChange":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"at":{"type":"string","format":"date"}},"required":["from","to","at"]},{"type":"null"}]},"missed":{"type":"array","maxItems":3,"items":{"type":"string","format":"date"}},"occurrences":{"type":"integer","minimum":2,"maximum":9007199254740991},"firstDate":{"type":"string","format":"date"},"lastDate":{"type":"string","format":"date"},"confidence":{"type":"number","minimum":0,"maximum":1},"yearlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"yearlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"stillPaying":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","merchantKey","name","status","state","direction","cadence","pocketId","categoryId","asset","usualAmount","expected","last","priceChange","missed","occurrences","firstDate","lastDate","confidence","yearlyCost","monthlyCost","monthlyBase","yearlyBase","stillPaying","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SERIES_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"SERIES_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/recurring/dismiss":{"post":{"operationId":"recurring.dismiss","summary":"Dismiss a recurring series and stop suggesting it again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"seriesId":{"type":"string","minLength":1,"maxLength":100},"expectedStatus":{"enum":["suggested","confirmed","dismissed"],"type":"string"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","seriesId","expectedStatus","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"merchantKey":{"type":"string"},"name":{"type":"string"},"status":{"enum":["suggested","confirmed","dismissed"],"type":"string"},"state":{"enum":["active","changed","missed","stopped"],"type":"string"},"direction":{"enum":["in","out"],"type":"string"},"cadence":{"enum":["weekly","biweekly","monthly","quarterly","yearly"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"usualAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"expected":{"anyOf":[{"type":"object","properties":{"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["date","amount"]},{"type":"null"}]},"last":{"type":"array","maxItems":6,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["transactionId","date","amount"]}},"priceChange":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"at":{"type":"string","format":"date"}},"required":["from","to","at"]},{"type":"null"}]},"missed":{"type":"array","maxItems":3,"items":{"type":"string","format":"date"}},"occurrences":{"type":"integer","minimum":2,"maximum":9007199254740991},"firstDate":{"type":"string","format":"date"},"lastDate":{"type":"string","format":"date"},"confidence":{"type":"number","minimum":0,"maximum":1},"yearlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"yearlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"stillPaying":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","merchantKey","name","status","state","direction","cadence","pocketId","categoryId","asset","usualAmount","expected","last","priceChange","missed","occurrences","firstDate","lastDate","confidence","yearlyCost","monthlyCost","monthlyBase","yearlyBase","stillPaying","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SERIES_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"SERIES_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/recurring/restore":{"post":{"operationId":"recurring.restore","summary":"Undo a recurring series’ dismissal","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"seriesId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","seriesId","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"merchantKey":{"type":"string"},"name":{"type":"string"},"status":{"enum":["suggested","confirmed","dismissed"],"type":"string"},"state":{"enum":["active","changed","missed","stopped"],"type":"string"},"direction":{"enum":["in","out"],"type":"string"},"cadence":{"enum":["weekly","biweekly","monthly","quarterly","yearly"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"usualAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"expected":{"anyOf":[{"type":"object","properties":{"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["date","amount"]},{"type":"null"}]},"last":{"type":"array","maxItems":6,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["transactionId","date","amount"]}},"priceChange":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"at":{"type":"string","format":"date"}},"required":["from","to","at"]},{"type":"null"}]},"missed":{"type":"array","maxItems":3,"items":{"type":"string","format":"date"}},"occurrences":{"type":"integer","minimum":2,"maximum":9007199254740991},"firstDate":{"type":"string","format":"date"},"lastDate":{"type":"string","format":"date"},"confidence":{"type":"number","minimum":0,"maximum":1},"yearlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"yearlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"stillPaying":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","merchantKey","name","status","state","direction","cadence","pocketId","categoryId","asset","usualAmount","expected","last","priceChange","missed","occurrences","firstDate","lastDate","confidence","yearlyCost","monthlyCost","monthlyBase","yearlyBase","stillPaying","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/recurring/update":{"post":{"operationId":"recurring.update","summary":"Edit, stop or resume a recurring series, confirming it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"seriesId":{"type":"string","minLength":1,"maxLength":100},"expectedUpdatedAt":{"type":"string","format":"date-time"},"name":{"type":"string","minLength":1,"maxLength":80},"cadence":{"enum":["weekly","biweekly","monthly","quarterly","yearly"],"type":"string"},"usualAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"stopped":{"type":"boolean"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","seriesId","expectedUpdatedAt","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":100},"merchantKey":{"type":"string"},"name":{"type":"string"},"status":{"enum":["suggested","confirmed","dismissed"],"type":"string"},"state":{"enum":["active","changed","missed","stopped"],"type":"string"},"direction":{"enum":["in","out"],"type":"string"},"cadence":{"enum":["weekly","biweekly","monthly","quarterly","yearly"],"type":"string"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"usualAmount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"expected":{"anyOf":[{"type":"object","properties":{"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["date","amount"]},{"type":"null"}]},"last":{"type":"array","maxItems":6,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"date":{"type":"string","format":"date"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"}},"required":["transactionId","date","amount"]}},"priceChange":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"to":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"at":{"type":"string","format":"date"}},"required":["from","to","at"]},{"type":"null"}]},"missed":{"type":"array","maxItems":3,"items":{"type":"string","format":"date"}},"occurrences":{"type":"integer","minimum":2,"maximum":9007199254740991},"firstDate":{"type":"string","format":"date"},"lastDate":{"type":"string","format":"date"},"confidence":{"type":"number","minimum":0,"maximum":1},"yearlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyCost":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"monthlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"yearlyBase":{"anyOf":[{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},{"type":"null"}]},"stillPaying":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","merchantKey","name","status","state","direction","cadence","pocketId","categoryId","asset","usualAmount","expected","last","priceChange","missed","occurrences","firstDate","lastDate","confidence","yearlyCost","monthlyCost","monthlyBase","yearlyBase","stillPaying","updatedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SERIES_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"SERIES_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TARGET_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"TARGET_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AMOUNT_TOO_PRECISE"},"status":{"const":422},"message":{"type":"string","default":"AMOUNT_TOO_PRECISE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/learned/list":{"get":{"operationId":"labelling.learned.list","summary":"List what memory learned per merchant, most used first, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"q","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"key","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"direction","in":"query","required":false,"schema":{"enum":["in","out"],"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"key":{"type":"string"},"payee":{"type":"string","minLength":1},"direction":{"enum":["in","out"],"type":"string"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"pinned":{"type":"boolean"},"source":{"enum":["choices","import"],"type":"string"},"labels":{"type":"integer","minimum":0,"maximum":9007199254740991},"appliedToAll":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastAt":{"type":"string","format":"date-time"}},"required":["key","payee","direction","categoryId","pinned","source","labels","appliedToAll","lastAt"]}},"next":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["entries","next"]}}}}}}},"/labelling/learned/taught":{"get":{"operationId":"labelling.learned.taught","summary":"Say what one change’s category choices taught memory, as it labels with now","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"changeSetId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"key":{"type":"string"},"payee":{"type":"string","minLength":1},"direction":{"enum":["in","out"],"type":"string"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"pinned":{"type":"boolean"},"source":{"enum":["choices","import"],"type":"string"},"labels":{"type":"integer","minimum":0,"maximum":9007199254740991},"appliedToAll":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastAt":{"type":"string","format":"date-time"}},"required":["key","payee","direction","categoryId","pinned","source","labels","appliedToAll","lastAt"]}}},"required":["entries"]}}}}}}},"/labelling/learned/forget":{"post":{"operationId":"labelling.learned.forget","summary":"Forget what memory learned for a merchant, keeping or re-labelling its payments","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","minLength":1,"maxLength":200},"direction":{"enum":["in","out"],"type":"string"},"relabel":{"type":"boolean","default":false},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","key","direction","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"type":"string","minLength":1,"maxLength":100},"kept":{"type":"integer","minimum":0,"maximum":9007199254740991},"relabelled":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["changeSetId","kept","relabelled"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LEARNED_GONE"},"status":{"const":409},"message":{"type":"string","default":"LEARNED_GONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/automation":{"get":{"operationId":"labelling.automation","summary":"Get the share of recent transactions labelled that no person changed","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"weeks","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^\\d{1,2}$"}],"default":4},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rate":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"labelled":{"type":"integer","minimum":0,"maximum":9007199254740991},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"firstMonthRate":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"rulesLearnedThisWeek":{"type":"integer","minimum":0,"maximum":9007199254740991},"byHow":{"type":"object","propertyNames":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}}},"required":["rate","labelled","total","firstMonthRate","rulesLearnedThisWeek","byHow"]}}}}}}},"/labelling/explain":{"get":{"operationId":"labelling.explain","summary":"Explain why a transaction has its category","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1},"reason":{"anyOf":[{"type":"object","properties":{"how":{"const":"rule"},"ruleId":{"type":"string","minLength":1,"maxLength":100},"ruleName":{"type":"string"},"matched":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"index":{"type":"integer","minimum":0,"maximum":9007199254740991},"field":{"enum":["merchant","description","amount","pocket","asset","direction","typeHint","date"],"type":"string"}},"required":["index","field"]}}},"required":["how","ruleId","ruleName","matched"]},{"type":"object","properties":{"how":{"const":"memory"},"key":{"type":"string"},"direction":{"enum":["in","out"],"type":"string"},"agreeing":{"type":"integer","minimum":1,"maximum":9007199254740991},"total":{"type":"integer","minimum":1,"maximum":9007199254740991},"lastChosenAt":{"type":"string","format":"date-time"},"learnedFrom":{"enum":["choices","import"],"type":"string"}},"required":["how","key","direction","agreeing","total","lastChosenAt","learnedFrom"]},{"type":"object","properties":{"how":{"const":"ai"},"suggester":{"enum":["history","model"],"type":"string"},"neighbours":{"type":"array","maxItems":3,"items":{"type":"object","properties":{"key":{"type":"string"},"count":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["key","count"]}}},"required":["how","suggester","neighbours"]},{"type":"object","properties":{"how":{"const":"manual"},"changeSetId":{"type":"string","minLength":1,"maxLength":100},"viaSimilar":{"type":"boolean"}},"required":["how","changeSetId","viaSimilar"]},{"type":"object","properties":{"how":{"const":"import"},"source":{"type":"string","minLength":1,"maxLength":40},"name":{"type":"string","maxLength":200}},"required":["how","source","name"]},{"type":"object","properties":{"how":{"const":"none"},"why":{"enum":["no-match","low-confidence","ai-off","ai-limit"],"type":"string"},"model":{"enum":["pending","unsure","refund-unpaid","gave-up","chosen","move","no-merchant","private","name"],"type":"string"}},"required":["how","why"]}]},"alternatives":{"type":"array","maxItems":4,"items":{"type":"object","properties":{"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"categoryId":{"type":"string","minLength":1,"maxLength":100},"confidence":{"type":"number","minimum":0,"maximum":1},"suggester":{"enum":["history","model"],"type":"string"}},"required":["how","categoryId","confidence"]}},"needsReview":{"type":"boolean"},"transferSkipped":{"type":"object","properties":{"ruleId":{"type":"string","minLength":1,"maxLength":100},"pocketId":{"type":"string","minLength":1,"maxLength":100},"counterpartId":{"type":"string","minLength":1,"maxLength":100}},"required":["ruleId","pocketId","counterpartId"]},"cashWithdrawal":{"type":"object","properties":{"pocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["pocketId"]},"labelledAt":{"type":"string","format":"date-time"},"likelyRight":{"type":"integer","minimum":1,"maximum":99},"sources":{"type":"object","properties":{"category":{"anyOf":[{"anyOf":[{"type":"object","properties":{"kind":{"const":"rule"},"ruleId":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"},"origin":{"enum":["user","similar","seed"],"type":"string"},"enabled":{"type":"boolean"}},"required":["kind","ruleId","name","origin","enabled"]},{"type":"object","properties":{"kind":{"const":"learned"},"key":{"type":"string"},"direction":{"enum":["in","out"],"type":"string"}},"required":["kind","key","direction"]}]},{"type":"null"}]},"name":{"anyOf":[{"type":"object","properties":{"ruleId":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"}},"required":["ruleId","name"]},{"type":"null"}]}},"required":["category","name"]}},"required":["transactionId","categoryId","how","confidence","reason","alternatives","needsReview","labelledAt"]}}}}}}},"/labelling/similar":{"get":{"operationId":"labelling.similar","summary":"Preview what applying a category to all similar transactions would change","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"transactionId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"categoryId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"sample":{"type":"array","maxItems":5,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"bookingDate":{"type":"string","format":"date"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"description":{"type":"string"},"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"before":{"type":"object","properties":{"categories":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["categoryId","amount"]}},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","maxItems":40,"items":{"type":"string"}},"transferPocketId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["categories","payee","tags","transferPocketId"]},"after":{"type":"object","properties":{"categories":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["categoryId","amount"]}},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","maxItems":40,"items":{"type":"string"}},"transferPocketId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["categories","payee","tags","transferPocketId"]}},"required":["transactionId","bookingDate","pocketId","amount","description","how","before","after"]}},"learn":{"anyOf":[{"type":"object","properties":{"kind":{"const":"memory"},"key":{"type":"string","minLength":1}},"required":["kind","key"]},{"type":"object","properties":{"kind":{"const":"rule"},"ruleId":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"}},"required":["kind","ruleId","name"]},{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"]}]},"previewToken":{"type":"string","minLength":1,"maxLength":128},"options":{"type":"array","maxItems":2,"items":{"type":"object","properties":{"breadth":{"enum":["name","key"],"type":"string"},"match":{"type":"string","minLength":1},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"sample":{"type":"array","maxItems":5,"items":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1,"maxLength":100},"bookingDate":{"type":"string","format":"date"},"pocketId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"description":{"type":"string"},"how":{"enum":["rule","memory","ai","manual","import","none"],"type":"string"},"before":{"type":"object","properties":{"categories":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["categoryId","amount"]}},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","maxItems":40,"items":{"type":"string"}},"transferPocketId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["categories","payee","tags","transferPocketId"]},"after":{"type":"object","properties":{"categories":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"amount":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]}},"required":["categoryId","amount"]}},"payee":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","maxItems":40,"items":{"type":"string"}},"transferPocketId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]}},"required":["categories","payee","tags","transferPocketId"]}},"required":["transactionId","bookingDate","pocketId","amount","description","how","before","after"]}},"previewToken":{"type":"string","minLength":1,"maxLength":128}},"required":["breadth","match","count","sample","previewToken"]}},"match":{"type":"string"},"direction":{"enum":["in","out"],"type":"string"}},"required":["count","sample","learn","previewToken","options","match","direction"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TARGET_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"TARGET_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_SINGLE_CATEGORY"},"status":{"const":409},"message":{"type":"string","default":"NOT_SINGLE_CATEGORY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/applyToSimilar":{"post":{"operationId":"labelling.applyToSimilar","summary":"Categorise a transaction and all similar ones, and learn it for future ones","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"transactionId":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"type":"string","minLength":1,"maxLength":100},"past":{"type":"boolean","default":true},"previewToken":{"type":"string","minLength":1,"maxLength":128},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","transactionId","categoryId","previewToken","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"type":"string","minLength":1,"maxLength":100},"applied":{"type":"integer","minimum":0,"maximum":9007199254740991},"learned":{"allOf":[{"anyOf":[{"type":"object","properties":{"kind":{"const":"memory"},"key":{"type":"string","minLength":1}},"required":["kind","key"]},{"type":"object","properties":{"kind":{"const":"rule"},"ruleId":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string"}},"required":["kind","ruleId","name"]},{"type":"object","properties":{"kind":{"const":"none"}},"required":["kind"]}]},{"type":"object","properties":{"categoryId":{"type":"string","minLength":1,"maxLength":100},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["categoryId","count"]}]}},"required":["changeSetId","applied","learned"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TARGET_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"TARGET_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_SINGLE_CATEGORY"},"status":{"const":409},"message":{"type":"string","default":"NOT_SINGLE_CATEGORY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"RULE_LIMIT"},"status":{"const":409},"message":{"type":"string","default":"RULE_LIMIT"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SIMILAR_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"SIMILAR_CHANGED"},"data":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/settings/get":{"get":{"operationId":"labelling.settings.get","summary":"Get whether AI labelling is on for the book, and what it did today","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"aiLabelling":{"type":"object","properties":{"enabled":{"type":"boolean"},"unavailable":{"anyOf":[{"enum":["not-configured","plan"],"type":"string"},{"type":"null"}]},"agreedVersion":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"enabledBy":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"enabledAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"pausedUntil":{"anyOf":[{"enum":["tomorrow","next-month"],"type":"string"},{"type":"null"}]},"labelledToday":{"type":"integer","minimum":0,"maximum":9007199254740991},"lookedUpToday":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastRunAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["enabled","unavailable","agreedVersion","enabledBy","enabledAt","pausedUntil","labelledToday","lookedUpToday","lastRunAt"]}},"required":["aiLabelling"]}}}}}}},"/labelling/settings/accuracy":{"get":{"operationId":"labelling.settings.accuracy","summary":"Count how the book’s AI guesses fared over the last 30 days","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"since":{"type":"string","format":"date-time"},"rows":{"type":"array","items":{"type":"object","properties":{"guesser":{"enum":["model","history"],"type":"string"},"bucket":{"type":"integer","minimum":4,"maximum":9},"confirmed":{"type":"integer","minimum":0,"maximum":9007199254740991},"changed":{"type":"integer","minimum":0,"maximum":9007199254740991},"open":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["guesser","bucket","confirmed","changed","open"]}}},"required":["since","rows"]}}}}}}},"/labelling/settings/update":{"post":{"operationId":"labelling.settings.update","summary":"Turn AI labelling on (agreeing to the disclosure) or off for the book","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"aiLabelling":{"type":"boolean"},"disclosureVersion":{"type":"string","minLength":1,"maxLength":40},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","aiLabelling","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"aiLabelling":{"type":"object","properties":{"enabled":{"type":"boolean"},"unavailable":{"anyOf":[{"enum":["not-configured","plan"],"type":"string"},{"type":"null"}]},"agreedVersion":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"enabledBy":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"enabledAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"pausedUntil":{"anyOf":[{"enum":["tomorrow","next-month"],"type":"string"},{"type":"null"}]},"labelledToday":{"type":"integer","minimum":0,"maximum":9007199254740991},"lookedUpToday":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastRunAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["enabled","unavailable","agreedVersion","enabledBy","enabledAt","pausedUntil","labelledToday","lookedUpToday","lastRunAt"]}},"required":["aiLabelling"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"DISCLOSURE_OUTDATED"},"status":{"const":409},"message":{"type":"string","default":"DISCLOSURE_OUTDATED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"AI_UNAVAILABLE"},"status":{"const":409},"message":{"type":"string","default":"AI_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/merchants/list":{"get":{"operationId":"labelling.merchants.list","summary":"List a book’s merchants, most payments first, searchable, a page at a time","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"q","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":400},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"merchants":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1},"payments":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["key","name","payments"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["merchants","nextCursor"]}}}}}}},"/labelling/merchants/get":{"get":{"operationId":"labelling.merchants.get","summary":"Get a merchant’s branches and the merchants that look like it","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"key","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"branches":{"type":"array","maxItems":1000,"items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1},"payments":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["key","name","payments"]}},"lookAlikes":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1},"payments":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["key","name","payments"]}}},"required":["branches","lookAlikes"]}}}}}}},"/labelling/merchants/alike":{"get":{"operationId":"labelling.merchants.alike","summary":"List groups of a book’s merchants that look like one shop","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"groups":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"merchants":{"type":"array","minItems":2,"maxItems":51,"items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1},"payments":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["key","name","payments"]}}},"required":["merchants"]}}},"required":["groups"]}}}}}}},"/labelling/merchants/combine":{"post":{"operationId":"labelling.merchants.combine","summary":"Combine merchants that are one place into one merchant","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","minLength":1,"maxLength":200},"others":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":200}},"rename":{"type":"object","properties":{"from":{"type":"string","minLength":1,"maxLength":500},"name":{"type":"string","minLength":1,"maxLength":200}},"required":["from","name"],"additionalProperties":false},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","key","others","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","minLength":1,"maxLength":200}},"required":["changeSetId","key"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERCHANT_GONE"},"status":{"const":409},"message":{"type":"string","default":"MERCHANT_GONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERCHANT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"MERCHANT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/merchants/rename":{"post":{"operationId":"labelling.merchants.rename","summary":"Give a merchant its own name","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","minLength":1,"maxLength":200},"from":{"type":"string","minLength":1,"maxLength":500},"name":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","key","from","name","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","minLength":1,"maxLength":200}},"required":["changeSetId","key"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERCHANT_GONE"},"status":{"const":409},"message":{"type":"string","default":"MERCHANT_GONE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERCHANT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"MERCHANT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/merchants/split":{"post":{"operationId":"labelling.merchants.split","summary":"Split one branch off a combined merchant","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","minLength":1,"maxLength":200},"branch":{"type":"string","minLength":1,"maxLength":200},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","key","branch","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERCHANT_KEY_BRANCH"},"status":{"const":409},"message":{"type":"string","default":"MERCHANT_KEY_BRANCH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MERCHANT_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"MERCHANT_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/merchants/dismiss":{"post":{"operationId":"labelling.merchants.dismiss","summary":"Stop suggesting a merchant as a look-alike of another","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","minLength":1,"maxLength":200},"others":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":200}},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","key","others","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"changeSetId":{"type":"string","minLength":1,"maxLength":100}},"required":["changeSetId"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/labelling/contactLinks/list":{"get":{"operationId":"labelling.contactLinks.list","summary":"List the payees remembered with a person, by key","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","maxItems":10000,"items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"contactId":{"type":"string"},"linkedAt":{"type":"string","format":"date-time"}},"required":["key","contactId","linkedAt"]}}}}}}}},"/labelling/contactLinks/remove":{"post":{"operationId":"labelling.contactLinks.remove","summary":"Stop remembering a payee with a person","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","minLength":1,"maxLength":200},"contactId":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","key","contactId","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["removed"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BOOK_ARCHIVED"},"status":{"const":409},"message":{"type":"string","default":"BOOK_ARCHIVED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONTACT_LINK_CHANGED"},"status":{"const":409},"message":{"type":"string","default":"CONTACT_LINK_CHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/checkin/preferences/get":{"get":{"operationId":"checkin.preferences.get","summary":"Get the caller’s own check-in and notification preferences","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"day":{"type":"integer","minimum":0,"maximum":6},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timeZone":{"type":"string","minLength":1,"maxLength":64},"quietFrom":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"quietTo":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"notify":{"type":"object","properties":{"import-failed":{"type":"boolean"},"weekly-check-in":{"type":"boolean"},"month-close":{"type":"boolean"},"recurring-change":{"type":"boolean"},"large-payment":{"type":"boolean"},"goal-reached":{"type":"boolean"},"partner-finished":{"type":"boolean"},"year-recap":{"type":"boolean"}},"required":["import-failed","weekly-check-in","month-close","recurring-change","large-payment","goal-reached","partner-finished","year-recap"],"additionalProperties":false},"digest":{"type":"boolean"},"amountsOnLockScreen":{"type":"boolean"},"seenNotes":{"type":"array","maxItems":200,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9-]{0,63}$"}},"saved":{"type":"boolean"}},"required":["day","time","timeZone","quietFrom","quietTo","notify","digest","amountsOnLockScreen","seenNotes","saved"]}}}}}}},"/checkin/preferences/update":{"post":{"operationId":"checkin.preferences.update","summary":"Change the caller’s own check-in and notification preferences","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"day":{"type":"integer","minimum":0,"maximum":6},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timeZone":{"type":"string","minLength":1,"maxLength":64},"quietFrom":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"quietTo":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"notify":{"type":"object","properties":{"import-failed":{"type":"boolean"},"weekly-check-in":{"type":"boolean"},"month-close":{"type":"boolean"},"recurring-change":{"type":"boolean"},"large-payment":{"type":"boolean"},"goal-reached":{"type":"boolean"},"partner-finished":{"type":"boolean"},"year-recap":{"type":"boolean"}},"additionalProperties":false},"digest":{"type":"boolean"},"amountsOnLockScreen":{"type":"boolean"}},"required":["bookId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"day":{"type":"integer","minimum":0,"maximum":6},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timeZone":{"type":"string","minLength":1,"maxLength":64},"quietFrom":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"quietTo":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"notify":{"type":"object","properties":{"import-failed":{"type":"boolean"},"weekly-check-in":{"type":"boolean"},"month-close":{"type":"boolean"},"recurring-change":{"type":"boolean"},"large-payment":{"type":"boolean"},"goal-reached":{"type":"boolean"},"partner-finished":{"type":"boolean"},"year-recap":{"type":"boolean"}},"required":["import-failed","weekly-check-in","month-close","recurring-change","large-payment","goal-reached","partner-finished","year-recap"],"additionalProperties":false},"digest":{"type":"boolean"},"amountsOnLockScreen":{"type":"boolean"},"seenNotes":{"type":"array","maxItems":200,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9-]{0,63}$"}},"saved":{"type":"boolean"}},"required":["day","time","timeZone","quietFrom","quietTo","notify","digest","amountsOnLockScreen","seenNotes","saved"]}}}}}}},"/checkin/state":{"post":{"operationId":"checkin.state","summary":"Get the caller’s check-in as it stands now, recording the visit","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"timeZone":{"type":"string","minLength":1,"maxLength":64}},"required":["bookId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"week":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"day":{"type":"string","format":"date"},"today":{"type":"string","format":"date"},"completed":{"type":"boolean"},"cairnShown":{"type":"boolean"},"lastVisitAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"daysAway":{"type":"integer","minimum":0,"maximum":9007199254740991},"timeZone":{"type":"string","minLength":1,"maxLength":64}},"required":["week","day","today","completed","cairnShown","lastVisitAt","daysAway","timeZone"]}}}}}}},"/checkin/complete":{"post":{"operationId":"checkin.complete","summary":"Mark the week’s check-in done","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"week":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","week","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"week":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"day":{"type":"string","format":"date"},"today":{"type":"string","format":"date"},"completed":{"type":"boolean"},"cairnShown":{"type":"boolean"},"lastVisitAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"daysAway":{"type":"integer","minimum":0,"maximum":9007199254740991},"timeZone":{"type":"string","minLength":1,"maxLength":64}},"required":["week","day","today","completed","cairnShown","lastVisitAt","daysAway","timeZone"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/checkin/markCairnShown":{"post":{"operationId":"checkin.markCairnShown","summary":"Record that the week’s cairn has settled, so it never settles again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"week":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"}},"required":["bookId","week"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"week":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"day":{"type":"string","format":"date"},"today":{"type":"string","format":"date"},"completed":{"type":"boolean"},"cairnShown":{"type":"boolean"},"lastVisitAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"daysAway":{"type":"integer","minimum":0,"maximum":9007199254740991},"timeZone":{"type":"string","minLength":1,"maxLength":64}},"required":["week","day","today","completed","cairnShown","lastVisitAt","daysAway","timeZone"]}}}}}}},"/checkin/insight":{"get":{"operationId":"checkin.insight","summary":"Get the week’s one insight, if something stands out","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"week","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"key":{"type":"string","maxLength":200},"sentence":{"type":"array","maxItems":20,"items":{"anyOf":[{"type":"string","maxLength":400},{"type":"object","properties":{"name":{"type":"string","maxLength":200},"filters":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"kinds":{"type":"array","minItems":1,"maxItems":8,"items":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"}},"spending":{"const":true},"categoryIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"search":{"type":"string","minLength":1,"maxLength":200},"pocketIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}}},"additionalProperties":false}},"required":["name","filters"]},{"type":"object","properties":{"figure":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"filters":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"kinds":{"type":"array","minItems":1,"maxItems":8,"items":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"}},"spending":{"const":true},"categoryIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"search":{"type":"string","minLength":1,"maxLength":200},"pocketIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}}},"additionalProperties":false},{"type":"null"}]},"label":{"type":"string","maxLength":200}},"required":["figure","filters","label"]}]}},"basis":{"type":"string","maxLength":200},"why":{"type":"string","maxLength":400},"filters":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"kinds":{"type":"array","minItems":1,"maxItems":8,"items":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"}},"spending":{"const":true},"categoryIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"search":{"type":"string","minLength":1,"maxLength":200},"pocketIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}}},"additionalProperties":false},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["key","sentence","basis","why","filters","count"]},{"type":"null"}]}}}}}}},"/checkin/insightFeedback":{"post":{"operationId":"checkin.insightFeedback","summary":"Hide an insight for 90 days as not useful, or dismiss it for this check-in","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"week":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"key":{"type":"string","minLength":1,"maxLength":200},"verdict":{"enum":["not-useful","dismissed"],"type":"string"}},"required":["bookId","week","key","verdict"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true}},"required":["ok"]}}}}}}},"/checkin/noteSeen":{"post":{"operationId":"checkin.noteSeen","summary":"Record that the caller saw a first-time note, so it never shows again","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"key":{"type":"string","pattern":"^[a-z0-9][a-z0-9-]{0,63}$"}},"required":["bookId","key"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"seenNotes":{"type":"array","maxItems":200,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9-]{0,63}$"}}},"required":["seenNotes"]}}}}}}},"/checkin/story":{"get":{"operationId":"checkin.story","summary":"Tell a week or a month in one sentence, every figure linked to its transactions","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"week","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"allowEmptyValue":true,"allowReserved":true},{"name":"month","in":"query","required":false,"schema":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"parts":{"type":"array","maxItems":40,"items":{"anyOf":[{"type":"string","maxLength":400},{"type":"object","properties":{"name":{"type":"string","maxLength":200},"filters":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"kinds":{"type":"array","minItems":1,"maxItems":8,"items":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"}},"spending":{"const":true},"categoryIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"search":{"type":"string","minLength":1,"maxLength":200},"pocketIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}}},"additionalProperties":false}},"required":["name","filters"]},{"type":"object","properties":{"figure":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"asset":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"}},"required":["amount","asset"]},"filters":{"anyOf":[{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"kinds":{"type":"array","minItems":1,"maxItems":8,"items":{"enum":["expense","income","transfer","exchange","adjustment","opening","book-transfer","other"],"type":"string"}},"spending":{"const":true},"categoryIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}},"search":{"type":"string","minLength":1,"maxLength":200},"pocketIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"maxLength":100}}},"additionalProperties":false},{"type":"null"}]},"label":{"type":"string","maxLength":200}},"required":["figure","filters","label"]}]}},"enoughHistory":{"type":"boolean"}},"required":["parts","enoughHistory"]}}}}}}},"/checkin/toCount":{"get":{"operationId":"checkin.toCount","summary":"List the by-hand pockets whose balance the week’s check-in asks to count again","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"week","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"pockets":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"pocketId":{"type":"string"},"countedOn":{"type":"string","format":"date"}},"required":["pocketId","countedOn"]}}},"required":["pockets"]}}}}}}},"/checkin/countLater":{"post":{"operationId":"checkin.countLater","summary":"Stop asking to count a by-hand pocket until next week’s check-in","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"week":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"},"pocketId":{"type":"string","minLength":1,"maxLength":100}},"required":["bookId","week","pocketId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true}},"required":["ok"]}}}}}}},"/checkin/month":{"get":{"operationId":"checkin.month","summary":"Get whether the caller closed a month","parameters":[{"name":"bookId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"month","in":"query","required":true,"schema":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"month":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"closedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["month","closedAt"]}}}}}}},"/checkin/closeMonth":{"post":{"operationId":"checkin.closeMonth","summary":"Close a month that is over, once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","minLength":1,"maxLength":100},"month":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"requestId":{"type":"string","format":"uuid"}},"required":["bookId","month","requestId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"month":{"type":"string","pattern":"^(?:19|[2-9]\\d)\\d{2}-(?:0[1-9]|1[0-2])$"},"closedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["month","closedAt"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"MONTH_NOT_OVER"},"status":{"const":409},"message":{"type":"string","default":"MONTH_NOT_OVER"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/exports/start":{"post":{"operationId":"exports.start","summary":"Start an export of every book you can read, or get the one under way","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["queued","building","ready","failed","expired"],"type":"string"},"books":{"type":"integer","minimum":0,"maximum":9007199254740991},"parts":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0,"maximum":9007199254740991},"name":{"type":"string"},"kind":{"enum":["data","files"],"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["index","name","kind","sizeBytes"]}},"failure":{"anyOf":[{"enum":["TOO_LARGE","FAILED"],"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"readyAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","status","books","parts","failure","createdAt","readyAt","expiresAt"]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EXPORTS_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"EXPORTS_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/exports/latest":{"get":{"operationId":"exports.latest","summary":"Get your newest export and where it is","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["queued","building","ready","failed","expired"],"type":"string"},"books":{"type":"integer","minimum":0,"maximum":9007199254740991},"parts":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0,"maximum":9007199254740991},"name":{"type":"string"},"kind":{"enum":["data","files"],"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["index","name","kind","sizeBytes"]}},"failure":{"anyOf":[{"enum":["TOO_LARGE","FAILED"],"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"readyAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","status","books","parts","failure","createdAt","readyAt","expiresAt"]},{"type":"null"}]}}}}}}},"/exports/download":{"get":{"operationId":"exports.download","summary":"Download one zip part of your export, decrypted","parameters":[{"name":"exportId","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"allowEmptyValue":true,"allowReserved":true},{"name":"part","in":"query","required":true,"schema":{"type":"integer","minimum":0,"maximum":9007199254740991},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","headers":{"content-disposition":{"schema":{"type":"string","pattern":"^attachment; filename=\"allmoni-[\\w.-]+\\.zip\"$"},"required":true},"cache-control":{"schema":{"const":"private, no-store"},"required":true},"x-content-type-options":{"schema":{"const":"nosniff"},"required":true},"content-security-policy":{"schema":{"const":"sandbox"},"required":true}},"content":{"application/zip":{"schema":{"type":"string","contentMediaType":"application/zip"}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EXPORT_NOT_READY"},"status":{"const":409},"message":{"type":"string","default":"EXPORT_NOT_READY"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EXPORTS_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"EXPORTS_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/account/deletion/get":{"get":{"operationId":"account.deletion.get","summary":"Get whether your account’s deletion is scheduled, and for when","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"status":{"const":"none"}},"required":["status"]},{"type":"object","properties":{"status":{"const":"scheduled"},"requestedAt":{"type":"string","format":"date-time"},"purgeAt":{"type":"string","format":"date-time"}},"required":["status","requestedAt","purgeAt"]}]}}}}}}},"/account/deletion/schedule":{"post":{"operationId":"account.deletion.schedule","summary":"Schedule your account’s deletion in 30 days and end every agent’s access","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"}},"required":["requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"status":{"const":"none"}},"required":["status"]},{"type":"object","properties":{"status":{"const":"scheduled"},"requestedAt":{"type":"string","format":"date-time"},"purgeAt":{"type":"string","format":"date-time"}},"required":["status","requestedAt","purgeAt"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SESSION_NOT_FRESH"},"status":{"const":403},"message":{"type":"string","default":"SESSION_NOT_FRESH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/account/deletion/cancel":{"post":{"operationId":"account.deletion.cancel","summary":"Keep your account: call off its scheduled deletion","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"}},"required":["requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"status":{"const":"none"}},"required":["status"]},{"type":"object","properties":{"status":{"const":"scheduled"},"requestedAt":{"type":"string","format":"date-time"},"purgeAt":{"type":"string","format":"date-time"}},"required":["status","requestedAt","purgeAt"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"DELETION_STARTED"},"status":{"const":409},"message":{"type":"string","default":"DELETION_STARTED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/account/profile/rename":{"post":{"operationId":"account.profile.rename","summary":"Change your name","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"requestId":{"type":"string","format":"uuid"}},"required":["name","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/account/email/confirm":{"post":{"operationId":"account.email.confirm","summary":"Confirm a new email with the link sent to it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1,"maxLength":128},"requestId":{"type":"string","format":"uuid"}},"required":["token","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"}},"required":["email"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EMAIL_IN_USE"},"status":{"const":409},"message":{"type":"string","default":"EMAIL_IN_USE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"410":{"description":"410","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LINK_EXPIRED"},"status":{"const":410},"message":{"type":"string","default":"LINK_EXPIRED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/account/email/change":{"post":{"operationId":"account.email.change","summary":"Ask to change your email: a link to confirm it goes to the new address","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"requestId":{"type":"string","format":"uuid"}},"required":["email","requestId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"pendingEmail":{"type":"string"}},"required":["pendingEmail"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SESSION_NOT_FRESH"},"status":{"const":403},"message":{"type":"string","default":"SESSION_NOT_FRESH"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"EMAIL_UNCHANGED"},"status":{"const":409},"message":{"type":"string","default":"EMAIL_UNCHANGED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_REUSED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_REUSED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_IN_PROGRESS"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_IN_PROGRESS"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"REQUEST_APPLIED"},"status":{"const":409},"message":{"type":"string","default":"REQUEST_APPLIED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/billing/status":{"get":{"operationId":"billing.status","summary":"Get your household’s plan, its subscription and the prices","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"enum":["free","plus","pro","owner"],"type":"string"},"subscription":{"anyOf":[{"type":"object","properties":{"source":{"enum":["paddle","apple"],"type":"string"},"plan":{"enum":["plus","pro"],"type":"string"},"status":{"enum":["trialing","active","past_due","paused","cancelled"],"type":"string"},"renewsAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"endsAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["source","plan","status","renewsAt","endsAt"]},{"type":"null"}]},"appAccountToken":{"type":"string","format":"uuid"},"canManage":{"type":"boolean"},"offers":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"plan":{"enum":["plus","pro"],"type":"string"},"interval":{"enum":["month","year"],"type":"string"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"currency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"limits":{"type":"object","properties":{"books":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"pockets":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"bankLinks":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"storageBytes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"members":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["books","pockets","bankLinks","storageBytes","members"]}},"required":["id","plan","interval","amount","currency","limits"]}},{"type":"null"}]}},"required":["plan","subscription","appAccountToken","canManage","offers"]}}}}}}},"/billing/checkout":{"post":{"operationId":"billing.checkout","summary":"Start a checkout for a plan","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"priceId":{"type":"string","minLength":1,"maxLength":64}},"required":["priceId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"transactionId":{"type":"string"},"clientToken":{"type":"string"},"environment":{"enum":["sandbox","production"],"type":"string"}},"required":["transactionId","clientToken","environment"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SUBSCRIBED"},"status":{"const":409},"message":{"type":"string","default":"SUBSCRIBED"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PRICE_UNKNOWN"},"status":{"const":409},"message":{"type":"string","default":"PRICE_UNKNOWN"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BILLING_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"BILLING_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/billing/portal":{"post":{"operationId":"billing.portal","summary":"Open the page to manage your subscription: card, invoices, cancel","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NO_SUBSCRIPTION"},"status":{"const":409},"message":{"type":"string","default":"NO_SUBSCRIPTION"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BILLING_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"BILLING_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/billing/apple":{"post":{"operationId":"billing.apple","summary":"Record a plan bought in the App Store","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"signedTransaction":{"type":"string","minLength":1,"maxLength":16000}},"required":["signedTransaction"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"enum":["free","plus","pro","owner"],"type":"string"},"subscription":{"anyOf":[{"type":"object","properties":{"source":{"enum":["paddle","apple"],"type":"string"},"plan":{"enum":["plus","pro"],"type":"string"},"status":{"enum":["trialing","active","past_due","paused","cancelled"],"type":"string"},"renewsAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"endsAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["source","plan","status","renewsAt","endsAt"]},{"type":"null"}]},"appAccountToken":{"type":"string","format":"uuid"},"canManage":{"type":"boolean"},"offers":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"plan":{"enum":["plus","pro"],"type":"string"},"interval":{"enum":["month","year"],"type":"string"},"amount":{"type":"string","pattern":"^-?(?:0|[1-9]\\d{0,29})(?:\\.\\d{1,18})?$"},"currency":{"type":"string","pattern":"^(?:[A-Z0-9][A-Z0-9-]{0,13}[A-Z0-9]|[A-Z0-9]{1,12}:[A-Z0-9](?:[A-Z0-9.-]{0,18}[A-Z0-9])?)$"},"limits":{"type":"object","properties":{"books":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"pockets":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"bankLinks":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"storageBytes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"members":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["books","pockets","bankLinks","storageBytes","members"]}},"required":["id","plan","interval","amount","currency","limits"]}},{"type":"null"}]}},"required":["plan","subscription","appAccountToken","canManage","offers"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"OTHER_HOUSEHOLD"},"status":{"const":409},"message":{"type":"string","default":"OTHER_HOUSEHOLD"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"422":{"description":"422","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TRANSACTION_INVALID"},"status":{"const":422},"message":{"type":"string","default":"TRANSACTION_INVALID"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"BILLING_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"BILLING_UNAVAILABLE"},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}}}}