-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.json
More file actions
1 lines (1 loc) · 13.8 KB
/
openapi.json
File metadata and controls
1 lines (1 loc) · 13.8 KB
1
{"info":{"description":"REST API for hledger journal access","license":{"name":"AGPL-3.0","url":"https://opensource.org/license/agpl-v3"},"title":"hledger API","version":"0.1.0"},"paths":{"/api/v1/accounts":{"get":{"parameters":[{"in":"query","name":"depth","required":false,"schema":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}},{"in":"query","name":"type","required":false,"schema":{"type":"string"}},{"in":"query","name":"search","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/AccountTree"},"type":"array"}}},"description":""},"400":{"description":"Invalid `search` or `type` or `depth`"}}}},"/api/v1/accounts/{name}":{"get":{"parameters":[{"in":"path","name":"name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/AccountDetail"}}},"description":""},"404":{"description":"`name` not found"}}}},"/api/v1/accounts/{name}/balance":{"get":{"parameters":[{"in":"path","name":"name","required":true,"schema":{"type":"string"}},{"in":"query","name":"from","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"to","required":false,"schema":{"format":"date","type":"string"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/BalanceReport"}}},"description":""},"400":{"description":"Invalid `to` or `from`"},"404":{"description":"`name` not found"}}}},"/api/v1/accounts/{name}/register":{"get":{"parameters":[{"in":"path","name":"name","required":true,"schema":{"type":"string"}},{"in":"query","name":"from","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"to","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}},{"in":"query","name":"offset","required":false,"schema":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/RegisterReport"}}},"description":""},"400":{"description":"Invalid `offset` or `limit` or `to` or `from`"},"404":{"description":"`name` not found"}}}},"/api/v1/transactions":{"get":{"parameters":[{"in":"query","name":"from","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"to","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"account","schema":{"items":{"type":"string"},"type":"array"}},{"in":"query","name":"description","required":false,"schema":{"type":"string"}},{"in":"query","name":"status","schema":{"items":{"type":"string"},"type":"array"}},{"in":"query","name":"tag","schema":{"items":{"type":"string"},"type":"array"}},{"in":"query","name":"minAmount","required":false,"schema":{"format":"double","type":"number"}},{"in":"query","name":"maxAmount","required":false,"schema":{"format":"double","type":"number"}},{"in":"query","name":"sort","required":false,"schema":{"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}},{"in":"query","name":"offset","required":false,"schema":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/PaginatedResponse"}}},"description":""},"400":{"description":"Invalid `offset` or `limit` or `sort` or `maxAmount` or `minAmount` or `tag` or `status` or `description` or `account` or `to` or `from`"}}},"post":{"requestBody":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/CreateTransactionRequest"}}}},"responses":{"201":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/Transaction"}}},"description":"","headers":{"Location":{"schema":{"type":"string"}}}},"400":{"description":"Invalid `body`"}}}},"/api/v1/transactions/{index}":{"get":{"parameters":[{"in":"path","name":"index","required":true,"schema":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/Transaction"}}},"description":""},"404":{"description":"`index` not found"}}}},"/api/v1/transactions/import/rules":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"type":"string"},"type":"array"}}},"description":""}}}},"/api/v1/transactions/import/{rules}":{"post":{"parameters":[{"in":"path","name":"rules","required":true,"schema":{"type":"string"}},{"in":"query","name":"dryRun","required":false,"schema":{"type":"boolean"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"properties":{"file":{"format":"binary","type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/ImportResponse"}}},"description":""},"400":{"description":"Invalid `dryRun`"},"404":{"description":"`rules` not found"}}}},"/api/v1/transactions/bulk":{"post":{"requestBody":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/CreateTransactionRequest"},"type":"array"}}}},"responses":{"201":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/Transaction"},"type":"array"}}},"description":""},"400":{"description":"Invalid `body`"}}}},"/api/v1/reports/balance-sheet":{"get":{"parameters":[{"in":"query","name":"date","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"depth","required":false,"schema":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/BalanceSheetReport"}}},"description":""},"400":{"description":"Invalid `depth` or `date`"}}}},"/api/v1/reports/income-statement":{"get":{"parameters":[{"in":"query","name":"from","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"to","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"depth","required":false,"schema":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/IncomeStatementReport"}}},"description":""},"400":{"description":"Invalid `depth` or `to` or `from`"}}}},"/api/v1/reports/cash-flow":{"get":{"parameters":[{"in":"query","name":"from","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"to","required":false,"schema":{"format":"date","type":"string"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/CashFlowReport"}}},"description":""},"400":{"description":"Invalid `to` or `from`"}}}},"/api/v1/reports/net-worth":{"get":{"parameters":[{"in":"query","name":"from","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"to","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"interval","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/NetWorthReport"}}},"description":""},"400":{"description":"Invalid `interval` or `to` or `from`"}}}},"/api/v1/version":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/VersionInfo"}}},"description":""}}}},"/api/v1/commodities":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/CommodityInfo"},"type":"array"}}},"description":""}}}},"/api/v1/payees":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"type":"string"},"type":"array"}}},"description":""}}}},"/api/v1/tags":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"type":"string"},"type":"array"}}},"description":""}}}}},"components":{"schemas":{"AccountTree":{"properties":{"balance":{"$ref":"#/components/schemas/MixedAmount"},"children":{"items":{"$ref":"#/components/schemas/AccountTree"},"type":"array"},"fullName":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"}},"required":["name","fullName","balance","children"],"type":"object"},"MixedAmount":{"description":"A multi-currency amount (list of amounts)","items":{"$ref":"#/components/schemas/Amount"},"type":"array"},"Amount":{"description":"A monetary amount with commodity","properties":{"commodity":{"type":"string"},"quantity":{"type":"number"}},"required":["quantity","commodity"],"type":"object"},"AccountDetail":{"properties":{"balance":{"$ref":"#/components/schemas/MixedAmount"},"fullName":{"type":"string"},"name":{"type":"string"},"parent":{"type":"string"},"subAccounts":{"items":{"type":"string"},"type":"array"},"type":{"type":"string"}},"type":"object"},"BalanceReport":{"properties":{"account":{"type":"string"},"history":{"items":{"$ref":"#/components/schemas/BalanceItem"},"type":"array"},"total":{"$ref":"#/components/schemas/MixedAmount"}},"type":"object"},"BalanceItem":{"properties":{"balance":{"$ref":"#/components/schemas/MixedAmount"},"date":{"format":"date","type":"string"}},"required":["date","balance"],"type":"object"},"RegisterReport":{"properties":{"account":{"type":"string"},"entries":{"items":{"$ref":"#/components/schemas/RegisterEntry"},"type":"array"},"total":{"type":"integer"}},"type":"object"},"RegisterEntry":{"properties":{"amount":{"$ref":"#/components/schemas/MixedAmount"},"balance":{"$ref":"#/components/schemas/MixedAmount"},"date":{"format":"date","type":"string"},"description":{"type":"string"},"otherAccounts":{"type":"array"}},"type":"object"},"PaginatedResponse":{"properties":{"data":{"items":{"items":{"$ref":"#/components/schemas/Transaction"},"type":"array"},"type":"array"},"limit":{"type":"integer"},"offset":{"type":"integer"},"total":{"type":"integer"}},"required":["data","total","limit","offset"],"type":"object"},"Transaction":{"properties":{"code":{"type":"string"},"comment":{"type":"string"},"date":{"format":"date","type":"string"},"date2":{"format":"date","type":"string"},"description":{"type":"string"},"index":{"type":"integer"},"postings":{"items":{"$ref":"#/components/schemas/Posting"},"type":"array"},"status":{"$ref":"#/components/schemas/Status"},"tags":{"type":"array"}},"required":["index","date","status","description","postings"],"type":"object"},"Status":{"description":"Transaction or posting status","enum":["unmarked","pending","cleared"],"type":"string"},"Posting":{"properties":{"account":{"type":"string"},"amount":{"$ref":"#/components/schemas/MixedAmount"},"status":{"$ref":"#/components/schemas/Status"}},"required":["account","amount","status"],"type":"object"},"CreateTransactionRequest":{"properties":{"code":{"type":"string"},"comment":{"type":"string"},"date":{"format":"date","type":"string"},"date2":{"format":"date","type":"string"},"description":{"type":"string"},"postings":{"items":{"$ref":"#/components/schemas/CreatePosting"},"type":"array"},"status":{"$ref":"#/components/schemas/Status"}},"required":["date","description","postings"],"type":"object"},"CreatePosting":{"properties":{"account":{"type":"string"},"amount":{"$ref":"#/components/schemas/MixedAmount"},"status":{"$ref":"#/components/schemas/Status"}},"required":["account"],"type":"object"},"ImportResponse":{"properties":{"imported":{"type":"integer"},"skipped":{"type":"integer"},"transactions":{"items":{"$ref":"#/components/schemas/Transaction"},"type":"array"}},"required":["imported","skipped","transactions"],"type":"object"},"BalanceSheetReport":{"properties":{"assets":{"$ref":"#/components/schemas/ReportSection"},"date":{"format":"date","type":"string"},"equity":{"$ref":"#/components/schemas/ReportSection"},"liabilities":{"$ref":"#/components/schemas/ReportSection"},"netWorth":{"$ref":"#/components/schemas/MixedAmount"}},"type":"object"},"ReportSection":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/ReportRow"},"type":"array"},"title":{"type":"string"},"total":{"$ref":"#/components/schemas/MixedAmount"}},"type":"object"},"ReportRow":{"properties":{"account":{"type":"string"},"amount":{"$ref":"#/components/schemas/MixedAmount"},"depth":{"type":"integer"}},"type":"object"},"IncomeStatementReport":{"properties":{"expenses":{"$ref":"#/components/schemas/ReportSection"},"from":{"format":"date","type":"string"},"netIncome":{"$ref":"#/components/schemas/MixedAmount"},"revenues":{"$ref":"#/components/schemas/ReportSection"},"to":{"format":"date","type":"string"}},"type":"object"},"CashFlowReport":{"properties":{"financing":{"$ref":"#/components/schemas/ReportSection"},"from":{"format":"date","type":"string"},"investing":{"$ref":"#/components/schemas/ReportSection"},"netChange":{"$ref":"#/components/schemas/MixedAmount"},"operating":{"$ref":"#/components/schemas/ReportSection"},"to":{"format":"date","type":"string"}},"type":"object"},"NetWorthReport":{"properties":{"dataPoints":{"items":{"$ref":"#/components/schemas/NetWorthDataPoint"},"type":"array"},"from":{"format":"date","type":"string"},"interval":{"type":"string"},"to":{"format":"date","type":"string"}},"type":"object"},"NetWorthDataPoint":{"properties":{"date":{"format":"date","type":"string"},"netWorth":{"$ref":"#/components/schemas/MixedAmount"}},"type":"object"},"VersionInfo":{"properties":{"api":{"type":"string"},"hledger":{"type":"string"}},"required":["api","hledger"],"type":"object"},"CommodityInfo":{"properties":{"precision":{"type":"integer"},"symbol":{"type":"string"}},"required":["symbol","precision"],"type":"object"}}},"openapi":"3.0.0"}