// JAG Finance API client for TypeScript. Generated on 2026-11-16 for API version 1.0.0. // Do not edit by hand: download a fresh copy whenever the API changes. // // curl -o jag-finance.ts https://finance.jagwebsites.xyz/api/v1/client.ts // // Usage: // // import { createJagFinanceClient, JagFinanceApiError } from './jag-finance'; // // const api = createJagFinanceClient({ apiKey: process.env['JAG_FINANCE_API_KEY']! }); // const { data } = await api.getTransactions({ query: { limit: 20 } }); // for await (const account of api.getAccountsAll()) console.log(account.name); // // Every method takes one object ({ params, query, body, idempotencyKey, ifMatch, signal }) and // returns the typed "data" of the answer (lists return { data, page, meta }; a CSV export returns // its text). Lists also have an // "...All" method that follows the page cursor for you. Any error answer throws a // JagFinanceApiError with status, code, message, details, requestId and suggestions. // // No dependencies. Needs a global fetch (Node 18+, Deno, Bun, browsers) and, for the types, // either the "dom" lib or @types/node. /** Something went wrong: the API answered with an error. */ export class JagFinanceApiError extends Error { readonly status: number; /** Stable machine-readable code, such as "validation_failed" or "version_conflict". */ readonly code: string; /** For "validation_failed": one entry per field that is wrong. */ readonly details: Array<{ path: string; message: string }> | undefined; /** Quote this when asking for help. */ readonly requestId: string | undefined; /** For "not_found": the endpoints the address was probably meant to be. */ readonly suggestions: Array<{ method: string; path: string; summary: string; docs: string }> | undefined; /** For "forbidden_scope": the scope the call needed. */ readonly requiredScope: string | undefined; /** Seconds to wait before retrying, when the API said so (rate limits, storage down). */ readonly retryAfter: number | undefined; constructor( status: number, error: { code?: string; message?: string; details?: Array<{ path: string; message: string }>; requestId?: string; suggestions?: Array<{ method: string; path: string; summary: string; docs: string }>; requiredScope?: string; }, retryAfter?: number, ) { super(error.message ?? 'The API answered ' + status + '.'); this.name = 'JagFinanceApiError'; this.status = status; this.code = error.code ?? 'unknown_error'; this.details = error.details; this.requestId = error.requestId; this.suggestions = error.suggestions; this.requiredScope = error.requiredScope; this.retryAfter = retryAfter; } } export interface JagFinanceClientOptions { /** An API key from Settings → API keys (it starts "sk_"). */ apiKey: string; /** Where the API lives. Defaults to the deployment this file came from. */ baseUrl?: string; /** Your own fetch, for tests or proxies. Defaults to the global one. */ fetch?: typeof fetch; } /** The paging info of a list answer. */ export interface PageInfo { /** Send as "cursor" to get the next page; null on the last page. */ nextCursor: string | null; hasMore: boolean; /** Lists with an "updatedSince" filter only: store it and send it as the next "updatedSince". */ asOf?: string; } /** One page of a list. */ export interface Page { data: T[]; page: PageInfo; /** Extra facts about the whole list, when the endpoint gives any (such as what a search left out). */ meta: Record | undefined; } interface ClientConfig { apiKey: string; baseUrl: string; fetch: typeof fetch; } interface CallArgs { params?: object; query?: object; body?: unknown; idempotencyKey?: string; ifMatch?: string; signal?: AbortSignal; } interface CallSpec { method: string; path: string; formData?: boolean; /** The media type of a success answer that is not JSON, such as "text/csv". */ accept?: string; } function buildUrl(config: ClientConfig, spec: CallSpec, args: CallArgs): string { const path = spec.path.replace(/\{(\w+)\}/g, (_match, name: string) => encodeURIComponent(String((args.params as Record | undefined)?.[name]))); const search = new URLSearchParams(); for (const [name, value] of Object.entries((args.query ?? {}) as Record)) { if (value === undefined || value === null) continue; for (const item of Array.isArray(value) ? value : [value]) search.append(name, String(item)); } const query = search.toString(); return config.baseUrl.replace(/\/+$/, '') + path + (query ? '?' + query : ''); } async function call(config: ClientConfig, spec: CallSpec, args: CallArgs): Promise<{ response: Response; json: unknown }> { const headers: Record = { authorization: 'Bearer ' + config.apiKey, accept: spec.accept ? spec.accept + ', application/json' : 'application/json', }; let body: string | FormData | undefined; if (args.body !== undefined) { if (spec.formData) { body = args.body as FormData; } else { body = JSON.stringify(args.body); headers['content-type'] = 'application/json'; } } if (args.idempotencyKey) headers['idempotency-key'] = args.idempotencyKey; if (args.ifMatch) headers['if-match'] = args.ifMatch; const init: RequestInit = { method: spec.method, headers }; if (body !== undefined) init.body = body; if (args.signal) init.signal = args.signal; const response = await config.fetch(buildUrl(config, spec, args), init); const isJson = (response.headers.get('content-type') ?? '').includes('json'); if (response.ok && !isJson) return { response, json: undefined }; const text = await response.text(); let json: unknown; try { json = text === '' ? undefined : JSON.parse(text); } catch { json = undefined; } if (!response.ok) { const error = (json as { error?: ConstructorParameters[1] } | undefined)?.error; const retryAfter = Number(response.headers.get('retry-after')); throw new JagFinanceApiError(response.status, error ?? (text === '' ? {} : { message: text.slice(0, 200) }), Number.isFinite(retryAfter) && retryAfter > 0 ? retryAfter : undefined); } return { response, json }; } async function sendData(config: ClientConfig, spec: CallSpec, args: CallArgs): Promise { const { response, json } = await call(config, spec, args); // A file answer is not JSON: hand back the Response so the caller can read the bytes. return (json === undefined ? response : (json as { data: T }).data) as T; } async function sendText(config: ClientConfig, spec: CallSpec, args: CallArgs): Promise { const { response, json } = await call(config, spec, args); // A JSON answer here is unexpected, but its text is still what the server sent. return json === undefined ? response.text() : JSON.stringify(json); } async function sendPage(config: ClientConfig, spec: CallSpec, args: CallArgs): Promise> { const { json } = await call(config, spec, args); const { data, page, meta } = json as Page; return { data, page, meta }; } async function sendEmpty(config: ClientConfig, spec: CallSpec, args: CallArgs): Promise { await call(config, spec, args); } /** * Every item across all pages. When it finishes it returns the first page's "asOf" (lists with * "updatedSince"), the value to store for the next sync. */ async function* allPages( fetchPage: (args: A) => Promise>, args: A, ): AsyncGenerator { let cursor = args.query?.cursor; let asOf: string | undefined; for (let first = true; ; first = false) { const result = await fetchPage({ ...args, query: { ...args.query, cursor } }); if (first) asOf = result.page.asOf; yield* result.data; if (!result.page.hasMore || result.page.nextCursor === null) return asOf; cursor = result.page.nextCursor; } } // --- Types --- export interface GetMeArgs { signal?: AbortSignal; } export interface GetMeResponse { /** The key making the request. */ key: { /** The key id (not the secret). */ id: string; /** The name you gave the key. */ name: string | null; /** What the key may do, such as `accounts:read`. */ scopes: string[]; /** When the key was created, ISO 8601 in UTC. */ createdAt: string | null; /** When the key stops working, ISO 8601 in UTC; null if it never does. */ expiresAt: string | null; /** When the key was last used, ISO 8601 in UTC; null if never. */ lastUsedAt: string | null; }; /** Who the key belongs to. */ user: { /** The id of the person the key belongs to. */ id: string; /** Their name. */ name: string | null; }; /** How many requests the key may make. */ rateLimit: { /** Requests allowed per minute. */ perMinute: number; /** The longer limit, such as 1,000 an hour; null when rate limiting is off for the key. */ window: { /** Requests allowed in the window. */ limit: number; /** Length of the window in seconds. */ seconds: number; } | null; }; /** The financial accounts the key is limited to, or null when it may use every account. */ accountLimit: Array<{ /** The account id. */ id: string; /** Its name. */ name: string; }> | null; /** Only when a connected app calls with its OAuth access token: the connection it acts for. `key` then describes that connection. */ connection?: { /** The connection (grant) the token acts for. */ grantId: string; /** The connected app, such as `jag-work`. */ clientId: string; /** What the app may do. */ scopes: string[]; /** The accounts the person allowed it to see. */ accountIds: string[]; } | null; } export interface GetConnectionArgs { signal?: AbortSignal; } export interface GetConnectionResponse { /** The connection. */ grantId: string; /** The app it is for. */ app: { /** Its client id, such as `jag-work`. */ clientId: string; /** Its name. */ name: string; }; /** What the app may do. */ scopes: string[]; /** The accounts the person allowed it to see. */ accounts: Array<{ /** The account id. */ id: string; /** Its name. */ name: string; /** The bank. */ institution: string; /** The last four digits, when known. */ mask: string | null; /** True for a closed account. */ closed: boolean; }>; /** Its webhook, if it has set one. */ webhook: { /** Where events go. */ url: string | null; /** What it is told about. */ events: string[]; /** `failing` while deliveries fail; `off` once switched off for failing. */ status: "healthy" | "failing" | "off"; /** The last delivery that worked, ISO 8601 in UTC. */ lastSuccessAt: string | null; /** The last delivery that failed, ISO 8601 in UTC. */ lastFailureAt: string | null; } | null; /** When it was connected. */ createdAt: string | null; /** When the accounts or scopes last changed. */ changedAt: string | null; } export interface PutConnectionWebhookBody { /** Where to send events: an https address. */ url: string; } export interface PutConnectionWebhookArgs { body: PutConnectionWebhookBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PutConnectionWebhookResponse { /** The webhook. */ id: string; /** Where events go. */ url: string | null; /** What it is told about. */ events: string[]; /** Signs each request (`JAG-Signature`). Store it; it is not shown again. */ secret: string; } export interface DeleteConnectionWebhookArgs { /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PostConnectionPayslipsQuery { /** The payment (income) to attach the payslip to. */ transactionId: string; } export interface PostConnectionPayslipsArgs { query: PostConnectionPayslipsQuery; /** A multipart form: put the file in the field named "file". */ body: FormData; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostConnectionPayslipsResponse { /** `added` for a new document; `existing` when the same file was already one. */ status: "added" | "existing"; /** The payslip. */ documentId: string; /** The payment it is attached to. */ transactionId: string; } export interface GetAccountsQuery { /** Closed accounts: `exclude` (default), `include` or `only`. With `updatedSince` the default is `include`, so a closing shows. */ closed?: "exclude" | "include" | "only"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; } export interface GetAccountsArgs { query?: GetAccountsQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetAccountsItem { /** The account id. */ id: string; /** The account name. */ name: string; /** The bank or provider it is held with. */ institution: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** What sort of account it is. */ kind: "current" | "savings" | "credit" | "cash"; /** `savings_pot` for a pot inside another account; otherwise null. */ subtype: "savings_pot" | null; /** The account currency, such as GBP. */ currency: string; /** True once the account has been closed. */ closed: boolean; /** Left out of planning cash (Safe to spend, Forecast, Runway), but still in balances. */ keepAside: boolean; /** The day of the month its statement cycle starts (1 to 31). Only means something when `statementSchedule` is `monthly`. */ statementDay: number; /** `monthly`: a statement each cycle from `statementDay`. `around`: monthly, each statement starting up to 3 days either side of `statementDay`. `none` (By statement, the default for new accounts): no fixed day, each statement keeps its own printed dates. */ statementSchedule: "monthly" | "around" | "none"; /** The day it was opened, YYYY-MM-DD. */ dateOpened: string | null; /** The ways money is paid in or out: the account itself, its cards, pots and so on. */ targets: Array<{ /** The payment source id. */ id: string; /** Its name. */ name: string; /** What this payment source is. `direct` is the account itself. */ kind: ("direct" | "debit_card" | "credit_card" | "virtual_card" | "savings_pot" | "cash") | null; /** The last four digits of the card, when it has them. */ lastFour: string | null; /** True once it has been closed. */ closed: boolean; }>; /** Send as `If-Match` when editing the account. */ version: string; /** The current balance in pence. Negative when money is owed. */ balanceMinor: number; /** The current balance ready to show, such as £1,250.00. */ balanceDisplay: string; /** The credit limit in pence; null when there is none. Negative when money is owed. */ creditLimitMinor: number | null; /** The credit limit ready to show, such as £1,250.00. */ creditLimitDisplay: string | null; } export type GetAccountsResponse = GetAccountsItem[]; export interface GetAccountsByIdParams { /** The account id. */ id: string; } export interface GetAccountsByIdArgs { params: GetAccountsByIdParams; signal?: AbortSignal; } export interface GetAccountsByIdResponse { /** The account id. */ id: string; /** The account name. */ name: string; /** The bank or provider it is held with. */ institution: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** What sort of account it is. */ kind: "current" | "savings" | "credit" | "cash"; /** `savings_pot` for a pot inside another account; otherwise null. */ subtype: "savings_pot" | null; /** The account currency, such as GBP. */ currency: string; /** True once the account has been closed. */ closed: boolean; /** Left out of planning cash (Safe to spend, Forecast, Runway), but still in balances. */ keepAside: boolean; /** The day of the month its statement cycle starts (1 to 31). Only means something when `statementSchedule` is `monthly`. */ statementDay: number; /** `monthly`: a statement each cycle from `statementDay`. `around`: monthly, each statement starting up to 3 days either side of `statementDay`. `none` (By statement, the default for new accounts): no fixed day, each statement keeps its own printed dates. */ statementSchedule: "monthly" | "around" | "none"; /** The day it was opened, YYYY-MM-DD. */ dateOpened: string | null; /** The ways money is paid in or out: the account itself, its cards, pots and so on. */ targets: Array<{ /** The payment source id. */ id: string; /** Its name. */ name: string; /** What this payment source is. `direct` is the account itself. */ kind: ("direct" | "debit_card" | "credit_card" | "virtual_card" | "savings_pot" | "cash") | null; /** The last four digits of the card, when it has them. */ lastFour: string | null; /** True once it has been closed. */ closed: boolean; }>; /** Send as `If-Match` when editing the account. */ version: string; /** The current balance in pence. Negative when money is owed. */ balanceMinor: number; /** The current balance ready to show, such as £1,250.00. */ balanceDisplay: string; /** The credit limit in pence; null when there is none. Negative when money is owed. */ creditLimitMinor: number | null; /** The credit limit ready to show, such as £1,250.00. */ creditLimitDisplay: string | null; /** The most recent balance check, or null when there is none. */ latestBalanceCheck: { /** The balance check id. */ id: string; /** The account it was recorded against. */ accountId: string; /** The UK calendar day the provider balance was read. */ observedOn: string; /** The exact moment, when it was recorded (older checks have only the day). */ observedAt: string | null; /** True when the provider balance equals the ledger balance. */ matches: boolean; /** A short note added with the check. */ note: string | null; /** True once a difference has been marked as dealt with. */ resolved: boolean; /** When it was marked resolved, ISO 8601 in UTC. */ resolvedAt: string | null; /** What was done about the difference. */ resolutionNote: string | null; /** When the check was recorded, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when changing the check. */ version: string; /** The balance the bank or provider showed in pence. Negative when money is owed. */ observedMinor: number; /** The balance the bank or provider showed ready to show, such as £1,250.00. */ observedDisplay: string; /** The balance JAG Finance worked out in pence. Negative when money is owed. */ ledgerMinor: number; /** The balance JAG Finance worked out ready to show, such as £1,250.00. */ ledgerDisplay: string; /** Observed minus ledger in pence. Negative when money is owed. */ differenceMinor: number; /** Observed minus ledger ready to show, such as £1,250.00. */ differenceDisplay: string; } | null; } export interface GetInstitutionsQuery { /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; } export interface GetInstitutionsArgs { query?: GetInstitutionsQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetInstitutionsItem { /** The institution id. */ id: string; /** The institution name. */ name: string; /** True once it has been closed. */ closed: boolean; /** The ids of its accounts. */ accountIds: string[]; } export type GetInstitutionsResponse = GetInstitutionsItem[]; export interface GetAccountsByIdBalanceChecksParams { /** The account id. */ id: string; } export interface GetAccountsByIdBalanceChecksArgs { params: GetAccountsByIdBalanceChecksParams; signal?: AbortSignal; } /** One item of the list. */ export interface GetAccountsByIdBalanceChecksItem { /** The balance check id. */ id: string; /** The account it was recorded against. */ accountId: string; /** The UK calendar day the provider balance was read. */ observedOn: string; /** The exact moment, when it was recorded (older checks have only the day). */ observedAt: string | null; /** True when the provider balance equals the ledger balance. */ matches: boolean; /** A short note added with the check. */ note: string | null; /** True once a difference has been marked as dealt with. */ resolved: boolean; /** When it was marked resolved, ISO 8601 in UTC. */ resolvedAt: string | null; /** What was done about the difference. */ resolutionNote: string | null; /** When the check was recorded, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when changing the check. */ version: string; /** The balance the bank or provider showed in pence. Negative when money is owed. */ observedMinor: number; /** The balance the bank or provider showed ready to show, such as £1,250.00. */ observedDisplay: string; /** The balance JAG Finance worked out in pence. Negative when money is owed. */ ledgerMinor: number; /** The balance JAG Finance worked out ready to show, such as £1,250.00. */ ledgerDisplay: string; /** Observed minus ledger in pence. Negative when money is owed. */ differenceMinor: number; /** Observed minus ledger ready to show, such as £1,250.00. */ differenceDisplay: string; } export type GetAccountsByIdBalanceChecksResponse = GetAccountsByIdBalanceChecksItem[]; export interface PostAccountsByIdBalanceChecksParams { /** The account id. */ id: string; } export interface PostAccountsByIdBalanceChecksBody { /** The balance the bank or provider showed, in pence. Negative when money is owed. */ observedMinor: number; /** The UK day it was read, `YYYY-MM-DD`, today or earlier. Covers the whole day; prefer `observedAt` when you know the time. */ observedOn?: string; /** The exact moment it was read, an ISO 8601 time such as `2026-10-24T08:30:00Z`. */ observedAt?: string; /** A short note. */ note?: string | null; } export interface PostAccountsByIdBalanceChecksArgs { params: PostAccountsByIdBalanceChecksParams; body: PostAccountsByIdBalanceChecksBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostAccountsByIdBalanceChecksResponse { /** The balance check id. */ id: string; /** The account it was recorded against. */ accountId: string; /** The UK calendar day the provider balance was read. */ observedOn: string; /** The exact moment, when it was recorded (older checks have only the day). */ observedAt: string | null; /** True when the provider balance equals the ledger balance. */ matches: boolean; /** A short note added with the check. */ note: string | null; /** True once a difference has been marked as dealt with. */ resolved: boolean; /** When it was marked resolved, ISO 8601 in UTC. */ resolvedAt: string | null; /** What was done about the difference. */ resolutionNote: string | null; /** When the check was recorded, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when changing the check. */ version: string; /** The balance the bank or provider showed in pence. Negative when money is owed. */ observedMinor: number; /** The balance the bank or provider showed ready to show, such as £1,250.00. */ observedDisplay: string; /** The balance JAG Finance worked out in pence. Negative when money is owed. */ ledgerMinor: number; /** The balance JAG Finance worked out ready to show, such as £1,250.00. */ ledgerDisplay: string; /** Observed minus ledger in pence. Negative when money is owed. */ differenceMinor: number; /** Observed minus ledger ready to show, such as £1,250.00. */ differenceDisplay: string; } export interface PatchAccountsByIdParams { /** The account id. */ id: string; } export interface PatchAccountsByIdBody { /** A new name. */ name?: string; /** True closes the account; false reopens it. The default cash account cannot be closed. */ closed?: boolean; /** True leaves the account out of planning cash (Safe to spend, Forecast, Runway). Credit accounts cannot be kept aside. */ keepAside?: boolean; /** The `version` you last read, as an alternative to the `If-Match` header. */ version?: string; } export interface PatchAccountsByIdArgs { params: PatchAccountsByIdParams; body: PatchAccountsByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchAccountsByIdResponse { /** The account id. */ id: string; /** The account name. */ name: string; /** The bank or provider it is held with. */ institution: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** What sort of account it is. */ kind: "current" | "savings" | "credit" | "cash"; /** `savings_pot` for a pot inside another account; otherwise null. */ subtype: "savings_pot" | null; /** The account currency, such as GBP. */ currency: string; /** True once the account has been closed. */ closed: boolean; /** Left out of planning cash (Safe to spend, Forecast, Runway), but still in balances. */ keepAside: boolean; /** The day of the month its statement cycle starts (1 to 31). Only means something when `statementSchedule` is `monthly`. */ statementDay: number; /** `monthly`: a statement each cycle from `statementDay`. `around`: monthly, each statement starting up to 3 days either side of `statementDay`. `none` (By statement, the default for new accounts): no fixed day, each statement keeps its own printed dates. */ statementSchedule: "monthly" | "around" | "none"; /** The day it was opened, YYYY-MM-DD. */ dateOpened: string | null; /** The ways money is paid in or out: the account itself, its cards, pots and so on. */ targets: Array<{ /** The payment source id. */ id: string; /** Its name. */ name: string; /** What this payment source is. `direct` is the account itself. */ kind: ("direct" | "debit_card" | "credit_card" | "virtual_card" | "savings_pot" | "cash") | null; /** The last four digits of the card, when it has them. */ lastFour: string | null; /** True once it has been closed. */ closed: boolean; }>; /** Send as `If-Match` when editing the account. */ version: string; /** The current balance in pence. Negative when money is owed. */ balanceMinor: number; /** The current balance ready to show, such as £1,250.00. */ balanceDisplay: string; /** The credit limit in pence; null when there is none. Negative when money is owed. */ creditLimitMinor: number | null; /** The credit limit ready to show, such as £1,250.00. */ creditLimitDisplay: string | null; /** The most recent balance check, or null when there is none. */ latestBalanceCheck: { /** The balance check id. */ id: string; /** The account it was recorded against. */ accountId: string; /** The UK calendar day the provider balance was read. */ observedOn: string; /** The exact moment, when it was recorded (older checks have only the day). */ observedAt: string | null; /** True when the provider balance equals the ledger balance. */ matches: boolean; /** A short note added with the check. */ note: string | null; /** True once a difference has been marked as dealt with. */ resolved: boolean; /** When it was marked resolved, ISO 8601 in UTC. */ resolvedAt: string | null; /** What was done about the difference. */ resolutionNote: string | null; /** When the check was recorded, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when changing the check. */ version: string; /** The balance the bank or provider showed in pence. Negative when money is owed. */ observedMinor: number; /** The balance the bank or provider showed ready to show, such as £1,250.00. */ observedDisplay: string; /** The balance JAG Finance worked out in pence. Negative when money is owed. */ ledgerMinor: number; /** The balance JAG Finance worked out ready to show, such as £1,250.00. */ ledgerDisplay: string; /** Observed minus ledger in pence. Negative when money is owed. */ differenceMinor: number; /** Observed minus ledger ready to show, such as £1,250.00. */ differenceDisplay: string; } | null; } export interface GetTransactionsQuery { /** Earliest date, inclusive. `YYYY-MM-DD` (a whole UK day) or an ISO 8601 timestamp. */ from?: string; /** Latest date, inclusive. `YYYY-MM-DD` runs to the end of that UK day; a timestamp is that instant. */ to?: string; /** A payment source (card, pot or account activity) id, or a financial account id for all of its sources. */ accountId?: string; /** Only transactions with a line in this category or any category under it (a parent category includes its subcategories, as on the Transactions page). */ categoryId?: string; /** Only transactions with a line for this payee or any payee under it (a parent payee includes its sub-payees). */ payeeId?: string; /** Only transactions carrying this tag. */ tagId?: string; /** Expense, income or transfer, read from all of a transaction’s lines as the app does. */ kind?: "expense" | "income" | "transfer"; /** Smallest absolute amount in pence, up to 2147483647. */ minAmountMinor?: number; /** Largest absolute amount in pence, up to 2147483647. */ maxAmountMinor?: number; /** Text search over the description, notes and item names, with the same AND / OR / NOT, "quotes" and accent folding as the Transactions page. */ q?: string; /** `true` for transactions with documents attached, `false` for those without. Needs the `documents:read` scope and a key for all accounts. */ hasDocuments?: "0" | "1" | "true" | "false"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). A transaction counts as changed when its header, any of its lines or its tags were (the same stamp as `version`); deleting a tag altogether does not move the transactions that had it. Transactions are hard-deleted, so a deleted one never appears. Paging works as usual. */ updatedSince?: string; /** `documents` adds each transaction’s attached documents (id and title). Needs the `documents:read` scope and a key for all accounts. */ include?: "documents"; /** Transactions per page, 1–200 (50 by default). */ limit?: number; /** `page.nextCursor` from the previous page. */ cursor?: string; } export interface GetTransactionsArgs { query?: GetTransactionsQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetTransactionsItem { /** The transaction id. */ id: string; /** The day it happened, YYYY-MM-DD in UK time. */ date: string; /** The moment it happened, ISO 8601 in UTC. */ at: string; /** What the transaction is called. */ description: string; /** True when the app writes the description from the lines, and rewrites it when they change. */ descriptionAuto: boolean; /** Free-text notes. */ notes: string | null; /** Whether money went out, came in, or moved between your own accounts. */ kind: "expense" | "income" | "transfer"; /** True for a move between your own accounts. */ isTransfer: boolean; /** True for a round-up transfer into savings. */ isRoundUp: boolean; /** Net amount of all lines in pence; negative is money out. */ amountMinor: number; /** Net amount of all lines ready to show, such as -£12.50. */ amountDisplay: string; /** The lines that make up the transaction; each moves money in one account. */ lines: Array<{ /** The line id. */ id: string; /** The account this line moves money in or out of. For a key limited to some accounts, a line on another account shows `{ "id": null, "name": "Another account" }`. */ account: { /** Its id; null for another account, to a key limited to some accounts. */ id: string | null; /** Its name. */ name: string; }; /** Amount of this line in pence; negative is money out. */ amountMinor: number; /** Amount of this line ready to show, such as -£12.50. */ amountDisplay: string; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** The line's category, or null when it has none. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who was paid, or null when none is set. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** What was bought, when the line names it. */ itemName: string | null; /** How many were bought, when the line says. */ quantity: number | null; /** Free-text notes on this line. */ notes: string | null; /** The amount in the currency it was paid in, when that differs from the account's. */ foreign: { /** The three-letter currency code it was paid in, such as EUR. */ currency: string; /** Amount in that currency in its minor unit, such as cents; negative is money out. */ amountMinor: number; /** Amount in that currency ready to show, such as -£12.50. */ amountDisplay: string; /** The exchange rate used to convert it to the account currency, if known. */ rate: string | null; /** The day the rate was taken from (YYYY-MM-DD), if known. */ asOf: string | null; } | null; }>; /** The tags on it. */ tags: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** Where it came from, such as manual or an import. */ source: string | null; /** Documents attached to it. Only present when the key can read documents. */ documents?: Array<{ /** The document id. */ id: string; /** The document title. */ title: string; }>; /** When it was added, ISO 8601 in UTC. */ createdAt: string; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string; /** Send as `If-Match` when editing or deleting, to avoid overwriting a newer change. */ version: string; } export type GetTransactionsResponse = GetTransactionsItem[]; export interface GetTransactionsLinesQuery { /** Earliest date, inclusive. `YYYY-MM-DD` (a whole UK day) or an ISO 8601 timestamp. */ from?: string; /** Latest date, inclusive. `YYYY-MM-DD` runs to the end of that UK day; a timestamp is that instant. */ to?: string; /** A payment source (card, pot or account activity) id, or a financial account id for all of its sources. */ accountId?: string; /** Only transactions with a line in this category or any category under it (a parent category includes its subcategories, as on the Transactions page). */ categoryId?: string; /** Only transactions with a line for this payee or any payee under it (a parent payee includes its sub-payees). */ payeeId?: string; /** Only transactions carrying this tag. */ tagId?: string; /** Expense, income or transfer, read from all of a transaction’s lines as the app does. */ kind?: "expense" | "income" | "transfer"; /** Smallest absolute amount in pence, up to 2147483647. */ minAmountMinor?: number; /** Largest absolute amount in pence, up to 2147483647. */ maxAmountMinor?: number; /** Text search over the description, notes and item names, with the same AND / OR / NOT, "quotes" and accent folding as the Transactions page. */ q?: string; /** `true` for transactions with documents attached, `false` for those without. Needs the `documents:read` scope and a key for all accounts. */ hasDocuments?: "0" | "1" | "true" | "false"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). A line counts as changed when it or its transaction’s header was. Deleted lines never appear. */ updatedSince?: string; /** Lines per page, 1–200 (50 by default). */ limit?: number; /** `page.nextCursor` from the previous page. */ cursor?: string; } export interface GetTransactionsLinesArgs { query?: GetTransactionsLinesQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetTransactionsLinesItem { /** The line id. */ id: string; /** The account this line moves money in or out of. For a key limited to some accounts, a line on another account shows `{ "id": null, "name": "Another account" }`. */ account: { /** Its id; null for another account, to a key limited to some accounts. */ id: string | null; /** Its name. */ name: string; }; /** Amount of this line in pence; negative is money out. */ amountMinor: number; /** Amount of this line ready to show, such as -£12.50. */ amountDisplay: string; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** The line's category, or null when it has none. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who was paid, or null when none is set. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** What was bought, when the line names it. */ itemName: string | null; /** How many were bought, when the line says. */ quantity: number | null; /** Free-text notes on this line. */ notes: string | null; /** The amount in the currency it was paid in, when that differs from the account's. */ foreign: { /** The three-letter currency code it was paid in, such as EUR. */ currency: string; /** Amount in that currency in its minor unit, such as cents; negative is money out. */ amountMinor: number; /** Amount in that currency ready to show, such as -£12.50. */ amountDisplay: string; /** The exchange rate used to convert it to the account currency, if known. */ rate: string | null; /** The day the rate was taken from (YYYY-MM-DD), if known. */ asOf: string | null; } | null; /** The transaction this line belongs to. */ transaction: { /** The transaction id. */ id: string; /** The day it happened, YYYY-MM-DD in UK time. */ date: string; /** The moment it happened, ISO 8601 in UTC. */ at: string; /** What the transaction is called. */ description: string; /** Whether money went out, came in, or moved between your own accounts. */ kind: "expense" | "income" | "transfer"; /** True for a move between your own accounts. */ isTransfer: boolean; /** True for a round-up transfer into savings. */ isRoundUp: boolean; }; } export type GetTransactionsLinesResponse = GetTransactionsLinesItem[]; export interface GetTransactionsByIdParams { /** The transaction id. */ id: string; } export interface GetTransactionsByIdArgs { params: GetTransactionsByIdParams; signal?: AbortSignal; } export interface GetTransactionsByIdResponse { /** The transaction id. */ id: string; /** The day it happened, YYYY-MM-DD in UK time. */ date: string; /** The moment it happened, ISO 8601 in UTC. */ at: string; /** What the transaction is called. */ description: string; /** True when the app writes the description from the lines, and rewrites it when they change. */ descriptionAuto: boolean; /** Free-text notes. */ notes: string | null; /** Whether money went out, came in, or moved between your own accounts. */ kind: "expense" | "income" | "transfer"; /** True for a move between your own accounts. */ isTransfer: boolean; /** True for a round-up transfer into savings. */ isRoundUp: boolean; /** Net amount of all lines in pence; negative is money out. */ amountMinor: number; /** Net amount of all lines ready to show, such as -£12.50. */ amountDisplay: string; /** The lines that make up the transaction; each moves money in one account. */ lines: Array<{ /** The line id. */ id: string; /** The account this line moves money in or out of. For a key limited to some accounts, a line on another account shows `{ "id": null, "name": "Another account" }`. */ account: { /** Its id; null for another account, to a key limited to some accounts. */ id: string | null; /** Its name. */ name: string; }; /** Amount of this line in pence; negative is money out. */ amountMinor: number; /** Amount of this line ready to show, such as -£12.50. */ amountDisplay: string; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** The line's category, or null when it has none. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who was paid, or null when none is set. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** What was bought, when the line names it. */ itemName: string | null; /** How many were bought, when the line says. */ quantity: number | null; /** Free-text notes on this line. */ notes: string | null; /** The amount in the currency it was paid in, when that differs from the account's. */ foreign: { /** The three-letter currency code it was paid in, such as EUR. */ currency: string; /** Amount in that currency in its minor unit, such as cents; negative is money out. */ amountMinor: number; /** Amount in that currency ready to show, such as -£12.50. */ amountDisplay: string; /** The exchange rate used to convert it to the account currency, if known. */ rate: string | null; /** The day the rate was taken from (YYYY-MM-DD), if known. */ asOf: string | null; } | null; }>; /** The tags on it. */ tags: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** Where it came from, such as manual or an import. */ source: string | null; /** Documents attached to it. Only present when the key can read documents. */ documents?: Array<{ /** The document id. */ id: string; /** The document title. */ title: string; }>; /** When it was added, ISO 8601 in UTC. */ createdAt: string; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string; /** Send as `If-Match` when editing or deleting, to avoid overwriting a newer change. */ version: string; } export interface PostTransactionsBody { /** The transaction’s date: `YYYY-MM-DD` (stored at midday UK time on that day) or an ISO 8601 timestamp for an exact moment. */ date: string; /** What the transaction was, such as `Weekly shop`. Leave it out and the app writes one from the lines, such as `Bought 3 items at Corner Market for £43.50`, and keeps it up to date. */ description?: string; /** For a description the app writes: `long` (`Bought 3 items at Corner Market for £43.50`), `short` (`3 items · Corner Market · £43.50`) or `smart` (long when it fits in 60 characters). Defaults to your Settings choice. */ descriptionStyle?: "smart" | "long" | "short"; /** For a description the app writes: whether it includes the amount. Defaults to your Settings choice. */ descriptionShowAmount?: boolean; /** Private notes on the transaction; `null` clears them. */ notes?: string | null; /** `expense` takes money out, `income` puts money in, `transfer` moves it between two of your accounts. */ kind: "expense" | "income" | "transfer"; /** Tag ids. The transaction ends up with exactly these tags. */ tagIds?: string[]; /** The lines of an expense or income. Use these, or the single-line shorthand (`accountId`, `amountMinor`, `categoryId`, `payeeId`), not both. */ lines?: Array<{ /** A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ accountId: string; /** The line’s size in pence, a whole number that may be zero. The sign comes from the transaction’s `kind` (an expense takes money out, income puts it in); an `adjustment` line such as a discount goes the other way. */ amountMinor: number; /** The category to file this line under. */ categoryId?: string; /** The payee for this line. */ payeeId?: string; /** What was bought, for itemised receipts. */ itemName?: string | null; /** How many were bought (1 if left out). */ quantity?: number | null; /** A private note on this line. */ notes?: string | null; /** `item` (the default), `adjustment` (a discount or voucher that reduces the total) or `surcharge` (a tip, tax or fee that adds to it). */ kind?: "item" | "adjustment" | "surcharge"; }>; /** Single-line shorthand instead of `lines`. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ accountId?: string; /** Single-line shorthand: the amount in pence (zero allowed). For a transfer, the amount moved. */ amountMinor?: number; /** Single-line shorthand: the category. */ categoryId?: string; /** Single-line shorthand: the payee. */ payeeId?: string; /** Transfers only: where the money leaves. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ fromAccountId?: string; /** Transfers only: where the money arrives. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ toAccountId?: string; } export interface PostTransactionsArgs { body: PostTransactionsBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostTransactionsResponse { /** The transaction id. */ id: string; /** The day it happened, YYYY-MM-DD in UK time. */ date: string; /** The moment it happened, ISO 8601 in UTC. */ at: string; /** What the transaction is called. */ description: string; /** True when the app writes the description from the lines, and rewrites it when they change. */ descriptionAuto: boolean; /** Free-text notes. */ notes: string | null; /** Whether money went out, came in, or moved between your own accounts. */ kind: "expense" | "income" | "transfer"; /** True for a move between your own accounts. */ isTransfer: boolean; /** True for a round-up transfer into savings. */ isRoundUp: boolean; /** Net amount of all lines in pence; negative is money out. */ amountMinor: number; /** Net amount of all lines ready to show, such as -£12.50. */ amountDisplay: string; /** The lines that make up the transaction; each moves money in one account. */ lines: Array<{ /** The line id. */ id: string; /** The account this line moves money in or out of. For a key limited to some accounts, a line on another account shows `{ "id": null, "name": "Another account" }`. */ account: { /** Its id; null for another account, to a key limited to some accounts. */ id: string | null; /** Its name. */ name: string; }; /** Amount of this line in pence; negative is money out. */ amountMinor: number; /** Amount of this line ready to show, such as -£12.50. */ amountDisplay: string; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** The line's category, or null when it has none. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who was paid, or null when none is set. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** What was bought, when the line names it. */ itemName: string | null; /** How many were bought, when the line says. */ quantity: number | null; /** Free-text notes on this line. */ notes: string | null; /** The amount in the currency it was paid in, when that differs from the account's. */ foreign: { /** The three-letter currency code it was paid in, such as EUR. */ currency: string; /** Amount in that currency in its minor unit, such as cents; negative is money out. */ amountMinor: number; /** Amount in that currency ready to show, such as -£12.50. */ amountDisplay: string; /** The exchange rate used to convert it to the account currency, if known. */ rate: string | null; /** The day the rate was taken from (YYYY-MM-DD), if known. */ asOf: string | null; } | null; }>; /** The tags on it. */ tags: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** Where it came from, such as manual or an import. */ source: string | null; /** Documents attached to it. Only present when the key can read documents. */ documents?: Array<{ /** The document id. */ id: string; /** The document title. */ title: string; }>; /** When it was added, ISO 8601 in UTC. */ createdAt: string; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string; /** Send as `If-Match` when editing or deleting, to avoid overwriting a newer change. */ version: string; } export interface PatchTransactionsByIdParams { /** The transaction id. */ id: string; } export interface PatchTransactionsByIdBody { /** The transaction’s date: `YYYY-MM-DD` (stored at midday UK time on that day) or an ISO 8601 timestamp for an exact moment. */ date?: string; /** A new description; `null` hands it back to the app, which writes it from the lines. */ description?: string | null; /** For a description the app writes: `long` (`Bought 3 items at Corner Market for £43.50`), `short` (`3 items · Corner Market · £43.50`) or `smart` (long when it fits in 60 characters). Defaults to your Settings choice. */ descriptionStyle?: "smart" | "long" | "short"; /** For a description the app writes: whether it includes the amount. Defaults to your Settings choice. */ descriptionShowAmount?: boolean; /** Private notes on the transaction; `null` clears them. */ notes?: string | null; /** Change the kind. Send `lines` (or the transfer fields) with it, since the amounts change sign. */ kind?: "expense" | "income" | "transfer"; /** Tag ids. The transaction ends up with exactly these tags. */ tagIds?: string[]; /** The full list of lines. A line with an `id` keeps that saved line; one without is added; a saved line left out is removed. */ lines?: Array<{ /** The id of an existing line to keep. Fields you leave out keep their saved value. Leave `id` out to add a new line, which needs every required field. */ id?: string; /** A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ accountId?: string; /** The line’s size in pence, a whole number that may be zero. The sign comes from the transaction’s `kind` (an expense takes money out, income puts it in); an `adjustment` line such as a discount goes the other way. */ amountMinor?: number; /** The category to file this line under. */ categoryId?: string; /** The payee for this line. */ payeeId?: string; /** What was bought, for itemised receipts. */ itemName?: string | null; /** How many were bought (1 if left out). */ quantity?: number | null; /** A private note on this line. */ notes?: string | null; /** `item` (the default), `adjustment` (a discount or voucher that reduces the total) or `surcharge` (a tip, tax or fee that adds to it). */ kind?: "item" | "adjustment" | "surcharge"; }>; /** Single-line shorthand instead of `lines`. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ accountId?: string; /** Single-line shorthand: the amount in pence (zero allowed). For a transfer, the amount moved. */ amountMinor?: number; /** Single-line shorthand: the category. */ categoryId?: string; /** Single-line shorthand: the payee. */ payeeId?: string; /** Transfers only: where the money leaves. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ fromAccountId?: string; /** Transfers only: where the money arrives. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ toAccountId?: string; /** The `version` from your last read, as an alternative to the `If-Match` header. */ version?: string | number; } export interface PatchTransactionsByIdArgs { params: PatchTransactionsByIdParams; body: PatchTransactionsByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchTransactionsByIdResponse { /** The transaction id. */ id: string; /** The day it happened, YYYY-MM-DD in UK time. */ date: string; /** The moment it happened, ISO 8601 in UTC. */ at: string; /** What the transaction is called. */ description: string; /** True when the app writes the description from the lines, and rewrites it when they change. */ descriptionAuto: boolean; /** Free-text notes. */ notes: string | null; /** Whether money went out, came in, or moved between your own accounts. */ kind: "expense" | "income" | "transfer"; /** True for a move between your own accounts. */ isTransfer: boolean; /** True for a round-up transfer into savings. */ isRoundUp: boolean; /** Net amount of all lines in pence; negative is money out. */ amountMinor: number; /** Net amount of all lines ready to show, such as -£12.50. */ amountDisplay: string; /** The lines that make up the transaction; each moves money in one account. */ lines: Array<{ /** The line id. */ id: string; /** The account this line moves money in or out of. For a key limited to some accounts, a line on another account shows `{ "id": null, "name": "Another account" }`. */ account: { /** Its id; null for another account, to a key limited to some accounts. */ id: string | null; /** Its name. */ name: string; }; /** Amount of this line in pence; negative is money out. */ amountMinor: number; /** Amount of this line ready to show, such as -£12.50. */ amountDisplay: string; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** The line's category, or null when it has none. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who was paid, or null when none is set. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** What was bought, when the line names it. */ itemName: string | null; /** How many were bought, when the line says. */ quantity: number | null; /** Free-text notes on this line. */ notes: string | null; /** The amount in the currency it was paid in, when that differs from the account's. */ foreign: { /** The three-letter currency code it was paid in, such as EUR. */ currency: string; /** Amount in that currency in its minor unit, such as cents; negative is money out. */ amountMinor: number; /** Amount in that currency ready to show, such as -£12.50. */ amountDisplay: string; /** The exchange rate used to convert it to the account currency, if known. */ rate: string | null; /** The day the rate was taken from (YYYY-MM-DD), if known. */ asOf: string | null; } | null; }>; /** The tags on it. */ tags: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** Where it came from, such as manual or an import. */ source: string | null; /** Documents attached to it. Only present when the key can read documents. */ documents?: Array<{ /** The document id. */ id: string; /** The document title. */ title: string; }>; /** When it was added, ISO 8601 in UTC. */ createdAt: string; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string; /** Send as `If-Match` when editing or deleting, to avoid overwriting a newer change. */ version: string; } export interface PutTransactionsByIdTagsParams { /** The transaction id. */ id: string; } export interface PutTransactionsByIdTagsBody { /** Tag ids. The transaction ends up with exactly these tags. */ tagIds: string[]; /** The `version` from your last read, as an alternative to the `If-Match` header. */ version?: string | number; } export interface PutTransactionsByIdTagsArgs { params: PutTransactionsByIdTagsParams; body: PutTransactionsByIdTagsBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PutTransactionsByIdTagsResponse { /** The transaction id. */ id: string; /** The day it happened, YYYY-MM-DD in UK time. */ date: string; /** The moment it happened, ISO 8601 in UTC. */ at: string; /** What the transaction is called. */ description: string; /** True when the app writes the description from the lines, and rewrites it when they change. */ descriptionAuto: boolean; /** Free-text notes. */ notes: string | null; /** Whether money went out, came in, or moved between your own accounts. */ kind: "expense" | "income" | "transfer"; /** True for a move between your own accounts. */ isTransfer: boolean; /** True for a round-up transfer into savings. */ isRoundUp: boolean; /** Net amount of all lines in pence; negative is money out. */ amountMinor: number; /** Net amount of all lines ready to show, such as -£12.50. */ amountDisplay: string; /** The lines that make up the transaction; each moves money in one account. */ lines: Array<{ /** The line id. */ id: string; /** The account this line moves money in or out of. For a key limited to some accounts, a line on another account shows `{ "id": null, "name": "Another account" }`. */ account: { /** Its id; null for another account, to a key limited to some accounts. */ id: string | null; /** Its name. */ name: string; }; /** Amount of this line in pence; negative is money out. */ amountMinor: number; /** Amount of this line ready to show, such as -£12.50. */ amountDisplay: string; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** The line's category, or null when it has none. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who was paid, or null when none is set. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** What was bought, when the line names it. */ itemName: string | null; /** How many were bought, when the line says. */ quantity: number | null; /** Free-text notes on this line. */ notes: string | null; /** The amount in the currency it was paid in, when that differs from the account's. */ foreign: { /** The three-letter currency code it was paid in, such as EUR. */ currency: string; /** Amount in that currency in its minor unit, such as cents; negative is money out. */ amountMinor: number; /** Amount in that currency ready to show, such as -£12.50. */ amountDisplay: string; /** The exchange rate used to convert it to the account currency, if known. */ rate: string | null; /** The day the rate was taken from (YYYY-MM-DD), if known. */ asOf: string | null; } | null; }>; /** The tags on it. */ tags: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** Where it came from, such as manual or an import. */ source: string | null; /** Documents attached to it. Only present when the key can read documents. */ documents?: Array<{ /** The document id. */ id: string; /** The document title. */ title: string; }>; /** When it was added, ISO 8601 in UTC. */ createdAt: string; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string; /** Send as `If-Match` when editing or deleting, to avoid overwriting a newer change. */ version: string; } export interface DeleteTransactionsByIdParams { /** The transaction id. */ id: string; } export interface DeleteTransactionsByIdQuery { /** `keep` (the default) leaves attached documents unfiled; `delete` moves documents attached only to this transaction to the trash. */ documents?: "keep" | "delete"; } export interface DeleteTransactionsByIdArgs { params: DeleteTransactionsByIdParams; query?: DeleteTransactionsByIdQuery; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PostTransactionsBatchBody { /** 1–100 transactions, each exactly the body of POST /transactions. */ transactions: Array<{ /** The transaction’s date: `YYYY-MM-DD` (stored at midday UK time on that day) or an ISO 8601 timestamp for an exact moment. */ date: string; /** What the transaction was, such as `Weekly shop`. Leave it out and the app writes one from the lines, such as `Bought 3 items at Corner Market for £43.50`, and keeps it up to date. */ description?: string; /** For a description the app writes: `long` (`Bought 3 items at Corner Market for £43.50`), `short` (`3 items · Corner Market · £43.50`) or `smart` (long when it fits in 60 characters). Defaults to your Settings choice. */ descriptionStyle?: "smart" | "long" | "short"; /** For a description the app writes: whether it includes the amount. Defaults to your Settings choice. */ descriptionShowAmount?: boolean; /** Private notes on the transaction; `null` clears them. */ notes?: string | null; /** `expense` takes money out, `income` puts money in, `transfer` moves it between two of your accounts. */ kind: "expense" | "income" | "transfer"; /** Tag ids. The transaction ends up with exactly these tags. */ tagIds?: string[]; /** The lines of an expense or income. Use these, or the single-line shorthand (`accountId`, `amountMinor`, `categoryId`, `payeeId`), not both. */ lines?: Array<{ /** A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ accountId: string; /** The line’s size in pence, a whole number that may be zero. The sign comes from the transaction’s `kind` (an expense takes money out, income puts it in); an `adjustment` line such as a discount goes the other way. */ amountMinor: number; /** The category to file this line under. */ categoryId?: string; /** The payee for this line. */ payeeId?: string; /** What was bought, for itemised receipts. */ itemName?: string | null; /** How many were bought (1 if left out). */ quantity?: number | null; /** A private note on this line. */ notes?: string | null; /** `item` (the default), `adjustment` (a discount or voucher that reduces the total) or `surcharge` (a tip, tax or fee that adds to it). */ kind?: "item" | "adjustment" | "surcharge"; }>; /** Single-line shorthand instead of `lines`. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ accountId?: string; /** Single-line shorthand: the amount in pence (zero allowed). For a transfer, the amount moved. */ amountMinor?: number; /** Single-line shorthand: the category. */ categoryId?: string; /** Single-line shorthand: the payee. */ payeeId?: string; /** Transfers only: where the money leaves. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ fromAccountId?: string; /** Transfers only: where the money arrives. A payment source id (card, pot or account activity), or a financial account id to use its Direct source. */ toAccountId?: string; }>; } export interface PostTransactionsBatchArgs { body: PostTransactionsBatchBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export type PostTransactionsBatchResponse = Array<{ /** The transaction id. */ id: string; /** The day it happened, YYYY-MM-DD in UK time. */ date: string; /** The moment it happened, ISO 8601 in UTC. */ at: string; /** What the transaction is called. */ description: string; /** True when the app writes the description from the lines, and rewrites it when they change. */ descriptionAuto: boolean; /** Free-text notes. */ notes: string | null; /** Whether money went out, came in, or moved between your own accounts. */ kind: "expense" | "income" | "transfer"; /** True for a move between your own accounts. */ isTransfer: boolean; /** True for a round-up transfer into savings. */ isRoundUp: boolean; /** Net amount of all lines in pence; negative is money out. */ amountMinor: number; /** Net amount of all lines ready to show, such as -£12.50. */ amountDisplay: string; /** The lines that make up the transaction; each moves money in one account. */ lines: Array<{ /** The line id. */ id: string; /** The account this line moves money in or out of. For a key limited to some accounts, a line on another account shows `{ "id": null, "name": "Another account" }`. */ account: { /** Its id; null for another account, to a key limited to some accounts. */ id: string | null; /** Its name. */ name: string; }; /** Amount of this line in pence; negative is money out. */ amountMinor: number; /** Amount of this line ready to show, such as -£12.50. */ amountDisplay: string; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** The line's category, or null when it has none. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who was paid, or null when none is set. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** What was bought, when the line names it. */ itemName: string | null; /** How many were bought, when the line says. */ quantity: number | null; /** Free-text notes on this line. */ notes: string | null; /** The amount in the currency it was paid in, when that differs from the account's. */ foreign: { /** The three-letter currency code it was paid in, such as EUR. */ currency: string; /** Amount in that currency in its minor unit, such as cents; negative is money out. */ amountMinor: number; /** Amount in that currency ready to show, such as -£12.50. */ amountDisplay: string; /** The exchange rate used to convert it to the account currency, if known. */ rate: string | null; /** The day the rate was taken from (YYYY-MM-DD), if known. */ asOf: string | null; } | null; }>; /** The tags on it. */ tags: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** Where it came from, such as manual or an import. */ source: string | null; /** Documents attached to it. Only present when the key can read documents. */ documents?: Array<{ /** The document id. */ id: string; /** The document title. */ title: string; }>; /** When it was added, ISO 8601 in UTC. */ createdAt: string; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string; /** Send as `If-Match` when editing or deleting, to avoid overwriting a newer change. */ version: string; }>; export interface GetTransactionsExportQuery { /** Earliest date, inclusive. `YYYY-MM-DD` (a whole UK day) or an ISO 8601 timestamp. */ from?: string; /** Latest date, inclusive. `YYYY-MM-DD` runs to the end of that UK day; a timestamp is that instant. */ to?: string; /** A payment source (card, pot or account activity) id, or a financial account id for all of its sources. */ accountId?: string; /** Only transactions with a line in this category or any category under it (a parent category includes its subcategories, as on the Transactions page). */ categoryId?: string; /** Only transactions with a line for this payee or any payee under it (a parent payee includes its sub-payees). */ payeeId?: string; /** Only transactions carrying this tag. */ tagId?: string; /** Expense, income or transfer, read from all of a transaction’s lines as the app does. */ kind?: "expense" | "income" | "transfer"; /** Smallest absolute amount in pence, up to 2147483647. */ minAmountMinor?: number; /** Largest absolute amount in pence, up to 2147483647. */ maxAmountMinor?: number; /** Text search over the description, notes and item names, with the same AND / OR / NOT, "quotes" and accent folding as the Transactions page. */ q?: string; /** `true` for transactions with documents attached, `false` for those without. Needs the `documents:read` scope and a key for all accounts. */ hasDocuments?: "0" | "1" | "true" | "false"; /** The file format. Only `csv` for now. */ format?: "csv"; } export interface GetTransactionsExportArgs { query?: GetTransactionsExportQuery; signal?: AbortSignal; } export type GetTransactionsExportResponse = string; export interface GetCategoriesQuery { /** Archived items: `exclude` (default), `include` or `only`. With `updatedSince` the default is `include`, so a change to archived shows. */ archived?: "exclude" | "include" | "only"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; } export interface GetCategoriesArgs { query?: GetCategoriesQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetCategoriesItem { /** The category id. */ id: string; /** The category name. */ name: string; /** The parent category, for a category inside a group; null at the top. */ parentId: string | null; /** Set on the categories the app itself relies on, such as starting balance. */ systemKey: string | null; /** The icon name, if one is set. */ icon: string | null; /** The colour as a hex code, if one is set. */ color: string | null; /** Free-text notes about what belongs in this category; null when none are set. */ notes: string | null; /** Position among its siblings; lower comes first. */ sortOrder: number; /** True once it has been archived. */ archived: boolean; /** When it was archived, ISO 8601 in UTC; null if it is not archived. */ archivedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export type GetCategoriesResponse = GetCategoriesItem[]; export interface GetCategoriesByIdParams { /** The category id. */ id: string; } export interface GetCategoriesByIdArgs { params: GetCategoriesByIdParams; signal?: AbortSignal; } export interface GetCategoriesByIdResponse { /** The category id. */ id: string; /** The category name. */ name: string; /** The parent category, for a category inside a group; null at the top. */ parentId: string | null; /** Set on the categories the app itself relies on, such as starting balance. */ systemKey: string | null; /** The icon name, if one is set. */ icon: string | null; /** The colour as a hex code, if one is set. */ color: string | null; /** Free-text notes about what belongs in this category; null when none are set. */ notes: string | null; /** Position among its siblings; lower comes first. */ sortOrder: number; /** True once it has been archived. */ archived: boolean; /** When it was archived, ISO 8601 in UTC; null if it is not archived. */ archivedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface GetRulesQuery { /** Archived items: `exclude` (default), `include` or `only`. With `updatedSince` the default is `include`, so a change to archived shows. */ archived?: "exclude" | "include" | "only"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; } export interface GetRulesArgs { query?: GetRulesQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetRulesItem { /** The rule id. */ id: string; /** The rule name. */ name: string; /** Higher numbers win when two rules set the same field. */ priority: number; /** False while the rule is switched off. */ enabled: boolean; /** Null follows the default in Settings. */ applyMode: ("suggest" | "auto_apply") | null; /** Whether the rule also approves matching items it trusts without asking. */ autoApproveTrusted: boolean; /** The conditions in words, as the Rules page shows them. */ matchDescription: string; /** The payee the rule matches, or null when it does not match on payee. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Sub-payees of the payee match too. */ matchPayeeSubtree: boolean; /** The payee matched by place rather than by name, or null. */ locationPayee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The payment source the rule matches. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** How the amount is compared: `any` ignores it. */ amountMatch: "any" | "equals" | "above" | "below" | "range"; /** The amount to compare with, in pence; null when the rule ignores amounts. */ amountMinor: number | null; /** That amount ready to show. */ amountDisplay: string | null; /** The upper end, for a range. */ amountMaxMinor: number | null; /** The upper end of a range, ready to show. */ amountMaxDisplay: string | null; /** The category the rule files matches under. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Tags the rule adds. */ tags: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** True once the rule has been archived. */ archived: boolean; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export type GetRulesResponse = GetRulesItem[]; export interface PostCategoriesBody { /** The category name. Names are unique among categories with the same parent. */ name: string; /** The category to nest it under. Omit or null for a top-level category. */ parentId?: string | null; /** An icon from the app's set: store, building, user, globe, shopping-cart, coffee, utensils, home, car, train, heart, briefcase, gift, wallet, tag. Null clears it. */ icon?: ("store" | "building" | "user" | "globe" | "shopping-cart" | "coffee" | "utensils" | "home" | "car" | "train" | "heart" | "briefcase" | "gift" | "wallet" | "tag") | null; /** A six-digit hex colour such as `#cc2936`. Null clears it. */ color?: string | null; /** Free-text notes about what belongs in this category. Null or blank clears them. */ notes?: string | null; } export interface PostCategoriesArgs { body: PostCategoriesBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostCategoriesResponse { /** The category id. */ id: string; /** The category name. */ name: string; /** The parent category, for a category inside a group; null at the top. */ parentId: string | null; /** Set on the categories the app itself relies on, such as starting balance. */ systemKey: string | null; /** The icon name, if one is set. */ icon: string | null; /** The colour as a hex code, if one is set. */ color: string | null; /** Free-text notes about what belongs in this category; null when none are set. */ notes: string | null; /** Position among its siblings; lower comes first. */ sortOrder: number; /** True once it has been archived. */ archived: boolean; /** When it was archived, ISO 8601 in UTC; null if it is not archived. */ archivedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface PatchCategoriesByIdParams { /** The category id. */ id: string; } export interface PatchCategoriesByIdBody { /** A new name. */ name?: string; /** Move under this category, or null to make it top-level. */ parentId?: string | null; /** An icon from the app's set: store, building, user, globe, shopping-cart, coffee, utensils, home, car, train, heart, briefcase, gift, wallet, tag. Null clears it. */ icon?: ("store" | "building" | "user" | "globe" | "shopping-cart" | "coffee" | "utensils" | "home" | "car" | "train" | "heart" | "briefcase" | "gift" | "wallet" | "tag") | null; /** A six-digit hex colour such as `#cc2936`. Null clears it. */ color?: string | null; /** Free-text notes about what belongs in this category. Null or blank clears them. */ notes?: string | null; /** True archives the category and every category inside it; false restores just this one. */ archived?: boolean; /** The `version` you last read, as an alternative to the `If-Match` header. */ version?: string; } export interface PatchCategoriesByIdArgs { params: PatchCategoriesByIdParams; body: PatchCategoriesByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchCategoriesByIdResponse { /** The category id. */ id: string; /** The category name. */ name: string; /** The parent category, for a category inside a group; null at the top. */ parentId: string | null; /** Set on the categories the app itself relies on, such as starting balance. */ systemKey: string | null; /** The icon name, if one is set. */ icon: string | null; /** The colour as a hex code, if one is set. */ color: string | null; /** Free-text notes about what belongs in this category; null when none are set. */ notes: string | null; /** Position among its siblings; lower comes first. */ sortOrder: number; /** True once it has been archived. */ archived: boolean; /** When it was archived, ISO 8601 in UTC; null if it is not archived. */ archivedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface GetPayeesQuery { /** Archived items: `exclude` (default), `include` or `only`. With `updatedSince` the default is `include`, so a change to archived shows. */ archived?: "exclude" | "include" | "only"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; /** Only payees whose name contains this text. */ q?: string; /** Payees per page, 1–200 (50 by default). */ limit?: number; /** `page.nextCursor` from the previous page. */ cursor?: string; } export interface GetPayeesArgs { query?: GetPayeesQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetPayeesItem { /** The payee id. */ id: string; /** The payee name. */ name: string; /** `general` for any payee, `physical` for a shop with locations, `online` for a web shop. */ kind: "general" | "physical" | "online"; /** What the payee is used for. */ transactionType: "expense" | "income" | "both"; /** The payee this one is a branch of. */ parent: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category new transactions with this payee start with, or null. */ defaultCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The icon name, if one is set. */ icon: string | null; /** The colour as a hex code, if one is set. */ color: string | null; /** Address of its logo image, if it has one. */ logoUrl: string | null; /** Its website address, if set. */ websiteUrl: string | null; /** Free-text notes. */ notes: string | null; /** True once it has been archived. */ archived: boolean; /** When it was archived, ISO 8601 in UTC; null if it is not archived. */ archivedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export type GetPayeesResponse = GetPayeesItem[]; export interface GetPayeesByIdParams { /** The payee id. */ id: string; } export interface GetPayeesByIdArgs { params: GetPayeesByIdParams; signal?: AbortSignal; } export interface GetPayeesByIdResponse { /** The payee id. */ id: string; /** The payee name. */ name: string; /** `general` for any payee, `physical` for a shop with locations, `online` for a web shop. */ kind: "general" | "physical" | "online"; /** What the payee is used for. */ transactionType: "expense" | "income" | "both"; /** The payee this one is a branch of. */ parent: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category new transactions with this payee start with, or null. */ defaultCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The icon name, if one is set. */ icon: string | null; /** The colour as a hex code, if one is set. */ color: string | null; /** Address of its logo image, if it has one. */ logoUrl: string | null; /** Its website address, if set. */ websiteUrl: string | null; /** Free-text notes. */ notes: string | null; /** True once it has been archived. */ archived: boolean; /** When it was archived, ISO 8601 in UTC; null if it is not archived. */ archivedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface PostPayeesBody { /** The payee name. Names are unique among payees with the same parent. */ name: string; /** `general` (the default), `physical` (a shop or branch) or `online`. */ kind?: "general" | "physical" | "online"; /** What the payee is used for. Defaults to `both` when creating. */ transactionType?: "expense" | "income" | "both"; /** The payee this one is a branch of. Null makes it top-level. */ parentId?: string | null; /** The category new transactions for this payee start with. Null clears it. */ defaultCategoryId?: string | null; /** An icon from the app's set: store, building, user, globe, shopping-cart, coffee, utensils, home, car, train, heart, briefcase, gift, wallet, tag. */ icon?: ("store" | "building" | "user" | "globe" | "shopping-cart" | "coffee" | "utensils" | "home" | "car" | "train" | "heart" | "briefcase" | "gift" | "wallet" | "tag") | null; /** A six-digit hex colour such as `#cc2936`. */ color?: string | null; /** An https:// address without credentials. */ websiteUrl?: string | null; /** Free text. */ notes?: string | null; } export interface PostPayeesArgs { body: PostPayeesBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostPayeesResponse { /** The payee id. */ id: string; /** The payee name. */ name: string; /** `general` for any payee, `physical` for a shop with locations, `online` for a web shop. */ kind: "general" | "physical" | "online"; /** What the payee is used for. */ transactionType: "expense" | "income" | "both"; /** The payee this one is a branch of. */ parent: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category new transactions with this payee start with, or null. */ defaultCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The icon name, if one is set. */ icon: string | null; /** The colour as a hex code, if one is set. */ color: string | null; /** Address of its logo image, if it has one. */ logoUrl: string | null; /** Its website address, if set. */ websiteUrl: string | null; /** Free-text notes. */ notes: string | null; /** True once it has been archived. */ archived: boolean; /** When it was archived, ISO 8601 in UTC; null if it is not archived. */ archivedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface PatchPayeesByIdParams { /** The payee id. */ id: string; } export interface PatchPayeesByIdBody { /** A new name. */ name?: string; /** `general` (the default), `physical` (a shop or branch) or `online`. */ kind?: "general" | "physical" | "online"; /** What the payee is used for. Defaults to `both` when creating. */ transactionType?: "expense" | "income" | "both"; /** The payee this one is a branch of. Null makes it top-level. */ parentId?: string | null; /** The category new transactions for this payee start with. Null clears it. */ defaultCategoryId?: string | null; /** An icon from the app's set: store, building, user, globe, shopping-cart, coffee, utensils, home, car, train, heart, briefcase, gift, wallet, tag. */ icon?: ("store" | "building" | "user" | "globe" | "shopping-cart" | "coffee" | "utensils" | "home" | "car" | "train" | "heart" | "briefcase" | "gift" | "wallet" | "tag") | null; /** A six-digit hex colour such as `#cc2936`. */ color?: string | null; /** An https:// address without credentials. */ websiteUrl?: string | null; /** Free text. */ notes?: string | null; /** True archives the payee (its sub-payees must be archived first); false restores it. */ archived?: boolean; /** The `version` you last read, as an alternative to the `If-Match` header. */ version?: string; } export interface PatchPayeesByIdArgs { params: PatchPayeesByIdParams; body: PatchPayeesByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchPayeesByIdResponse { /** The payee id. */ id: string; /** The payee name. */ name: string; /** `general` for any payee, `physical` for a shop with locations, `online` for a web shop. */ kind: "general" | "physical" | "online"; /** What the payee is used for. */ transactionType: "expense" | "income" | "both"; /** The payee this one is a branch of. */ parent: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category new transactions with this payee start with, or null. */ defaultCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The icon name, if one is set. */ icon: string | null; /** The colour as a hex code, if one is set. */ color: string | null; /** Address of its logo image, if it has one. */ logoUrl: string | null; /** Its website address, if set. */ websiteUrl: string | null; /** Free-text notes. */ notes: string | null; /** True once it has been archived. */ archived: boolean; /** When it was archived, ISO 8601 in UTC; null if it is not archived. */ archivedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface GetTagsQuery { /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; } export interface GetTagsArgs { query?: GetTagsQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetTagsItem { /** The tag id. */ id: string; /** The tag name. */ name: string; /** How many transactions carry the tag (for a key limited to some accounts, how many of those it can list). */ transactionCount: number; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export type GetTagsResponse = GetTagsItem[]; export interface GetTagsByIdParams { /** The tag id. */ id: string; } export interface GetTagsByIdArgs { params: GetTagsByIdParams; signal?: AbortSignal; } export interface GetTagsByIdResponse { /** The tag id. */ id: string; /** The tag name. */ name: string; /** How many transactions carry the tag (for a key limited to some accounts, how many of those it can list). */ transactionCount: number; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface PostTagsBody { /** The tag name, up to 80 characters. Names are unique, ignoring case. */ name: string; } export interface PostTagsArgs { body: PostTagsBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostTagsResponse { /** The tag id. */ id: string; /** The tag name. */ name: string; /** How many transactions carry the tag (for a key limited to some accounts, how many of those it can list). */ transactionCount: number; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface PatchTagsByIdParams { /** The tag id. */ id: string; } export interface PatchTagsByIdBody { /** The tag name, up to 80 characters. Names are unique, ignoring case. */ name: string; /** The `version` you last read, as an alternative to the `If-Match` header. */ version?: string; } export interface PatchTagsByIdArgs { params: PatchTagsByIdParams; body: PatchTagsByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchTagsByIdResponse { /** The tag id. */ id: string; /** The tag name. */ name: string; /** How many transactions carry the tag (for a key limited to some accounts, how many of those it can list). */ transactionCount: number; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Send as `If-Match` when editing or deleting it, to avoid overwriting a newer change. */ version: string; } export interface DeleteTagsByIdParams { /** The tag id. */ id: string; } export interface DeleteTagsByIdArgs { params: DeleteTagsByIdParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface GetBillsUpcomingQuery { /** How many days ahead to look, 1 to 366. */ days?: number; /** Items per page, 1 to 200. */ limit?: number; /** The `nextCursor` of the previous page. */ cursor?: string; } export interface GetBillsUpcomingArgs { query?: GetBillsUpcomingQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetBillsUpcomingItem { /** `recurring` for an occurrence of a repeating bill, `scheduled` for a one-off scheduled item. */ type: "recurring" | "scheduled"; /** The occurrence id (recurring) or the scheduled item id. */ id: string; /** The recurring series it belongs to; null for a scheduled item. */ seriesId: string | null; /** What the bill is called. */ name: string; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** `pending` waits for you to post it; `pre_approved` will be posted on its day. */ status: "pending" | "pre_approved"; /** The account the money leaves or arrives in, or null. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Transfers only: where the money goes. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Will the account hold enough on the day? Null when there is nothing to judge (income, no account). */ covered: boolean | null; /** How well the account covers it, or null when there is nothing to judge. */ coverage: { /** `covered` when the account will hold enough on the day, `short` when it will not, `unknown` when that cannot be judged. */ status: "covered" | "short" | "unknown"; /** The financial account the money comes out of. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** Available, in whole pence; null when there is none. */ availableMinor: number | null; /** Available, ready to show, such as £12.50; null when there is none. */ availableDisplay: string | null; /** Required, in whole pence. */ requiredMinor: number; /** Required, ready to show, such as £12.50. */ requiredDisplay: string; /** Shortfall, in whole pence; null when there is none. */ shortfallMinor: number | null; /** Shortfall, ready to show, such as £12.50; null when there is none. */ shortfallDisplay: string | null; } | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; } export type GetBillsUpcomingResponse = GetBillsUpcomingItem[]; export interface GetRecurringQuery { /** Comma-separated: active, paused, ended, suggested, dismissed. Default `active,paused`, or all of them with `updatedSince`. */ status?: string; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; } export interface GetRecurringArgs { query?: GetRecurringQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetRecurringItem { /** The series id. */ id: string; /** What the series is called. */ name: string; /** Whether it is running: `active`, `paused`, `ended`, or `suggested` / `dismissed` for ones spotted from your transactions. */ status: "active" | "paused" | "ended" | "suggested" | "dismissed"; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** How often it repeats. */ cadence: "weekly" | "fortnightly" | "four_weekly" | "monthly" | "quarterly" | "yearly" | "custom"; /** Weekday (0 = Sunday) for weekly cadences, day of the month otherwise. */ anchorDay: number; /** Yearly series only. */ anchorMonth: number | null; /** Custom cadence only: every N days. */ intervalDays: number | null; /** The next day it falls due, YYYY-MM-DD; null when it has ended. */ nextDueOn: string | null; /** The last day an occurrence was posted, YYYY-MM-DD, or null. */ lastPostedOn: string | null; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its default category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** Free-text notes. */ notes: string | null; /** Send as `If-Match` when editing the series. */ version: string; /** Expected amount, in whole pence. */ expectedAmountMinor: number; /** Expected amount, ready to show, such as £12.50. */ expectedAmountDisplay: string; } export type GetRecurringResponse = GetRecurringItem[]; export interface GetRecurringByIdParams { /** The id. */ id: string; } export interface GetRecurringByIdArgs { params: GetRecurringByIdParams; signal?: AbortSignal; } export interface GetRecurringByIdResponse { /** The series id. */ id: string; /** What the series is called. */ name: string; /** Whether it is running: `active`, `paused`, `ended`, or `suggested` / `dismissed` for ones spotted from your transactions. */ status: "active" | "paused" | "ended" | "suggested" | "dismissed"; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** How often it repeats. */ cadence: "weekly" | "fortnightly" | "four_weekly" | "monthly" | "quarterly" | "yearly" | "custom"; /** Weekday (0 = Sunday) for weekly cadences, day of the month otherwise. */ anchorDay: number; /** Yearly series only. */ anchorMonth: number | null; /** Custom cadence only: every N days. */ intervalDays: number | null; /** The next day it falls due, YYYY-MM-DD; null when it has ended. */ nextDueOn: string | null; /** The last day an occurrence was posted, YYYY-MM-DD, or null. */ lastPostedOn: string | null; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its default category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** Free-text notes. */ notes: string | null; /** Send as `If-Match` when editing the series. */ version: string; /** Expected amount, in whole pence. */ expectedAmountMinor: number; /** Expected amount, ready to show, such as £12.50. */ expectedAmountDisplay: string; /** Pending and pre-approved, soonest first. */ upcomingOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** The last 12 posted, skipped or cancelled, newest first. */ recentOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; } export interface GetScheduledQuery { /** Comma-separated: pending, pre_approved, posted, cancelled. Default `pending,pre_approved`, or all of them with `updatedSince`. */ status?: string; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; /** Items per page, 1 to 200. */ limit?: number; /** The `nextCursor` of the previous page. */ cursor?: string; } export interface GetScheduledArgs { query?: GetScheduledQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetScheduledItem { /** The scheduled item id. */ id: string; /** What the item is called. */ name: string; /** Free-text notes. */ notes: string | null; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction or cancelled. */ status: "pending" | "pre_approved" | "posted" | "cancelled"; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The lines of the transaction it becomes. */ lines: Array<{ /** The account the line moves money in or out of, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** The line category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** What is bought, when the line names it. */ itemName: string | null; /** How many are bought, when the line says. */ quantity: number | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or cancelling the item. */ version: string; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; } export type GetScheduledResponse = GetScheduledItem[]; export interface GetScheduledByIdParams { /** The id. */ id: string; } export interface GetScheduledByIdArgs { params: GetScheduledByIdParams; signal?: AbortSignal; } export interface GetScheduledByIdResponse { /** The scheduled item id. */ id: string; /** What the item is called. */ name: string; /** Free-text notes. */ notes: string | null; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction or cancelled. */ status: "pending" | "pre_approved" | "posted" | "cancelled"; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The lines of the transaction it becomes. */ lines: Array<{ /** The account the line moves money in or out of, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** The line category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** What is bought, when the line names it. */ itemName: string | null; /** How many are bought, when the line says. */ quantity: number | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or cancelling the item. */ version: string; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; } export interface PostScheduledBody { /** What it is, such as “Car service”. Becomes the transaction description when it posts. */ description: string; /** The day it is due. `YYYY-MM-DD`. */ dueOn: string; /** `expense` is money out, `income` money in, `transfer` between two of your accounts. */ direction: "expense" | "income" | "transfer"; /** The amount in pence, always positive; `direction` says which way it goes. */ amountMinor: number; /** The account the money comes out of (or goes into, for income). A payment source id (the `account` of a bill), not a financial account id. */ accountId: string; /** Transfers only, and required for them: the account the money goes into. */ counterAccountId?: string; /** The category to post it under. Required for an expense or income; a transfer is filed under Transfer. */ categoryId?: string; /** The payee to post it under. */ payeeId?: string; /** Free-text notes. */ notes?: string | null; /** Post it to the ledger by itself on the due day (default false). If the due day is today or past, it posts straight away. */ autoPost?: boolean; /** Send a reminder this many days before it is due, 0 to 30. */ remindDaysBefore?: number; } export interface PostScheduledArgs { body: PostScheduledBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostScheduledResponse { /** The scheduled item id. */ id: string; /** What the item is called. */ name: string; /** Free-text notes. */ notes: string | null; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction or cancelled. */ status: "pending" | "pre_approved" | "posted" | "cancelled"; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The lines of the transaction it becomes. */ lines: Array<{ /** The account the line moves money in or out of, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** The line category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** What is bought, when the line names it. */ itemName: string | null; /** How many are bought, when the line says. */ quantity: number | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or cancelling the item. */ version: string; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; } export interface PatchScheduledByIdParams { /** The id. */ id: string; } export interface PatchScheduledByIdBody { /** A new description. */ description?: string; /** A new due day. `YYYY-MM-DD`. */ dueOn?: string; /** A new amount in pence, always positive. */ amountMinor?: number; /** A new account. A payment source id (the `account` of a bill), not a financial account id. */ accountId?: string; /** Transfers only: a new account the money goes into. */ counterAccountId?: string; /** A new category. Null clears it. */ categoryId?: string | null; /** A new payee. Null clears it. */ payeeId?: string | null; /** New notes. Null clears them. */ notes?: string | null; /** Turn automatic posting on or off. */ autoPost?: boolean; /** Send a reminder this many days before it is due, 0 to 30. */ remindDaysBefore?: number; /** The `version` you last read. The same as sending `If-Match`; if the item has changed since, the answer is 412. */ version?: string | number; } export interface PatchScheduledByIdArgs { params: PatchScheduledByIdParams; body: PatchScheduledByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchScheduledByIdResponse { /** The scheduled item id. */ id: string; /** What the item is called. */ name: string; /** Free-text notes. */ notes: string | null; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction or cancelled. */ status: "pending" | "pre_approved" | "posted" | "cancelled"; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The lines of the transaction it becomes. */ lines: Array<{ /** The account the line moves money in or out of, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** The line category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** What is bought, when the line names it. */ itemName: string | null; /** How many are bought, when the line says. */ quantity: number | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or cancelling the item. */ version: string; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; } export interface PostScheduledByIdPostParams { /** The id. */ id: string; } export interface PostScheduledByIdPostBody { /** The transaction date to post it under (default: the day it was scheduled for). `YYYY-MM-DD`. */ date?: string; /** Post a different amount (in pence, positive) than the one scheduled. */ amountMinor?: number; } export interface PostScheduledByIdPostArgs { params: PostScheduledByIdPostParams; body: PostScheduledByIdPostBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostScheduledByIdPostResponse { /** The scheduled item id. */ id: string; /** What the item is called. */ name: string; /** Free-text notes. */ notes: string | null; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction or cancelled. */ status: "pending" | "pre_approved" | "posted" | "cancelled"; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The lines of the transaction it becomes. */ lines: Array<{ /** The account the line moves money in or out of, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** The line category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** What is bought, when the line names it. */ itemName: string | null; /** How many are bought, when the line says. */ quantity: number | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or cancelling the item. */ version: string; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; } export interface PostScheduledByIdCancelParams { /** The id. */ id: string; } export interface PostScheduledByIdCancelArgs { params: PostScheduledByIdCancelParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostScheduledByIdCancelResponse { /** The scheduled item id. */ id: string; /** What the item is called. */ name: string; /** Free-text notes. */ notes: string | null; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction or cancelled. */ status: "pending" | "pre_approved" | "posted" | "cancelled"; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The lines of the transaction it becomes. */ lines: Array<{ /** The account the line moves money in or out of, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** The line category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** `item` is something bought; `adjustment` a discount or correction; `surcharge` a fee or tip. */ kind: "item" | "adjustment" | "surcharge"; /** What is bought, when the line names it. */ itemName: string | null; /** How many are bought, when the line says. */ quantity: number | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or cancelling the item. */ version: string; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; } export interface PostRecurringBody { /** What it is, such as “Broadband”. */ name: string; /** `expense` (the default), `income` or `transfer`. */ direction?: "expense" | "income" | "transfer"; /** How often it repeats. */ cadence: "weekly" | "fortnightly" | "four_weekly" | "monthly" | "quarterly" | "yearly" | "custom"; /** Weekday (0 = Sunday to 6) for weekly, fortnightly and four-weekly cadences; day of the month (1 to 31) for the rest. Worked out from `startOn` when left out. */ anchorDay?: number; /** Yearly cadence only: the month, 1 to 12. Worked out from `startOn` when left out. */ anchorMonth?: number | null; /** Custom cadence only, and required for it: repeat every this many days. */ intervalDays?: number | null; /** The first day it can fall due (default today). Its first due day is the first one on or after this. `YYYY-MM-DD`. */ startOn?: string; /** The usual amount of one payment, in pence, always positive. */ expectedAmountMinor: number; /** The account it is paid from (or into, for income). A payment source id (the `account` of a bill), not a financial account id. */ accountId: string; /** Transfers only, and required for them: the account the money goes into. */ counterAccountId?: string; /** The category payments are posted under. Required for an expense or income; a transfer is filed under Transfer. */ categoryId?: string; /** The payee payments are posted under. Needed before an occurrence can be posted. */ payeeId?: string; /** Remind this many days before each is due, 0 to 30 (default 3). */ remindDaysBefore?: number; /** Free-text notes. */ notes?: string | null; } export interface PostRecurringArgs { body: PostRecurringBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostRecurringResponse { /** The series id. */ id: string; /** What the series is called. */ name: string; /** Whether it is running: `active`, `paused`, `ended`, or `suggested` / `dismissed` for ones spotted from your transactions. */ status: "active" | "paused" | "ended" | "suggested" | "dismissed"; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** How often it repeats. */ cadence: "weekly" | "fortnightly" | "four_weekly" | "monthly" | "quarterly" | "yearly" | "custom"; /** Weekday (0 = Sunday) for weekly cadences, day of the month otherwise. */ anchorDay: number; /** Yearly series only. */ anchorMonth: number | null; /** Custom cadence only: every N days. */ intervalDays: number | null; /** The next day it falls due, YYYY-MM-DD; null when it has ended. */ nextDueOn: string | null; /** The last day an occurrence was posted, YYYY-MM-DD, or null. */ lastPostedOn: string | null; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its default category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** Free-text notes. */ notes: string | null; /** Send as `If-Match` when editing the series. */ version: string; /** Expected amount, in whole pence. */ expectedAmountMinor: number; /** Expected amount, ready to show, such as £12.50. */ expectedAmountDisplay: string; /** Pending and pre-approved, soonest first. */ upcomingOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** The last 12 posted, skipped or cancelled, newest first. */ recentOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; } export interface PatchRecurringByIdParams { /** The id. */ id: string; } export interface PatchRecurringByIdBody { /** A new name. */ name?: string; /** A new direction. Not allowed while customised or pre-approved payments are still to come. */ direction?: "expense" | "income" | "transfer"; /** A new cadence. Open, uncustomised future occurrences are regenerated; customised or pre-approved ones block it (409-style 400). */ cadence?: "weekly" | "fortnightly" | "four_weekly" | "monthly" | "quarterly" | "yearly" | "custom"; /** Weekday (0 = Sunday to 6) for weekly, fortnightly and four-weekly cadences; day of the month (1 to 31) for the rest. Worked out from `startOn` when left out. */ anchorDay?: number; /** Yearly cadence only: the month, 1 to 12. Worked out from `startOn` when left out. */ anchorMonth?: number | null; /** Custom cadence only, and required for it: repeat every this many days. */ intervalDays?: number | null; /** A new usual amount in pence, always positive. Applies to occurrences not yet customised. */ expectedAmountMinor?: number; /** A new account. A payment source id (the `account` of a bill), not a financial account id. */ accountId?: string; /** Transfers only: a new account the money goes into. */ counterAccountId?: string | null; /** A new default category. Null clears it. */ categoryId?: string | null; /** A new default payee. Null clears it. */ payeeId?: string | null; /** Send a reminder this many days before it is due, 0 to 30. */ remindDaysBefore?: number; /** New notes. Null clears them. */ notes?: string | null; /** The `version` you last read. The same as sending `If-Match`; if the item has changed since, the answer is 412. */ version?: string | number; } export interface PatchRecurringByIdArgs { params: PatchRecurringByIdParams; body: PatchRecurringByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchRecurringByIdResponse { /** The series id. */ id: string; /** What the series is called. */ name: string; /** Whether it is running: `active`, `paused`, `ended`, or `suggested` / `dismissed` for ones spotted from your transactions. */ status: "active" | "paused" | "ended" | "suggested" | "dismissed"; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** How often it repeats. */ cadence: "weekly" | "fortnightly" | "four_weekly" | "monthly" | "quarterly" | "yearly" | "custom"; /** Weekday (0 = Sunday) for weekly cadences, day of the month otherwise. */ anchorDay: number; /** Yearly series only. */ anchorMonth: number | null; /** Custom cadence only: every N days. */ intervalDays: number | null; /** The next day it falls due, YYYY-MM-DD; null when it has ended. */ nextDueOn: string | null; /** The last day an occurrence was posted, YYYY-MM-DD, or null. */ lastPostedOn: string | null; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its default category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** Free-text notes. */ notes: string | null; /** Send as `If-Match` when editing the series. */ version: string; /** Expected amount, in whole pence. */ expectedAmountMinor: number; /** Expected amount, ready to show, such as £12.50. */ expectedAmountDisplay: string; /** Pending and pre-approved, soonest first. */ upcomingOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** The last 12 posted, skipped or cancelled, newest first. */ recentOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; } export interface PostRecurringByIdPauseParams { /** The id. */ id: string; } export interface PostRecurringByIdPauseArgs { params: PostRecurringByIdPauseParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostRecurringByIdPauseResponse { /** The series id. */ id: string; /** What the series is called. */ name: string; /** Whether it is running: `active`, `paused`, `ended`, or `suggested` / `dismissed` for ones spotted from your transactions. */ status: "active" | "paused" | "ended" | "suggested" | "dismissed"; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** How often it repeats. */ cadence: "weekly" | "fortnightly" | "four_weekly" | "monthly" | "quarterly" | "yearly" | "custom"; /** Weekday (0 = Sunday) for weekly cadences, day of the month otherwise. */ anchorDay: number; /** Yearly series only. */ anchorMonth: number | null; /** Custom cadence only: every N days. */ intervalDays: number | null; /** The next day it falls due, YYYY-MM-DD; null when it has ended. */ nextDueOn: string | null; /** The last day an occurrence was posted, YYYY-MM-DD, or null. */ lastPostedOn: string | null; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its default category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** Free-text notes. */ notes: string | null; /** Send as `If-Match` when editing the series. */ version: string; /** Expected amount, in whole pence. */ expectedAmountMinor: number; /** Expected amount, ready to show, such as £12.50. */ expectedAmountDisplay: string; /** Pending and pre-approved, soonest first. */ upcomingOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** The last 12 posted, skipped or cancelled, newest first. */ recentOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; } export interface PostRecurringByIdResumeParams { /** The id. */ id: string; } export interface PostRecurringByIdResumeBody { /** Missed due days to bring back as pending occurrences. They must fall in the missed window; none by default. */ catchUpDueOns?: string[]; } export interface PostRecurringByIdResumeArgs { params: PostRecurringByIdResumeParams; body: PostRecurringByIdResumeBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostRecurringByIdResumeResponse { /** The series id. */ id: string; /** What the series is called. */ name: string; /** Whether it is running: `active`, `paused`, `ended`, or `suggested` / `dismissed` for ones spotted from your transactions. */ status: "active" | "paused" | "ended" | "suggested" | "dismissed"; /** Whether money goes out, comes in or moves between your own accounts. */ direction: "expense" | "income" | "transfer"; /** How often it repeats. */ cadence: "weekly" | "fortnightly" | "four_weekly" | "monthly" | "quarterly" | "yearly" | "custom"; /** Weekday (0 = Sunday) for weekly cadences, day of the month otherwise. */ anchorDay: number; /** Yearly series only. */ anchorMonth: number | null; /** Custom cadence only: every N days. */ intervalDays: number | null; /** The next day it falls due, YYYY-MM-DD; null when it has ended. */ nextDueOn: string | null; /** The last day an occurrence was posted, YYYY-MM-DD, or null. */ lastPostedOn: string | null; /** The account the money leaves or arrives in, or null. */ account: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** For a transfer, the account the money goes to. */ counterAccount: { /** The payment source id. */ id: string; /** The account, card or pot’s own name. */ name: string; /** The glance label the dashboard uses, such as `Lloyds · Main Card •••• 4242`. */ path: string; } | null; /** Its default category, or null. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** Who is paid, or null. */ payee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** How many days before the due date to remind you. */ remindDaysBefore: number; /** Free-text notes. */ notes: string | null; /** Send as `If-Match` when editing the series. */ version: string; /** Expected amount, in whole pence. */ expectedAmountMinor: number; /** Expected amount, ready to show, such as £12.50. */ expectedAmountDisplay: string; /** Pending and pre-approved, soonest first. */ upcomingOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; /** The last 12 posted, skipped or cancelled, newest first. */ recentOccurrences: Array<{ /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; }>; } export interface PostRecurringByIdOccurrencesByDueOnPostParams { /** The recurring series id. */ id: string; /** The occurrence’s due day, `YYYY-MM-DD`, as `dueOn` in the series’ occurrences. */ dueOn: string; } export interface PostRecurringByIdOccurrencesByDueOnPostBody { /** The transaction date to post it under (default: its due day). `YYYY-MM-DD`. */ date?: string; /** Post a different amount (in pence, positive) than planned. */ amountMinor?: number; } export interface PostRecurringByIdOccurrencesByDueOnPostArgs { params: PostRecurringByIdOccurrencesByDueOnPostParams; body: PostRecurringByIdOccurrencesByDueOnPostBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostRecurringByIdOccurrencesByDueOnPostResponse { /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; /** The series it belongs to. */ seriesId: string; } export interface PostRecurringByIdOccurrencesByDueOnSkipParams { /** The recurring series id. */ id: string; /** The occurrence’s due day, `YYYY-MM-DD`, as `dueOn` in the series’ occurrences. */ dueOn: string; } export interface PostRecurringByIdOccurrencesByDueOnSkipArgs { params: PostRecurringByIdOccurrencesByDueOnSkipParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostRecurringByIdOccurrencesByDueOnSkipResponse { /** The occurrence id. */ id: string; /** The day it is due, YYYY-MM-DD. */ dueOn: string; /** Where it has got to: waiting, pre-approved, posted as a transaction, skipped or cancelled. */ status: "pending" | "pre_approved" | "posted" | "skipped" | "cancelled"; /** What the transaction will be called. */ description: string; /** The ledger transaction it was posted as. Always null unless the key can read transactions. */ transactionId: string | null; /** When it was posted, ISO 8601 in UTC; null until then. */ postedAt: string | null; /** Amount, in whole pence. */ amountMinor: number; /** Amount, ready to show, such as £12.50. */ amountDisplay: string; /** The series it belongs to. */ seriesId: string; } export interface GetBudgetsQuery { /** The month to show, `YYYY-MM`. Defaults to the current UK month. */ month?: string; /** Archived items: `exclude` (default), `include` or `only`. With `updatedSince` the default is `include`, so a change to archived shows. */ archived?: "exclude" | "include" | "only"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; } export interface GetBudgetsArgs { query?: GetBudgetsQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetBudgetsItem { /** The budget id. */ id: string; /** The budget name. */ name: string; /** What it watches: a `category`, an `account` or an `envelope` of money set aside. */ scope: "category" | "account" | "envelope"; /** The category (and its subcategories) this budget watches. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The financial account this budget is limited to. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The month these figures are for, YYYY-MM. */ month: string; /** What happens to the unspent amount at month end: nothing, carry it forward, or hold it in a buffer. */ rolloverMode: "none" | "carry" | "buffer"; /** Warn at this percentage of the budget used; null for no alert. */ alertThresholdPercent: number | null; /** True once the budget has been archived. */ archived: boolean; /** Send as `If-Match` when editing the budget. */ version: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; } export type GetBudgetsResponse = GetBudgetsItem[]; export interface GetBudgetsByIdParams { /** The budget id. */ id: string; } export interface GetBudgetsByIdQuery { /** The month to show, `YYYY-MM`. Defaults to the current UK month. */ month?: string; } export interface GetBudgetsByIdArgs { params: GetBudgetsByIdParams; query?: GetBudgetsByIdQuery; signal?: AbortSignal; } export interface GetBudgetsByIdResponse { /** The budget id. */ id: string; /** The budget name. */ name: string; /** What it watches: a `category`, an `account` or an `envelope` of money set aside. */ scope: "category" | "account" | "envelope"; /** The category (and its subcategories) this budget watches. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The financial account this budget is limited to. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The month these figures are for, YYYY-MM. */ month: string; /** What happens to the unspent amount at month end: nothing, carry it forward, or hold it in a buffer. */ rolloverMode: "none" | "carry" | "buffer"; /** Warn at this percentage of the budget used; null for no alert. */ alertThresholdPercent: number | null; /** True once the budget has been archived. */ archived: boolean; /** Send as `If-Match` when editing the budget. */ version: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; /** The earlier months, with the same figures for each. */ history: Array<{ /** The month these figures are for, YYYY-MM. */ month: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; }>; } export interface PostBudgetsBody { /** The budget name. */ name: string; /** `category` watches one category and its subcategories, `account` one financial account, `envelope` is money you put aside and draw on. */ scope: "category" | "account" | "envelope"; /** Required for a `category` budget. */ categoryId?: string | null; /** The financial account, required for an `account` budget. */ accountId?: string | null; /** Defaults to `none`. */ rolloverMode?: "none" | "carry" | "buffer"; /** Percentage of the budget at which to warn you, 1–100. Null for no warning. */ alertThresholdPercent?: number | null; /** The month the first allocation is for, `YYYY-MM`. Defaults to the current UK month. */ month?: string; /** The first month's allocation in pence. Leave out to set it later with `PUT /budgets/{id}/months/{month}`. */ plannedMinor?: number; } export interface PostBudgetsArgs { body: PostBudgetsBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostBudgetsResponse { /** The budget id. */ id: string; /** The budget name. */ name: string; /** What it watches: a `category`, an `account` or an `envelope` of money set aside. */ scope: "category" | "account" | "envelope"; /** The category (and its subcategories) this budget watches. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The financial account this budget is limited to. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The month these figures are for, YYYY-MM. */ month: string; /** What happens to the unspent amount at month end: nothing, carry it forward, or hold it in a buffer. */ rolloverMode: "none" | "carry" | "buffer"; /** Warn at this percentage of the budget used; null for no alert. */ alertThresholdPercent: number | null; /** True once the budget has been archived. */ archived: boolean; /** Send as `If-Match` when editing the budget. */ version: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; /** The earlier months, with the same figures for each. */ history: Array<{ /** The month these figures are for, YYYY-MM. */ month: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; }>; } export interface PatchBudgetsByIdParams { /** The budget id. */ id: string; } export interface PatchBudgetsByIdBody { /** A new name. */ name?: string; /** Watch a different category (category budgets). */ categoryId?: string | null; /** Watch a different financial account (account budgets). */ accountId?: string | null; /** What happens to money left over: `none` (it resets), `carry` (it rolls into next month) or `buffer` (it builds a buffer). */ rolloverMode?: "none" | "carry" | "buffer"; /** Percentage of the budget at which to warn you, 1–100. Null for no warning. */ alertThresholdPercent?: number | null; /** True archives the budget. A budget cannot be restored once archived: `false` on an archived budget answers 409. */ archived?: boolean; /** The month to show in the answer, `YYYY-MM`. Defaults to the current UK month. */ month?: string; /** The `version` you last read, as an alternative to the `If-Match` header. */ version?: string; } export interface PatchBudgetsByIdArgs { params: PatchBudgetsByIdParams; body: PatchBudgetsByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchBudgetsByIdResponse { /** The budget id. */ id: string; /** The budget name. */ name: string; /** What it watches: a `category`, an `account` or an `envelope` of money set aside. */ scope: "category" | "account" | "envelope"; /** The category (and its subcategories) this budget watches. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The financial account this budget is limited to. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The month these figures are for, YYYY-MM. */ month: string; /** What happens to the unspent amount at month end: nothing, carry it forward, or hold it in a buffer. */ rolloverMode: "none" | "carry" | "buffer"; /** Warn at this percentage of the budget used; null for no alert. */ alertThresholdPercent: number | null; /** True once the budget has been archived. */ archived: boolean; /** Send as `If-Match` when editing the budget. */ version: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; /** The earlier months, with the same figures for each. */ history: Array<{ /** The month these figures are for, YYYY-MM. */ month: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; }>; } export interface PutBudgetsByIdMonthsByMonthParams { /** The budget id. */ id: string; /** The month, `YYYY-MM`. */ month: string; } export interface PutBudgetsByIdMonthsByMonthBody { /** The month's allocation in pence. */ amountMinor: number; /** The budget `version` you last read, as an alternative to the `If-Match` header. */ version?: string; } export interface PutBudgetsByIdMonthsByMonthArgs { params: PutBudgetsByIdMonthsByMonthParams; body: PutBudgetsByIdMonthsByMonthBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PutBudgetsByIdMonthsByMonthResponse { /** The budget id. */ id: string; /** The budget name. */ name: string; /** What it watches: a `category`, an `account` or an `envelope` of money set aside. */ scope: "category" | "account" | "envelope"; /** The category (and its subcategories) this budget watches. */ category: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The financial account this budget is limited to. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The month these figures are for, YYYY-MM. */ month: string; /** What happens to the unspent amount at month end: nothing, carry it forward, or hold it in a buffer. */ rolloverMode: "none" | "carry" | "buffer"; /** Warn at this percentage of the budget used; null for no alert. */ alertThresholdPercent: number | null; /** True once the budget has been archived. */ archived: boolean; /** Send as `If-Match` when editing the budget. */ version: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; /** The earlier months, with the same figures for each. */ history: Array<{ /** The month these figures are for, YYYY-MM. */ month: string; /** Spent as a percentage of what was available to spend this month. */ progressPercent: number; /** `under` while there is room, `near` once the alert threshold is reached, `over` once everything available is spent. */ status: "under" | "near" | "over"; /** Amount planned for the month, in whole pence. */ plannedMinor: number; /** Amount planned for the month, ready to show, such as £12.50. */ plannedDisplay: string; /** Amount carried in from earlier months, in whole pence. */ openingMinor: number; /** Amount carried in from earlier months, ready to show, such as £12.50. */ openingDisplay: string; /** Amount added to the budget this month, in whole pence. */ fundingMinor: number; /** Amount added to the budget this month, ready to show, such as £12.50. */ fundingDisplay: string; /** Amount taken from the buffer to cover overspending, in whole pence. */ bufferDrawMinor: number; /** Amount taken from the buffer to cover overspending, ready to show, such as £12.50. */ bufferDrawDisplay: string; /** Amount spent this month, in whole pence. */ spentMinor: number; /** Amount spent this month, ready to show, such as £12.50. */ spentDisplay: string; /** Amount left to spend; negative when over, in whole pence. */ remainingMinor: number; /** Amount left to spend; negative when over, ready to show, such as £12.50. */ remainingDisplay: string; /** Amount spent beyond what was available, in whole pence. */ overLimitMinor: number; /** Amount spent beyond what was available, ready to show, such as £12.50. */ overLimitDisplay: string; /** Amount held in the buffer, in whole pence. */ bufferMinor: number; /** Amount held in the buffer, ready to show, such as £12.50. */ bufferDisplay: string; /** Amount the buffer is short of what it should hold, in whole pence. */ bufferShortfallMinor: number; /** Amount the buffer is short of what it should hold, ready to show, such as £12.50. */ bufferShortfallDisplay: string; }>; } export interface GetGoalsQuery { /** Archived items: `exclude` (default), `include` or `only`. With `updatedSince` the default is `include`, so a change to archived shows. */ archived?: "exclude" | "include" | "only"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). */ updatedSince?: string; } export interface GetGoalsArgs { query?: GetGoalsQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetGoalsItem { /** The goal id. */ id: string; /** The goal name. */ name: string; /** `savings` builds towards a target; `payoff` clears a debt. */ type: "savings" | "payoff"; /** Progress as a whole percentage of the target. */ progressPercent: number; /** Calendar day, YYYY-MM-DD. */ deadline: string | null; /** How the deadline stands: `none` when there is no deadline, `future`, `due` today, `overdue`, or `met` once the target is reached. */ deadlineStatus: "none" | "future" | "due" | "overdue" | "met"; /** Days to the deadline; negative once it has passed. */ remainingDays: number | null; /** The account the goal is measured on. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** The cash account a payoff goal is funded from. */ fundingAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** True once the goal has been archived. */ archived: boolean; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or archiving the goal. */ version: string; /** The amount to reach, in whole pence. */ targetMinor: number; /** The amount to reach, ready to show, such as £12.50. */ targetDisplay: string; /** The amount reached so far, in whole pence. */ progressMinor: number; /** The amount reached so far, ready to show, such as £12.50. */ progressDisplay: string; /** The amount still to find, in whole pence. */ shortfallMinor: number; /** The amount still to find, ready to show, such as £12.50. */ shortfallDisplay: string; /** The amount set aside for it so far, in whole pence. */ reservedMinor: number; /** The amount set aside for it so far, ready to show, such as £12.50. */ reservedDisplay: string; /** For a payoff goal, the debt still owed, in whole pence. */ outstandingDebtMinor: number; /** For a payoff goal, the debt still owed, ready to show, such as £12.50. */ outstandingDebtDisplay: string; /** What to put aside each month to meet the deadline, in whole pence; null when there is none. */ requiredPerMonthMinor: number | null; /** What to put aside each month to meet the deadline, ready to show, such as £12.50; null when there is none. */ requiredPerMonthDisplay: string | null; } export type GetGoalsResponse = GetGoalsItem[]; export interface GetGoalsByIdParams { /** The goal id. */ id: string; } export interface GetGoalsByIdArgs { params: GetGoalsByIdParams; signal?: AbortSignal; } export interface GetGoalsByIdResponse { /** The goal id. */ id: string; /** The goal name. */ name: string; /** `savings` builds towards a target; `payoff` clears a debt. */ type: "savings" | "payoff"; /** Progress as a whole percentage of the target. */ progressPercent: number; /** Calendar day, YYYY-MM-DD. */ deadline: string | null; /** How the deadline stands: `none` when there is no deadline, `future`, `due` today, `overdue`, or `met` once the target is reached. */ deadlineStatus: "none" | "future" | "due" | "overdue" | "met"; /** Days to the deadline; negative once it has passed. */ remainingDays: number | null; /** The account the goal is measured on. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** The cash account a payoff goal is funded from. */ fundingAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** True once the goal has been archived. */ archived: boolean; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or archiving the goal. */ version: string; /** The amount to reach, in whole pence. */ targetMinor: number; /** The amount to reach, ready to show, such as £12.50. */ targetDisplay: string; /** The amount reached so far, in whole pence. */ progressMinor: number; /** The amount reached so far, ready to show, such as £12.50. */ progressDisplay: string; /** The amount still to find, in whole pence. */ shortfallMinor: number; /** The amount still to find, ready to show, such as £12.50. */ shortfallDisplay: string; /** The amount set aside for it so far, in whole pence. */ reservedMinor: number; /** The amount set aside for it so far, ready to show, such as £12.50. */ reservedDisplay: string; /** For a payoff goal, the debt still owed, in whole pence. */ outstandingDebtMinor: number; /** For a payoff goal, the debt still owed, ready to show, such as £12.50. */ outstandingDebtDisplay: string; /** What to put aside each month to meet the deadline, in whole pence; null when there is none. */ requiredPerMonthMinor: number | null; /** What to put aside each month to meet the deadline, ready to show, such as £12.50; null when there is none. */ requiredPerMonthDisplay: string | null; /** Money put towards the goal, newest first. */ funding: Array<{ /** The funding entry id. */ id: string; /** The day the money was put towards the goal, YYYY-MM-DD. */ occurredOn: string; /** A short note. */ note: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** The amount put towards the goal, in whole pence. */ amountMinor: number; /** The amount put towards the goal, ready to show, such as £12.50. */ amountDisplay: string; }>; } export interface PostGoalsBody { /** The goal name. */ name: string; /** `savings` sets cash aside in a cash or savings account; `payoff` repays the debt on a credit account. */ type: "savings" | "payoff"; /** The target in pence. For a payoff goal it cannot exceed the debt now. */ targetMinor: number; /** The day to reach the target by, `YYYY-MM-DD`. Null for no deadline. */ deadline?: string | null; /** The account the goal is measured on: where savings are held, or the credit account to pay off. */ accountId: string; /** For a payoff goal, the cash account its reserved money comes from. */ fundingAccountId?: string | null; } export interface PostGoalsArgs { body: PostGoalsBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostGoalsResponse { /** The goal id. */ id: string; /** The goal name. */ name: string; /** `savings` builds towards a target; `payoff` clears a debt. */ type: "savings" | "payoff"; /** Progress as a whole percentage of the target. */ progressPercent: number; /** Calendar day, YYYY-MM-DD. */ deadline: string | null; /** How the deadline stands: `none` when there is no deadline, `future`, `due` today, `overdue`, or `met` once the target is reached. */ deadlineStatus: "none" | "future" | "due" | "overdue" | "met"; /** Days to the deadline; negative once it has passed. */ remainingDays: number | null; /** The account the goal is measured on. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** The cash account a payoff goal is funded from. */ fundingAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** True once the goal has been archived. */ archived: boolean; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or archiving the goal. */ version: string; /** The amount to reach, in whole pence. */ targetMinor: number; /** The amount to reach, ready to show, such as £12.50. */ targetDisplay: string; /** The amount reached so far, in whole pence. */ progressMinor: number; /** The amount reached so far, ready to show, such as £12.50. */ progressDisplay: string; /** The amount still to find, in whole pence. */ shortfallMinor: number; /** The amount still to find, ready to show, such as £12.50. */ shortfallDisplay: string; /** The amount set aside for it so far, in whole pence. */ reservedMinor: number; /** The amount set aside for it so far, ready to show, such as £12.50. */ reservedDisplay: string; /** For a payoff goal, the debt still owed, in whole pence. */ outstandingDebtMinor: number; /** For a payoff goal, the debt still owed, ready to show, such as £12.50. */ outstandingDebtDisplay: string; /** What to put aside each month to meet the deadline, in whole pence; null when there is none. */ requiredPerMonthMinor: number | null; /** What to put aside each month to meet the deadline, ready to show, such as £12.50; null when there is none. */ requiredPerMonthDisplay: string | null; /** Money put towards the goal, newest first. */ funding: Array<{ /** The funding entry id. */ id: string; /** The day the money was put towards the goal, YYYY-MM-DD. */ occurredOn: string; /** A short note. */ note: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** The amount put towards the goal, in whole pence. */ amountMinor: number; /** The amount put towards the goal, ready to show, such as £12.50. */ amountDisplay: string; }>; } export interface PatchGoalsByIdParams { /** The goal id. */ id: string; } export interface PatchGoalsByIdBody { /** A new name. */ name?: string; /** Changing the type needs the goal to have no reserved funds. */ type?: "savings" | "payoff"; /** A new target in pence; it cannot be below what is reserved. */ targetMinor?: number; /** The day to reach the target by, `YYYY-MM-DD`. Null for no deadline. */ deadline?: string | null; /** Measure on a different account; needs no reserved funds. */ accountId?: string; /** A payoff goal's funding account. */ fundingAccountId?: string | null; /** True archives the goal; false restores it (the account must cover its reserve). */ archived?: boolean; /** The `version` you last read, as an alternative to the `If-Match` header. */ version?: string; } export interface PatchGoalsByIdArgs { params: PatchGoalsByIdParams; body: PatchGoalsByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchGoalsByIdResponse { /** The goal id. */ id: string; /** The goal name. */ name: string; /** `savings` builds towards a target; `payoff` clears a debt. */ type: "savings" | "payoff"; /** Progress as a whole percentage of the target. */ progressPercent: number; /** Calendar day, YYYY-MM-DD. */ deadline: string | null; /** How the deadline stands: `none` when there is no deadline, `future`, `due` today, `overdue`, or `met` once the target is reached. */ deadlineStatus: "none" | "future" | "due" | "overdue" | "met"; /** Days to the deadline; negative once it has passed. */ remainingDays: number | null; /** The account the goal is measured on. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** The cash account a payoff goal is funded from. */ fundingAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** True once the goal has been archived. */ archived: boolean; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or archiving the goal. */ version: string; /** The amount to reach, in whole pence. */ targetMinor: number; /** The amount to reach, ready to show, such as £12.50. */ targetDisplay: string; /** The amount reached so far, in whole pence. */ progressMinor: number; /** The amount reached so far, ready to show, such as £12.50. */ progressDisplay: string; /** The amount still to find, in whole pence. */ shortfallMinor: number; /** The amount still to find, ready to show, such as £12.50. */ shortfallDisplay: string; /** The amount set aside for it so far, in whole pence. */ reservedMinor: number; /** The amount set aside for it so far, ready to show, such as £12.50. */ reservedDisplay: string; /** For a payoff goal, the debt still owed, in whole pence. */ outstandingDebtMinor: number; /** For a payoff goal, the debt still owed, ready to show, such as £12.50. */ outstandingDebtDisplay: string; /** What to put aside each month to meet the deadline, in whole pence; null when there is none. */ requiredPerMonthMinor: number | null; /** What to put aside each month to meet the deadline, ready to show, such as £12.50; null when there is none. */ requiredPerMonthDisplay: string | null; /** Money put towards the goal, newest first. */ funding: Array<{ /** The funding entry id. */ id: string; /** The day the money was put towards the goal, YYYY-MM-DD. */ occurredOn: string; /** A short note. */ note: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** The amount put towards the goal, in whole pence. */ amountMinor: number; /** The amount put towards the goal, ready to show, such as £12.50. */ amountDisplay: string; }>; } export interface PostGoalsByIdFundingParams { /** The goal id. */ id: string; } export interface PostGoalsByIdFundingBody { /** Pence to reserve (positive) or release (negative). */ amountMinor: number; /** The day the money was set aside, `YYYY-MM-DD`, today or earlier. */ date: string; /** A short note shown in the goal's history. */ note?: string | null; } export interface PostGoalsByIdFundingArgs { params: PostGoalsByIdFundingParams; body: PostGoalsByIdFundingBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostGoalsByIdFundingResponse { /** The funding entry id. */ id: string; /** The day the money was put towards the goal, YYYY-MM-DD. */ occurredOn: string; /** A short note. */ note: string | null; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** The amount put towards the goal, in whole pence. */ amountMinor: number; /** The amount put towards the goal, ready to show, such as £12.50. */ amountDisplay: string; /** The goal after the change. */ goal: { /** The goal id. */ id: string; /** The goal name. */ name: string; /** `savings` builds towards a target; `payoff` clears a debt. */ type: "savings" | "payoff"; /** Progress as a whole percentage of the target. */ progressPercent: number; /** Calendar day, YYYY-MM-DD. */ deadline: string | null; /** How the deadline stands: `none` when there is no deadline, `future`, `due` today, `overdue`, or `met` once the target is reached. */ deadlineStatus: "none" | "future" | "due" | "overdue" | "met"; /** Days to the deadline; negative once it has passed. */ remainingDays: number | null; /** The account the goal is measured on. */ account: { /** Its id. */ id: string; /** Its name. */ name: string; }; /** The cash account a payoff goal is funded from. */ fundingAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** True once the goal has been archived. */ archived: boolean; /** When it was created, ISO 8601 in UTC. */ createdAt: string | null; /** Send as `If-Match` when editing or archiving the goal. */ version: string; /** The amount to reach, in whole pence. */ targetMinor: number; /** The amount to reach, ready to show, such as £12.50. */ targetDisplay: string; /** The amount reached so far, in whole pence. */ progressMinor: number; /** The amount reached so far, ready to show, such as £12.50. */ progressDisplay: string; /** The amount still to find, in whole pence. */ shortfallMinor: number; /** The amount still to find, ready to show, such as £12.50. */ shortfallDisplay: string; /** The amount set aside for it so far, in whole pence. */ reservedMinor: number; /** The amount set aside for it so far, ready to show, such as £12.50. */ reservedDisplay: string; /** For a payoff goal, the debt still owed, in whole pence. */ outstandingDebtMinor: number; /** For a payoff goal, the debt still owed, ready to show, such as £12.50. */ outstandingDebtDisplay: string; /** What to put aside each month to meet the deadline, in whole pence; null when there is none. */ requiredPerMonthMinor: number | null; /** What to put aside each month to meet the deadline, ready to show, such as £12.50; null when there is none. */ requiredPerMonthDisplay: string | null; }; } export interface GetInsightsTotalsQuery { /** Start of the range: `YYYY-MM-DD` (that whole UK day) or an ISO 8601 timestamp. Default: 29 days before `to`. */ from?: string; /** End of the range, included: `YYYY-MM-DD` (that whole UK day) or an ISO 8601 timestamp. Default: today. */ to?: string; /** How to split the range: `day`, `week`, `month` or `none` (one group, the default). */ groupBy?: "day" | "week" | "month" | "none"; } export interface GetInsightsTotalsArgs { query?: GetInsightsTotalsQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetInsightsTotalsItem { /** First UK day of the group inside the range. */ start: string; /** Last UK day of the group inside the range. */ end: string; /** Ledger lines counted. */ lineCount: number; /** Income, in whole pence. */ incomeMinor: number; /** Income, ready to show, such as £12.50. */ incomeDisplay: string; /** Spending, in whole pence. */ spendingMinor: number; /** Spending, ready to show, such as £12.50. */ spendingDisplay: string; /** Net, in whole pence. */ netMinor: number; /** Net, ready to show, such as £12.50. */ netDisplay: string; } export type GetInsightsTotalsResponse = GetInsightsTotalsItem[]; export interface GetInsightsCashFlowQuery { /** Start of the range: `YYYY-MM-DD` (that whole UK day) or an ISO 8601 timestamp. Default: 29 days before `to`. */ from?: string; /** End of the range, included: `YYYY-MM-DD` (that whole UK day) or an ISO 8601 timestamp. Default: today. */ to?: string; /** One row per `day` (the default), `week` (Monday to Sunday) or `month`. */ interval?: "day" | "week" | "month"; } export interface GetInsightsCashFlowArgs { query?: GetInsightsCashFlowQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetInsightsCashFlowItem { /** First UK day of the point inside the range. */ start: string; /** Last UK day of the point inside the range. */ end: string; /** Ledger lines counted. */ lineCount: number; /** Income, in whole pence. */ incomeMinor: number; /** Income, ready to show, such as £12.50. */ incomeDisplay: string; /** Spending, in whole pence. */ spendingMinor: number; /** Spending, ready to show, such as £12.50. */ spendingDisplay: string; /** Net, in whole pence. */ netMinor: number; /** Net, ready to show, such as £12.50. */ netDisplay: string; /** Balance of all accounts at the end of the point, in whole pence. */ balanceMinor: number; /** Balance of all accounts at the end of the point, ready to show, such as £12.50. */ balanceDisplay: string; } export type GetInsightsCashFlowResponse = GetInsightsCashFlowItem[]; export interface GetInsightsSpendingQuery { /** Start of the range: `YYYY-MM-DD` (that whole UK day) or an ISO 8601 timestamp. Default: 29 days before `to`. */ from?: string; /** End of the range, included: `YYYY-MM-DD` (that whole UK day) or an ISO 8601 timestamp. Default: today. */ to?: string; /** Group by `category` (the default) or `payee`. */ by?: "category" | "payee"; /** How many rows, 1 to 100. Default 10. */ limit?: number; } export interface GetInsightsSpendingArgs { query?: GetInsightsSpendingQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetInsightsSpendingItem { /** The category or payee id; null for spending with no category or payee. */ id: string | null; /** The category or payee name. */ name: string; /** The category with its parents, such as `Home › Bills`. */ path: string | null; /** Share of `meta.totalSpending` (all spending in the range), 0 to 100, one decimal. */ sharePercent: number; /** Ledger lines counted. */ lineCount: number; /** Spending, in whole pence. */ spendingMinor: number; /** Spending, ready to show, such as £12.50. */ spendingDisplay: string; } export type GetInsightsSpendingResponse = GetInsightsSpendingItem[]; export interface GetInsightsNetWorthQuery { /** Start of the range: `YYYY-MM-DD` (that whole UK day) or an ISO 8601 timestamp. Default: 29 days before `to`. */ from?: string; /** End of the range, included: `YYYY-MM-DD` (that whole UK day) or an ISO 8601 timestamp. Default: today. */ to?: string; } export interface GetInsightsNetWorthArgs { query?: GetInsightsNetWorthQuery; signal?: AbortSignal; } export interface GetInsightsNetWorthResponse { /** The day the change is measured from. */ from: string; /** The balance is as at the end of this day. */ asOf: string; /** Net worth, in whole pence. */ netWorthMinor: number; /** Net worth, ready to show, such as £12.50. */ netWorthDisplay: string; /** Opening net worth, in whole pence. */ openingNetWorthMinor: number; /** Opening net worth, ready to show, such as £12.50. */ openingNetWorthDisplay: string; /** Change, in whole pence. */ changeMinor: number; /** Change, ready to show, such as £12.50. */ changeDisplay: string; } export interface GetInsightsForecastQuery { /** How far ahead: 7, 14, 30, 60, 90 or 180 days. Default 30. */ days?: number; } export interface GetInsightsForecastArgs { query?: GetInsightsForecastQuery; signal?: AbortSignal; } export interface GetInsightsForecastResponse { /** Today, in UK time. */ today: string; /** The last day the forecast covers. */ throughOn: string; /** Whether budgets are switched on, so unscheduled budget spending is included. */ budgetsEnabled: boolean; /** What can be spent without leaving a bill uncovered, and how it is made up. */ safeToSpend: { /** The last day counted. */ throughOn: string; /** The cash accounts whose posted balances are counted. */ postedCashAccounts: Array<{ /** The account id. */ id: string; /** The account name. */ name: string; /** The account balance, in whole pence. */ amountMinor: number; /** The account balance, ready to show, such as £12.50. */ amountDisplay: string; }>; /** Accounts kept aside, left out of the figures. */ keptAsideAccounts: Array<{ /** The account id. */ id: string; /** The account name. */ name: string; /** The account balance, in whole pence. */ amountMinor: number; /** The account balance, ready to show, such as £12.50. */ amountDisplay: string; }>; /** Starting cash, in whole pence. */ startingCashMinor: number; /** Starting cash, ready to show, such as £12.50. */ startingCashDisplay: string; /** Excluded future income, in whole pence. */ excludedFutureIncomeMinor: number; /** Excluded future income, ready to show, such as £12.50. */ excludedFutureIncomeDisplay: string; /** Scheduled income, in whole pence. */ scheduledIncomeMinor: number; /** Scheduled income, ready to show, such as £12.50. */ scheduledIncomeDisplay: string; /** Scheduled expense, in whole pence. */ scheduledExpenseMinor: number; /** Scheduled expense, ready to show, such as £12.50. */ scheduledExpenseDisplay: string; /** Reserved goal, in whole pence. */ reservedGoalMinor: number; /** Reserved goal, ready to show, such as £12.50. */ reservedGoalDisplay: string; /** Reserved envelope, in whole pence. */ reservedEnvelopeMinor: number; /** Reserved envelope, ready to show, such as £12.50. */ reservedEnvelopeDisplay: string; /** Envelope release, in whole pence. */ envelopeReleaseMinor: number; /** Envelope release, ready to show, such as £12.50. */ envelopeReleaseDisplay: string; /** Unreserved cash, in whole pence. */ unreservedCashMinor: number; /** Unreserved cash, ready to show, such as £12.50. */ unreservedCashDisplay: string; /** Kept aside total, in whole pence. */ keptAsideTotalMinor: number; /** Kept aside total, ready to show, such as £12.50. */ keptAsideTotalDisplay: string; /** Unused credit, in whole pence. */ unusedCreditMinor: number; /** Unused credit, ready to show, such as £12.50. */ unusedCreditDisplay: string; /** The safe-to-spend amount, in whole pence. */ amountMinor: number; /** The safe-to-spend amount, ready to show, such as £12.50. */ amountDisplay: string; /** How much a bill goes uncovered by, if any, in whole pence. */ shortfallMinor: number; /** How much a bill goes uncovered by, if any, ready to show, such as £12.50. */ shortfallDisplay: string; }; /** The projected figures for each day, soonest first. */ points: Array<{ /** The day. */ date: string; /** The ids of the `movements` that land on this day. */ movementIds: string[]; /** Scheduled balance, in whole pence. */ scheduledBalanceMinor: number; /** Scheduled balance, ready to show, such as £12.50. */ scheduledBalanceDisplay: string; /** Upper available, in whole pence. */ upperAvailableMinor: number; /** Upper available, ready to show, such as £12.50. */ upperAvailableDisplay: string; /** Lower available, in whole pence. */ lowerAvailableMinor: number; /** Lower available, ready to show, such as £12.50. */ lowerAvailableDisplay: string; /** Scheduled income, in whole pence. */ scheduledIncomeMinor: number; /** Scheduled income, ready to show, such as £12.50. */ scheduledIncomeDisplay: string; /** Scheduled expense, in whole pence. */ scheduledExpenseMinor: number; /** Scheduled expense, ready to show, such as £12.50. */ scheduledExpenseDisplay: string; /** Unscheduled budget, in whole pence. */ unscheduledBudgetMinor: number; /** Unscheduled budget, ready to show, such as £12.50. */ unscheduledBudgetDisplay: string; /** Goal commitment, in whole pence. */ goalCommitmentMinor: number; /** Goal commitment, ready to show, such as £12.50. */ goalCommitmentDisplay: string; /** Envelope release, in whole pence. */ envelopeReleaseMinor: number; /** Envelope release, ready to show, such as £12.50. */ envelopeReleaseDisplay: string; }>; /** The bills, income, allowances and commitments the forecast is made of. */ movements: Array<{ /** The movement id. */ id: string; /** The day it lands. */ date: string; /** What it is: a scheduled bill or income, a budget allowance or a goal commitment. */ kind: "schedule" | "budget_allowance" | "goal_commitment"; /** For a `schedule` movement, where it comes from; null otherwise. */ scheduleKind: ("recurring" | "scheduled" | "posted") | null; /** What it is called. */ label: string; /** The amount of the movement; negative is money out, in whole pence. */ amountMinor: number; /** The amount of the movement; negative is money out, ready to show, such as £12.50. */ amountDisplay: string; }>; /** Things the forecast assumed, in words. */ assumptions: string[]; /** Data that was missing, so the figures may be rough. */ missingData: string[]; /** Starting cash, in whole pence. */ startingCashMinor: number; /** Starting cash, ready to show, such as £12.50. */ startingCashDisplay: string; /** Scheduled income, in whole pence. */ scheduledIncomeMinor: number; /** Scheduled income, ready to show, such as £12.50. */ scheduledIncomeDisplay: string; /** Scheduled expense, in whole pence. */ scheduledExpenseMinor: number; /** Scheduled expense, ready to show, such as £12.50. */ scheduledExpenseDisplay: string; /** Budget unscheduled, in whole pence. */ budgetUnscheduledMinor: number; /** Budget unscheduled, ready to show, such as £12.50. */ budgetUnscheduledDisplay: string; /** Goal commitment, in whole pence. */ goalCommitmentMinor: number; /** Goal commitment, ready to show, such as £12.50. */ goalCommitmentDisplay: string; /** Reserved goal, in whole pence. */ reservedGoalMinor: number; /** Reserved goal, ready to show, such as £12.50. */ reservedGoalDisplay: string; /** Reserved envelope, in whole pence. */ reservedEnvelopeMinor: number; /** Reserved envelope, ready to show, such as £12.50. */ reservedEnvelopeDisplay: string; } export interface GetInsightsRunwayArgs { signal?: AbortSignal; } export interface GetInsightsRunwayResponse { /** A UK calendar day, YYYY-MM-DD. */ today: string; /** Whole days of cover before cash first runs out; null if it never does in the next 90 days. */ runwayDays: number | null; /** The first day cash is projected to go below zero; null if it does not. */ firstNegativeOn: string | null; /** The same, counting unused credit. */ liquidityRunwayDays: number | null; /** How much of the credit limit is used, as a percentage; null with no credit. */ creditUtilisationPercent: number | null; /** How many payments were moved to the next working day. */ workingDayShiftedCount: number; /** Cash already past the day it was due to move. Items that do not change planning cash are left out. */ overdue: { /** How many bills and payments it covers. */ itemCount: number; /** Money coming in, in whole pence. */ inflowMinor: number; /** Money coming in, ready to show, such as £12.50. */ inflowDisplay: string; /** Money going out, in whole pence. */ outflowMinor: number; /** Money going out, ready to show, such as £12.50. */ outflowDisplay: string; /** Inflow minus outflow, in whole pence. */ netMinor: number; /** Inflow minus outflow, ready to show, such as £12.50. */ netDisplay: string; }; /** Cover for the next week, fortnight, month and so on. */ horizons: Array<{ /** How many days ahead this horizon looks. */ days: number; /** The last day of the horizon. */ endsOn: string; /** Whether cash covers everything due in the horizon. */ status: "covered" | "tight" | "short"; /** How many bills and payments it covers. */ itemCount: number; /** Money coming in, in whole pence. */ inflowMinor: number; /** Money coming in, ready to show, such as £12.50. */ inflowDisplay: string; /** Money going out, in whole pence. */ outflowMinor: number; /** Money going out, ready to show, such as £12.50. */ outflowDisplay: string; /** Inflow minus outflow, in whole pence. */ netMinor: number; /** Inflow minus outflow, ready to show, such as £12.50. */ netDisplay: string; /** Projected cash at the end of the horizon, in whole pence. */ projectedBalanceMinor: number; /** Projected cash at the end of the horizon, ready to show, such as £12.50. */ projectedBalanceDisplay: string; /** How much is missing if cash does not cover everything due, in whole pence. */ shortfallMinor: number; /** How much is missing if cash does not cover everything due, ready to show, such as £12.50. */ shortfallDisplay: string; }>; /** Projected cash for each of the next 90 days. */ daily: Array<{ /** The day. */ date: string; /** How many bills and payments fall on it. */ itemCount: number; /** Projected cash at the end of the day, in whole pence. */ balanceMinor: number; /** Projected cash at the end of the day, ready to show, such as £12.50. */ balanceDisplay: string; /** Money coming in that day, in whole pence. */ inflowMinor: number; /** Money coming in that day, ready to show, such as £12.50. */ inflowDisplay: string; /** Money going out that day, in whole pence. */ outflowMinor: number; /** Money going out that day, ready to show, such as £12.50. */ outflowDisplay: string; }>; /** Accounts kept aside, left out of the figures. */ keptAsideAccounts: Array<{ /** The account id. */ id: string; /** The account name. */ name: string; /** The account balance, in whole pence. */ amountMinor: number; /** The account balance, ready to show, such as £12.50. */ amountDisplay: string; }>; /** Available balance, in whole pence. */ availableBalanceMinor: number; /** Available balance, ready to show, such as £12.50. */ availableBalanceDisplay: string; /** Credit card balance, in whole pence. */ creditCardBalanceMinor: number; /** Credit card balance, ready to show, such as £12.50. */ creditCardBalanceDisplay: string; /** Unused credit, in whole pence. */ unusedCreditMinor: number; /** Unused credit, ready to show, such as £12.50. */ unusedCreditDisplay: string; /** Emergency liquidity, in whole pence. */ emergencyLiquidityMinor: number; /** Emergency liquidity, ready to show, such as £12.50. */ emergencyLiquidityDisplay: string; /** Credit limit, in whole pence. */ creditLimitMinor: number; /** Credit limit, ready to show, such as £12.50. */ creditLimitDisplay: string; /** Credit debt, in whole pence. */ creditDebtMinor: number; /** Credit debt, ready to show, such as £12.50. */ creditDebtDisplay: string; /** Kept aside total, in whole pence. */ keptAsideTotalMinor: number; /** Kept aside total, ready to show, such as £12.50. */ keptAsideTotalDisplay: string; } export interface GetSummariesQuery { /** The kind of period: weekly, biweekly, fourweekly, monthly, quarterly or annual. Default monthly. */ type?: "weekly" | "monthly" | "quarterly" | "annual" | "biweekly" | "fourweekly"; /** Rows per page, 1 to 200. */ limit?: number; /** The `nextCursor` of the previous page. */ cursor?: string; } export interface GetSummariesArgs { query?: GetSummariesQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetSummariesItem { /** The id of the latest saved version of this period. */ id: string; /** The length of the period. */ type: "weekly" | "biweekly" | "fourweekly" | "monthly" | "quarterly" | "annual"; /** For example `2026-10` or `2026-W41`. */ periodKey: string; /** The first day of the period. */ periodStart: string; /** The last day of the period. */ periodEnd: string; /** The version was written while the period was still open. */ partial: boolean; /** Which saved version of the period this is; 1 is the first. */ version: number; /** How many versions of the period are saved. */ versionCount: number; /** A one-line summary of the period. */ headline: string | null; /** How many transactions the period holds. */ transactionCount: number | null; /** When this version was written, ISO 8601 in UTC. */ createdAt: string | null; /** Income, in whole pence; null when there is none. */ incomeMinor: number | null; /** Income, ready to show, such as £12.50; null when there is none. */ incomeDisplay: string | null; /** Spending, in whole pence; null when there is none. */ spendingMinor: number | null; /** Spending, ready to show, such as £12.50; null when there is none. */ spendingDisplay: string | null; /** Net, in whole pence; null when there is none. */ netMinor: number | null; /** Net, ready to show, such as £12.50; null when there is none. */ netDisplay: string | null; /** Net change from prior, in whole pence; null when there is none. */ netChangeFromPriorMinor: number | null; /** Net change from prior, ready to show, such as £12.50; null when there is none. */ netChangeFromPriorDisplay: string | null; } export type GetSummariesResponse = GetSummariesItem[]; export interface GetSummariesByIdParams { /** A summary version id from `/summaries`. */ id: string; } export interface GetSummariesByIdArgs { params: GetSummariesByIdParams; signal?: AbortSignal; } export interface GetSummariesByIdResponse { /** The id of the latest saved version of this period. */ id: string; /** The length of the period. */ type: "weekly" | "biweekly" | "fourweekly" | "monthly" | "quarterly" | "annual"; /** For example `2026-10` or `2026-W41`. */ periodKey: string; /** The first day of the period. */ periodStart: string; /** The last day of the period. */ periodEnd: string; /** The version was written while the period was still open. */ partial: boolean; /** Which saved version of the period this is; 1 is the first. */ version: number; /** How many versions of the period are saved. */ versionCount: number; /** A one-line summary of the period. */ headline: string | null; /** How many transactions the period holds. */ transactionCount: number | null; /** Income, in whole pence; null when there is none. */ incomeMinor: number | null; /** Income, ready to show, such as £12.50; null when there is none. */ incomeDisplay: string | null; /** Spending, in whole pence; null when there is none. */ spendingMinor: number | null; /** Spending, ready to show, such as £12.50; null when there is none. */ spendingDisplay: string | null; /** Net, in whole pence; null when there is none. */ netMinor: number | null; /** Net, ready to show, such as £12.50; null when there is none. */ netDisplay: string | null; /** Net change from prior, in whole pence; null when there is none. */ netChangeFromPriorMinor: number | null; /** Net change from prior, ready to show, such as £12.50; null when there is none. */ netChangeFromPriorDisplay: string | null; /** When this version was written, ISO 8601 in UTC. */ createdAt: string | null; /** Transactions have changed since this version was written. */ stale: boolean; /** The summary written out as short paragraphs. */ narrative: string[]; /** The categories with the most spending. */ topCategories: Array<{ /** The category id; null for uncategorised spending. */ categoryId: string | null; /** The category name. */ name: string; /** How many transactions it holds. */ transactionCount: number; /** Total spent in the category, in whole pence. */ amountMinor: number; /** Total spent in the category, ready to show, such as £12.50. */ amountDisplay: string; }>; /** Day by day figures; null for older versions without them. */ dailySeries: Array<{ /** The day. */ date: string; /** How many transactions it holds. */ transactionCount: number; /** Income, in whole pence. */ incomeMinor: number; /** Income, ready to show, such as £12.50. */ incomeDisplay: string; /** Spending, in whole pence. */ spendingMinor: number; /** Spending, ready to show, such as £12.50. */ spendingDisplay: string; /** Net, in whole pence. */ netMinor: number; /** Net, ready to show, such as £12.50. */ netDisplay: string; /** Balance, in whole pence. */ balanceMinor: number; /** Balance, ready to show, such as £12.50. */ balanceDisplay: string; }> | null; /** Null for a key that cannot read accounts, and for older versions without it. */ topAccounts: (Array<{ /** The account id. */ id: string | null; /** The account name. */ name: string; /** How many transactions it holds. */ transactionCount: number; /** Income, in whole pence. */ incomeMinor: number; /** Income, ready to show, such as £12.50. */ incomeDisplay: string; /** Spending, in whole pence. */ spendingMinor: number; /** Spending, ready to show, such as £12.50. */ spendingDisplay: string; }>) | null; /** Things that looked unusual in the period. */ anomalies: Array<{ /** What kind of oddity it is, such as a large expense. */ kind: string; /** Null for a large expense when the key cannot read transactions: the text names it. */ message: string | null; /** Null unless the key can read transactions. */ transactionId: string | null; /** The amount involved, in whole pence; null when there is none. */ amountMinor: number | null; /** The amount involved, ready to show, such as £12.50; null when there is none. */ amountDisplay: string | null; }>; /** Every saved version of the period, newest first. */ versions: Array<{ /** The version id. */ id: string; /** The version number. */ version: number; /** Written while the period was still open. */ partial: boolean; /** When it was written, ISO 8601 in UTC. */ createdAt: string | null; }>; /** Opening balance, in whole pence; null when there is none. */ openingBalanceMinor: number | null; /** Opening balance, ready to show, such as £12.50; null when there is none. */ openingBalanceDisplay: string | null; /** Closing balance, in whole pence; null when there is none. */ closingBalanceMinor: number | null; /** Closing balance, ready to show, such as £12.50; null when there is none. */ closingBalanceDisplay: string | null; } export interface GetDocumentsQuery { /** `all` (default), `unfiled` (attached to nothing), `review` (waiting in the Documents inbox) or `trash`. With `updatedSince` and no tab, the Trash is included. */ tab?: "all" | "unfiled" | "review" | "trash"; /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). A document counts as changed on an edit, a link, or a step in its reading. A trashed document comes back with `trashedAt` set; once the Trash is emptied it is gone for good. */ updatedSince?: string; /** Only these kinds, comma-separated: `receipt,invoice`. `unknown` is a document with no kind set. */ kind?: string | string[]; /** Only documents that arrived this way: `upload`, `shortcut`, `share_target`, `email` or `system`. */ source?: string | string[]; /** `true` for documents attached to anything (a transaction, an inbox item or an account, whatever the key can read), `false` for those attached to nothing. */ linked?: "0" | "1" | "true" | "false"; /** First day (`YYYY-MM-DD`) of the date a document is filed under, inclusive. */ from?: string; /** Last day (`YYYY-MM-DD`) of the date a document is filed under, inclusive. */ to?: string; /** Words to find in titles, file names, notes and the text read from the pages. Every word must match. */ q?: string; /** Documents per page, 1 to 100. Default 50. */ limit?: number; /** `page.nextCursor` from the previous page. */ cursor?: string; } export interface GetDocumentsArgs { query?: GetDocumentsQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetDocumentsItem { /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name, else `Photo` or `PDF`. */ title: string; /** What named it, when it was not the file. */ titleSource: ("user" | "transaction") | null; /** `receipt`, `invoice`, `statement`, `payslip`, `tax`, `policy`, `warranty`, `letter`, `summary`, `other` or `unknown`. */ kind: string; /** How it arrived. */ source: "upload" | "shortcut" | "share_target" | "email" | "system"; /** The file type of the first file, such as `application/pdf`. */ mimeType: string; /** Whether it is made of images or is a PDF. */ family: "image" | "pdf"; /** Files that make it up: photos of a long receipt, say. */ partCount: number; /** How many pages it has, once known. */ pageCount: number | null; /** All originals together, in bytes. */ sizeBytes: number; /** Where reading its text has got to: `processed` once done, `needs_input` when it waits for you, `failed` on an error. */ processingStatus: "upload_pending" | "queued" | "processing" | "processed" | "needs_input" | "failed"; /** `pending` means it waits in the Documents inbox. */ reviewStatus: "none" | "pending" | "done"; /** Transactions, inbox items and accounts it is attached to. Only those the key can read are counted, as in `links`. */ linkCount: number; /** The same purchase in other files, such as an invoice and its receipt from one email; null when it has none. */ pair: { /** `lead`: the other files go with it (the receipt leads). `companion`: it goes with `leadId`. */ role: "lead" | "companion"; /** For a companion, the document it goes with; null for a lead. */ leadId: string | null; /** For a lead, how many other files are paired with it; 0 for a companion. */ companionCount: number; /** `paired`: attaching, detaching or filing one does them all. `suggested`: only offered, as “Same purchase as …?”. */ state: "paired" | "suggested"; } | null; /** The day it is filed under, `YYYY-MM-DD`: the day it is dated when one is set (`documentDate`), else when it was taken, else when it arrived. */ date: string | null; /** When it was added, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Changes whenever the document does. */ version: string; /** Set while it is in the Trash. */ trashedAt: string | null; /** When the Trash removes it for good. */ purgeAfter: string | null; /** Where a search matched, as plain text. */ snippet: string | null; } export type GetDocumentsResponse = GetDocumentsItem[]; export interface GetDocumentsSearchQuery { /** What the document is about, in your own words. At least 3 characters. */ q: string; /** Which documents to search, as for `GET /documents`. */ tab?: "all" | "unfiled" | "review" | "trash"; /** Documents to return, 1 to 20. Default 10. */ limit?: number; } export interface GetDocumentsSearchArgs { query: GetDocumentsSearchQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetDocumentsSearchItem { /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name, else `Photo` or `PDF`. */ title: string; /** What named it, when it was not the file. */ titleSource: ("user" | "transaction") | null; /** `receipt`, `invoice`, `statement`, `payslip`, `tax`, `policy`, `warranty`, `letter`, `summary`, `other` or `unknown`. */ kind: string; /** How it arrived. */ source: "upload" | "shortcut" | "share_target" | "email" | "system"; /** The file type of the first file, such as `application/pdf`. */ mimeType: string; /** Whether it is made of images or is a PDF. */ family: "image" | "pdf"; /** Files that make it up: photos of a long receipt, say. */ partCount: number; /** How many pages it has, once known. */ pageCount: number | null; /** All originals together, in bytes. */ sizeBytes: number; /** Where reading its text has got to: `processed` once done, `needs_input` when it waits for you, `failed` on an error. */ processingStatus: "upload_pending" | "queued" | "processing" | "processed" | "needs_input" | "failed"; /** `pending` means it waits in the Documents inbox. */ reviewStatus: "none" | "pending" | "done"; /** Transactions, inbox items and accounts it is attached to. Only those the key can read are counted, as in `links`. */ linkCount: number; /** The same purchase in other files, such as an invoice and its receipt from one email; null when it has none. */ pair: { /** `lead`: the other files go with it (the receipt leads). `companion`: it goes with `leadId`. */ role: "lead" | "companion"; /** For a companion, the document it goes with; null for a lead. */ leadId: string | null; /** For a lead, how many other files are paired with it; 0 for a companion. */ companionCount: number; /** `paired`: attaching, detaching or filing one does them all. `suggested`: only offered, as “Same purchase as …?”. */ state: "paired" | "suggested"; } | null; /** The day it is filed under, `YYYY-MM-DD`: the day it is dated when one is set (`documentDate`), else when it was taken, else when it arrived. */ date: string | null; /** When it was added, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Changes whenever the document does. */ version: string; /** Set while it is in the Trash. */ trashedAt: string | null; /** When the Trash removes it for good. */ purgeAfter: string | null; /** Where a search matched, as plain text. */ snippet: string | null; /** How closely the document matches the search. */ match: { /** How far the closest passage is from the search, 0 to 0.7. Smaller is closer. */ distance: number; /** The distance in words. */ closeness: "very_close" | "close" | "related"; /** The page that passage is on. */ page: number; }; } export type GetDocumentsSearchResponse = GetDocumentsSearchItem[]; export interface GetDocumentsByIdParams { /** The document, starts with `doc_`. */ id: string; } export interface GetDocumentsByIdArgs { params: GetDocumentsByIdParams; signal?: AbortSignal; } export interface GetDocumentsByIdResponse { /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name, else `Photo` or `PDF`. */ title: string; /** What named it, when it was not the file. */ titleSource: ("user" | "transaction") | null; /** `receipt`, `invoice`, `statement`, `payslip`, `tax`, `policy`, `warranty`, `letter`, `summary`, `other` or `unknown`. */ kind: string; /** How it arrived. */ source: "upload" | "shortcut" | "share_target" | "email" | "system"; /** The file type of the first file, such as `application/pdf`. */ mimeType: string; /** Whether it is made of images or is a PDF. */ family: "image" | "pdf"; /** Files that make it up: photos of a long receipt, say. */ partCount: number; /** How many pages it has, once known. */ pageCount: number | null; /** All originals together, in bytes. */ sizeBytes: number; /** Where reading its text has got to: `processed` once done, `needs_input` when it waits for you, `failed` on an error. */ processingStatus: "upload_pending" | "queued" | "processing" | "processed" | "needs_input" | "failed"; /** `pending` means it waits in the Documents inbox. */ reviewStatus: "none" | "pending" | "done"; /** Transactions, inbox items and accounts it is attached to. Only those the key can read are counted, as in `links`. */ linkCount: number; /** The same purchase in other files, such as an invoice and its receipt from one email; null when it has none. */ pair: { /** `lead`: the other files go with it (the receipt leads). `companion`: it goes with `leadId`. */ role: "lead" | "companion"; /** For a companion, the document it goes with; null for a lead. */ leadId: string | null; /** For a lead, how many other files are paired with it; 0 for a companion. */ companionCount: number; /** `paired`: attaching, detaching or filing one does them all. `suggested`: only offered, as “Same purchase as …?”. */ state: "paired" | "suggested"; } | null; /** The day it is filed under, `YYYY-MM-DD`: the day it is dated when one is set (`documentDate`), else when it was taken, else when it arrived. */ date: string | null; /** When it was added, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Changes whenever the document does. */ version: string; /** Set while it is in the Trash. */ trashedAt: string | null; /** When the Trash removes it for good. */ purgeAfter: string | null; /** Where a search matched, as plain text. */ snippet: string | null; /** The name of the first file as it was uploaded. */ originalFilename: string | null; /** Free-text notes. */ notes: string | null; /** The day it is dated, `YYYY-MM-DD`, when you or a suggested date you used set one; null when none is set. */ documentDate: string | null; /** The time of that day it is dated, `HH:MM` on the UK clock (Europe/London), when one is set with `documentDate` (a receipt’s printed time, say); null when none is. Documents on the same day are listed by it. */ documentTime: string | null; /** The day it was paid, `YYYY-MM-DD`: its transaction’s day when it’s attached to one (the latest, if several), else a day you set; null when not known. Shown only: `date` is what it’s filed under. */ paidDate: string | null; /** Where `paidDate` comes from: its transaction, or you. */ paidFrom: ("transaction" | "you") | null; /** When the photo or scan was taken, ISO 8601 in UTC, when known. */ capturedAt: string | null; /** Why reading it failed, when `processingStatus` is `failed`. */ processingError: string | null; /** What it is attached to. Only things the key can read are listed. */ links: Array<{ /** The link, starts with `dln_`. */ id: string; /** What kind of thing it is attached to. */ targetType: "transaction" | "inbox_item" | "account"; /** The transaction, inbox item or account it is attached to. */ targetId: string; /** Who attached it. Not given for accounts. */ linkSource: ("user" | "auto_match" | "system") | null; /** Accounts only: the statement period, first day. */ periodStart: string | null; /** Accounts only: the statement period, last day. */ periodEnd: string | null; }>; /** The rest of its pair, the lead first; empty when it is not paired. */ pairMembers: Array<{ /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name. */ title: string; /** `lead`: the one the pair goes by (the receipt). */ role: "lead" | "companion"; }>; /** A document from somewhere else offered as the same purchase, not yet paired; null when none. */ suggestedPair: { /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name. */ title: string; } | null; /** The headline values Read with AI found; `null` until a document has been read that way. */ reading: { /** What it was read as: `receipt`, `invoice`, … */ formKind: string | null; /** When it was read, ISO 8601 in UTC. */ readAt: string | null; /** False when the document was read again since this reading. */ current: boolean; /** The shop or company the reading found. */ merchant: string | null; /** `YYYY-MM-DD`, when the reading found a date. */ date: string | null; /** The total found, in whole pence; null when none. */ totalMinor: number | null; /** Ready to show, such as `£12.50`. */ totalDisplay: string | null; /** For a document read as a payslip: what it says, from the same figures Itemise salary uses. Deductions are positive, the money taken off. A value dismissed in the app is null. Never the National Insurance number. Null for anything not read as a payslip. */ payslip: { /** Who paid you, as the payslip names them. */ employer: string | null; /** The day it says you were paid, `YYYY-MM-DD`. */ payDate: string | null; /** The period it pays for, as printed, such as `October 2026` or `Week 28`. */ payPeriod: string | null; /** The tax code it was worked out with, such as `1257L`. */ taxCode: string | null; /** Gross pay for the period, in whole pence; null when there is none. */ grossPayMinor: number | null; /** Gross pay for the period, ready to show, such as £12.50; null when there is none. */ grossPayDisplay: string | null; /** Income tax taken off, in whole pence; null when there is none. */ incomeTaxMinor: number | null; /** Income tax taken off, ready to show, such as £12.50; null when there is none. */ incomeTaxDisplay: string | null; /** National Insurance taken off, in whole pence; null when there is none. */ nationalInsuranceMinor: number | null; /** National Insurance taken off, ready to show, such as £12.50; null when there is none. */ nationalInsuranceDisplay: string | null; /** Your pension contribution taken off, in whole pence; null when there is none. */ pensionMinor: number | null; /** Your pension contribution taken off, ready to show, such as £12.50; null when there is none. */ pensionDisplay: string | null; /** Student loan repayment taken off, in whole pence; null when there is none. */ studentLoanMinor: number | null; /** Student loan repayment taken off, ready to show, such as £12.50; null when there is none. */ studentLoanDisplay: string | null; /** Whatever its total deductions take besides the four above (a share scheme, a union), 0 when they are all of it, in whole pence; null when there is none. */ otherDeductionsMinor: number | null; /** Whatever its total deductions take besides the four above (a share scheme, a union), 0 when they are all of it, ready to show, such as £12.50; null when there is none. */ otherDeductionsDisplay: string | null; /** Net pay: what it says reached your bank, in whole pence; null when there is none. */ netPayMinor: number | null; /** Net pay: what it says reached your bank, ready to show, such as £12.50; null when there is none. */ netPayDisplay: string | null; /** The tax year so far, as the payslip prints it. */ yearToDate: { /** Gross pay in the tax year so far, in whole pence; null when there is none. */ grossPayMinor: number | null; /** Gross pay in the tax year so far, ready to show, such as £12.50; null when there is none. */ grossPayDisplay: string | null; /** Income tax in the tax year so far, in whole pence; null when there is none. */ incomeTaxMinor: number | null; /** Income tax in the tax year so far, ready to show, such as £12.50; null when there is none. */ incomeTaxDisplay: string | null; /** National Insurance in the tax year so far, in whole pence; null when there is none. */ nationalInsuranceMinor: number | null; /** National Insurance in the tax year so far, ready to show, such as £12.50; null when there is none. */ nationalInsuranceDisplay: string | null; /** Pension contributions in the tax year so far, in whole pence; null when there is none. */ pensionMinor: number | null; /** Pension contributions in the tax year so far, ready to show, such as £12.50; null when there is none. */ pensionDisplay: string | null; }; } | null; } | null; /** The lines its reading found, in order: a receipt’s items and discounts, a payslip’s gross pay and deductions. Empty until it has been read with AI, or when its reading was dismissed. */ lines: Array<{ /** The line, starts with `dli_`. A new reading gives every line a new id. */ id: string; /** Its place in the reading’s lines, from 0. */ position: number; /** What the line says, such as `Gross pay`. Account and card numbers are masked. */ description: string | null; /** What the line is, where the reading labelled it: `item` or `discount` on a receipt or invoice. Null where it did not, as on a payslip, whose gross pay is positive and each deduction negative. */ kind: ("item" | "discount" | "subtotal" | "tax" | "service" | "tip" | "total" | "payment" | "change" | "other") | null; /** How many, where the line printed it. */ quantity: number | null; /** The price of one, where the line printed it, in whole pence; null when there is none. */ unitPriceMinor: number | null; /** The price of one, where the line printed it, ready to show, such as £12.50; null when there is none. */ unitPriceDisplay: string | null; /** The line’s amount as printed: an item positive, a discount or deduction negative, in whole pence; null when there is none. */ amountMinor: number | null; /** The line’s amount as printed: an item positive, a discount or deduction negative, ready to show, such as £12.50; null when there is none. */ amountDisplay: string | null; /** How sure the reading is of it: `verified` when it was found where the reading says. */ status: "verified" | "found_elsewhere" | "unsupported" | "disputed" | "missing"; /** A discount printed under its item (a loyalty price): that item’s `position`; null otherwise. */ ofPosition: number | null; /** True when you said it is fine for it to be missing from the transaction. */ dismissed: boolean; /** The transaction line this line is on. Null when it is on none, or the key cannot read transactions. */ transactionLine: { /** The transaction line it is on. */ id: string; /** The transaction that line is part of. */ transactionId: string; /** How it got there: made by Create or Itemise, linked by you, or a pairing you kept. */ linkSource: "create" | "itemise" | "user" | "paired"; } | null; }>; } export interface GetDocumentsByIdTextParams { /** The document, starts with `doc_`. */ id: string; } export interface GetDocumentsByIdTextArgs { params: GetDocumentsByIdTextParams; signal?: AbortSignal; } export interface GetDocumentsByIdTextResponse { /** The document id. */ id: string; /** Where most of the text came from: the PDF’s own text, the app’s reading of the photo, or Live Text. */ source: string | null; /** Length of all the text, even when `pages` stops short. */ characters: number; /** How many pages have any text. */ pagesWithText: number; /** True when long documents were cut to the first 50,000 characters. */ truncated: boolean; /** The pages joined with a blank line between them. */ text: string; /** The text page by page; stops short of `characters` when the text was cut. */ pages: Array<{ /** The page number, from 1. */ page: number; /** Where the text of this page came from. */ source: string; /** The text of the page. */ text: string; }>; } export interface GetDocumentsByIdFileParams { /** The document, starts with `doc_`. */ id: string; } export interface GetDocumentsByIdFileQuery { /** Which file of a document with several photos, from 1. For `variant=page` it is the page. */ part?: number; /** `original` (default), `model` (the copy used for reading), `page` (a PDF page as an image), `thumb` or `unlocked` (a password-protected PDF, unlocked). */ variant?: "original" | "model" | "page" | "thumb" | "unlocked" | "display"; /** `true` to have the file saved rather than shown in a browser. */ download?: "0" | "1" | "true" | "false"; /** `link` answers with `{ url, expiresAt }` instead of redirecting. */ as?: "link"; } export interface GetDocumentsByIdFileArgs { params: GetDocumentsByIdFileParams; query?: GetDocumentsByIdFileQuery; signal?: AbortSignal; } export interface GetDocumentsByIdFileResponse { /** A short-lived address to download the file from. */ url: string; /** When the address stops working, ISO 8601 in UTC. */ expiresAt: string; } export interface PostDocumentsArgs { /** A multipart form: put the file in the field named "file". */ body: FormData; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostDocumentsResponse { /** `added` for a new document, `duplicate` when the file was already there. */ status: "added" | "duplicate"; /** The new document. Not given for a duplicate. */ documentId?: string; /** Where the document opens in the app. Not given for a duplicate. */ url?: string; } export interface PostDocumentsUploadsBody { /** The file’s name, such as `IMG_2041.jpg`. */ name?: string | null; /** The MIME type: `image/jpeg`, `image/png`, `image/heic` or `application/pdf`. */ type: string; /** The file’s size in bytes. */ size: number; /** The SHA-256 of the file’s bytes, in hex (64 characters). */ sha256: string; /** Text read on the phone (Live Text). It only helps find the transaction. */ clientOcrText?: string | null; } export interface PostDocumentsUploadsArgs { body: PostDocumentsUploadsBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostDocumentsUploadsResponse { /** `upload` when the file should be sent to `upload`; `duplicate` when it is already a document. */ status: "upload" | "duplicate"; /** The document being uploaded. */ documentId?: string; /** Always 1 here. */ part?: number; /** Send the file to this form (a `POST` of `fields` plus the file in `file`, or a `PUT` with `headers`) before it expires. */ upload?: { /** The HTTP method to send the file with. */ method: "POST" | "PUT"; /** The address to send the file to. */ url: string; /** `POST` only: form fields to send before the file. */ fields?: { [key: string]: string }; /** `PUT` only: headers to send with the file. */ headers?: { [key: string]: string }; /** When the form stops working, ISO 8601 in UTC. */ expiresAt: string; }; } export interface PostDocumentsByIdPartsParams { /** The document, starts with `doc_`. */ id: string; } export interface PostDocumentsByIdPartsBody { /** The file’s name, such as `IMG_2041.jpg`. */ name?: string | null; /** The MIME type: `image/jpeg`, `image/png`, `image/heic` or `application/pdf`. */ type: string; /** The file’s size in bytes. */ size: number; /** The SHA-256 of the file’s bytes, in hex (64 characters). */ sha256: string; /** Text read on the phone (Live Text). It only helps find the transaction. */ clientOcrText?: string | null; /** The page this file is: 2 for the second, and so on. A retry sends the same number. */ part: number; } export interface PostDocumentsByIdPartsArgs { params: PostDocumentsByIdPartsParams; body: PostDocumentsByIdPartsBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostDocumentsByIdPartsResponse { /** The document this page belongs to. */ documentId: string; /** The page number this upload is for. */ part: number; /** Where to send the file’s bytes. */ upload: { /** The HTTP method to send the file with. */ method: "POST" | "PUT"; /** The address to send the file to. */ url: string; /** `POST` only: form fields to send before the file. */ fields?: { [key: string]: string }; /** `PUT` only: headers to send with the file. */ headers?: { [key: string]: string }; /** When the form stops working, ISO 8601 in UTC. */ expiresAt: string; }; } export interface PostDocumentsByIdCompleteParams { /** The document, starts with `doc_`. */ id: string; } export interface PostDocumentsByIdCompleteArgs { params: PostDocumentsByIdCompleteParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostDocumentsByIdCompleteResponse { /** `added` for a new document, `duplicate` when the file was already there. */ status: "added" | "duplicate"; /** Not given for a duplicate. */ documentId?: string; /** Where the document opens in the app. Not given for a duplicate. */ url?: string; } export interface PatchDocumentsByIdParams { /** The document, starts with `doc_`. */ id: string; } export interface PatchDocumentsByIdBody { /** A new title, up to 200 characters. `null` or blank means the file’s name. */ title?: string | null; /** `receipt`, `invoice`, `statement`, `payslip`, `tax`, `policy`, `warranty`, `letter`, `summary`, `other` or `unknown` (not set). */ kind?: "receipt" | "invoice" | "statement" | "payslip" | "tax" | "policy" | "warranty" | "letter" | "summary" | "other" | "unknown"; /** Your notes, up to 5000 characters. `null` or blank clears them. */ notes?: string | null; /** The day it is dated, `YYYY-MM-DD`, from 2000 to tomorrow. `null` clears it (and its time), so it is filed under when it was taken or arrived again. */ date?: string | null; /** The time of that day it is dated, `HH:MM` on the UK clock (Europe/London); it needs a date, sent with it or already set. `null` clears it. Left out, it stays, unless `date` changes to another day. */ time?: string | null; /** The day it was paid, `YYYY-MM-DD`, for a document on no transaction (one on a transaction is paid that transaction’s day). `null` clears it. */ paidDate?: string | null; /** `true` files a document waiting in the Documents inbox without a transaction; `false` sends it to the Documents inbox, from anywhere in the vault. What it is attached to stays. */ reviewed?: boolean; /** The `version` you last read; the same as sending `If-Match`. */ version?: string; } export interface PatchDocumentsByIdArgs { params: PatchDocumentsByIdParams; body: PatchDocumentsByIdBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PatchDocumentsByIdResponse { /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name, else `Photo` or `PDF`. */ title: string; /** What named it, when it was not the file. */ titleSource: ("user" | "transaction") | null; /** `receipt`, `invoice`, `statement`, `payslip`, `tax`, `policy`, `warranty`, `letter`, `summary`, `other` or `unknown`. */ kind: string; /** How it arrived. */ source: "upload" | "shortcut" | "share_target" | "email" | "system"; /** The file type of the first file, such as `application/pdf`. */ mimeType: string; /** Whether it is made of images or is a PDF. */ family: "image" | "pdf"; /** Files that make it up: photos of a long receipt, say. */ partCount: number; /** How many pages it has, once known. */ pageCount: number | null; /** All originals together, in bytes. */ sizeBytes: number; /** Where reading its text has got to: `processed` once done, `needs_input` when it waits for you, `failed` on an error. */ processingStatus: "upload_pending" | "queued" | "processing" | "processed" | "needs_input" | "failed"; /** `pending` means it waits in the Documents inbox. */ reviewStatus: "none" | "pending" | "done"; /** Transactions, inbox items and accounts it is attached to. Only those the key can read are counted, as in `links`. */ linkCount: number; /** The same purchase in other files, such as an invoice and its receipt from one email; null when it has none. */ pair: { /** `lead`: the other files go with it (the receipt leads). `companion`: it goes with `leadId`. */ role: "lead" | "companion"; /** For a companion, the document it goes with; null for a lead. */ leadId: string | null; /** For a lead, how many other files are paired with it; 0 for a companion. */ companionCount: number; /** `paired`: attaching, detaching or filing one does them all. `suggested`: only offered, as “Same purchase as …?”. */ state: "paired" | "suggested"; } | null; /** The day it is filed under, `YYYY-MM-DD`: the day it is dated when one is set (`documentDate`), else when it was taken, else when it arrived. */ date: string | null; /** When it was added, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Changes whenever the document does. */ version: string; /** Set while it is in the Trash. */ trashedAt: string | null; /** When the Trash removes it for good. */ purgeAfter: string | null; /** Where a search matched, as plain text. */ snippet: string | null; /** The name of the first file as it was uploaded. */ originalFilename: string | null; /** Free-text notes. */ notes: string | null; /** The day it is dated, `YYYY-MM-DD`, when you or a suggested date you used set one; null when none is set. */ documentDate: string | null; /** The time of that day it is dated, `HH:MM` on the UK clock (Europe/London), when one is set with `documentDate` (a receipt’s printed time, say); null when none is. Documents on the same day are listed by it. */ documentTime: string | null; /** The day it was paid, `YYYY-MM-DD`: its transaction’s day when it’s attached to one (the latest, if several), else a day you set; null when not known. Shown only: `date` is what it’s filed under. */ paidDate: string | null; /** Where `paidDate` comes from: its transaction, or you. */ paidFrom: ("transaction" | "you") | null; /** When the photo or scan was taken, ISO 8601 in UTC, when known. */ capturedAt: string | null; /** Why reading it failed, when `processingStatus` is `failed`. */ processingError: string | null; /** What it is attached to. Only things the key can read are listed. */ links: Array<{ /** The link, starts with `dln_`. */ id: string; /** What kind of thing it is attached to. */ targetType: "transaction" | "inbox_item" | "account"; /** The transaction, inbox item or account it is attached to. */ targetId: string; /** Who attached it. Not given for accounts. */ linkSource: ("user" | "auto_match" | "system") | null; /** Accounts only: the statement period, first day. */ periodStart: string | null; /** Accounts only: the statement period, last day. */ periodEnd: string | null; }>; /** The rest of its pair, the lead first; empty when it is not paired. */ pairMembers: Array<{ /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name. */ title: string; /** `lead`: the one the pair goes by (the receipt). */ role: "lead" | "companion"; }>; /** A document from somewhere else offered as the same purchase, not yet paired; null when none. */ suggestedPair: { /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name. */ title: string; } | null; /** The headline values Read with AI found; `null` until a document has been read that way. */ reading: { /** What it was read as: `receipt`, `invoice`, … */ formKind: string | null; /** When it was read, ISO 8601 in UTC. */ readAt: string | null; /** False when the document was read again since this reading. */ current: boolean; /** The shop or company the reading found. */ merchant: string | null; /** `YYYY-MM-DD`, when the reading found a date. */ date: string | null; /** The total found, in whole pence; null when none. */ totalMinor: number | null; /** Ready to show, such as `£12.50`. */ totalDisplay: string | null; /** For a document read as a payslip: what it says, from the same figures Itemise salary uses. Deductions are positive, the money taken off. A value dismissed in the app is null. Never the National Insurance number. Null for anything not read as a payslip. */ payslip: { /** Who paid you, as the payslip names them. */ employer: string | null; /** The day it says you were paid, `YYYY-MM-DD`. */ payDate: string | null; /** The period it pays for, as printed, such as `October 2026` or `Week 28`. */ payPeriod: string | null; /** The tax code it was worked out with, such as `1257L`. */ taxCode: string | null; /** Gross pay for the period, in whole pence; null when there is none. */ grossPayMinor: number | null; /** Gross pay for the period, ready to show, such as £12.50; null when there is none. */ grossPayDisplay: string | null; /** Income tax taken off, in whole pence; null when there is none. */ incomeTaxMinor: number | null; /** Income tax taken off, ready to show, such as £12.50; null when there is none. */ incomeTaxDisplay: string | null; /** National Insurance taken off, in whole pence; null when there is none. */ nationalInsuranceMinor: number | null; /** National Insurance taken off, ready to show, such as £12.50; null when there is none. */ nationalInsuranceDisplay: string | null; /** Your pension contribution taken off, in whole pence; null when there is none. */ pensionMinor: number | null; /** Your pension contribution taken off, ready to show, such as £12.50; null when there is none. */ pensionDisplay: string | null; /** Student loan repayment taken off, in whole pence; null when there is none. */ studentLoanMinor: number | null; /** Student loan repayment taken off, ready to show, such as £12.50; null when there is none. */ studentLoanDisplay: string | null; /** Whatever its total deductions take besides the four above (a share scheme, a union), 0 when they are all of it, in whole pence; null when there is none. */ otherDeductionsMinor: number | null; /** Whatever its total deductions take besides the four above (a share scheme, a union), 0 when they are all of it, ready to show, such as £12.50; null when there is none. */ otherDeductionsDisplay: string | null; /** Net pay: what it says reached your bank, in whole pence; null when there is none. */ netPayMinor: number | null; /** Net pay: what it says reached your bank, ready to show, such as £12.50; null when there is none. */ netPayDisplay: string | null; /** The tax year so far, as the payslip prints it. */ yearToDate: { /** Gross pay in the tax year so far, in whole pence; null when there is none. */ grossPayMinor: number | null; /** Gross pay in the tax year so far, ready to show, such as £12.50; null when there is none. */ grossPayDisplay: string | null; /** Income tax in the tax year so far, in whole pence; null when there is none. */ incomeTaxMinor: number | null; /** Income tax in the tax year so far, ready to show, such as £12.50; null when there is none. */ incomeTaxDisplay: string | null; /** National Insurance in the tax year so far, in whole pence; null when there is none. */ nationalInsuranceMinor: number | null; /** National Insurance in the tax year so far, ready to show, such as £12.50; null when there is none. */ nationalInsuranceDisplay: string | null; /** Pension contributions in the tax year so far, in whole pence; null when there is none. */ pensionMinor: number | null; /** Pension contributions in the tax year so far, ready to show, such as £12.50; null when there is none. */ pensionDisplay: string | null; }; } | null; } | null; /** The lines its reading found, in order: a receipt’s items and discounts, a payslip’s gross pay and deductions. Empty until it has been read with AI, or when its reading was dismissed. */ lines: Array<{ /** The line, starts with `dli_`. A new reading gives every line a new id. */ id: string; /** Its place in the reading’s lines, from 0. */ position: number; /** What the line says, such as `Gross pay`. Account and card numbers are masked. */ description: string | null; /** What the line is, where the reading labelled it: `item` or `discount` on a receipt or invoice. Null where it did not, as on a payslip, whose gross pay is positive and each deduction negative. */ kind: ("item" | "discount" | "subtotal" | "tax" | "service" | "tip" | "total" | "payment" | "change" | "other") | null; /** How many, where the line printed it. */ quantity: number | null; /** The price of one, where the line printed it, in whole pence; null when there is none. */ unitPriceMinor: number | null; /** The price of one, where the line printed it, ready to show, such as £12.50; null when there is none. */ unitPriceDisplay: string | null; /** The line’s amount as printed: an item positive, a discount or deduction negative, in whole pence; null when there is none. */ amountMinor: number | null; /** The line’s amount as printed: an item positive, a discount or deduction negative, ready to show, such as £12.50; null when there is none. */ amountDisplay: string | null; /** How sure the reading is of it: `verified` when it was found where the reading says. */ status: "verified" | "found_elsewhere" | "unsupported" | "disputed" | "missing"; /** A discount printed under its item (a loyalty price): that item’s `position`; null otherwise. */ ofPosition: number | null; /** True when you said it is fine for it to be missing from the transaction. */ dismissed: boolean; /** The transaction line this line is on. Null when it is on none, or the key cannot read transactions. */ transactionLine: { /** The transaction line it is on. */ id: string; /** The transaction that line is part of. */ transactionId: string; /** How it got there: made by Create or Itemise, linked by you, or a pairing you kept. */ linkSource: "create" | "itemise" | "user" | "paired"; } | null; }>; } export interface PostDocumentsByIdLinksParams { /** The document, starts with `doc_`. */ id: string; } export interface PostDocumentsByIdLinksBody { /** What to attach it to. */ targetType: "transaction" | "account" | "inbox"; /** The transaction, account or inbox item. */ targetId: string; /** Accounts only: the first day of the statement period (`YYYY-MM-DD`). */ periodStart?: string; /** Accounts only: the last day of the statement period. */ periodEnd?: string; } export interface PostDocumentsByIdLinksArgs { params: PostDocumentsByIdLinksParams; body: PostDocumentsByIdLinksBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostDocumentsByIdLinksResponse { /** The link, starts with `dln_`. */ id: string; /** What kind of thing it is attached to. */ targetType: "transaction" | "inbox_item" | "account"; /** The transaction, inbox item or account it is attached to. */ targetId: string; /** Who attached it. Not given for accounts. */ linkSource: ("user" | "auto_match" | "system") | null; /** Accounts only: the statement period, first day. */ periodStart: string | null; /** Accounts only: the statement period, last day. */ periodEnd: string | null; } export interface DeleteDocumentsByIdLinksByLinkIdParams { /** The document, starts with `doc_`. */ id: string; /** The attachment, starts with `dln_`. */ linkId: string; } export interface DeleteDocumentsByIdLinksByLinkIdArgs { params: DeleteDocumentsByIdLinksByLinkIdParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface DeleteDocumentsByIdParams { /** The document, starts with `doc_`. */ id: string; } export interface DeleteDocumentsByIdArgs { params: DeleteDocumentsByIdParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } export interface PostDocumentsByIdRestoreParams { /** The document, starts with `doc_`. */ id: string; } export interface PostDocumentsByIdRestoreArgs { params: PostDocumentsByIdRestoreParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostDocumentsByIdRestoreResponse { /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name, else `Photo` or `PDF`. */ title: string; /** What named it, when it was not the file. */ titleSource: ("user" | "transaction") | null; /** `receipt`, `invoice`, `statement`, `payslip`, `tax`, `policy`, `warranty`, `letter`, `summary`, `other` or `unknown`. */ kind: string; /** How it arrived. */ source: "upload" | "shortcut" | "share_target" | "email" | "system"; /** The file type of the first file, such as `application/pdf`. */ mimeType: string; /** Whether it is made of images or is a PDF. */ family: "image" | "pdf"; /** Files that make it up: photos of a long receipt, say. */ partCount: number; /** How many pages it has, once known. */ pageCount: number | null; /** All originals together, in bytes. */ sizeBytes: number; /** Where reading its text has got to: `processed` once done, `needs_input` when it waits for you, `failed` on an error. */ processingStatus: "upload_pending" | "queued" | "processing" | "processed" | "needs_input" | "failed"; /** `pending` means it waits in the Documents inbox. */ reviewStatus: "none" | "pending" | "done"; /** Transactions, inbox items and accounts it is attached to. Only those the key can read are counted, as in `links`. */ linkCount: number; /** The same purchase in other files, such as an invoice and its receipt from one email; null when it has none. */ pair: { /** `lead`: the other files go with it (the receipt leads). `companion`: it goes with `leadId`. */ role: "lead" | "companion"; /** For a companion, the document it goes with; null for a lead. */ leadId: string | null; /** For a lead, how many other files are paired with it; 0 for a companion. */ companionCount: number; /** `paired`: attaching, detaching or filing one does them all. `suggested`: only offered, as “Same purchase as …?”. */ state: "paired" | "suggested"; } | null; /** The day it is filed under, `YYYY-MM-DD`: the day it is dated when one is set (`documentDate`), else when it was taken, else when it arrived. */ date: string | null; /** When it was added, ISO 8601 in UTC. */ createdAt: string | null; /** When it last changed, ISO 8601 in UTC. */ updatedAt: string | null; /** Changes whenever the document does. */ version: string; /** Set while it is in the Trash. */ trashedAt: string | null; /** When the Trash removes it for good. */ purgeAfter: string | null; /** Where a search matched, as plain text. */ snippet: string | null; /** The name of the first file as it was uploaded. */ originalFilename: string | null; /** Free-text notes. */ notes: string | null; /** The day it is dated, `YYYY-MM-DD`, when you or a suggested date you used set one; null when none is set. */ documentDate: string | null; /** The time of that day it is dated, `HH:MM` on the UK clock (Europe/London), when one is set with `documentDate` (a receipt’s printed time, say); null when none is. Documents on the same day are listed by it. */ documentTime: string | null; /** The day it was paid, `YYYY-MM-DD`: its transaction’s day when it’s attached to one (the latest, if several), else a day you set; null when not known. Shown only: `date` is what it’s filed under. */ paidDate: string | null; /** Where `paidDate` comes from: its transaction, or you. */ paidFrom: ("transaction" | "you") | null; /** When the photo or scan was taken, ISO 8601 in UTC, when known. */ capturedAt: string | null; /** Why reading it failed, when `processingStatus` is `failed`. */ processingError: string | null; /** What it is attached to. Only things the key can read are listed. */ links: Array<{ /** The link, starts with `dln_`. */ id: string; /** What kind of thing it is attached to. */ targetType: "transaction" | "inbox_item" | "account"; /** The transaction, inbox item or account it is attached to. */ targetId: string; /** Who attached it. Not given for accounts. */ linkSource: ("user" | "auto_match" | "system") | null; /** Accounts only: the statement period, first day. */ periodStart: string | null; /** Accounts only: the statement period, last day. */ periodEnd: string | null; }>; /** The rest of its pair, the lead first; empty when it is not paired. */ pairMembers: Array<{ /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name. */ title: string; /** `lead`: the one the pair goes by (the receipt). */ role: "lead" | "companion"; }>; /** A document from somewhere else offered as the same purchase, not yet paired; null when none. */ suggestedPair: { /** Starts with `doc_`. */ id: string; /** Its title, else the file’s name. */ title: string; } | null; /** The headline values Read with AI found; `null` until a document has been read that way. */ reading: { /** What it was read as: `receipt`, `invoice`, … */ formKind: string | null; /** When it was read, ISO 8601 in UTC. */ readAt: string | null; /** False when the document was read again since this reading. */ current: boolean; /** The shop or company the reading found. */ merchant: string | null; /** `YYYY-MM-DD`, when the reading found a date. */ date: string | null; /** The total found, in whole pence; null when none. */ totalMinor: number | null; /** Ready to show, such as `£12.50`. */ totalDisplay: string | null; /** For a document read as a payslip: what it says, from the same figures Itemise salary uses. Deductions are positive, the money taken off. A value dismissed in the app is null. Never the National Insurance number. Null for anything not read as a payslip. */ payslip: { /** Who paid you, as the payslip names them. */ employer: string | null; /** The day it says you were paid, `YYYY-MM-DD`. */ payDate: string | null; /** The period it pays for, as printed, such as `October 2026` or `Week 28`. */ payPeriod: string | null; /** The tax code it was worked out with, such as `1257L`. */ taxCode: string | null; /** Gross pay for the period, in whole pence; null when there is none. */ grossPayMinor: number | null; /** Gross pay for the period, ready to show, such as £12.50; null when there is none. */ grossPayDisplay: string | null; /** Income tax taken off, in whole pence; null when there is none. */ incomeTaxMinor: number | null; /** Income tax taken off, ready to show, such as £12.50; null when there is none. */ incomeTaxDisplay: string | null; /** National Insurance taken off, in whole pence; null when there is none. */ nationalInsuranceMinor: number | null; /** National Insurance taken off, ready to show, such as £12.50; null when there is none. */ nationalInsuranceDisplay: string | null; /** Your pension contribution taken off, in whole pence; null when there is none. */ pensionMinor: number | null; /** Your pension contribution taken off, ready to show, such as £12.50; null when there is none. */ pensionDisplay: string | null; /** Student loan repayment taken off, in whole pence; null when there is none. */ studentLoanMinor: number | null; /** Student loan repayment taken off, ready to show, such as £12.50; null when there is none. */ studentLoanDisplay: string | null; /** Whatever its total deductions take besides the four above (a share scheme, a union), 0 when they are all of it, in whole pence; null when there is none. */ otherDeductionsMinor: number | null; /** Whatever its total deductions take besides the four above (a share scheme, a union), 0 when they are all of it, ready to show, such as £12.50; null when there is none. */ otherDeductionsDisplay: string | null; /** Net pay: what it says reached your bank, in whole pence; null when there is none. */ netPayMinor: number | null; /** Net pay: what it says reached your bank, ready to show, such as £12.50; null when there is none. */ netPayDisplay: string | null; /** The tax year so far, as the payslip prints it. */ yearToDate: { /** Gross pay in the tax year so far, in whole pence; null when there is none. */ grossPayMinor: number | null; /** Gross pay in the tax year so far, ready to show, such as £12.50; null when there is none. */ grossPayDisplay: string | null; /** Income tax in the tax year so far, in whole pence; null when there is none. */ incomeTaxMinor: number | null; /** Income tax in the tax year so far, ready to show, such as £12.50; null when there is none. */ incomeTaxDisplay: string | null; /** National Insurance in the tax year so far, in whole pence; null when there is none. */ nationalInsuranceMinor: number | null; /** National Insurance in the tax year so far, ready to show, such as £12.50; null when there is none. */ nationalInsuranceDisplay: string | null; /** Pension contributions in the tax year so far, in whole pence; null when there is none. */ pensionMinor: number | null; /** Pension contributions in the tax year so far, ready to show, such as £12.50; null when there is none. */ pensionDisplay: string | null; }; } | null; } | null; /** The lines its reading found, in order: a receipt’s items and discounts, a payslip’s gross pay and deductions. Empty until it has been read with AI, or when its reading was dismissed. */ lines: Array<{ /** The line, starts with `dli_`. A new reading gives every line a new id. */ id: string; /** Its place in the reading’s lines, from 0. */ position: number; /** What the line says, such as `Gross pay`. Account and card numbers are masked. */ description: string | null; /** What the line is, where the reading labelled it: `item` or `discount` on a receipt or invoice. Null where it did not, as on a payslip, whose gross pay is positive and each deduction negative. */ kind: ("item" | "discount" | "subtotal" | "tax" | "service" | "tip" | "total" | "payment" | "change" | "other") | null; /** How many, where the line printed it. */ quantity: number | null; /** The price of one, where the line printed it, in whole pence; null when there is none. */ unitPriceMinor: number | null; /** The price of one, where the line printed it, ready to show, such as £12.50; null when there is none. */ unitPriceDisplay: string | null; /** The line’s amount as printed: an item positive, a discount or deduction negative, in whole pence; null when there is none. */ amountMinor: number | null; /** The line’s amount as printed: an item positive, a discount or deduction negative, ready to show, such as £12.50; null when there is none. */ amountDisplay: string | null; /** How sure the reading is of it: `verified` when it was found where the reading says. */ status: "verified" | "found_elsewhere" | "unsupported" | "disputed" | "missing"; /** A discount printed under its item (a loyalty price): that item’s `position`; null otherwise. */ ofPosition: number | null; /** True when you said it is fine for it to be missing from the transaction. */ dismissed: boolean; /** The transaction line this line is on. Null when it is on none, or the key cannot read transactions. */ transactionLine: { /** The transaction line it is on. */ id: string; /** The transaction that line is part of. */ transactionId: string; /** How it got there: made by Create or Itemise, linked by you, or a pairing you kept. */ linkSource: "create" | "itemise" | "user" | "paired"; } | null; }>; } export interface GetSearchQuery { /** What to look for. Every word must match. At least 2 characters. */ q: string; /** Only these kinds of result, comma-separated: `transaction`, `account`, `payee`, `category`, `tag`, `bill`, `document` (plurals work too). Default: every kind the key can read. */ types?: string | string[]; /** Results of each kind, 1 to 20. Default 5. */ limit?: number; } export interface GetSearchArgs { query: GetSearchQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetSearchItem { /** What sort of thing it is, such as `transaction` or `document`. */ type: "transaction" | "account" | "payee" | "category" | "tag" | "bill" | "document"; /** The id to use with that type’s own endpoint, such as `GET /transactions/{id}`. */ id: string; /** Its name or description. */ title: string; /** A second line of context: the payee and account, the institution, the document kind. */ subtitle: string | null; /** `YYYY-MM-DD`: a transaction’s or document’s day, a bill’s next due date. */ date: string | null; /** Whole pence, negative for money out. 0 for a transfer between your own accounts. `null` for things without an amount. */ amountMinor: number | null; /** The amount ready to show, or null. */ amountDisplay: string | null; } export type GetSearchResponse = GetSearchItem[]; export interface GetInboxQuery { /** Only items changed at or after this time (inclusive): an ISO 8601 timestamp such as `2026-10-24T18:30:00Z` (no offset means UK time; a plain date is the start of that UK day). Send the `page.asOf` of your last run (of its first page, if it took several), not the newest `updatedAt` you saw; it is a few seconds before the read, so an item may come back twice: update by id. Items that were archived or trashed since then come back with that state. Deleted items are not listed (compare ids for a full check). Lists items of every status that changed (approved, dismissed and expired ones too, flagged by `status`), oldest first, and without suggestions for those no longer pending. */ updatedSince?: string; /** Items per page, 1 to 50. Default 50. */ limit?: number; /** `page.nextCursor` from the previous page. */ cursor?: string; } export interface GetInboxArgs { query?: GetInboxQuery; signal?: AbortSignal; } /** One item of the list. */ export interface GetInboxItem { /** The inbox item id. */ id: string; /** `pending` waits for you; `approved` became a transaction; `dismissed` was thrown away; `expired` was left too long. */ status: "pending" | "approved" | "dismissed" | "expired"; /** The merchant as the wallet sent it. */ merchant: string; /** Whole pence, negative for money spent. 0 when the purchase arrived without an amount. */ amountMinor: number; /** The amount ready to show, such as -£4.80. */ amountDisplay: string; /** False when the purchase arrived without an amount and waits for you to fill it in. */ hasAmount: boolean; /** What was charged in the merchant’s own currency, for a foreign purchase. */ original: { /** The three-letter currency code charged, such as EUR. */ currency: string; /** The amount in that currency's minor unit (cents for EUR); negative for money spent. */ amountMinor: number; /** That amount ready to show. */ amountDisplay: string; } | null; /** The day of the purchase (`YYYY-MM-DD`), when the wallet gave one. */ date: string | null; /** The card label the wallet sent, such as `Visa •• 4242`. */ card: string | null; /** When it reached the inbox. */ receivedAt: string | null; /** The payee it will probably be filed under, if one was worked out. */ suggestedPayee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category it will probably be filed under, if one was worked out. */ suggestedCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The card or account the purchase probably came from. */ suggestedAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; } export type GetInboxResponse = GetInboxItem[]; export interface GetInboxByIdParams { /** The inbox item. */ id: string; } export interface GetInboxByIdArgs { params: GetInboxByIdParams; signal?: AbortSignal; } export interface GetInboxByIdResponse { /** The inbox item id. */ id: string; /** `pending` waits for you; `approved` became a transaction; `dismissed` was thrown away; `expired` was left too long. */ status: "pending" | "approved" | "dismissed" | "expired"; /** The merchant as the wallet sent it. */ merchant: string; /** Whole pence, negative for money spent. 0 when the purchase arrived without an amount. */ amountMinor: number; /** The amount ready to show, such as -£4.80. */ amountDisplay: string; /** False when the purchase arrived without an amount and waits for you to fill it in. */ hasAmount: boolean; /** What was charged in the merchant’s own currency, for a foreign purchase. */ original: { /** The three-letter currency code charged, such as EUR. */ currency: string; /** The amount in that currency's minor unit (cents for EUR); negative for money spent. */ amountMinor: number; /** That amount ready to show. */ amountDisplay: string; } | null; /** The day of the purchase (`YYYY-MM-DD`), when the wallet gave one. */ date: string | null; /** The card label the wallet sent, such as `Visa •• 4242`. */ card: string | null; /** When it reached the inbox. */ receivedAt: string | null; /** The payee it will probably be filed under, if one was worked out. */ suggestedPayee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category it will probably be filed under, if one was worked out. */ suggestedCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The card or account the purchase probably came from. */ suggestedAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The Shortcut that sent it, if one did. */ shortcutName: string | null; /** Other payees it could be filed under. */ alternatePayees: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** Other categories it could be filed under. */ alternateCategories: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** Other accounts it could have come from. */ alternateAccounts: Array<{ /** Its id. */ id: string; /** Its name. */ name: string; }>; /** True when the same purchase looks already recorded or queued. */ possibleDuplicate: boolean; /** What it looks like a repeat of. */ possibleDuplicates: { /** Only listed when the key can read transactions. */ transactionIds: string[]; /** Other inbox items it looks like a repeat of. */ inboxItemIds: string[]; }; /** The transaction it became, once approved. Only given when the key can read transactions. */ transactionId: string | null; /** Documents attached to it. Only present when the key can read documents. */ documents?: Array<{ /** The document id. */ id: string; /** The document title. */ title: string; }>; } export interface PostInboxBody { /** The merchant or title shown in the inbox. Leave it out when the wallet cannot say. */ merchant?: string | null; /** Pence spent, as a positive whole number (`495` is £4.95). Leave it out, or send 0, for a purchase that arrived without an amount: it waits for you to fill it in. */ amountMinor?: number | null; /** The day of the purchase: `YYYY-MM-DD` or an ISO 8601 date-time (no offset means UK time). Wins over `date`. Dates like `05/10/2026` are refused: the day and month order would be a guess. */ transactionDate?: string; /** The same as `transactionDate`, for clients that call it this. */ date?: string; /** The card label the wallet sent, such as `Visa •• 4242`. It helps pick the account. */ card?: string; /** The name of the Shortcut sending this. */ name?: string; /** Makes a retry safe, like the `Idempotency-Key` header (send either; if both, they must match). A purchase already queued under this key is answered again, not queued twice. */ idempotencyKey?: string; /** Anything else worth keeping with the purchase. Kept as sent and shown in its history. */ metadata?: { [key: string]: unknown }; originalCurrency?: string | null; originalAmountMinor?: number | null; fxRate?: (number | string) | null; fxSource?: ("manual" | "derived" | "frankfurter") | null; fxAsOf?: string | null; } export interface PostInboxArgs { body: PostInboxBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostInboxResponse { /** The inbox item id. */ id: string; /** `pending` waits for you; `approved` became a transaction; `dismissed` was thrown away; `expired` was left too long. */ status: "pending" | "approved" | "dismissed" | "expired"; /** The merchant as the wallet sent it. */ merchant: string; /** Whole pence, negative for money spent. 0 when the purchase arrived without an amount. */ amountMinor: number; /** The amount ready to show, such as -£4.80. */ amountDisplay: string; /** False when the purchase arrived without an amount and waits for you to fill it in. */ hasAmount: boolean; /** What was charged in the merchant’s own currency, for a foreign purchase. */ original: { /** The three-letter currency code charged, such as EUR. */ currency: string; /** The amount in that currency's minor unit (cents for EUR); negative for money spent. */ amountMinor: number; /** That amount ready to show. */ amountDisplay: string; } | null; /** The day of the purchase (`YYYY-MM-DD`), when the wallet gave one. */ date: string | null; /** The card label the wallet sent, such as `Visa •• 4242`. */ card: string | null; /** When it reached the inbox. */ receivedAt: string | null; /** The payee it will probably be filed under, if one was worked out. */ suggestedPayee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category it will probably be filed under, if one was worked out. */ suggestedCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The card or account the purchase probably came from. */ suggestedAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** True when an auto-approve rule posted it straight away. */ autoApproved: boolean; /** True when this key had already queued the purchase, so nothing new was added. */ deduplicated: boolean; } export interface PostInboxByIdApproveParams { /** The inbox item. */ id: string; } export interface PostInboxByIdApproveBody { /** The category to post under. Left out, the one saved for this merchant is used. */ categoryId?: string; /** The payee. Left out, the one saved for this merchant is used. */ payeeId?: string; /** The card or pot it was paid from, or a financial account id to use its Direct source. Left out, the saved one, or the one card the label names, is used. */ accountId?: string; /** The transaction’s description. Left out, the merchant as the wallet sent it. */ description?: string; /** Pence to post, as a positive whole number. Needed when the purchase arrived without an amount; also corrects one. */ amountMinor?: number; } export interface PostInboxByIdApproveArgs { params: PostInboxByIdApproveParams; body: PostInboxByIdApproveBody; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostInboxByIdApproveResponse { /** The inbox item id. */ id: string; /** `pending` waits for you; `approved` became a transaction; `dismissed` was thrown away; `expired` was left too long. */ status: "pending" | "approved" | "dismissed" | "expired"; /** The merchant as the wallet sent it. */ merchant: string; /** Whole pence, negative for money spent. 0 when the purchase arrived without an amount. */ amountMinor: number; /** The amount ready to show, such as -£4.80. */ amountDisplay: string; /** False when the purchase arrived without an amount and waits for you to fill it in. */ hasAmount: boolean; /** What was charged in the merchant’s own currency, for a foreign purchase. */ original: { /** The three-letter currency code charged, such as EUR. */ currency: string; /** The amount in that currency's minor unit (cents for EUR); negative for money spent. */ amountMinor: number; /** That amount ready to show. */ amountDisplay: string; } | null; /** The day of the purchase (`YYYY-MM-DD`), when the wallet gave one. */ date: string | null; /** The card label the wallet sent, such as `Visa •• 4242`. */ card: string | null; /** When it reached the inbox. */ receivedAt: string | null; /** The payee it will probably be filed under, if one was worked out. */ suggestedPayee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category it will probably be filed under, if one was worked out. */ suggestedCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The card or account the purchase probably came from. */ suggestedAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The transaction it became. Read it with `GET /transactions/{id}` (needs `transactions:read`). */ transactionId: string; } export interface PostInboxByIdDismissParams { /** The inbox item. */ id: string; } export interface PostInboxByIdDismissArgs { params: PostInboxByIdDismissParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; signal?: AbortSignal; } export interface PostInboxByIdDismissResponse { /** The inbox item id. */ id: string; /** `pending` waits for you; `approved` became a transaction; `dismissed` was thrown away; `expired` was left too long. */ status: "pending" | "approved" | "dismissed" | "expired"; /** The merchant as the wallet sent it. */ merchant: string; /** Whole pence, negative for money spent. 0 when the purchase arrived without an amount. */ amountMinor: number; /** The amount ready to show, such as -£4.80. */ amountDisplay: string; /** False when the purchase arrived without an amount and waits for you to fill it in. */ hasAmount: boolean; /** What was charged in the merchant’s own currency, for a foreign purchase. */ original: { /** The three-letter currency code charged, such as EUR. */ currency: string; /** The amount in that currency's minor unit (cents for EUR); negative for money spent. */ amountMinor: number; /** That amount ready to show. */ amountDisplay: string; } | null; /** The day of the purchase (`YYYY-MM-DD`), when the wallet gave one. */ date: string | null; /** The card label the wallet sent, such as `Visa •• 4242`. */ card: string | null; /** When it reached the inbox. */ receivedAt: string | null; /** The payee it will probably be filed under, if one was worked out. */ suggestedPayee: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The category it will probably be filed under, if one was worked out. */ suggestedCategory: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; /** The card or account the purchase probably came from. */ suggestedAccount: { /** Its id. */ id: string; /** Its name. */ name: string; } | null; } export interface DeleteInboxByIdParams { /** The inbox item. */ id: string; } export interface DeleteInboxByIdArgs { params: DeleteInboxByIdParams; /** Makes a retry safe: the same key within 24 hours replays the first answer. */ idempotencyKey?: string; /** The item's `version` from your last read; a newer change makes the call fail with 412. */ ifMatch?: string; signal?: AbortSignal; } // --- Client --- /** The default address of the API this file was generated from. */ export const JAG_FINANCE_BASE_URL = 'https://finance.jagwebsites.xyz/api/v1'; export function createJagFinanceClient(options: JagFinanceClientOptions) { const config: ClientConfig = { apiKey: options.apiKey, baseUrl: options.baseUrl ?? JAG_FINANCE_BASE_URL, fetch: options.fetch ?? ((input, init) => globalThis.fetch(input, init)), }; return { /** GET /me: The key making the request. */ getMe: (args: GetMeArgs = {}): Promise => sendData(config, { method: 'GET', path: '/me' }, args), /** GET /connection: The app’s connection. */ getConnection: (args: GetConnectionArgs = {}): Promise => sendData(config, { method: 'GET', path: '/connection' }, args), /** PUT /connection/webhook: Set the app’s webhook. */ putConnectionWebhook: (args: PutConnectionWebhookArgs): Promise => sendData(config, { method: 'PUT', path: '/connection/webhook' }, args), /** DELETE /connection/webhook: Remove the app’s webhook. */ deleteConnectionWebhook: (args: DeleteConnectionWebhookArgs = {}): Promise => sendEmpty(config, { method: 'DELETE', path: '/connection/webhook' }, args), /** POST /connection/payslips: Add a payslip to a payment. Needs `documents:upload`. */ postConnectionPayslips: (args: PostConnectionPayslipsArgs): Promise => sendData(config, { method: 'POST', path: '/connection/payslips', formData: true }, args), /** GET /accounts: List accounts. Needs `accounts:read`. */ getAccounts: (args: GetAccountsArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/accounts' }, args), /** GET /accounts/{id}: Get an account. Needs `accounts:read`. */ getAccountsById: (args: GetAccountsByIdArgs): Promise => sendData(config, { method: 'GET', path: '/accounts/{id}' }, args), /** GET /institutions: List institutions. Needs `accounts:read`. */ getInstitutions: (args: GetInstitutionsArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/institutions' }, args), /** GET /accounts/{id}/balance-checks: List an account's balance checks. Needs `accounts:read`. */ getAccountsByIdBalanceChecks: (args: GetAccountsByIdBalanceChecksArgs): Promise> => sendPage(config, { method: 'GET', path: '/accounts/{id}/balance-checks' }, args), /** POST /accounts/{id}/balance-checks: Record a balance check. Needs `accounts:write`. */ postAccountsByIdBalanceChecks: (args: PostAccountsByIdBalanceChecksArgs): Promise => sendData(config, { method: 'POST', path: '/accounts/{id}/balance-checks' }, args), /** PATCH /accounts/{id}: Rename, close or keep aside an account. Needs `accounts:write`. */ patchAccountsById: (args: PatchAccountsByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/accounts/{id}' }, args), /** GET /transactions: List transactions. Needs `transactions:read`. */ getTransactions: (args: GetTransactionsArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/transactions' }, args), /** GET /transactions/lines: List transaction lines. Needs `transactions:read`. */ getTransactionsLines: (args: GetTransactionsLinesArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/transactions/lines' }, args), /** GET /transactions/{id}: Get a transaction. Needs `transactions:read`. */ getTransactionsById: (args: GetTransactionsByIdArgs): Promise => sendData(config, { method: 'GET', path: '/transactions/{id}' }, args), /** POST /transactions: Create a transaction. Needs `transactions:write`. */ postTransactions: (args: PostTransactionsArgs): Promise => sendData(config, { method: 'POST', path: '/transactions' }, args), /** PATCH /transactions/{id}: Edit a transaction. Needs `transactions:write`. */ patchTransactionsById: (args: PatchTransactionsByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/transactions/{id}' }, args), /** PUT /transactions/{id}/tags: Set a transaction’s tags. Needs `transactions:write`. */ putTransactionsByIdTags: (args: PutTransactionsByIdTagsArgs): Promise => sendData(config, { method: 'PUT', path: '/transactions/{id}/tags' }, args), /** DELETE /transactions/{id}: Delete a transaction. Needs `transactions:delete`. */ deleteTransactionsById: (args: DeleteTransactionsByIdArgs): Promise => sendEmpty(config, { method: 'DELETE', path: '/transactions/{id}' }, args), /** POST /transactions/batch: Create many transactions at once. Needs `transactions:write`. */ postTransactionsBatch: (args: PostTransactionsBatchArgs): Promise => sendData(config, { method: 'POST', path: '/transactions/batch' }, args), /** GET /transactions/export: Export transactions as CSV. Needs `transactions:read`. */ getTransactionsExport: (args: GetTransactionsExportArgs = {}): Promise => sendText(config, { method: 'GET', path: '/transactions/export', accept: 'text/csv' }, args), /** GET /categories: List categories. Needs `categories:read`. */ getCategories: (args: GetCategoriesArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/categories' }, args), /** GET /categories/{id}: Get a category. Needs `categories:read`. */ getCategoriesById: (args: GetCategoriesByIdArgs): Promise => sendData(config, { method: 'GET', path: '/categories/{id}' }, args), /** GET /rules: List categorisation rules. Needs `categories:read`. */ getRules: (args: GetRulesArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/rules' }, args), /** POST /categories: Create a category. Needs `categories:write`. */ postCategories: (args: PostCategoriesArgs): Promise => sendData(config, { method: 'POST', path: '/categories' }, args), /** PATCH /categories/{id}: Edit or archive a category. Needs `categories:write`. */ patchCategoriesById: (args: PatchCategoriesByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/categories/{id}' }, args), /** GET /payees: List payees. Needs `payees:read`. */ getPayees: (args: GetPayeesArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/payees' }, args), /** GET /payees/{id}: Get a payee. Needs `payees:read`. */ getPayeesById: (args: GetPayeesByIdArgs): Promise => sendData(config, { method: 'GET', path: '/payees/{id}' }, args), /** POST /payees: Create a payee. Needs `payees:write`. */ postPayees: (args: PostPayeesArgs): Promise => sendData(config, { method: 'POST', path: '/payees' }, args), /** PATCH /payees/{id}: Edit, archive or restore a payee. Needs `payees:write`. */ patchPayeesById: (args: PatchPayeesByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/payees/{id}' }, args), /** GET /tags: List tags. Needs `tags:read`. */ getTags: (args: GetTagsArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/tags' }, args), /** GET /tags/{id}: Get a tag. Needs `tags:read`. */ getTagsById: (args: GetTagsByIdArgs): Promise => sendData(config, { method: 'GET', path: '/tags/{id}' }, args), /** POST /tags: Create a tag. Needs `tags:write`. */ postTags: (args: PostTagsArgs): Promise => sendData(config, { method: 'POST', path: '/tags' }, args), /** PATCH /tags/{id}: Rename a tag. Needs `tags:write`. */ patchTagsById: (args: PatchTagsByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/tags/{id}' }, args), /** DELETE /tags/{id}: Delete a tag. Needs `tags:delete`. */ deleteTagsById: (args: DeleteTagsByIdArgs): Promise => sendEmpty(config, { method: 'DELETE', path: '/tags/{id}' }, args), /** GET /bills/upcoming: What is due soon. Needs `bills:read`. */ getBillsUpcoming: (args: GetBillsUpcomingArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/bills/upcoming' }, args), /** GET /recurring: Recurring bills and income. Needs `bills:read`. */ getRecurring: (args: GetRecurringArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/recurring' }, args), /** GET /recurring/{id}: One recurring series. Needs `bills:read`. */ getRecurringById: (args: GetRecurringByIdArgs): Promise => sendData(config, { method: 'GET', path: '/recurring/{id}' }, args), /** GET /scheduled: Scheduled one-off items. Needs `bills:read`. */ getScheduled: (args: GetScheduledArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/scheduled' }, args), /** GET /scheduled/{id}: One scheduled item. Needs `bills:read`. */ getScheduledById: (args: GetScheduledByIdArgs): Promise => sendData(config, { method: 'GET', path: '/scheduled/{id}' }, args), /** POST /scheduled: Schedule a one-off payment. Needs `bills:write`. */ postScheduled: (args: PostScheduledArgs): Promise => sendData(config, { method: 'POST', path: '/scheduled' }, args), /** PATCH /scheduled/{id}: Change a scheduled item. Needs `bills:write`. */ patchScheduledById: (args: PatchScheduledByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/scheduled/{id}' }, args), /** POST /scheduled/{id}/post: Post a scheduled item to the ledger. Needs `bills:write`. */ postScheduledByIdPost: (args: PostScheduledByIdPostArgs): Promise => sendData(config, { method: 'POST', path: '/scheduled/{id}/post' }, args), /** POST /scheduled/{id}/cancel: Cancel a scheduled item. Needs `bills:delete`. */ postScheduledByIdCancel: (args: PostScheduledByIdCancelArgs): Promise => sendData(config, { method: 'POST', path: '/scheduled/{id}/cancel' }, args), /** POST /recurring: Create a recurring bill or income. Needs `bills:write`. */ postRecurring: (args: PostRecurringArgs): Promise => sendData(config, { method: 'POST', path: '/recurring' }, args), /** PATCH /recurring/{id}: Change a recurring series. Needs `bills:write`. */ patchRecurringById: (args: PatchRecurringByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/recurring/{id}' }, args), /** POST /recurring/{id}/pause: Pause a recurring series. Needs `bills:write`. */ postRecurringByIdPause: (args: PostRecurringByIdPauseArgs): Promise => sendData(config, { method: 'POST', path: '/recurring/{id}/pause' }, args), /** POST /recurring/{id}/resume: Resume a recurring series. Needs `bills:write`. */ postRecurringByIdResume: (args: PostRecurringByIdResumeArgs): Promise => sendData(config, { method: 'POST', path: '/recurring/{id}/resume' }, args), /** POST /recurring/{id}/occurrences/{dueOn}/post: Post a recurring occurrence to the ledger. Needs `bills:write`. */ postRecurringByIdOccurrencesByDueOnPost: (args: PostRecurringByIdOccurrencesByDueOnPostArgs): Promise => sendData(config, { method: 'POST', path: '/recurring/{id}/occurrences/{dueOn}/post' }, args), /** POST /recurring/{id}/occurrences/{dueOn}/skip: Skip a recurring occurrence. Needs `bills:write`. */ postRecurringByIdOccurrencesByDueOnSkip: (args: PostRecurringByIdOccurrencesByDueOnSkipArgs): Promise => sendData(config, { method: 'POST', path: '/recurring/{id}/occurrences/{dueOn}/skip' }, args), /** GET /budgets: List budgets for a month. Needs `budgets:read`. */ getBudgets: (args: GetBudgetsArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/budgets' }, args), /** GET /budgets/{id}: Get a budget. Needs `budgets:read`. */ getBudgetsById: (args: GetBudgetsByIdArgs): Promise => sendData(config, { method: 'GET', path: '/budgets/{id}' }, args), /** POST /budgets: Create a budget. Needs `budgets:write`. */ postBudgets: (args: PostBudgetsArgs): Promise => sendData(config, { method: 'POST', path: '/budgets' }, args), /** PATCH /budgets/{id}: Edit or archive a budget. Needs `budgets:write`. */ patchBudgetsById: (args: PatchBudgetsByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/budgets/{id}' }, args), /** PUT /budgets/{id}/months/{month}: Set a budget's allocation for a month. Needs `budgets:write`. */ putBudgetsByIdMonthsByMonth: (args: PutBudgetsByIdMonthsByMonthArgs): Promise => sendData(config, { method: 'PUT', path: '/budgets/{id}/months/{month}' }, args), /** GET /goals: List goals. Needs `goals:read`. */ getGoals: (args: GetGoalsArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/goals' }, args), /** GET /goals/{id}: Get a goal. Needs `goals:read`. */ getGoalsById: (args: GetGoalsByIdArgs): Promise => sendData(config, { method: 'GET', path: '/goals/{id}' }, args), /** POST /goals: Create a goal. Needs `goals:write`. */ postGoals: (args: PostGoalsArgs): Promise => sendData(config, { method: 'POST', path: '/goals' }, args), /** PATCH /goals/{id}: Edit, archive or restore a goal. Needs `goals:write`. */ patchGoalsById: (args: PatchGoalsByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/goals/{id}' }, args), /** POST /goals/{id}/funding: Reserve or release money for a goal. Needs `goals:write`. */ postGoalsByIdFunding: (args: PostGoalsByIdFundingArgs): Promise => sendData(config, { method: 'POST', path: '/goals/{id}/funding' }, args), /** GET /insights/totals: Income, spending and net for a range. Needs `totals:read`. */ getInsightsTotals: (args: GetInsightsTotalsArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/insights/totals' }, args), /** GET /insights/cash-flow: Cash flow over time. Needs `insights:read`. */ getInsightsCashFlow: (args: GetInsightsCashFlowArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/insights/cash-flow' }, args), /** GET /insights/spending: Where the money went. Needs `insights:read`. */ getInsightsSpending: (args: GetInsightsSpendingArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/insights/spending' }, args), /** GET /insights/net-worth: Net worth and how it changed. Needs `insights:read`. */ getInsightsNetWorth: (args: GetInsightsNetWorthArgs = {}): Promise => sendData(config, { method: 'GET', path: '/insights/net-worth' }, args), /** GET /insights/forecast: Cash forecast and safe to spend. Needs `insights:read`. */ getInsightsForecast: (args: GetInsightsForecastArgs = {}): Promise => sendData(config, { method: 'GET', path: '/insights/forecast' }, args), /** GET /insights/runway: Cash runway. Needs `insights:read`. */ getInsightsRunway: (args: GetInsightsRunwayArgs = {}): Promise => sendData(config, { method: 'GET', path: '/insights/runway' }, args), /** GET /summaries: Period summaries. Needs `insights:read`. */ getSummaries: (args: GetSummariesArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/summaries' }, args), /** GET /summaries/{id}: One period summary. Needs `insights:read`. */ getSummariesById: (args: GetSummariesByIdArgs): Promise => sendData(config, { method: 'GET', path: '/summaries/{id}' }, args), /** GET /documents: List documents. Needs `documents:read`. */ getDocuments: (args: GetDocumentsArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/documents' }, args), /** GET /documents/search: Search documents by meaning. Needs `documents:read`. */ getDocumentsSearch: (args: GetDocumentsSearchArgs): Promise> => sendPage(config, { method: 'GET', path: '/documents/search' }, args), /** GET /documents/{id}: Get a document. Needs `documents:read`. */ getDocumentsById: (args: GetDocumentsByIdArgs): Promise => sendData(config, { method: 'GET', path: '/documents/{id}' }, args), /** GET /documents/{id}/text: Read a document’s text. Needs `documents:read`. */ getDocumentsByIdText: (args: GetDocumentsByIdTextArgs): Promise => sendData(config, { method: 'GET', path: '/documents/{id}/text' }, args), /** GET /documents/{id}/file: Download a document file. Needs `documents:read`. */ getDocumentsByIdFile: (args: GetDocumentsByIdFileArgs): Promise => sendData(config, { method: 'GET', path: '/documents/{id}/file' }, args), /** POST /documents: Upload a document in one request. Needs `documents:upload`. */ postDocuments: (args: PostDocumentsArgs): Promise => sendData(config, { method: 'POST', path: '/documents', formData: true }, args), /** POST /documents/uploads: Start an upload of any size. Needs `documents:upload`. */ postDocumentsUploads: (args: PostDocumentsUploadsArgs): Promise => sendData(config, { method: 'POST', path: '/documents/uploads' }, args), /** POST /documents/{id}/parts: Add a page to an upload. Needs `documents:upload`. */ postDocumentsByIdParts: (args: PostDocumentsByIdPartsArgs): Promise => sendData(config, { method: 'POST', path: '/documents/{id}/parts' }, args), /** POST /documents/{id}/complete: Finish an upload. Needs `documents:upload`. */ postDocumentsByIdComplete: (args: PostDocumentsByIdCompleteArgs): Promise => sendData(config, { method: 'POST', path: '/documents/{id}/complete' }, args), /** PATCH /documents/{id}: Change a document’s details. Needs `documents:write`. */ patchDocumentsById: (args: PatchDocumentsByIdArgs): Promise => sendData(config, { method: 'PATCH', path: '/documents/{id}' }, args), /** POST /documents/{id}/links: Attach a document. Needs `documents:write`. */ postDocumentsByIdLinks: (args: PostDocumentsByIdLinksArgs): Promise => sendData(config, { method: 'POST', path: '/documents/{id}/links' }, args), /** DELETE /documents/{id}/links/{linkId}: Detach a document. Needs `documents:write`. */ deleteDocumentsByIdLinksByLinkId: (args: DeleteDocumentsByIdLinksByLinkIdArgs): Promise => sendEmpty(config, { method: 'DELETE', path: '/documents/{id}/links/{linkId}' }, args), /** DELETE /documents/{id}: Move a document to the Trash. Needs `documents:delete`. */ deleteDocumentsById: (args: DeleteDocumentsByIdArgs): Promise => sendEmpty(config, { method: 'DELETE', path: '/documents/{id}' }, args), /** POST /documents/{id}/restore: Restore a document from the Trash. Needs `documents:write`. */ postDocumentsByIdRestore: (args: PostDocumentsByIdRestoreArgs): Promise => sendData(config, { method: 'POST', path: '/documents/{id}/restore' }, args), /** GET /search: Search everything. Needs `search:read`. */ getSearch: (args: GetSearchArgs): Promise> => sendPage(config, { method: 'GET', path: '/search' }, args), /** GET /inbox: List inbox items. Needs `inbox:read`. */ getInbox: (args: GetInboxArgs = {}): Promise> => sendPage(config, { method: 'GET', path: '/inbox' }, args), /** GET /inbox/{id}: Get an inbox item. Needs `inbox:read`. */ getInboxById: (args: GetInboxByIdArgs): Promise => sendData(config, { method: 'GET', path: '/inbox/{id}' }, args), /** POST /inbox: Add a purchase to the inbox. Needs `wallet:write`. */ postInbox: (args: PostInboxArgs): Promise => sendData(config, { method: 'POST', path: '/inbox' }, args), /** POST /inbox/{id}/approve: Approve an inbox item. Needs `inbox:write`. */ postInboxByIdApprove: (args: PostInboxByIdApproveArgs): Promise => sendData(config, { method: 'POST', path: '/inbox/{id}/approve' }, args), /** POST /inbox/{id}/dismiss: Dismiss an inbox item. Needs `inbox:write`. */ postInboxByIdDismiss: (args: PostInboxByIdDismissArgs): Promise => sendData(config, { method: 'POST', path: '/inbox/{id}/dismiss' }, args), /** DELETE /inbox/{id}: Delete a dismissed inbox item. Needs `inbox:delete`. */ deleteInboxById: (args: DeleteInboxByIdArgs): Promise => sendEmpty(config, { method: 'DELETE', path: '/inbox/{id}' }, args), /** GET /transactions: List transactions, every item across all pages. Needs `transactions:read`. */ getTransactionsAll: (args: GetTransactionsArgs = {}): AsyncGenerator => allPages((pageArgs) => sendPage(config, { method: 'GET', path: '/transactions' }, pageArgs), args), /** GET /transactions/lines: List transaction lines, every item across all pages. Needs `transactions:read`. */ getTransactionsLinesAll: (args: GetTransactionsLinesArgs = {}): AsyncGenerator => allPages((pageArgs) => sendPage(config, { method: 'GET', path: '/transactions/lines' }, pageArgs), args), /** GET /payees: List payees, every item across all pages. Needs `payees:read`. */ getPayeesAll: (args: GetPayeesArgs = {}): AsyncGenerator => allPages((pageArgs) => sendPage(config, { method: 'GET', path: '/payees' }, pageArgs), args), /** GET /bills/upcoming: What is due soon, every item across all pages. Needs `bills:read`. */ getBillsUpcomingAll: (args: GetBillsUpcomingArgs = {}): AsyncGenerator => allPages((pageArgs) => sendPage(config, { method: 'GET', path: '/bills/upcoming' }, pageArgs), args), /** GET /scheduled: Scheduled one-off items, every item across all pages. Needs `bills:read`. */ getScheduledAll: (args: GetScheduledArgs = {}): AsyncGenerator => allPages((pageArgs) => sendPage(config, { method: 'GET', path: '/scheduled' }, pageArgs), args), /** GET /summaries: Period summaries, every item across all pages. Needs `insights:read`. */ getSummariesAll: (args: GetSummariesArgs = {}): AsyncGenerator => allPages((pageArgs) => sendPage(config, { method: 'GET', path: '/summaries' }, pageArgs), args), /** GET /documents: List documents, every item across all pages. Needs `documents:read`. */ getDocumentsAll: (args: GetDocumentsArgs = {}): AsyncGenerator => allPages((pageArgs) => sendPage(config, { method: 'GET', path: '/documents' }, pageArgs), args), /** GET /inbox: List inbox items, every item across all pages. Needs `inbox:read`. */ getInboxAll: (args: GetInboxArgs = {}): AsyncGenerator => allPages((pageArgs) => sendPage(config, { method: 'GET', path: '/inbox' }, pageArgs), args), }; } export type JagFinanceClient = ReturnType;