# Generated from packages/connectors/customapi/src/spec.ts by scripts/custom-api-openapi.ts. Do not edit by hand. openapi: "3.1.0" info: title: "Aggregate Custom API" version: "1" description: |- The three routes your own system answers so Aggregate can read it: your platform, an internal tool or a side business. Full guide: https://aggregate.finance/docs/custom-api You choose what to expose. Aggregate only ever sends GET requests and can’t change anything in your system. There is no route that writes, and Aggregate can’t move money. How the money is counted: - A balance account holds money in your system and pays it out to a bank later, through /payouts. A payout takes gross out of the balance, and net (gross − fees) reaches the bank; Aggregate matches net to the bank deposit. - Payouts appear in /payouts only, never also as rows in /transactions, or the money would leave the balance twice. - A direct account maps one row to one bank deposit (or payment). Batched deposits need a balance account with /payouts. - Refunds, fees paid back (money in) and sales with a negative amount need a balance account with /payouts. On a direct account, or on an endpoint without /payouts, they are refused at connect and at sync. - `since` (YYYY-MM-DD) is compared with the date part of `date` (or `date_arrives`) as your endpoint writes it, with no time zone change: a row dated 2026-11-02T23:30:00-05:00 is on 2026-11-02. Send every row on or after it. - Amounts are decimal strings in the currency’s major units ("12.50"), never JSON numbers: an optional "-", no "+", exponent or grouping, at most the currency’s own decimal places. Money in is positive, out negative. With gross, fee or refund given, amount must equal gross − fee − refund (a missing one counts as 0). Limits (each one stops the request or the sync with a plain message): - 10 seconds per request, 5 MB per response, JSON only (Content-Type: application/json). - 1,000 rows per page (and accounts in /accounts), 200 pages per sync. - HTTPS on port 443 at a public host name. Redirects are not followed. Ids up to 128 characters, next_cursor up to 512. A row that breaks the spec stops the connect or the sync with its place named (transactions[3].amount: not a decimal); nothing is repaired or guessed. Requests come from 209.71.116.234 and 2a09:8280:e618:1:0:1b0:a37b:0 (the hosted service), with User-Agent "Aggregate (+https://aggregate.finance)". servers: - url: "https://api.example.com/aggregate" description: "Your base URL. Aggregate adds /accounts, /transactions and /payouts to it." security: - bearer: [] paths: "/accounts": get: operationId: "listAccounts" summary: "Accounts" description: "Every account, as a JSON array." responses: "200": description: "OK" content: "application/json": schema: type: "array" maxItems: 1000 items: $ref: "#/components/schemas/Account" "401": description: "The key is wrong or missing." "/transactions": get: operationId: "listTransactions" summary: "Transactions" description: "Rows dated on or after `since` (YYYY-MM-DD, compared with the date part of `date` as you write it, no time zone change; absent: every row), oldest first, up to 1,000 per page. Payouts never appear here." parameters: - name: "since" in: "query" required: false schema: type: "string" format: "date" description: "YYYY-MM-DD. Rows on or after this day, by the date part as you write it (no time zone change). Absent: every row." - name: "cursor" in: "query" required: false schema: type: "string" maxLength: 512 description: "The next_cursor of the page before. Absent: the first page." responses: "200": description: "OK" content: "application/json": schema: $ref: "#/components/schemas/TransactionPage" "401": description: "The key is wrong or missing." "/payouts": get: operationId: "listPayouts" summary: "Payouts (optional)" description: "Payouts arriving on or after `since`, once their money has left the balance: gross leaves the balance, net reaches the bank. Not repeated in /transactions. Answer 404 if you have none." parameters: - name: "since" in: "query" required: false schema: type: "string" format: "date" description: "YYYY-MM-DD. Rows on or after this day, by the date part as you write it (no time zone change). Absent: every row." - name: "cursor" in: "query" required: false schema: type: "string" maxLength: 512 description: "The next_cursor of the page before. Absent: the first page." responses: "200": description: "OK" content: "application/json": schema: $ref: "#/components/schemas/PayoutPage" "401": description: "The key is wrong or missing." "404": description: "No payouts: every account is booked row by row (refunds then need a balance account with /payouts)." components: securitySchemes: bearer: type: "http" scheme: "bearer" description: "A key you make for Aggregate, checked in the Authorization: Bearer header." schemas: Decimal: type: "string" pattern: "^-?(0|[1-9][0-9]{0,12})(\\.[0-9]+)?$" examples: - "12.50" - "-3.00" - "1500" Account: type: "object" required: - "id" - "name" - "currency" - "kind" properties: id: type: "string" minLength: 1 maxLength: 128 description: "Your id for the account; never changes." name: type: "string" description: "A name people recognise. Kept at most 80 characters (cut, not refused)." currency: type: "string" pattern: "^[A-Z]{3}$" description: "ISO 4217 code, upper case (USD). Every row of the account is in it." kind: type: "string" enum: - "balance" - "direct" description: "balance: money held in your system and paid out later; direct: each row is one bank deposit or payment of its own (batched deposits and refunds need a balance account with /payouts)." balance: $ref: "#/components/schemas/Decimal" description: "balance accounts: the money held now. When given, each sync checks the rows add up to it, and posts them only once they do." description: "Fields not listed here are ignored and never stored." Transaction: type: "object" required: - "id" - "account_id" - "date" - "amount" - "currency" properties: id: type: "string" minLength: 1 maxLength: 128 description: "Your id for the row; never changes, unique in the account." account_id: type: "string" minLength: 1 maxLength: 128 description: "An id from /accounts." date: type: "string" description: "YYYY-MM-DD, or a date and time with its offset." examples: - "2026-11-02" - "2026-11-02T14:30:00-05:00" amount: $ref: "#/components/schemas/Decimal" description: "Signed: money in positive, out negative. Equals gross − fee − refund when any of those is given." currency: type: "string" pattern: "^[A-Z]{3}$" description: "The account's currency." description: type: "string" description: "Shown as written, as data. Kept at most 200 characters (cut, not refused)." type: type: "string" enum: - "sale" - "refund" - "fee" - "adjustment" description: "sale, refund, fee or adjustment. Left out: adjustment (Aggregate never guesses). Refunds need a balance account with /payouts." gross: $ref: "#/components/schemas/Decimal" description: "The sale before fees and refunds." fee: $ref: "#/components/schemas/Decimal" description: "Fees taken from it (a cost, positive)." refund: $ref: "#/components/schemas/Decimal" description: "Refunded from it (positive)." payout_id: type: "string" minLength: 1 maxLength: 128 description: "The payout that paid it out, if known." description: "Fields not listed here are ignored and never stored." TransactionPage: type: "object" required: - "data" - "next_cursor" properties: data: type: "array" maxItems: 1000 items: $ref: "#/components/schemas/Transaction" next_cursor: type: - "string" - "null" minLength: 1 maxLength: 512 description: "The next page’s cursor, sent back as ?cursor=; null on the last page." Payout: type: "object" required: - "id" - "account_id" - "date_arrives" - "gross" - "fees" - "net" - "currency" properties: id: type: "string" minLength: 1 maxLength: 128 description: "Your id for the payout; never changes." account_id: type: "string" minLength: 1 maxLength: 128 description: "A balance account from /accounts." date_arrives: type: "string" format: "date" description: "YYYY-MM-DD the money reaches the bank." gross: $ref: "#/components/schemas/Decimal" description: "What leaves the balance." fees: $ref: "#/components/schemas/Decimal" description: "What the payout itself cost." net: $ref: "#/components/schemas/Decimal" description: "What reaches the bank: gross − fees." currency: type: "string" pattern: "^[A-Z]{3}$" description: "The account's currency." description: "Fields not listed here are ignored and never stored." PayoutPage: type: "object" required: - "data" - "next_cursor" properties: data: type: "array" maxItems: 1000 items: $ref: "#/components/schemas/Payout" next_cursor: type: - "string" - "null" minLength: 1 maxLength: 512 description: "The next page’s cursor, sent back as ?cursor=; null on the last page."