{"openapi":"3.0.0","info":{"title":"Beancount.io v1 API","version":"1.0.0","description":"The public REST API for Beancount.io ledgers.\n\nEvery endpoint addresses a ledger as two path segments — `/api-gateway/v1/ledgers/{owner}/{name}`.\nResource responses are JSON except for archive downloads, which stream bytes. Errors share one\nshape: `{ \"ok\": false, \"error\": { \"code\", \"message\" } }`.\n\n## Authentication\n\nFor scripts and integrations, create a personal access token at\nhttps://beancount.io/settings/api-keys and send it in the `x-api-key` header. The\nplaintext is shown only once. OAuth 2.1 access tokens may instead be sent as bearer\ntokens, and signed-in browsers use their session cookie. Each protected operation maps\nto a business permission. A token's `ledger.read`, `ledger.write`, or `ledger.admin`\nscope is a credential ceiling; the token's ledger pin and the caller's current ledger\nrelationship must also authorize the action. A scope alone never grants access.","contact":{"name":"Beancount.io","url":"https://github.com/bex-co/beancount-io"}},"servers":[{"url":"http://localhost:4104","description":"Development server"},{"url":"https://beancount.io","description":"Production server"}],"tags":[{"name":"Ledger v1","description":"Ledger resources: query, journal, accounts, statements, files, entries, archives"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT Bearer token for authenticated user endpoints"},"adminToken":{"type":"apiKey","in":"header","name":"x-admin-token","description":"Admin API token for administrative operations"},"apiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"A Beancount.io personal access token. Create and manage tokens at https://beancount.io/settings/api-keys, copy the plaintext when it is shown once, and send it in the x-api-key header."}},"schemas":{"V1Error":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string","description":"Canonical error category","example":"VALIDATION_FAILED"},"message":{"type":"string"},"metadata":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","error"],"description":"Standard v1 error body"},"BqlQuery":{"type":"object","properties":{"query":{"type":"string","minLength":1,"description":"A Beancount Query Language statement","example":"SELECT account, sum(position) GROUP BY account"}},"required":["query"],"description":"A BQL query to run against the ledger"},"LedgerDirEntry":{"type":"object","properties":{"path":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["file","dir"]}},"required":["path","name","type"],"description":"One file or directory at a level of the repository"},"LedgerFile":{"type":"object","properties":{"path":{"type":"string"},"content":{"type":"string"},"sha":{"type":"string"}},"required":["path","content","sha"],"description":"One ledger file and its blob SHA"},"FileCommitAck":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"path":{"type":"string"}},"required":["ok","path"],"description":"Acknowledgement that a file change was committed"},"FileWrite":{"type":"object","properties":{"content":{"type":"string","description":"The file's full new content, as UTF-8 text","example":"2026-01-01 open Assets:Bank:Checking USD\n"},"message":{"type":"string","minLength":1,"description":"Commit message; defaults to a generated one","example":"Add January transactions"},"sha":{"type":"string","description":"Blob SHA the edit is based on. Send the SHA from a prior GET to update an existing file; omit it to create a new one."}},"required":["content"],"description":"New content for one ledger file"},"FileDelete":{"type":"object","properties":{"message":{"type":"string","minLength":1},"sha":{"type":"string","description":"Blob SHA of the file being deleted, from a prior GET"}},"description":"Delete one ledger file"},"EntriesRequest":{"type":"object","properties":{"entries":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transaction"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"flag":{"type":"string","description":"`*` for cleared, `!` for pending","example":"*"},"payee":{"type":"string","nullable":true},"narration":{"type":"string","nullable":true},"postings":{"type":"array","items":{"type":"object","properties":{"account":{"type":"string","example":"Assets:Bank:Checking"},"units":{"type":"object","properties":{"number":{"type":"string","description":"Decimal amount","example":"42.50"},"currency":{"type":"string","example":"USD"}},"required":["number","currency"],"additionalProperties":false},"price":{"type":"object","nullable":true,"properties":{"number":{"type":"string","description":"Decimal amount","example":"42.50"},"currency":{"type":"string","example":"USD"}},"required":["number","currency"],"additionalProperties":false},"flag":{"type":"string","nullable":true}},"required":["account","units"],"additionalProperties":false}},"tags":{"type":"array","nullable":true,"items":{"type":"string"}},"links":{"type":"array","nullable":true,"items":{"type":"string"}},"meta":{"type":"object","nullable":true,"additionalProperties":{"type":"string"}}},"required":["date","flag","postings"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["open"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"account":{"type":"string"},"currencies":{"type":"array","items":{"type":"string"}}},"required":["date","account","currencies"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["close"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"account":{"type":"string"}},"required":["date","account"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["balance"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"account":{"type":"string"},"amount":{"type":"object","properties":{"number":{"type":"string","description":"Decimal amount","example":"42.50"},"currency":{"type":"string","example":"USD"}},"required":["number","currency"],"additionalProperties":false}},"required":["date","account","amount"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["price"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"currency":{"type":"string"},"amount":{"type":"object","properties":{"number":{"type":"string","description":"Decimal amount","example":"42.50"},"currency":{"type":"string","example":"USD"}},"required":["number","currency"],"additionalProperties":false}},"required":["date","currency","amount"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["commodity"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"currency":{"type":"string"}},"required":["date","currency"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["note"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"account":{"type":"string"},"content":{"type":"string"}},"required":["date","account","content"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["budget"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"account":{"type":"string"},"interval":{"type":"string","enum":["daily","weekly","monthly","quarterly","yearly"]},"amount":{"type":"object","properties":{"number":{"type":"string","description":"Decimal amount","example":"42.50"},"currency":{"type":"string","example":"USD"}},"required":["number","currency"],"additionalProperties":false}},"required":["date","account","interval","amount"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"account":{"type":"string"},"filename":{"type":"string"},"tags":{"type":"array","nullable":true,"items":{"type":"string"}},"links":{"type":"array","nullable":true,"items":{"type":"string"}}},"required":["date","account","filename"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["event"]},"entry":{"type":"object","properties":{"date":{"type":"string","example":"2026-08-23"},"type":{"type":"string"},"description":{"type":"string"}},"required":["date","type","description"],"additionalProperties":false}},"required":["type","entry"],"additionalProperties":false}]},"description":"Directives to append, committed all-or-nothing"}},"required":["entries"],"additionalProperties":false,"description":"One or more directives to add to the ledger"},"BankTransactionSubmission":{"type":"object","properties":{"transactions":{"type":"array","items":{"type":"object","properties":{"transactionId":{"type":"string"},"targetAccount":{"type":"string","description":"The ledger account to book this against","example":"Expenses:Groceries"},"sourceAccount":{"type":"string"}},"required":["transactionId","targetAccount"]},"minItems":1},"filename":{"type":"string","description":"Which ledger file to append to; must already exist"}},"required":["transactions"]},"BankTransactionDiscard":{"type":"object","properties":{"transactionIds":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["transactionIds"]},"BankAccountMapping":{"type":"object","properties":{"ledgerAccount":{"type":"string"}},"required":["ledgerAccount"],"additionalProperties":false},"BankAccountCurrency":{"type":"object","properties":{"currency":{"type":"string"}},"required":["currency"],"additionalProperties":false},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"keyPrefix":{"type":"string","description":"The first characters of the key, for telling keys apart","example":"bcio_7wXzK9mN"},"scopes":{"type":"array","items":{"type":"string"}},"ledgerScope":{"type":"string"},"lastUsedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"revokedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","keyPrefix","scopes","createdAt"],"description":"An API key as it can be shown — never the key itself"},"MintedApiKey":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/ApiKey"},"plaintext":{"type":"string","description":"The key. Returned exactly once, by this response, and never recoverable afterwards — store it now.","example":"bcio_7wXzK9mNpQrSt2VxYaBcDeF3gH4jK5mN"}},"required":["key","plaintext"],"description":"A newly minted key, including its one and only plaintext"},"CreateApiKey":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"description":"What this key is for — shown in the key list","example":"CI: nightly ledger export"},"scopes":{"type":"array","items":{"type":"string","enum":["ledger.read","ledger.write","ledger.admin"],"description":"One of the three ledger scopes","example":"ledger.read"},"minItems":1,"description":"What the key may do. A key can never hold more than its creator did.","example":["ledger.read"]},"ledgerScope":{"type":"string","description":"Confine the key to one ledger, as `owner/name`. Omit to inherit the caller's own confinement (all its ledgers, or the one its credential is pinned to). A credential pinned to one ledger cannot name a different one.","example":"alice/main-ledger"},"expiresAt":{"type":"string","nullable":true,"format":"date-time","description":"When the key stops working (ISO 8601). Omit for no expiry."}},"required":["name","scopes"],"description":"A new API key to mint"}},"parameters":{}},"paths":{"/api-gateway/v1/ledgers":{"get":{"summary":"List the caller's accessible ledgers, restricted to the credential's ledger pin when present","description":"List the caller's accessible ledgers, restricted to the credential's ledger pin when present","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"description":"1-based page number","example":1},"required":false,"description":"1-based page number","name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size, at most 100","example":20},"required":false,"description":"Page size, at most 100","name":"limit","in":"query"}],"responses":{"200":{"description":"List the caller's accessible ledgers, restricted to the credential's ledger pin when present","content":{"application/json":{"schema":{"type":"array","items":{"nullable":true}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"post":{"summary":"Create a ledger","description":"Create a ledger for the authenticated user under existing administrative account authority and tier limits. STARTER is the default template. This is an account operation even for a ledger-pinned credential.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100,"pattern":"^[a-z0-9_-]+$"},"description":{"type":"string","nullable":true},"private":{"type":"boolean","nullable":true},"template":{"type":"string","nullable":true,"enum":["STARTER","SAMPLE",null]}},"required":["name"],"additionalProperties":false}}}},"responses":{"200":{"description":"Created ledger","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"fullName":{"type":"string"},"sshUrl":{"type":"string"},"httpUrl":{"type":"string"},"empty":{"type":"boolean"},"private":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"size":{"type":"number"},"description":{"type":"string","nullable":true},"permissions":{"type":"object","properties":{"admin":{"type":"boolean"},"pull":{"type":"boolean"},"push":{"type":"boolean"}},"required":["admin","pull","push"]},"isStarred":{"type":"boolean"}},"required":["id","name","fullName","sshUrl","httpUrl","empty","private","createdAt","updatedAt","size"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/owned":{"get":{"summary":"List the caller's owned ledgers","description":"List the caller's owned ledgers","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"number","nullable":true},"required":false,"name":"page","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"List the caller's owned ledgers","content":{"application/json":{"schema":{"type":"array","items":{"nullable":true}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/search":{"get":{"summary":"Search ledgers with ownership, visibility, sorting, and pagination filters","description":"Search ledgers with ownership, visibility, sorting, and pagination filters","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"number","nullable":true},"required":false,"name":"page","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"topic","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"includeDesc","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"uid","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"priorityOwnerId","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"teamId","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"starredBy","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"private","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"isPrivate","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"template","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"archived","in":"query"},{"schema":{"type":"string"},"required":false,"name":"mode","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"exclusive","in":"query"},{"schema":{"type":"string"},"required":false,"name":"sort","in":"query"},{"schema":{"type":"string"},"required":false,"name":"order","in":"query"}],"responses":{"200":{"description":"Search ledgers with ownership, visibility, sorting, and pagination filters","content":{"application/json":{"schema":{"type":"array","items":{"nullable":true}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}":{"get":{"summary":"Get one ledger","description":"Metadata for a single ledger: description, visibility, default branch, and the caller's permissions on it.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"The ledger","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"put":{"summary":"Update a ledger","description":"Update ledger name, description, or visibility. Requires current administrative authority over the addressed ledger and respects the credential pin.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","nullable":true,"maxLength":100,"pattern":"^[a-z0-9_-]+$"},"description":{"type":"string","nullable":true},"private":{"type":"boolean","nullable":true}},"additionalProperties":false}}}},"responses":{"200":{"description":"Updated ledger","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"fullName":{"type":"string"},"sshUrl":{"type":"string"},"httpUrl":{"type":"string"},"empty":{"type":"boolean"},"private":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"size":{"type":"number"},"description":{"type":"string","nullable":true},"permissions":{"type":"object","properties":{"admin":{"type":"boolean"},"pull":{"type":"boolean"},"push":{"type":"boolean"}},"required":["admin","pull","push"]},"isStarred":{"type":"boolean"}},"required":["id","name","fullName","sshUrl","httpUrl","empty","private","createdAt","updatedAt","size"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"delete":{"summary":"Delete a ledger","description":"Delete the repository and perform the existing linked-bank cleanup. Requires current administrative authority and respects the credential pin. Applies immediately; no preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"Deleted ledger identifier","content":{"application/json":{"schema":{"type":"object","properties":{"ledgerId":{"type":"string"}},"required":["ledgerId"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/archive-download-url":{"get":{"summary":"Discover a ledger archive download URL","description":"Return the same main.zip download URL as GraphQL. Public-ledger discovery permits anonymous callers; authenticated access retains current scope, pin, and relationship checks. Fetching the returned URL performs its own authorization.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"Archive download URL","content":{"application/json":{"schema":{"type":"object","properties":{"downloadUrl":{"type":"string"}},"required":["downloadUrl"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/asset-download-url":{"get":{"summary":"Get a ledger asset download URL","description":"Resolve the ledger by numeric repository ID, check current file-read access, and issue the same presigned asset URL as GraphQL. filename is relative to that repository's asset directory.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true},"required":true,"name":"ledgerRepoId","in":"query"},{"schema":{"type":"string"},"required":true,"name":"filename","in":"query"}],"responses":{"200":{"description":"Presigned download URL","content":{"application/json":{"schema":{"type":"object","properties":{"downloadUrl":{"type":"string"}},"required":["downloadUrl"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/temp-assets/upload-url":{"post":{"summary":"Create a temporary asset upload URL","description":"Presign a PUT with optional filename and MIME type. The current user owns the generated key; expiresIn is seconds. No preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","nullable":true},"mimeType":{"type":"string","nullable":true}},"default":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Upload URL, uploader-owned object key, and lifetime in seconds","content":{"application/json":{"schema":{"type":"object","properties":{"uploadUrl":{"type":"string"},"objectKey":{"type":"string"},"expiresIn":{"type":"number"}},"required":["uploadUrl","objectKey","expiresIn"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/temp-assets/download-url":{"get":{"summary":"Create a download URL for the caller's temporary asset","description":"Authorize ownership of objectKey and presign a GET using the configured download lifetime. No ledger selector is required.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"objectKey","in":"query"}],"responses":{"200":{"description":"Download URL and lifetime in seconds","content":{"application/json":{"schema":{"type":"object","properties":{"downloadUrl":{"type":"string"},"expiresIn":{"type":"number"}},"required":["downloadUrl","expiresIn"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/import/parse-file":{"post":{"summary":"Parse an uploaded file into transactions","description":"Parse a caller-owned temporary upload using the supplied fileFormat. Requires AI-use and temporary-asset authority and consumes AI quota. Returns rows without writing ledger entries. No preview or ledger selector.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"s3ObjectKey":{"type":"string"},"fileFormat":{"type":"string"}},"required":["s3ObjectKey","fileFormat"],"additionalProperties":false}}}},"responses":{"200":{"description":"Parsed transaction rows","content":{"application/json":{"schema":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"payee":{"type":"string"},"description":{"type":"string"},"amount":{"type":"number"}},"required":["date","payee","description","amount"]}}},"required":["rows"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/import/parse-receipt":{"post":{"summary":"Parse a receipt and recommend ledger accounts","description":"Parse a caller-owned temporary image or PDF and recommend accounts from the selected ledger. Requires current content and asset read access; consumes extraction and recommendation tokens. No ledger write or preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"s3ObjectKey":{"type":"string"}},"required":["s3ObjectKey"],"additionalProperties":false}}}},"responses":{"200":{"description":"Parsed receipt and account recommendations","content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","nullable":true},"payee":{"type":"string"},"description":{"type":"string"},"amount":{"type":"number"},"sourceAccount":{"type":"string"},"targetAccount":{"type":"string"}},"required":["date","payee","description","amount"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/import/suggest-categories":{"post":{"summary":"Suggest transaction categories from the ledger","description":"Suggest a target account for each supplied transaction using the ledger's open accounts and recent transaction history. Requires assisted-categorization authority on the ledger and consumes AI quota. Returns suggestions without writing entries.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"transactions":{"type":"array","items":{"type":"object","properties":{"rowIndex":{"type":"integer"},"date":{"type":"string"},"payee":{"type":"string"},"description":{"type":"string"},"amount":{"type":"number"}},"required":["rowIndex","date","payee","description","amount"],"additionalProperties":false}}},"required":["transactions"],"additionalProperties":false}}}},"responses":{"200":{"description":"Category suggestions","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"rowIndex":{"type":"integer"},"targetAccount":{"type":"string"},"confidence":{"type":"number"},"source":{"type":"string"},"reasoning":{"type":"string"}},"required":["rowIndex","targetAccount","confidence","source"]}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/import/insert-receipt":{"post":{"summary":"Insert a receipt-linked transaction","description":"Promote the caller-owned temporary receipt into the ledger's configured receipt storage (S3 or git, per the receipt_storage beancountio-option) and append the confirmed transaction — plus its document directive under git storage — in one operation. Requires current content and asset write authority. No preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"receiptObjectKey":{"type":"string","description":"Caller-owned temporary object key (starts with tmp/)"},"input":{"type":"object","properties":{"date":{"type":"string"},"payee":{"type":"string"},"description":{"type":"string"},"postings":{"type":"array","items":{"type":"object","properties":{"account":{"type":"string"},"amountNumber":{"type":"string","description":"Decimal amount string, e.g. '25.50'"},"amountCurrency":{"type":"string"}},"required":["account","amountNumber","amountCurrency"],"additionalProperties":false}},"documentAccount":{"type":"string","description":"Account the stored receipt document attaches to"}},"required":["date","payee","description","postings","documentAccount"],"additionalProperties":false}},"required":["receiptObjectKey","input"],"additionalProperties":false}}}},"responses":{"200":{"description":"Insertion result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/pull-requests/{prNumber}":{"get":{"summary":"Inspect a pull request","description":"Read metadata, file statistics, and diff under the current repository read permission.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"integer","nullable":true},"required":false,"name":"prNumber","in":"path"}],"responses":{"200":{"description":"Pull request details","content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"integer"},"title":{"type":"string"},"description":{"type":"string"},"state":{"type":"string"},"author":{"type":"string"},"headBranch":{"type":"string"},"baseBranch":{"type":"string"},"files":{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string"},"additions":{"type":"integer"},"deletions":{"type":"integer"},"changes":{"type":"integer"}},"required":["filename","additions","deletions","changes"]}},"diff":{"type":"string"}},"required":["number","title","description","state","author","headBranch","baseBranch","files"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/pull-requests":{"post":{"summary":"Create a pull request from file changes","description":"Create a branch from baseBranch (default main), apply complete file contents, and open a pull request using the existing workflow.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string","nullable":true},"baseBranch":{"type":"string","default":"main"},"changes":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"content":{"type":"string"}},"required":["path","content"],"additionalProperties":false}}},"required":["title","changes"],"additionalProperties":false}}}},"responses":{"200":{"description":"Creation result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"prNumber":{"type":"integer"},"prUrl":{"type":"string"}},"required":["success"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/pull-requests/{prNumber}/approve":{"post":{"summary":"Merge a pull request","description":"Applies immediately using current repository write authority. Repository failures retain the GraphQL success/message result.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"integer","nullable":true},"required":false,"name":"prNumber","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Review result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"prNumber":{"type":"integer"},"prUrl":{"type":"string"}},"required":["success"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/pull-requests/{prNumber}/reject":{"post":{"summary":"Close a pull request","description":"Applies immediately using current repository write authority. Repository failures retain the GraphQL success/message result.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"integer","nullable":true},"required":false,"name":"prNumber","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Review result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"prNumber":{"type":"integer"},"prUrl":{"type":"string"}},"required":["success"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/star":{"put":{"summary":"Star a ledger","description":"Change the authenticated user's star. Requires write capability and current ledger readability; honors ledger pins. Upstream write failures return success:false and the existing isStarred/message result. No preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{},"default":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Star operation result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"isStarred":{"type":"boolean"},"message":{"type":"string"}},"required":["success","isStarred"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"delete":{"summary":"Unstar a ledger","description":"Change the authenticated user's star. Requires write capability and current ledger readability; honors ledger pins. Upstream write failures return success:false and the existing isStarred/message result. No preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{},"default":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Star operation result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"isStarred":{"type":"boolean"},"message":{"type":"string"}},"required":["success","isStarred"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/latest-commit":{"get":{"summary":"Read the latest commit on a ledger branch","description":"Read the latest commit on a ledger branch","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","default":"main"},"required":false,"name":"branchName","in":"query"}],"responses":{"200":{"description":"Read the latest commit on a ledger branch","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/commits":{"get":{"summary":"List commits with branch and pagination controls","description":"List commits with branch and pagination controls","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","default":"main"},"required":false,"name":"branch","in":"query"},{"schema":{"type":"integer","nullable":true,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","nullable":true,"default":30},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"List commits with branch and pagination controls","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/commit-details":{"get":{"summary":"Read commit metadata, parents, file statistics, and unified diff","description":"Read commit metadata, parents, file statistics, and unified diff","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sha","in":"query"}],"responses":{"200":{"description":"Read commit metadata, parents, file statistics, and unified diff","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/collaborators":{"get":{"summary":"List ledger collaborators","description":"Requires ledger.admin and current permission to inspect collaborators. Defaults to page 1 and limit 10.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"number","nullable":true,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"number","nullable":true,"default":10},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Collaborators with their permissions","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"login":{"type":"string"},"fullName":{"type":"string"},"email":{"type":"string"},"active":{"type":"boolean"},"isAdmin":{"type":"boolean"},"created":{"type":"string"},"lastLogin":{"type":"string"},"permission":{"type":"string","enum":["read","write","admin"]}}}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/collaborators/permission":{"get":{"summary":"Read a ledger collaborator's permission","description":"Requires ledger.admin and current permission to inspect collaborators.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string"},"required":true,"name":"collaborator","in":"query"}],"responses":{"200":{"description":"Collaborator permission and user","content":{"application/json":{"schema":{"type":"object","properties":{"permission":{"type":"string"},"roleName":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"number"},"login":{"type":"string"},"fullName":{"type":"string"},"email":{"type":"string"},"active":{"type":"boolean"},"isAdmin":{"type":"boolean"},"created":{"type":"string"},"lastLogin":{"type":"string"}}}}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/collaborators/{collaborator}":{"put":{"summary":"Add or update a ledger collaborator","description":"Requires ledger.admin and current permission to change collaborators. Existing collaborator limits apply. An omitted or null permission uses the repository service's default.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string"},"required":true,"name":"collaborator","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"permission":{"type":"string","nullable":true,"enum":["read","write","admin",null]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Membership update result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"delete":{"summary":"Delete a ledger collaborator","description":"Requires ledger.admin and current permission to change collaborators.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string"},"required":true,"name":"collaborator","in":"path"}],"responses":{"200":{"description":"Membership removal result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/leave":{"post":{"summary":"Leave a ledger","description":"Requires ledger.admin and the current leave relationship. Removes only the authenticated caller from the ledger.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Self-removal result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/public-keys":{"get":{"summary":"List the caller's SSH public keys","description":"Administrative account operation. Uses the authenticated user, including for ledger-pinned credentials. Pagination is passed to the key service.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"number","nullable":true},"required":false,"name":"page","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"SSH public keys","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"fingerprint":{"type":"string"},"key":{"type":"string"},"lastUsedAt":{"type":"string"},"title":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","fingerprint","key","title","createdAt"]}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"post":{"summary":"Create an SSH public key for the caller","description":"Administrative account operation. Key format and uniqueness are checked by the repository service. readOnly defaults to false.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"readOnly":{"type":"boolean","nullable":true,"default":false}},"required":["key","title"],"additionalProperties":false}}}},"responses":{"200":{"description":"Created SSH public key","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"fingerprint":{"type":"string"},"key":{"type":"string"},"lastUsedAt":{"type":"string"},"title":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","fingerprint","key","title","createdAt"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/public-keys/{keyId}":{"get":{"summary":"Read the caller's SSH public key","description":"Administrative account operation. The key is fetched using the authenticated user's key API.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"number","nullable":true},"required":false,"name":"keyId","in":"path"}],"responses":{"200":{"description":"SSH public key","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"fingerprint":{"type":"string"},"key":{"type":"string"},"lastUsedAt":{"type":"string"},"title":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","fingerprint","key","title","createdAt"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"delete":{"summary":"Delete the caller's SSH public key","description":"Administrative account operation. The repository service enforces key ownership.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"number","nullable":true},"required":false,"name":"keyId","in":"path"}],"responses":{"200":{"description":"Deleted key identifier","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"}},"required":["id"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/legacy/ledger-meta":{"get":{"summary":"Read legacy ledger metadata","description":"The legacy ledgerMeta contract: accounts, currencies, error count, and account-name/currency options. The authenticated caller determines the default ledger; userId cannot impersonate another user.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","description":"Legacy compatibility argument; authentication determines the caller"},"required":true,"description":"Legacy compatibility argument; authentication determines the caller","name":"userId","in":"query"},{"schema":{"type":"string","description":"Defaults to the credential pin or the caller's first ledger, matching legacy ledgerMeta"},"required":false,"description":"Defaults to the credential pin or the caller's first ledger, matching legacy ledgerMeta","name":"ledgerId","in":"query"}],"responses":{"200":{"description":"Legacy metadata envelope","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/legacy/journal-entries":{"get":{"summary":"Read legacy journal entries","description":"The journalEntries compatibility contract, including enhanced postings, computed entry fields, and cursor metadata. Uses the credential pin or caller's first ledger, as in GraphQL. entryTypes is a JSON-encoded string array.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"integer","nullable":true},"required":false,"name":"first","in":"query"},{"schema":{"type":"string"},"required":false,"name":"after","in":"query"},{"schema":{"type":"integer","nullable":true},"required":false,"name":"last","in":"query"},{"schema":{"type":"string"},"required":false,"name":"before","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"detailed","in":"query"},{"schema":{"type":"string"},"required":false,"name":"searchQuery","in":"query"},{"schema":{"type":"string"},"required":false,"name":"accountFilter","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"amountMin","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"amountMax","in":"query"},{"schema":{"type":"string","description":"JSON-encoded string array, including [] for an empty filter list"},"required":false,"description":"JSON-encoded string array, including [] for an empty filter list","name":"entryTypes","in":"query"},{"schema":{"type":"string"},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string"},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"string"},"required":false,"name":"groupBy","in":"query"}],"responses":{"200":{"description":"Legacy journal envelope","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/query":{"post":{"summary":"Run a BQL query","description":"Runs a Beancount Query Language statement against the ledger. `Accept: application/json` returns a typed table; `Accept: text/plain` returns the shell's own text rendering.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BqlQuery"}}}},"responses":{"200":{"description":"Query result, as a typed table or as shell text","content":{"application/json":{"schema":{"nullable":true}},"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/journal":{"get":{"summary":"Read the journal with pagination and all subtype filters","description":"Read the journal with pagination and all subtype filters","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string"},"required":false,"name":"account","in":"query"},{"schema":{"type":"string"},"required":false,"name":"filter","in":"query"},{"schema":{"type":"string"},"required":false,"name":"time","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":1000},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"JSON-encoded string array, including [] for an empty filter list"},"required":false,"description":"JSON-encoded string array, including [] for an empty filter list","name":"directiveTypes","in":"query"},{"schema":{"type":"string","description":"JSON-encoded string array, including [] for an empty filter list"},"required":false,"description":"JSON-encoded string array, including [] for an empty filter list","name":"transactionSubtypes","in":"query"},{"schema":{"type":"string","description":"JSON-encoded string array, including [] for an empty filter list"},"required":false,"description":"JSON-encoded string array, including [] for an empty filter list","name":"documentSubtypes","in":"query"},{"schema":{"type":"string","description":"JSON-encoded string array, including [] for an empty filter list"},"required":false,"description":"JSON-encoded string array, including [] for an empty filter list","name":"customSubtypes","in":"query"}],"responses":{"200":{"description":"Read the journal with pagination and all subtype filters","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/plaintext-journal":{"get":{"summary":"Read Beancount journal text with account, time, and expression filters","description":"Read Beancount journal text with account, time, and expression filters","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string"},"required":false,"name":"account","in":"query"},{"schema":{"type":"string"},"required":false,"name":"filter","in":"query"},{"schema":{"type":"string"},"required":false,"name":"time","in":"query"}],"responses":{"200":{"description":"Read Beancount journal text with account, time, and expression filters","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/account-journal":{"get":{"summary":"Read account entries with changes and running balances","description":"Read account entries with changes and running balances","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string"},"required":true,"name":"account","in":"query"},{"schema":{"type":"string"},"required":false,"name":"filter","in":"query"},{"schema":{"type":"string"},"required":false,"name":"time","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":1000},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"with_children","in":"query"},{"schema":{"type":"string"},"required":false,"name":"conversion","in":"query"}],"responses":{"200":{"description":"Read account entries with changes and running balances","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/source-files":{"get":{"summary":"List the ledger's source files","description":"List the ledger's source files","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List the ledger's source files","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/accounts":{"get":{"summary":"List accounts","description":"Every account name in the ledger. `status=open` or `status=closed` narrows it to accounts with or without a close directive.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Use open or closed to filter; other values return all accounts, matching GraphQL"},"required":false,"description":"Use open or closed to filter; other values return all accounts, matching GraphQL","name":"status","in":"query"}],"responses":{"200":{"description":"Account names","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/statements/{statement}":{"get":{"summary":"Get a financial statement","description":"Renders the balance sheet or the income statement for the period, with optional currency conversion and interval bucketing.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","enum":["balance-sheet","income-statement"],"description":"Which statement to render","example":"balance-sheet"},"required":true,"description":"Which statement to render","name":"statement","in":"path"},{"schema":{"type":"string"},"required":false,"name":"account","in":"query"},{"schema":{"type":"string"},"required":false,"name":"filter","in":"query"},{"schema":{"type":"string","description":"Reporting period as a Fava time expression","example":"2026-01-01 - 2026-12-31"},"required":false,"description":"Reporting period as a Fava time expression","name":"time","in":"query"},{"schema":{"type":"string","default":"USD","description":"Convert amounts to this currency","example":"USD"},"required":false,"description":"Convert amounts to this currency","name":"conversion","in":"query"},{"schema":{"type":"string","default":"monthly","description":"Bucket the period: day, week, month, quarter, year","example":"month"},"required":false,"description":"Bucket the period: day, week, month, quarter, year","name":"interval","in":"query"}],"responses":{"200":{"description":"The rendered statement","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/files":{"get":{"summary":"List files and directories","description":"One directory level, directories first then files by name. Pass `dir` to descend; omit it for the repository root.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Directory to list, relative to the repository root","example":"2026"},"required":false,"description":"Directory to list, relative to the repository root","name":"dir","in":"query"}],"responses":{"200":{"description":"Directory contents","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LedgerDirEntry"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/files/{path}":{"get":{"summary":"Read a file","description":"The file's content as UTF-8 text, with the blob SHA to pass back when updating it.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Path of the file within the ledger repository. May contain slashes.","example":"2026/january.bean"},"required":true,"description":"Path of the file within the ledger repository. May contain slashes.","name":"path","in":"path"}],"responses":{"200":{"description":"The file","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LedgerFile"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"put":{"summary":"Create or replace a file","description":"Writes the file and commits it. Include the `sha` from a prior GET to replace an existing file; omit it to create a new one.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Path of the file within the ledger repository. May contain slashes.","example":"2026/january.bean"},"required":true,"description":"Path of the file within the ledger repository. May contain slashes.","name":"path","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileWrite"}}}},"responses":{"200":{"description":"The commit succeeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileCommitAck"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"delete":{"summary":"Delete a file","description":"Removes the file and commits the deletion.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Path of the file within the ledger repository. May contain slashes.","example":"2026/january.bean"},"required":true,"description":"Path of the file within the ledger repository. May contain slashes.","name":"path","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileDelete"}}}},"responses":{"200":{"description":"The deletion was committed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileCommitAck"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/rename-file":{"post":{"summary":"Rename a ledger file","description":"Move oldPath to newPath using the repository's existing rename operation and optional commit message. Both paths must be safe repository-relative paths. No client SHA or preview argument is supported by this operation.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"oldPath":{"type":"string"},"newPath":{"type":"string"},"message":{"type":"string","nullable":true}},"required":["oldPath","newPath"],"additionalProperties":false}}}},"responses":{"200":{"description":"Renamed file paths","content":{"application/json":{"schema":{"type":"object","properties":{"oldPath":{"type":"string"},"newPath":{"type":"string"}},"required":["oldPath","newPath"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/entries":{"post":{"summary":"Add directives to the ledger","description":"Appends one or more Beancount directives, routed to the right file by type and date and committed as a single commit. All-or-nothing: if any directive fails, none are written.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntriesRequest"}}}},"responses":{"200":{"description":"The directives were committed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string","nullable":true}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/legacy/entries":{"post":{"summary":"Insert entries using the legacy transaction contract","description":"Compatibility for GraphQL addEntries: Transaction payloads with amount strings, legacy metadata accepted but ignored, and explicit-ledger/pin/first-ledger fallback. Uses normal web quotas. No preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ledgerId":{"type":"string","nullable":true},"entriesInput":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"date":{"type":"string"},"flag":{"type":"string"},"meta":{"type":"object","additionalProperties":{"nullable":true}},"narration":{"type":"string"},"payee":{"type":"string"},"postings":{"type":"array","items":{"type":"object","properties":{"account":{"type":"string"},"amount":{"type":"string"}},"required":["account","amount"],"additionalProperties":false}}},"required":["type","date","flag","meta","narration","payee","postings"],"additionalProperties":false}}},"required":["entriesInput"],"additionalProperties":false}}}},"responses":{"200":{"description":"Legacy insertion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"string"},"success":{"type":"boolean"}},"required":["data","success"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/entry-source/delete":{"post":{"summary":"Delete one entry source slice","description":"Modify entry source using the current sha256sum from entry context. Ledger content-write authority is checked before delegation. Stale source hashes are refused by the ledger service. No preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entryHash":{"type":"string"},"sha256sum":{"type":"string"}},"required":["entryHash","sha256sum"],"additionalProperties":false}}}},"responses":{"200":{"description":"Deleted entry","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"entryHash":{"type":"string"}},"required":["message","entryHash"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/entry-source/delete-many":{"post":{"summary":"Delete multiple entry source slices","description":"Modify entry source using the current sha256sum from entry context. Ledger content-write authority is checked before delegation. Stale source hashes are refused by the ledger service. No preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"entryHash":{"type":"string"},"sha256sum":{"type":"string"}},"required":["entryHash","sha256sum"],"additionalProperties":false}}},"required":["entries"],"additionalProperties":false}}}},"responses":{"200":{"description":"Deleted entries","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"deletedHashes":{"type":"array","items":{"type":"string"}}},"required":["message","deletedHashes"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/entry-source":{"put":{"summary":"Update an entry source slice","description":"Modify entry source using the current sha256sum from entry context. Ledger content-write authority is checked before delegation. Stale source hashes are refused by the ledger service. No preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entryHash":{"type":"string"},"sha256sum":{"type":"string"},"newContent":{"type":"string"}},"required":["entryHash","sha256sum","newContent"],"additionalProperties":false}}}},"responses":{"200":{"description":"Updated entry and source hash","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"entryHash":{"type":"string"},"newSha256sum":{"type":"string"}},"required":["message","entryHash","newSha256sum"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/payees":{"get":{"summary":"List payees used in the ledger","description":"Every payee that appears on a transaction. The list a client should reconcile against before inventing a new payee string.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List payees used in the ledger","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/narrations":{"get":{"summary":"List narrations used in the ledger","description":"Every narration string that appears on a transaction.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List narrations used in the ledger","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/currencies":{"get":{"summary":"List currencies used in the ledger","description":"Every currency the ledger's postings are denominated in. Writing an entry in a currency absent from this list is usually a typo.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List currencies used in the ledger","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/tags":{"get":{"summary":"List tags used in the ledger","description":"Every `#tag` that appears on a directive.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List tags used in the ledger","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/links":{"get":{"summary":"List links used in the ledger","description":"Every `^link` that appears on a directive.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List links used in the ledger","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/years":{"get":{"summary":"List years the ledger covers","description":"Every year that has at least one directive — the ledger's span, without reading it.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List years the ledger covers","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/commodities":{"get":{"summary":"List commodities and their price pairs","description":"Commodity pairs held in the ledger, with the prices recorded for them.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List commodities and their price pairs","content":{"application/json":{"schema":{"type":"array","items":{"nullable":true}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/events":{"get":{"summary":"List event directives","description":"Every `event` directive in the ledger, in date order.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List event directives","content":{"application/json":{"schema":{"type":"array","items":{"nullable":true}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/errors":{"get":{"summary":"List the ledger's parse and validation errors","description":"What `bean-check` reports for this ledger. An empty list means the ledger is currently valid.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List the ledger's parse and validation errors","content":{"application/json":{"schema":{"type":"array","items":{"nullable":true}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/attributes":{"get":{"summary":"Get the ledger's attributes","description":"Accounts, currencies, payees, and links as one document — the summary the other endpoints break out individually.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"Get the ledger's attributes","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/overview":{"get":{"summary":"Get the ledger overview","description":"Net worth, account hierarchies, and income/expense series with the full reporting filters.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string"},"required":false,"name":"account","in":"query"},{"schema":{"type":"string"},"required":false,"name":"filter","in":"query"},{"schema":{"type":"string","description":"Reporting period as a Fava time expression","example":"2026-01-01 - 2026-12-31"},"required":false,"description":"Reporting period as a Fava time expression","name":"time","in":"query"},{"schema":{"type":"string","default":"USD","description":"Convert amounts to this currency","example":"USD"},"required":false,"description":"Convert amounts to this currency","name":"conversion","in":"query"},{"schema":{"type":"string","default":"monthly","description":"Bucket the period: day, week, month, quarter, year","example":"month"},"required":false,"description":"Bucket the period: day, week, month, quarter, year","name":"interval","in":"query"}],"responses":{"200":{"description":"Get the ledger overview","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/documents":{"get":{"summary":"List ledger documents","description":"Document directives with account, time, and Fava-expression filters.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Restrict to one account and its children","example":"Assets:Bank:Checking"},"required":false,"description":"Restrict to one account and its children","name":"account","in":"query"},{"schema":{"type":"string","description":"Fava filter expression","example":"#travel"},"required":false,"description":"Fava filter expression","name":"filter","in":"query"},{"schema":{"type":"string","description":"Fava time expression","example":"2026"},"required":false,"description":"Fava time expression","name":"time","in":"query"}],"responses":{"200":{"description":"List ledger documents","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/trial-balance":{"get":{"summary":"Get the trial balance","description":"Every account's debit and credit totals — the statement that proves the books balance.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Restrict to one account and its children","example":"Assets:Bank:Checking"},"required":false,"description":"Restrict to one account and its children","name":"account","in":"query"},{"schema":{"type":"string","description":"Fava filter expression","example":"#travel"},"required":false,"description":"Fava filter expression","name":"filter","in":"query"},{"schema":{"type":"string","description":"Fava time expression","example":"2026"},"required":false,"description":"Fava time expression","name":"time","in":"query"},{"schema":{"type":"string","description":"Period grouping: day, week, month, quarter, or year","example":"month"},"required":false,"description":"Period grouping: day, week, month, quarter, or year","name":"interval","in":"query"},{"schema":{"type":"string","description":"Convert postings to this currency before totalling","example":"USD"},"required":false,"description":"Convert postings to this currency before totalling","name":"conversion","in":"query"}],"responses":{"200":{"description":"Get the trial balance","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/interval-totals":{"get":{"summary":"Get totals per interval","description":"Balances grouped by period — the series behind a spending-over-time view, without the view.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Restrict to one account and its children","example":"Assets:Bank:Checking"},"required":false,"description":"Restrict to one account and its children","name":"account","in":"query"},{"schema":{"type":"string","description":"Fava filter expression","example":"#travel"},"required":false,"description":"Fava filter expression","name":"filter","in":"query"},{"schema":{"type":"string","description":"Fava time expression","example":"2026"},"required":false,"description":"Fava time expression","name":"time","in":"query"},{"schema":{"type":"string","description":"Period grouping: day, week, month, quarter, or year","example":"month"},"required":false,"description":"Period grouping: day, week, month, quarter, or year","name":"interval","in":"query"},{"schema":{"type":"string","description":"Convert postings to this currency before totalling","example":"USD"},"required":false,"description":"Convert postings to this currency before totalling","name":"conversion","in":"query"},{"schema":{"type":"string","description":"Restrict the totals to one account"},"required":false,"description":"Restrict the totals to one account","name":"accountName","in":"query"}],"responses":{"200":{"description":"Get totals per interval","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/account-report":{"get":{"summary":"Get one account's report","description":"Balances and changes for a single account over the selected period.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Restrict to one account and its children","example":"Assets:Bank:Checking"},"required":false,"description":"Restrict to one account and its children","name":"account","in":"query"},{"schema":{"type":"string","description":"Fava filter expression","example":"#travel"},"required":false,"description":"Fava filter expression","name":"filter","in":"query"},{"schema":{"type":"string","description":"Fava time expression","example":"2026"},"required":false,"description":"Fava time expression","name":"time","in":"query"},{"schema":{"type":"string","description":"Period grouping: day, week, month, quarter, or year","example":"month"},"required":false,"description":"Period grouping: day, week, month, quarter, or year","name":"interval","in":"query"},{"schema":{"type":"string","description":"Convert postings to this currency before totalling","example":"USD"},"required":false,"description":"Convert postings to this currency before totalling","name":"conversion","in":"query"},{"schema":{"type":"string","description":"The account to report on","example":"Expenses:Groceries"},"required":true,"description":"The account to report on","name":"accountName","in":"query"}],"responses":{"200":{"description":"Get one account's report","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/account-last-entries":{"get":{"summary":"List the latest entry per account","description":"The most recent directive touching each account — how stale each part of the ledger is.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Restrict to one account and its children","example":"Assets:Bank:Checking"},"required":false,"description":"Restrict to one account and its children","name":"account","in":"query"},{"schema":{"type":"string","description":"Fava filter expression","example":"#travel"},"required":false,"description":"Fava filter expression","name":"filter","in":"query"},{"schema":{"type":"string","description":"Fava time expression","example":"2026"},"required":false,"description":"Fava time expression","name":"time","in":"query"}],"responses":{"200":{"description":"List the latest entry per account","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/entries-count":{"get":{"summary":"Count entries per directive type","description":"How many transactions, opens, balances, and so on the ledger holds.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Restrict to one account and its children","example":"Assets:Bank:Checking"},"required":false,"description":"Restrict to one account and its children","name":"account","in":"query"},{"schema":{"type":"string","description":"Fava filter expression","example":"#travel"},"required":false,"description":"Fava filter expression","name":"filter","in":"query"},{"schema":{"type":"string","description":"Fava time expression","example":"2026"},"required":false,"description":"Fava time expression","name":"time","in":"query"}],"responses":{"200":{"description":"Count entries per directive type","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/payee-transactions":{"get":{"summary":"Get a payee's transactions","description":"The transaction recorded against one payee.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The payee to look up"},"required":true,"description":"The payee to look up","name":"payee","in":"query"}],"responses":{"200":{"description":"Get a payee's transactions","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/narration-transactions":{"get":{"summary":"Get a narration's transactions","description":"The transaction recorded against one narration string.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The narration to look up"},"required":true,"description":"The narration to look up","name":"narration","in":"query"}],"responses":{"200":{"description":"Get a narration's transactions","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/payee-accounts":{"get":{"summary":"List the accounts a payee posts to","description":"Which accounts this payee has historically been booked against — what an agent should reach for when categorising a new one.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The payee to look up"},"required":true,"description":"The payee to look up","name":"payee","in":"query"}],"responses":{"200":{"description":"List the accounts a payee posts to","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/entry-context":{"get":{"summary":"Get the source context around one entry","description":"The ledger text surrounding a directive, addressed by its hash — what to read before editing it.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The entry's hash"},"required":true,"description":"The entry's hash","name":"entryHash","in":"query"}],"responses":{"200":{"description":"Get the source context around one entry","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/account-directives":{"get":{"summary":"List open/close directives per account","description":"Each account's open and close directives — which accounts are usable on a given date.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"List open/close directives per account","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/banks":{"get":{"summary":"List linked banks","description":"Every bank connection linked to this ledger.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"Linked banks","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/banks/{itemId}":{"get":{"summary":"Get one linked bank","description":"Status and institution details for a single bank connection.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The linked bank's item id"},"required":true,"description":"The linked bank's item id","name":"itemId","in":"path"}],"responses":{"200":{"description":"The bank connection","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"delete":{"summary":"Unlink a bank","description":"Severs the bank connection. `dry_run=true` reports what would be severed — the institution and every account — without doing it.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The linked bank's item id"},"required":true,"description":"The linked bank's item id","name":"itemId","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"Validate and report what would change, without changing anything."},"required":false,"description":"Validate and report what would change, without changing anything.","name":"dry_run","in":"query"}],"responses":{"200":{"description":"Unlink result, or a preview of one","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/banks/{itemId}/accounts":{"get":{"summary":"List a bank's accounts","description":"The accounts this bank connection shares.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The linked bank's item id"},"required":true,"description":"The linked bank's item id","name":"itemId","in":"path"}],"responses":{"200":{"description":"Bank accounts","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/bank-accounts":{"get":{"summary":"List every bank account on the ledger","description":"Accounts across all linked banks, with their institution and ledger-account mapping.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"}],"responses":{"200":{"description":"Bank accounts","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/bank-transactions/unsynced":{"get":{"summary":"List transactions not yet in the ledger","description":"Transactions pulled from the bank that have not been written into the ledger.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Restrict to one bank account"},"required":false,"description":"Restrict to one bank account","name":"accountId","in":"query"}],"responses":{"200":{"description":"Unsynced transactions","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/bank-transactions/suggested-categories":{"get":{"summary":"Suggest a ledger account per unsynced transaction","description":"Category suggestions drawn from the ledger's own history — what an importer should propose before asking.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"Restrict to one bank account"},"required":false,"description":"Restrict to one bank account","name":"accountId","in":"query"}],"responses":{"200":{"description":"Category suggestions","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/banks/{itemId}/suggested-mapping":{"get":{"summary":"Suggest a ledger account per bank account","description":"Which ledger account each of this bank's accounts most likely corresponds to.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The linked bank's item id"},"required":true,"description":"The linked bank's item id","name":"itemId","in":"path"}],"responses":{"200":{"description":"Account mapping suggestions","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/banks/{itemId}/sync":{"post":{"summary":"Pull new transactions from the bank","description":"Fetches transactions from the bank into the staging area. `dry_run=true` reports what would arrive without storing it or advancing the sync cursor, so the real sync that follows returns the same thing.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The linked bank's item id"},"required":true,"description":"The linked bank's item id","name":"itemId","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"Validate and report what would change, without changing anything."},"required":false,"description":"Validate and report what would change, without changing anything.","name":"dry_run","in":"query"}],"responses":{"200":{"description":"Sync result, or a preview of one","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/bank-transactions/submit":{"post":{"summary":"Write staged transactions into the ledger","description":"Appends the named transactions as beancount directives. `dry_run=true` runs every check and returns the exact entries that would be written.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"Validate and report what would change, without changing anything."},"required":false,"description":"Validate and report what would change, without changing anything.","name":"dry_run","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankTransactionSubmission"}}}},"responses":{"200":{"description":"Submission result, or a preview of one","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/bank-transactions":{"delete":{"summary":"Discard staged transactions","description":"Removes transactions from the staging area. Already-written ones are refused. `dry_run=true` lists exactly what would go.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"Validate and report what would change, without changing anything."},"required":false,"description":"Validate and report what would change, without changing anything.","name":"dry_run","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankTransactionDiscard"}}}},"responses":{"200":{"description":"Deletion result, or a preview of one","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/banks/{itemId}/reconcile":{"post":{"summary":"Re-read which accounts the bank shares","description":"Adds accounts the bank now shares and removes ones it no longer does. `dry_run=true` returns that diff without applying it.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The linked bank's item id"},"required":true,"description":"The linked bank's item id","name":"itemId","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"Validate and report what would change, without changing anything."},"required":false,"description":"Validate and report what would change, without changing anything.","name":"dry_run","in":"query"}],"responses":{"200":{"description":"Reconcile result, or a preview of one","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/banks/{itemId}/refresh":{"post":{"summary":"Refresh a bank's connection status","description":"Refreshes and stores the connection status from the bank. Preview is unsupported; dry_run=true is rejected.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The linked bank's item id"},"required":true,"description":"The linked bank's item id","name":"itemId","in":"path"},{"schema":{"type":"string","enum":["false"]},"required":false,"name":"dry_run","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{},"default":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The refreshed connection","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/bank-accounts/{accountId}/mapping":{"put":{"summary":"Map a bank account to a ledger account","description":"Sets which ledger account this bank account's transactions book against. No `dry_run`: the preview would only echo the value you sent.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The bank account's id"},"required":true,"description":"The bank account's id","name":"accountId","in":"path"},{"schema":{"type":"string","enum":["false"]},"required":false,"name":"dry_run","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankAccountMapping"}}}},"responses":{"200":{"description":"Whether the mapping changed","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/bank-accounts/{accountId}/currency":{"put":{"summary":"Set a bank account's currency","description":"Sets the currency its transactions are booked in. No `dry_run`, for the same reason as the mapping above.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","description":"The bank account's id"},"required":true,"description":"The bank account's id","name":"accountId","in":"path"},{"schema":{"type":"string","enum":["false"]},"required":false,"name":"dry_run","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankAccountCurrency"}}}},"responses":{"200":{"description":"Whether the currency changed","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/ledgers/{owner}/{name}/archive/{archive}":{"get":{"summary":"Download a ledger archive","description":"Streams the archive for an authenticated caller with read access to the ledger. Send a session cookie, OAuth bearer token, or personal API key.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Ledger owner's username","example":"alice"},"required":true,"description":"Ledger owner's username","name":"owner","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Ledger (repository) name","example":"main-ledger"},"required":true,"description":"Ledger (repository) name","name":"name","in":"path"},{"schema":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$","description":"Archive to download. Git archives are `gitea-<branch>.zip`; `tar.gz` and `zip` are also accepted.","example":"gitea-main.zip"},"required":true,"description":"Archive to download. Git archives are `gitea-<branch>.zip`; `tar.gz` and `zip` are also accepted.","name":"archive","in":"path"}],"responses":{"200":{"description":"The archive bytes","content":{"application/zip":{"schema":{"type":"string","format":"binary"}},"application/gzip":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/tier-quotas":{"get":{"summary":"Read public subscription tier quotas","description":"Static product limits for every tier. A limit of -1 means unlimited. No user billing information or Stripe request is involved.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Tier quotas","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"tier":{"type":"string"},"aiCfoTokensMax":{"type":"number"},"maxLedgers":{"type":"number"},"maxCollaboratorsPerLedger":{"type":"number"},"maxDirectives":{"type":"number"}},"required":["tier","aiCfoTokensMax","maxLedgers","maxCollaboratorsPerLedger","maxDirectives"]}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/health":{"get":{"summary":"Read application health","description":"The public GraphQL health probe; this is not a dependency readiness check.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Application health","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/feature-flags":{"get":{"summary":"Read public feature flags","description":"Public feature flags. The legacy userId argument is accepted but does not affect this static configuration.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"query"}],"responses":{"200":{"description":"Feature flags","content":{"application/json":{"schema":{"type":"object","properties":{"spendingReportSubscription":{"type":"boolean"}},"required":["spendingReportSubscription"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/account/ai-cfo-usage":{"get":{"summary":"Read the current account's AI CFO usage","description":"Current billing-month token usage and plan limit. The authenticated identity selects the account; no user or ledger selector is accepted.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"AI CFO token usage","content":{"application/json":{"schema":{"type":"object","properties":{"aiCfoTokensUsed":{"type":"number"},"aiCfoTokensMax":{"type":"number"}},"required":["aiCfoTokensUsed","aiCfoTokensMax"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/account":{"delete":{"summary":"Delete the authenticated account","description":"Permanently deletes the caller's account using the existing subscription, bank, credential, and ledger-user cleanup. Session or OAuth identity is required; API keys cannot delete an account. No user or ledger selector and no preview.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Account deleted","content":{"application/json":{"schema":{"type":"boolean"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/user-profile":{"get":{"summary":"Read the current user's profile","description":"Returns null without an authenticated identity or when the user no longer exists. A supplied userId must identify the caller; the shared account service enforces scope and exact-self authority.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","nullable":true},"required":false,"name":"userId","in":"query"}],"responses":{"200":{"description":"User profile or null","content":{"application/json":{"schema":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"email":{"type":"string"},"locale":{"type":"string"},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"emailReportStatus":{"type":"string","nullable":true,"enum":["OFF","WEEKLY","MONTHLY",null]},"username":{"type":"string","nullable":true},"tier":{"type":"string"},"limits":{"type":"object","properties":{"ledgersUsed":{"type":"number"},"ledgersMax":{"type":"number"},"collaboratorsPerLedgerMax":{"type":"number"},"maxDirectives":{"type":"number"}},"required":["ledgersUsed","ledgersMax","collaboratorsPerLedgerMax","maxDirectives"]},"hasEverSubscribed":{"type":"boolean"}},"required":["id","email","locale","tier","limits","hasEverSubscribed"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/social/profile":{"get":{"summary":"Read a public user profile","description":"Profile, activities, and repositories by username. Authenticated self-views retain existing private-repository/activity enrichment and follow status; other views use the public client. Activity/repository lists retain the existing 20/50 limits and fallback behavior.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"username","in":"query"}],"responses":{"200":{"description":"Public profile","content":{"application/json":{"schema":{"type":"object","properties":{"profile":{"type":"object","properties":{"username":{"type":"string"},"fullName":{"type":"string","nullable":true},"avatarUrl":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"followersCount":{"type":"number"},"followingCount":{"type":"number"},"starredReposCount":{"type":"number"},"created":{"type":"string","nullable":true,"format":"date-time"}},"required":["username","followersCount","followingCount","starredReposCount"]},"isFollowing":{"type":"boolean","nullable":true},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"repoName":{"type":"string","nullable":true},"repoFullName":{"type":"string","nullable":true}},"required":["id","type","content","createdAt"]}},"repositories":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"fullName":{"type":"string"},"description":{"type":"string","nullable":true},"isPrivate":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["name","fullName","isPrivate","createdAt","updatedAt"]}}},"required":["profile","activities","repositories"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/social/followers":{"get":{"summary":"Read followers","description":"Public social discovery. page defaults to 1 and limit to 20. total is the returned page size. Existing upstream failures return an empty page.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"username","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"page","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Social discovery page","content":{"application/json":{"schema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"username":{"type":"string"},"fullName":{"type":"string"},"avatarUrl":{"type":"string"},"bio":{"type":"string"}},"required":["username"]}},"total":{"type":"number"}},"required":["users","total"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/social/following":{"get":{"summary":"Read following","description":"Public social discovery. page defaults to 1 and limit to 20. total is the returned page size. Existing upstream failures return an empty page.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"username","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"page","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Social discovery page","content":{"application/json":{"schema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"username":{"type":"string"},"fullName":{"type":"string"},"avatarUrl":{"type":"string"},"bio":{"type":"string"}},"required":["username"]}},"total":{"type":"number"}},"required":["users","total"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/social/starred-repositories":{"get":{"summary":"Read starred-repositories","description":"Public social discovery. page defaults to 1 and limit to 20. total is the returned page size. Existing upstream failures return an empty page.","tags":["Ledger v1"],"security":[{},{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"username","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"page","in":"query"},{"schema":{"type":"number","nullable":true},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Social discovery page","content":{"application/json":{"schema":{"type":"object","properties":{"repositories":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"fullName":{"type":"string"},"description":{"type":"string"},"isPrivate":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"},"starsCount":{"type":"number"}},"required":["name","fullName","isPrivate","updatedAt"]}},"total":{"type":"number"}},"required":["repositories","total"]}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/api-keys":{"get":{"summary":"List your API keys","description":"Every key you have minted, newest first, including revoked and expired ones. Keys are shown by prefix — the key itself was returned once, when it was created.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Your API keys","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}},"post":{"summary":"Mint an API key","description":"Creates a key and returns its plaintext, which is shown here and never again. Requires a paid plan, and cannot be called with an API key — sign in, or use an OAuth grant.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKey"}}}},"responses":{"200":{"description":"The new key, with its one-time plaintext","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MintedApiKey"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"402":{"description":"Minting API keys requires a paid plan","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}},"/api-gateway/v1/api-keys/{id}":{"delete":{"summary":"Revoke an API key","description":"Stops the key working from the next request onward. Revoking twice is not an error, and a key id you do not own reads as not found.","tags":["Ledger v1"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"The key's id (`akey_…`), not the key itself","example":"akey_7wXzK9mNpQrSt2VxYaBc"},"required":true,"description":"The key's id (`akey_…`), not the key itself","name":"id","in":"path"}],"responses":{"200":{"description":"The revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"400":{"description":"Request failed validation against the documented schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"401":{"description":"No credential, or a credential that no longer resolves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"403":{"description":"The credential lacks the permission this business action requires","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"404":{"description":"No such ledger, or no access to it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1Error"}}}}}}}}}