openapi: 3.0.3 info: title: Ledger API contact: {} version: v2 paths: /_info: get: tags: - ledger.v1 summary: Show server information operationId: getInfo responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ConfigInfoResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /{ledger}/_info: get: summary: Get information about a ledger operationId: getLedgerInfo tags: - ledger.v1 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/LedgerInfoResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /{ledger}/accounts: head: summary: Count the accounts from a ledger operationId: countAccounts tags: - ledger.v1 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: address in: query description: >- Filter accounts by address pattern (regular expression placed between ^ and $). schema: type: string example: users:.+ - name: metadata in: query description: >- Filter accounts by metadata key value pairs. The filter can be used like this metadata[key]=value1&metadata[a.nested.key]=value2 style: deepObject explode: true schema: type: object additionalProperties: true example: metadata[key]=value1&metadata[a.nested.key]=value2 responses: '204': description: OK headers: Count: schema: type: integer format: int64 minimum: 0 default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read get: summary: List accounts from a ledger description: List accounts from a ledger, sorted by address in descending order. operationId: listAccounts tags: - ledger.v1 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: page_size x-speakeasy-ignore: true in: query description: | The maximum number of results to return per page. Deprecated, please use `pageSize` instead. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 deprecated: true - name: after in: query description: >- Pagination cursor, will return accounts after given address, in descending order. schema: type: string example: users:003 - name: address in: query description: >- Filter accounts by address pattern (regular expression placed between ^ and $). schema: type: string example: users:.+ - name: metadata in: query description: >- Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. style: deepObject explode: true schema: type: object additionalProperties: true example: metadata[key]=value1&metadata[a.nested.key]=value2 - name: balance in: query description: Filter accounts by their balance (default operator is gte) schema: type: integer format: int64 example: 2400 - name: balanceOperator x-speakeasy-ignore: true in: query description: > Operator used for the filtering of balances can be greater than/equal, less than/equal, greater than, less than, equal or not. schema: type: string enum: - gte - lte - gt - lt - e - ne example: gte - name: balance_operator x-speakeasy-ignore: true in: query description: > Operator used for the filtering of balances can be greater than/equal, less than/equal, greater than, less than, equal or not. Deprecated, please use `balanceOperator` instead. schema: type: string enum: - gte - lte - gt - lt - e - ne example: gte deprecated: true - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 1000. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: pagination_token in: query description: > Parameter used in pagination requests. Maximum page size is set to 1000. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. Deprecated, please use `cursor` instead. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== deprecated: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AccountsCursorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /{ledger}/accounts/{address}: get: summary: Get account by its address operationId: getAccount tags: - ledger.v1 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: address in: path description: > Exact address of the account. It must match the following regular expressions pattern: ``` ^\w+(:\w+)*$ ``` required: true schema: type: string example: users:001 responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AccountResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /{ledger}/accounts/{address}/metadata: post: summary: Add metadata to an account operationId: addMetadataToAccount tags: - ledger.v1 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: address in: path description: > Exact address of the account. It must match the following regular expressions pattern: ``` ^\w+(:\w+)*$ ``` required: true schema: type: string example: users:001 requestBody: description: metadata content: application/json: schema: $ref: '#/components/schemas/Metadata' required: true responses: '204': description: No Content headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: {} default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:write /{ledger}/mapping: get: tags: - ledger.v1 operationId: getMapping summary: Get the mapping of a ledger parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/MappingResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read put: tags: - ledger.v1 operationId: updateMapping summary: Update the mapping of a ledger parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 requestBody: content: application/json: schema: $ref: '#/components/schemas/Mapping' required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/MappingResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:write /{ledger}/script: post: deprecated: true tags: - ledger.v1 operationId: runScript summary: Execute a Numscript description: > This route is deprecated, and has been merged into `POST /{ledger}/transactions`. parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: preview in: query description: >- Set the preview mode. Preview mode doesn't add the logs to the database or publish a message to the message broker. schema: type: boolean example: true requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Script' responses: '200': description: > On success, it will return a 200 status code, and the resulting transaction under the `transaction` field. On failure, it will also return a 200 status code, and the following fields: - `details`: contains a URL. When there is an error parsing Numscript, the result can be difficult to read—the provided URL will render the error in an easy-to-read format. - `errorCode` and `error_code` (deprecated): contains the string code of the error - `errorMessage` and `error_message` (deprecated): contains a human-readable indication of what went wrong, for example that an account had insufficient funds, or that there was an error in the provided Numscript. content: application/json: schema: $ref: '#/components/schemas/ScriptResponse' security: - Authorization: - ledger:write /{ledger}/stats: get: tags: - ledger.v1 operationId: readStats summary: Get statistics from a ledger description: > Get statistics from a ledger. (aggregate metrics on accounts and transactions) parameters: - name: ledger in: path description: name of the ledger required: true schema: type: string example: ledger001 responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/StatsResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /{ledger}/transactions: head: tags: - ledger.v1 summary: Count the transactions from a ledger operationId: countTransactions parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: reference in: query description: Filter transactions by reference field. schema: type: string example: ref:001 - name: account in: query description: >- Filter transactions with postings involving given account, either as source or destination (regular expression placed between ^ and $). schema: type: string example: users:001 - name: source in: query description: >- Filter transactions with postings involving given account at source (regular expression placed between ^ and $). schema: type: string example: users:001 - name: destination in: query description: >- Filter transactions with postings involving given account at destination (regular expression placed between ^ and $). schema: type: string example: users:001 - name: startTime in: query description: > Filter transactions that occurred after this timestamp. The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). schema: type: string format: date-time - name: start_time x-speakeasy-ignore: true in: query description: > Filter transactions that occurred after this timestamp. The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). Deprecated, please use `startTime` instead. schema: type: string format: date-time deprecated: true - name: endTime in: query description: > Filter transactions that occurred before this timestamp. The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). schema: type: string format: date-time - name: end_time x-speakeasy-ignore: true in: query description: > Filter transactions that occurred before this timestamp. The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). Deprecated, please use `endTime` instead. schema: type: string format: date-time deprecated: true - name: metadata in: query description: >- Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. style: deepObject explode: true schema: type: object properties: {} example: metadata[key]=value1&metadata[a.nested.key]=value2 responses: '200': description: OK headers: Count: schema: type: integer format: int64 minimum: 0 default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read get: tags: - ledger.v1 summary: List transactions from a ledger description: List transactions from a ledger, sorted by txid in descending order. operationId: listTransactions parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: page_size x-speakeasy-ignore: true in: query description: | The maximum number of results to return per page. Deprecated, please use `pageSize` instead. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 deprecated: true - name: after in: query description: >- Pagination cursor, will return transactions after given txid (in descending order). schema: type: string example: 1234 - name: reference in: query description: Find transactions by reference field. schema: type: string example: ref:001 - name: account in: query description: >- Filter transactions with postings involving given account, either as source or destination (regular expression placed between ^ and $). schema: type: string example: users:001 - name: source in: query description: >- Filter transactions with postings involving given account at source (regular expression placed between ^ and $). schema: type: string example: users:001 - name: destination in: query description: >- Filter transactions with postings involving given account at destination (regular expression placed between ^ and $). schema: type: string example: users:001 - name: startTime in: query description: > Filter transactions that occurred after this timestamp. The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). schema: type: string format: date-time - name: start_time x-speakeasy-ignore: true in: query description: > Filter transactions that occurred after this timestamp. The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). Deprecated, please use `startTime` instead. schema: type: string format: date-time deprecated: true - name: endTime in: query description: > Filter transactions that occurred before this timestamp. The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). schema: type: string format: date-time - name: end_time x-speakeasy-ignore: true in: query description: > Filter transactions that occurred before this timestamp. The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). Deprecated, please use `endTime` instead. schema: type: string format: date-time deprecated: true - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 1000. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: pagination_token x-speakeasy-ignore: true in: query description: > Parameter used in pagination requests. Maximum page size is set to 1000. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. Deprecated, please use `cursor` instead. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== deprecated: true - name: metadata in: query description: >- Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. style: deepObject explode: true schema: type: object additionalProperties: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/TransactionsCursorResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read post: tags: - ledger.v1 summary: Create a new transaction to a ledger operationId: createTransaction parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: preview in: query description: >- Set the preview mode. Preview mode doesn't add the logs to the database or publish a message to the message broker. schema: type: boolean example: true requestBody: required: true description: | The request body must contain at least one of the following objects: - `postings`: suitable for simple transactions - `script`: enabling more complex transactions with Numscript content: application/json: schema: $ref: '#/components/schemas/PostTransaction' responses: '200': description: OK headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: application/json: schema: $ref: '#/components/schemas/TransactionsResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:write /{ledger}/transactions/{txid}: get: tags: - ledger.v1 summary: Get transaction from a ledger by its ID operationId: getTransaction parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: txid in: path description: Transaction ID. required: true schema: type: integer format: bigint minimum: 0 example: 1234 responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/TransactionResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /{ledger}/transactions/{txid}/metadata: post: tags: - ledger.v1 summary: Set the metadata of a transaction by its ID operationId: addMetadataOnTransaction parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: txid in: path description: Transaction ID. required: true schema: type: integer format: bigint minimum: 0 example: 1234 requestBody: required: true description: metadata content: application/json: schema: $ref: '#/components/schemas/Metadata' responses: '204': description: No Content headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: {} default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:write /{ledger}/transactions/{txid}/revert: post: tags: - ledger.v1 operationId: revertTransaction summary: Revert a ledger transaction by its ID parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: txid in: path description: Transaction ID. required: true schema: type: integer format: bigint minimum: 0 example: 1234 - name: disableChecks in: query description: Allow to disable balances checks required: false schema: type: boolean responses: '201': description: OK headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: application/json: schema: $ref: '#/components/schemas/TransactionResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:write /{ledger}/transactions/batch: post: tags: - ledger.v1 summary: Create a new batch of transactions to a ledger operationId: CreateTransactions parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 requestBody: content: application/json: schema: $ref: '#/components/schemas/Transactions' required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/TransactionsResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:write /{ledger}/balances: get: tags: - ledger.v1 summary: Get the balances from a ledger's account operationId: getBalances parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: address in: query description: >- Filter balances involving given account, either as source or destination. schema: type: string example: users:001 - name: pageSize in: query description: | The maximum number of results to return per page. schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: after in: query description: >- Pagination cursor, will return accounts after given address, in descending order. schema: type: string example: users:003 - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 1000. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: pagination_token x-speakeasy-ignore: true in: query description: |- Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. Deprecated, please use `cursor` instead. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== deprecated: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/BalancesCursorResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /{ledger}/aggregate/balances: get: tags: - ledger.v1 summary: Get the aggregated balances from selected accounts operationId: getBalancesAggregated parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: address in: query description: >- Filter balances involving given account, either as source or destination. schema: type: string example: users:001 - name: useInsertionDate in: query description: Use insertion date instead of effective date required: false schema: type: boolean responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AggregateBalancesResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /{ledger}/logs: get: tags: - ledger.v1 summary: List the logs from a ledger description: List the logs from a ledger, sorted by ID in descending order. operationId: listLogs parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: page_size x-speakeasy-ignore: true in: query description: | The maximum number of results to return per page. Deprecated, please use `pageSize` instead. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 deprecated: true - name: after in: query description: >- Pagination cursor, will return the logs after a given ID. (in descending order). schema: type: string example: 1234 - name: startTime in: query description: > Filter transactions that occurred after this timestamp. The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). schema: type: string format: date-time - name: start_time x-speakeasy-ignore: true in: query description: > Filter transactions that occurred after this timestamp. The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). Deprecated, please use `startTime` instead. schema: type: string format: date-time deprecated: true - name: endTime in: query description: > Filter transactions that occurred before this timestamp. The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). schema: type: string format: date-time - name: end_time x-speakeasy-ignore: true in: query description: > Filter transactions that occurred before this timestamp. The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). Deprecated, please use `endTime` instead. schema: type: string format: date-time deprecated: true - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 1000. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: pagination_token x-speakeasy-ignore: true in: query description: > Parameter used in pagination requests. Maximum page size is set to 1000. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. Deprecated, please use `cursor` instead. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== deprecated: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/LogsCursorResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - Authorization: - ledger:read /_/info: get: tags: - ledger summary: Show server information operationId: v2GetInfo x-speakeasy-name-override: GetInfo responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2ConfigInfoResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" 5XX: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /_/metrics: get: tags: - ledger summary: Read in memory metrics operationId: getMetrics x-speakeasy-name-override: GetMetrics responses: "200": description: OK content: application/json: schema: type: object additionalProperties: {} default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2: get: summary: List ledgers operationId: v2ListLedgers x-speakeasy-name-override: ListLedgers tags: - ledger.v2 parameters: - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: includeDeleted in: query description: | If true, include deleted ledgers in the results. By default, deleted ledgers are excluded. schema: type: boolean default: false example: false - $ref: "#/components/parameters/sort" requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2LedgerListResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 get: summary: Get a ledger operationId: v2GetLedger x-speakeasy-name-override: GetLedger tags: - ledger.v2 responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2GetLedgerResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read post: summary: Create a ledger operationId: v2CreateLedger x-speakeasy-name-override: CreateLedger tags: - ledger.v2 requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/V2CreateLedgerRequest" responses: "204": description: OK default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/schemas/{version}: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: version in: path description: Schema version. required: true schema: type: string example: v1.0.0 post: summary: Insert a schema for a ledger operationId: v2InsertSchema x-speakeasy-name-override: InsertSchema tags: - ledger.v2 parameters: - name: Idempotency-Key in: header description: Use an idempotency key schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/V2SchemaData" responses: "204": description: Schema inserted successfully headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write get: summary: Get a schema for a ledger by version operationId: v2GetSchema x-speakeasy-name-override: GetSchema tags: - ledger.v2 responses: "200": description: Schema retrieved successfully content: application/json: schema: $ref: "#/components/schemas/V2SchemaResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/schemas: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 get: summary: List all schemas for a ledger operationId: v2ListSchemas x-speakeasy-name-override: ListSchemas tags: - ledger.v2 parameters: - name: cursor in: query description: The pagination cursor value schema: type: string - name: pageSize in: query description: The maximum number of results to return per page schema: type: integer minimum: 1 maximum: 1000 default: 15 - name: sort in: query description: The field to sort by schema: type: string enum: - created_at default: created_at - name: order in: query description: The sort order schema: type: string enum: - asc - desc default: desc responses: "200": description: Schemas retrieved successfully content: application/json: schema: $ref: "#/components/schemas/V2SchemasCursorResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/metadata: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 put: summary: Update ledger metadata operationId: v2UpdateLedgerMetadata x-speakeasy-name-override: UpdateLedgerMetadata tags: - ledger.v2 requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/V2UpdateLedgerMetadataRequest" responses: "204": description: OK default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" 5XX: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/metadata/{key}: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: key in: path description: Key to remove. required: true schema: type: string example: foo delete: summary: Delete ledger metadata by key operationId: v2DeleteLedgerMetadata x-speakeasy-name-override: DeleteLedgerMetadata tags: - ledger.v2 responses: "204": description: OK default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/_info: get: summary: Get information about a ledger operationId: v2GetLedgerInfo x-speakeasy-name-override: GetLedgerInfo tags: - ledger.v2 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2LedgerInfoResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/_bulk: post: summary: Bulk request operationId: v2CreateBulk x-speakeasy-name-override: CreateBulk tags: - ledger.v2 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: continueOnFailure in: query description: Continue on failure schema: type: boolean example: true - name: atomic in: query description: Make bulk atomic schema: type: boolean example: true - name: parallel in: query description: Process bulk elements in parallel schema: type: boolean example: true - name: schemaVersion in: query description: Default schema version to use for validation (can be overridden per element) schema: type: string example: v1.0.0 requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/V2Bulk" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2BulkResponse" "400": description: OK content: application/json: schema: $ref: "#/components/schemas/V2BulkResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/accounts: head: summary: Count the accounts from a ledger operationId: v2CountAccounts x-speakeasy-name-override: CountAccounts tags: - ledger.v2 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pit in: query required: false schema: type: string format: date-time requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: "204": description: OK headers: Count: schema: type: integer format: bigint minimum: 0 default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read get: summary: List accounts from a ledger description: List accounts from a ledger, sorted by address in descending order. operationId: v2ListAccounts x-speakeasy-name-override: ListAccounts tags: - ledger.v2 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: expand in: query schema: type: string items: type: string - name: pit in: query required: false schema: type: string format: date-time - $ref: "#/components/parameters/sort" requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2AccountsCursorResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/accounts/{address}: get: summary: Get account by its address operationId: v2GetAccount x-speakeasy-name-override: GetAccount tags: - ledger.v2 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: address in: path description: > Exact address of the account. It must match the following regular expressions pattern: ``` ^\w+(:\w+)*$ ``` required: true schema: type: string example: users:001 - name: expand in: query schema: type: string items: type: string - name: pit in: query required: false schema: type: string format: date-time responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2AccountResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/accounts/{address}/metadata: post: summary: Add metadata to an account operationId: v2AddMetadataToAccount x-speakeasy-name-override: AddMetadataToAccount tags: - ledger.v2 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: address in: path description: > Exact address of the account. It must match the following regular expressions pattern: ``` ^\w+(:\w+)*$ ``` required: true schema: type: string example: users:001 - name: dryRun in: query description: >- Set the dry run mode. Dry run mode doesn't add the logs to the database or publish a message to the message broker. schema: type: boolean example: true - name: Idempotency-Key in: header description: Use an idempotency key schema: type: string - name: schemaVersion in: query description: Schema version to use for validation schema: type: string example: v1.0.0 requestBody: description: metadata content: application/json: schema: $ref: "#/components/schemas/V2Metadata" required: true responses: "204": description: No Content headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: {} default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/accounts/{address}/metadata/{key}: delete: description: Delete metadata by key operationId: v2DeleteAccountMetadata x-speakeasy-name-override: DeleteAccountMetadata tags: - ledger.v2 summary: Delete metadata by key parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: address in: path description: Account address required: true schema: type: string - name: key in: path description: The key to remove. required: true schema: type: string example: foo - name: Idempotency-Key in: header description: Use an idempotency key schema: type: string responses: 204: description: Key deleted headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: {} default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/stats: get: tags: - ledger.v2 operationId: v2ReadStats x-speakeasy-name-override: ReadStats summary: Get statistics from a ledger description: > Get statistics from a ledger. (aggregate metrics on accounts and transactions) parameters: - name: ledger in: path description: name of the ledger required: true schema: type: string example: ledger001 responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2StatsResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/transactions: head: tags: - ledger.v2 summary: Count the transactions from a ledger operationId: v2CountTransactions x-speakeasy-name-override: CountTransactions parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pit in: query required: false schema: type: string format: date-time requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: "204": description: OK headers: Count: schema: type: integer format: int64 minimum: 0 default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read get: tags: - ledger.v2 summary: List transactions from a ledger description: List transactions from a ledger, sorted by id in descending order. operationId: v2ListTransactions x-speakeasy-name-override: ListTransactions parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: expand in: query schema: type: string items: type: string - name: pit in: query required: false schema: type: string format: date-time - name: order in: query required: false deprecated: true description: "Deprecated: Use sort param" schema: type: string enum: - effective - name: reverse in: query required: false schema: type: boolean - $ref: "#/components/parameters/sort" requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2TransactionsCursorResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read post: tags: - ledger.v2 summary: Create a new transaction to a ledger operationId: v2CreateTransaction x-speakeasy-name-override: CreateTransaction parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: dryRun in: query description: >- Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker. schema: type: boolean example: true - name: Idempotency-Key in: header description: Use an idempotency key schema: type: string - name: force in: query description: Disable balance checks when passing postings schema: type: boolean example: true - name: schemaVersion in: query description: Schema version to use for validation schema: type: string example: v1.0.0 requestBody: required: true description: | The request body must contain at least one of the following objects: - `postings`: suitable for simple transactions - `script`: enabling more complex transactions with Numscript content: application/json: schema: $ref: "#/components/schemas/V2PostTransaction" responses: "200": description: OK headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: application/json: schema: $ref: "#/components/schemas/V2CreateTransactionResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/transactions/{id}: get: tags: - ledger.v2 summary: Get transaction from a ledger by its ID operationId: v2GetTransaction x-speakeasy-name-override: GetTransaction parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: id in: path description: Transaction ID. required: true schema: type: integer format: bigint minimum: 0 example: 1234 - name: expand in: query schema: type: string items: type: string - name: pit in: query required: false schema: type: string format: date-time responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2GetTransactionResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/transactions/{id}/metadata: post: tags: - ledger.v2 summary: Set the metadata of a transaction by its ID operationId: v2AddMetadataOnTransaction x-speakeasy-name-override: AddMetadataOnTransaction parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: id in: path description: Transaction ID. required: true schema: type: integer format: bigint minimum: 0 example: 1234 - name: dryRun in: query description: >- Set the dryRun mode. Dry run mode doesn't add the logs to the database or publish a message to the message broker. schema: type: boolean example: true - name: Idempotency-Key in: header description: Use an idempotency key schema: type: string - name: schemaVersion in: query description: Schema version to use for validation schema: type: string example: v1.0.0 requestBody: required: true description: metadata content: application/json: schema: $ref: "#/components/schemas/V2Metadata" responses: "204": description: No Content headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: {} default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/transactions/{id}/metadata/{key}: delete: description: Delete metadata by key operationId: v2DeleteTransactionMetadata x-speakeasy-name-override: DeleteTransactionMetadata summary: Delete metadata by key tags: - ledger.v2 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: id in: path description: Transaction ID. required: true schema: type: integer format: bigint minimum: 0 example: 1234 - name: key in: path required: true description: The key to remove. schema: type: string example: foo - name: Idempotency-Key in: header description: Use an idempotency key schema: type: string responses: 204: description: Key deleted headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: {} default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/transactions/{id}/revert: post: tags: - ledger.v2 operationId: v2RevertTransaction x-speakeasy-name-override: RevertTransaction summary: Revert a ledger transaction by its ID parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: id in: path description: Transaction ID. required: true schema: type: integer format: bigint minimum: 0 example: 1234 - name: force in: query description: Force revert required: false schema: type: boolean - name: atEffectiveDate in: query description: Revert transaction at effective date of the original tx required: false schema: type: boolean - name: dryRun in: query description: >- Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker. schema: type: boolean example: true - name: schemaVersion in: query description: Schema version to use for validation schema: type: string example: v1.0.0 - name: Idempotency-Key in: header description: Use an idempotency key schema: type: string requestBody: content: application/json: schema: $ref: "#/components/schemas/V2RevertTransactionRequest" responses: "201": description: OK headers: Idempotency-Hit: description: Indicates that the request was processed using an idempotency key that was already used schema: type: string example: "true" content: application/json: schema: $ref: "#/components/schemas/V2RevertTransactionResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/aggregate/balances: get: tags: - ledger.v2 summary: Get the aggregated balances from selected accounts operationId: v2GetBalancesAggregated x-speakeasy-name-override: GetBalancesAggregated parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pit in: query required: false schema: type: string format: date-time - name: useInsertionDate in: query description: Use insertion date instead of effective date required: false schema: type: boolean requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2AggregateBalancesResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/volumes: get: tags: - ledger.v2 summary: Get list of volumes with balances for (account/asset) operationId: v2GetVolumesWithBalances x-speakeasy-name-override: GetVolumesWithBalances parameters: - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: endTime in: query required: false schema: type: string format: date-time - name: startTime in: query required: false schema: type: string format: date-time - name: insertionDate in: query description: Use insertion date instead of effective date required: false schema: type: boolean - name: groupBy in: query description: Group volumes and balance by the level of the segment of the address example: 3 schema: type: integer format: int64 minimum: 0 maximum: 1000 - $ref: "#/components/parameters/sort" requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2VolumesWithBalanceCursorResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/logs: get: tags: - ledger.v2 summary: List the logs from a ledger description: List the logs from a ledger, sorted by ID in descending order. operationId: v2ListLogs x-speakeasy-name-override: ListLogs parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: pit in: query required: false schema: type: string format: date-time - $ref: "#/components/parameters/sort" requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/V2LogsCursorResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/{ledger}/logs/import: post: tags: - ledger.v2 operationId: v2ImportLogs x-speakeasy-name-override: ImportLogs parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 requestBody: required: true content: application/octet-stream: schema: $ref: "#/components/schemas/V2ImportLogsRequest" responses: "204": description: Import OK default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/logs/export: post: summary: Export logs operationId: v2ExportLogs x-speakeasy-name-override: ExportLogs tags: - ledger.v2 parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 responses: "200": description: Export OK content: application/octet-stream: schema: title: bytes type: string format: binary default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/queries/{id}/run: post: tags: - ledger.v2 summary: Run a query template description: Run a query template on a ledger operationId: v2RunQuery x-speakeasy-name-override: RunQuery parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: schemaVersion in: query required: true description: Schema version to use for validation schema: type: string example: v1.0.0 - name: id in: path description: Query template ID. required: true schema: type: string example: CUSTOMER_DEPOSIT - name: pageSize in: query description: | The maximum number of results to return per page. example: 100 schema: type: integer format: int64 minimum: 1 maximum: 1000 - name: cursor in: query description: > Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: expand in: query schema: type: string items: type: string - name: pit in: query required: false schema: type: string format: date-time - name: order in: query required: false deprecated: true description: "Deprecated: Use sort param" schema: type: string enum: - effective - name: reverse in: query required: false schema: type: boolean - $ref: "#/components/parameters/sort" requestBody: required: true content: application/json: schema: type: object properties: cursor: type: string params: $ref: "#/components/schemas/V2QueryParams" vars: type: object additionalProperties: type: string responses: "200": description: OK content: application/json: schema: oneOf: - $ref: "#/components/schemas/V2TransactionsCursorResponse" - $ref: "#/components/schemas/V2AccountsCursorResponse" - $ref: "#/components/schemas/V2LogsCursorResponse" - $ref: "#/components/schemas/V2VolumesWithBalanceCursorResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:read /v2/_/exporters: get: summary: List exporters operationId: v2ListExporters x-speakeasy-name-override: ListExporters tags: - ledger.v2 responses: "200": $ref: "#/components/responses/V2ListExportersResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" post: summary: Create exporter operationId: v2CreateExporter x-speakeasy-name-override: CreateExporter tags: - ledger.v2 requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/V2CreateExporterRequest" responses: "201": $ref: "#/components/responses/V2CreateExporterResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" /v2/_/exporters/{exporterID}: parameters: - name: exporterID description: The exporter id in: path schema: type: string required: true get: summary: Get exporter state operationId: v2GetExporterState x-speakeasy-name-override: GetExporterState tags: - ledger.v2 responses: "200": $ref: "#/components/responses/V2GetExporterStateResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" put: summary: Update exporter operationId: v2UpdateExporter x-speakeasy-name-override: UpdateExporter tags: - ledger.v2 requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/V2UpdateExporterRequest" responses: "204": description: Exporter updated default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write delete: summary: Delete exporter operationId: v2DeleteExporter x-speakeasy-name-override: DeleteExporter tags: - ledger.v2 responses: "204": description: Exporter deleted default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" /v2/_/buckets/{bucket}: parameters: - name: bucket description: The bucket name in: path schema: type: string required: true delete: summary: Delete bucket operationId: v2DeleteBucket x-speakeasy-name-override: DeleteBucket tags: - ledger.v2 description: >- Delete a bucket by marking all ledgers in the bucket as deleted (soft delete). All ledgers in the bucket will have their deleted_at field set to the current timestamp. responses: "204": description: Bucket deleted "404": description: Bucket not found content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/_/buckets/{bucket}/restore: parameters: - name: bucket description: The bucket name in: path schema: type: string required: true post: summary: Restore bucket operationId: v2RestoreBucket x-speakeasy-name-override: RestoreBucket tags: - ledger.v2 description: >- Restore a deleted bucket by unmarking all ledgers in the bucket as deleted. All ledgers in the bucket will have their deleted_at field set to NULL. responses: "204": description: Bucket restored "404": description: Bucket not found content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" security: - Authorization: - ledger:write /v2/{ledger}/pipelines: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 get: summary: List pipelines operationId: v2ListPipelines x-speakeasy-name-override: ListPipelines tags: - ledger.v2 responses: "200": $ref: "#/components/responses/V2ListPipelinesResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" post: summary: Create pipeline operationId: v2CreatePipeline x-speakeasy-name-override: CreatePipeline tags: - ledger.v2 requestBody: content: application/json: schema: $ref: "#/components/schemas/V2CreatePipelineRequest" responses: "201": $ref: "#/components/responses/V2CreatePipelineResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" /v2/{ledger}/pipelines/{pipelineID}: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pipelineID description: The pipeline id in: path schema: type: string required: true get: summary: Get pipeline state operationId: v2GetPipelineState x-speakeasy-name-override: GetPipelineState tags: - ledger.v2 responses: "200": $ref: "#/components/responses/V2GetPipelineStateResponse" default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" delete: summary: Delete pipeline operationId: v2DeletePipeline x-speakeasy-name-override: DeletePipeline tags: - ledger.v2 responses: "204": description: Pipeline deleted default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" /v2/{ledger}/pipelines/{pipelineID}/reset: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pipelineID description: The pipeline id in: path schema: type: string required: true post: summary: Reset pipeline operationId: v2ResetPipeline x-speakeasy-name-override: ResetPipeline tags: - ledger.v2 responses: "202": description: Pipeline reset default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" /v2/{ledger}/pipelines/{pipelineID}/start: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pipelineID description: The pipeline id in: path schema: type: string required: true post: summary: Start pipeline operationId: v2StartPipeline x-speakeasy-name-override: StartPipeline tags: - ledger.v2 responses: "202": description: Pipeline started default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" /v2/{ledger}/pipelines/{pipelineID}/stop: parameters: - name: ledger in: path description: Name of the ledger. required: true schema: type: string example: ledger001 - name: pipelineID description: The pipeline id in: path schema: type: string required: true post: summary: Stop pipeline operationId: v2StopPipeline x-speakeasy-name-override: StopPipeline tags: - ledger.v2 responses: "202": description: Pipeline stopped default: description: Error content: application/json: schema: $ref: "#/components/schemas/V2ErrorResponse" x-speakeasy-errors: statusCodes: - default components: securitySchemes: Authorization: type: oauth2 flows: clientCredentials: tokenUrl: '/oauth/token' refreshUrl: '/oauth/token' scopes: {} schemas: AccountsCursorResponse: type: object required: - cursor properties: cursor: type: object description: Paginated cursor wrapping the list of accounts required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: '' data: type: array items: $ref: '#/components/schemas/Account' BalancesCursorResponse: type: object required: - cursor properties: cursor: type: object description: Paginated cursor wrapping the list of balances required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: '' data: type: array items: $ref: '#/components/schemas/AccountsBalances' TransactionsCursorResponse: type: object required: - cursor properties: cursor: type: object description: Paginated cursor wrapping the list of transactions required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: '' data: type: array items: $ref: '#/components/schemas/Transaction' LogsCursorResponse: type: object required: - cursor properties: cursor: type: object description: Paginated cursor wrapping the list of logs required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: '' data: type: array items: $ref: '#/components/schemas/Log' AccountResponse: type: object required: - data properties: data: $ref: '#/components/schemas/AccountWithVolumesAndBalances' AggregateBalancesResponse: type: object required: - data properties: data: $ref: '#/components/schemas/AssetsBalances' Config: type: object description: Configuration the ledger server is running with properties: storage: $ref: '#/components/schemas/LedgerStorage' required: - storage LedgerStorage: type: object description: Storage backend the ledgers are held in properties: driver: type: string description: Name of the storage driver backing the ledgers ledgers: type: array description: Names of the ledgers held in this storage backend items: type: string required: - driver - ledgers Metadata: type: object nullable: true description: Arbitrary key/value pairs attached to the resource additionalProperties: {} ConfigInfo: type: object description: Configuration and version information for the ledger server properties: config: $ref: '#/components/schemas/Config' server: type: string description: Name of the server serving the API version: type: string description: Version of the ledger service experimentalFeatures: type: array description: Experimental feature flags enabled on this deployment items: type: string required: - config - server - version ScriptResponse: type: object properties: errorCode: $ref: '#/components/schemas/ErrorsEnum' errorMessage: type: string description: Human-readable description of the error example: account had insufficient funds details: type: string description: >- Optional link carrying additional context about the error, such as a Numscript playground URL reproducing it example: >- https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9 transaction: $ref: '#/components/schemas/Transaction' Account: type: object required: - address properties: address: type: string description: The account address, a colon-separated segmented path such as users:001 example: users:001 type: type: string description: Free-form classification of the account example: virtual metadata: type: object description: Arbitrary key/value pairs attached to the account additionalProperties: true example: admin: true a: nested: key: value AccountWithVolumesAndBalances: type: object description: An account together with its volumes and net balances per asset required: - address properties: address: type: string description: The account address, a colon-separated segmented path such as users:001 example: users:001 type: type: string description: Free-form classification of the account example: virtual metadata: type: object description: Arbitrary key/value pairs attached to the account additionalProperties: true example: admin: true a: nested: key: value volumes: $ref: '#/components/schemas/Volumes' balances: type: object description: Net balance per asset, equal to input minus output additionalProperties: type: integer format: bigint example: COIN: 100 AccountsBalances: type: object additionalProperties: $ref: '#/components/schemas/AssetsBalances' example: account1: USD: 100 EUR: 23 account2: CAD: 20 JPY: 21 AssetsBalances: type: object description: Balances keyed by asset additionalProperties: type: integer format: int64 example: USD: 100 EUR: 12 Contract: type: object properties: account: type: string description: Account address, or pattern, the contract applies to example: users:001 expr: type: object description: Expression the account's balances must satisfy required: - accounts - expr Mapping: type: object nullable: true description: Contracts constraining the balances a ledger's accounts may hold required: - contracts properties: contracts: type: array description: Constraints enforced on the ledger's accounts items: $ref: '#/components/schemas/Contract' Posting: type: object properties: amount: type: integer format: bigint minimum: 0 description: Amount to move, as an arbitrary-precision integer expressed in the asset's smallest unit example: 100 asset: type: string description: The asset being moved, optionally carrying a scale suffix such as USD/2 example: COIN destination: type: string description: Address of the account credited by this posting example: users:002 source: type: string description: Address of the account debited by this posting example: users:001 required: - amount - asset - destination - source Script: type: object properties: plain: type: string description: The Numscript program to execute example: "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n" vars: type: object description: Values bound to the script's declared variables, keyed by variable name additionalProperties: true example: user: users:042 reference: type: string example: order_1234 description: Reference to attach to the generated transaction metadata: $ref: '#/components/schemas/Metadata' required: - plain Transaction: type: object description: A transaction recorded in the ledger, carrying its postings and metadata properties: timestamp: type: string format: date-time description: >- The transaction time: when the transaction is considered to have occurred. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality) postings: type: array description: The fund movements making up the transaction items: $ref: '#/components/schemas/Posting' reference: type: string description: Optional caller-supplied identifier, unique within the ledger, used to deduplicate transactions example: ref:001 metadata: $ref: '#/components/schemas/Metadata' txid: type: integer format: bigint minimum: 0 description: Unique sequential identifier for this transaction within the ledger preCommitVolumes: $ref: '#/components/schemas/AggregatedVolumes' postCommitVolumes: $ref: '#/components/schemas/AggregatedVolumes' required: - postings - timestamp - txid TransactionData: type: object required: - postings properties: postings: type: array description: The fund movements making up the transaction items: $ref: '#/components/schemas/Posting' reference: type: string description: Optional caller-supplied identifier, unique within the ledger, used to deduplicate transactions example: ref:001 metadata: $ref: '#/components/schemas/Metadata' timestamp: type: string format: date-time description: >- The transaction time to record, letting you backdate or postdate the transaction. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality) Transactions: required: - transactions type: object properties: transactions: type: array description: The transactions to create, applied in order items: $ref: '#/components/schemas/TransactionData' PostTransaction: type: object properties: timestamp: type: string format: date-time description: >- The transaction time to record, letting you backdate or postdate the transaction. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality) postings: type: array description: Fund movements to apply. Mutually exclusive with script items: $ref: '#/components/schemas/Posting' script: type: object description: A Numscript program executed to produce the postings. Mutually exclusive with postings properties: plain: type: string example: "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n" vars: type: object additionalProperties: true example: user: users:042 required: - plain reference: type: string description: Optional caller-supplied identifier, unique within the ledger, used to deduplicate transactions example: ref:001 metadata: $ref: '#/components/schemas/Metadata' Stats: type: object description: Aggregate counts for a ledger properties: accounts: type: integer format: int64 minimum: 0 description: Total number of accounts in the ledger transactions: type: integer format: int64 minimum: 0 description: Total number of transactions in the ledger required: - accounts - transactions Log: type: object properties: id: type: integer format: int64 minimum: 0 description: Unique sequential identifier for this log entry within the ledger example: 1234 type: type: string description: The type of operation this log represents enum: - NEW_TRANSACTION - SET_METADATA data: type: object description: The payload of the log entry, whose shape depends on the log type additionalProperties: true hash: type: string description: SHA256 hash of the log entry, chained from the previous log for integrity verification example: 9ee060170400f556b7e1575cb13f9db004f150a08355c7431c62bc639166431e date: type: string format: date-time description: Timestamp when the operation was recorded required: - id - type - data - hash - date TransactionsResponse: type: object properties: data: items: $ref: '#/components/schemas/Transaction' type: array description: The transactions that were created required: - data TransactionResponse: properties: data: $ref: '#/components/schemas/Transaction' type: object required: - data StatsResponse: properties: data: $ref: '#/components/schemas/Stats' type: object required: - data MappingResponse: properties: data: $ref: '#/components/schemas/Mapping' type: object ConfigInfoResponse: properties: data: $ref: '#/components/schemas/ConfigInfo' type: object required: - data Volume: type: object properties: input: type: integer format: bigint description: Total amount credited for this asset output: type: integer format: bigint description: Total amount debited for this asset balance: type: integer format: bigint description: Net balance, equal to input minus output required: - input - output example: input: 100 output: 20 balance: 80 Volumes: type: object description: Volumes per asset for a single account additionalProperties: $ref: '#/components/schemas/Volume' example: USD: input: 100 output: 10 balance: 90 EUR: input: 100 output: 10 balance: 90 AggregatedVolumes: type: object description: Volumes aggregated per account and per asset additionalProperties: $ref: '#/components/schemas/Volumes' example: orders:1: USD: input: 100 output: 10 balance: 90 orders:2: USD: input: 100 output: 10 balance: 90 ErrorResponse: type: object required: - errorCode - errorMessage properties: errorCode: $ref: '#/components/schemas/ErrorsEnum' errorMessage: type: string description: Human-readable description of the error example: '[INSUFFICIENT_FUND] account had insufficient funds' details: type: string description: >- Optional link carrying additional context about the error, such as a Numscript playground URL reproducing it example: >- https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9 ErrorsEnum: type: string description: Machine-readable error code identifying the failure enum: - INTERNAL - INSUFFICIENT_FUND - VALIDATION - CONFLICT - NO_SCRIPT - COMPILATION_FAILED - METADATA_OVERRIDE - NOT_FOUND - TIMEOUT example: INSUFFICIENT_FUND LedgerInfoResponse: type: object properties: data: $ref: '#/components/schemas/LedgerInfo' LedgerInfo: type: object description: Runtime information about a ledger, including the state of its storage migrations properties: name: type: string description: Name of the ledger example: ledger001 storage: type: object description: Storage backend information, including the applied migrations properties: migrations: type: array items: $ref: '#/components/schemas/MigrationInfo' MigrationInfo: type: object properties: version: type: string minimum: 0 description: Sequence number of the migration example: 11 name: type: string description: Name of the migration example: migrations:001 date: type: string format: date-time description: When the migration was applied state: type: string description: Current state of the migration enum: - TO DO - DONE V2ExportersCursorResponse: type: object required: - cursor properties: cursor: type: object description: Paginated cursor wrapping the list of exporters required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ= data: type: array items: $ref: "#/components/schemas/V2Exporter" V2PipelinesCursorResponse: type: object required: - cursor properties: cursor: type: object description: Paginated cursor wrapping the list of pipelines required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ= data: type: array items: $ref: "#/components/schemas/V2Pipeline" V2AccountsCursorResponse: type: object required: - cursor properties: resource: type: string description: The resource type carried by this cursor enum: - accounts cursor: type: object description: Paginated cursor wrapping the list of accounts required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ= data: type: array items: $ref: "#/components/schemas/V2Account" V2TransactionsCursorResponse: type: object required: - cursor properties: resource: type: string description: The resource type carried by this cursor enum: - transactions cursor: type: object description: Paginated cursor wrapping the list of transactions required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ= data: type: array items: $ref: "#/components/schemas/V2Transaction" V2LogsCursorResponse: type: object required: - cursor properties: resource: type: string description: The resource type carried by this cursor enum: - logs cursor: type: object description: Paginated cursor wrapping the list of logs required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ= data: type: array items: $ref: "#/components/schemas/V2Log" V2AccountResponse: type: object required: - data properties: data: $ref: "#/components/schemas/V2Account" V2AggregateBalancesResponse: type: object required: - data properties: data: $ref: "#/components/schemas/V2AssetsBalances" V2VolumesWithBalanceCursorResponse: type: object required: - cursor properties: resource: type: string description: The resource type carried by this cursor enum: - volumes cursor: type: object description: Paginated cursor wrapping the list of volumes required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ= data: type: array items: $ref: "#/components/schemas/V2VolumesWithBalance" V2VolumesWithBalance: type: object properties: account: type: string description: The account address these volumes belong to asset: type: string description: The asset these volumes are denominated in input: type: integer format: bigint description: Total amount credited to the account for this asset output: type: integer format: bigint description: Total amount debited from the account for this asset balance: type: integer format: bigint description: Net balance for this asset, equal to input minus output required: - account - asset - input - output - balance V2Metadata: type: object description: >- Arbitrary key/value pairs attached to the resource. Metadata is bi-temporal, so a point-in-time query returns the metadata as it stood at that time additionalProperties: type: string example: admin: "true" V2ConfigInfo: type: object properties: server: type: string description: Name of the server serving the API version: type: string description: Version of the ledger service experimentalFeatures: type: array description: Experimental feature flags enabled on this deployment items: type: string required: - config - server - version V2Account: type: object description: An account in the ledger, identified by its address and carrying its metadata and volumes required: - address - metadata properties: address: type: string description: The account address, a colon-separated segmented path such as users:001 example: users:001 metadata: type: object description: >- Arbitrary key/value pairs attached to the account. Metadata is bi-temporal, so a point-in-time query returns the metadata as it stood at that time properties: {} additionalProperties: type: string example: admin: "true" insertionDate: type: string format: date-time description: When the account was first written to the ledger, on the request-time axis example: "2023-01-01T00:00:00Z" updatedAt: type: string format: date-time description: When the account was last modified, for example by a metadata change example: "2023-01-01T00:00:00Z" firstUsage: type: string format: date-time description: >- Transaction time of the earliest transaction touching this account. Inserting a backdated transaction can move it earlier example: "2023-01-01T00:00:00Z" volumes: $ref: "#/components/schemas/V2Volumes" effectiveVolumes: $ref: "#/components/schemas/V2Volumes" V2AssetsBalances: type: object description: Balances keyed by asset additionalProperties: type: integer format: bigint example: USD: 100 EUR: 12 V2Posting: type: object properties: amount: type: integer format: bigint minimum: 0 description: Amount to move, as an arbitrary-precision integer expressed in the asset's smallest unit example: 100 asset: type: string description: The asset being moved, optionally carrying a scale suffix such as USD/2 example: COIN destination: type: string description: Address of the account credited by this posting example: users:002 source: type: string description: Address of the account debited by this posting example: users:001 required: - amount - asset - destination - source V2Transaction: type: object description: >- A transaction recorded in the ledger, carrying its postings, metadata and both bi-temporal timestamps properties: insertedAt: type: string format: date-time description: >- The request time: when the transaction was actually written to the ledger. Set by the ledger, not the caller. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality) updatedAt: type: string format: date-time description: When the transaction row was last modified, for example by a metadata change or a revert timestamp: type: string format: date-time description: >- The transaction time: when the transaction is considered to have occurred, also called the effective or booking date. This is the axis the ledger uses to compute balances and resolve point-in-time queries. Settable at creation, defaulting to current machine time if omitted, and immutable once written. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality) postings: type: array description: The fund movements making up the transaction items: $ref: "#/components/schemas/V2Posting" reference: type: string description: Optional caller-supplied identifier, unique within the ledger, used to deduplicate transactions example: ref:001 metadata: $ref: "#/components/schemas/V2Metadata" id: type: integer format: bigint minimum: 0 description: Unique sequential identifier for this transaction within the ledger reverted: type: boolean description: Indicates if the transaction has been reverted revertedAt: type: string format: date-time description: >- When the transaction was reverted, on the request-time axis. Absent if the transaction has not been reverted preCommitVolumes: $ref: "#/components/schemas/V2AggregatedVolumes" postCommitVolumes: $ref: "#/components/schemas/V2AggregatedVolumes" preCommitEffectiveVolumes: $ref: "#/components/schemas/V2AggregatedVolumes" postCommitEffectiveVolumes: $ref: "#/components/schemas/V2AggregatedVolumes" template: type: string description: Name of the transaction template this transaction was created from, if any required: - postings - timestamp - id - metadata - reverted V2PostTransaction: type: object required: - metadata properties: timestamp: type: string format: date-time description: >- The transaction time to record, letting you backdate or postdate the transaction. Defaults to current machine time if omitted. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality) postings: type: array description: Fund movements to apply. Mutually exclusive with script and template items: $ref: "#/components/schemas/V2Posting" script: type: object description: A Numscript program executed to produce the postings. Mutually exclusive with postings properties: template: type: string example: CUSTOMER_DEPOSIT plain: type: string example: "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n" vars: type: object properties: {} additionalProperties: type: string example: user: users:042 runtime: $ref: "#/components/schemas/Runtime" reference: type: string description: Optional caller-supplied identifier, unique within the ledger, used to deduplicate transactions example: ref:001 metadata: $ref: "#/components/schemas/V2Metadata" accountMetadata: type: object description: Metadata to set on the accounts involved in the transaction, keyed by account address additionalProperties: $ref: "#/components/schemas/V2Metadata" force: type: boolean description: >- When true, lets source accounts overdraft without bound, bypassing the balance check. Applies to the postings form only V2Stats: type: object description: Aggregate counts for a ledger properties: accounts: type: integer format: int64 minimum: 0 description: Total number of accounts in the ledger transactions: type: integer format: bigint minimum: 0 description: Total number of transactions in the ledger required: - accounts - transactions V2Log: type: object description: | Represents an immutable log entry in the ledger. Each log captures an atomic operation with its full payload, enabling audit trails and event sourcing patterns. The data field structure depends on the log type. properties: id: type: integer format: bigint minimum: 0 description: Unique sequential identifier for this log entry within the ledger example: 1234 type: type: string enum: - NEW_TRANSACTION - SET_METADATA - REVERTED_TRANSACTION - DELETE_METADATA - INSERTED_SCHEMA description: The type of operation this log represents data: description: | The payload of the log entry. Structure depends on the log type: - NEW_TRANSACTION: V2LogDataNewTransaction - SET_METADATA: V2LogDataSetMetadata - REVERTED_TRANSACTION: V2LogDataRevertedTransaction - DELETE_METADATA: V2LogDataDeleteMetadata - INSERTED_SCHEMA: V2LogDataInsertedSchema oneOf: - $ref: "#/components/schemas/V2LogDataNewTransaction" - $ref: "#/components/schemas/V2LogDataSetMetadata" - $ref: "#/components/schemas/V2LogDataRevertedTransaction" - $ref: "#/components/schemas/V2LogDataDeleteMetadata" - $ref: "#/components/schemas/V2LogDataInsertedSchema" hash: type: string description: SHA256 hash of the log entry, chained from the previous log for integrity verification example: 9ee060170400f556b7e1575cb13f9db004f150a08355c7431c62bc639166431e date: type: string format: date-time description: Timestamp when the operation was recorded schemaVersion: type: string description: Schema version used for validation when the log was created example: v1.0.0 required: - id - type - data - hash - date # Log payload schemas - used to document the structure of log data field V2LogTransaction: type: object description: Transaction structure as it appears in log payloads properties: id: type: integer format: bigint minimum: 0 description: Unique sequential identifier for this transaction within the ledger postings: type: array description: The fund movements making up the transaction items: $ref: "#/components/schemas/V2Posting" metadata: $ref: "#/components/schemas/V2Metadata" timestamp: type: string format: date-time description: >- The transaction time: when the transaction is considered to have occurred. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality) reference: type: string description: Optional caller-supplied identifier, unique within the ledger insertedAt: type: string format: date-time description: >- The request time: when the transaction was actually written to the ledger. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality) updatedAt: type: string format: date-time description: When the transaction row was last modified revertedAt: type: string format: date-time description: When the transaction was reverted, on the request-time axis reverted: type: boolean description: Indicates if the transaction has been reverted template: type: string description: Transaction template used postCommitVolumes: $ref: "#/components/schemas/V2AggregatedVolumes" postCommitEffectiveVolumes: $ref: "#/components/schemas/V2AggregatedVolumes" preCommitVolumes: $ref: "#/components/schemas/V2AggregatedVolumes" preCommitEffectiveVolumes: $ref: "#/components/schemas/V2AggregatedVolumes" required: - id - postings - metadata - timestamp - reverted V2LogDataNewTransaction: type: object description: Payload for NEW_TRANSACTION log entries. Contains the created transaction and any account metadata set during creation. properties: transaction: $ref: "#/components/schemas/V2LogTransaction" accountMetadata: type: object description: Metadata applied to accounts involved in the transaction additionalProperties: $ref: "#/components/schemas/V2Metadata" required: - transaction - accountMetadata example: transaction: id: 1234 postings: - source: "world" destination: "users:001" amount: 100 asset: "USD/2" metadata: {} timestamp: "2024-01-15T10:30:00Z" insertedAt: "2024-01-15T10:30:00Z" reverted: false accountMetadata: "users:001": created_by: "system" V2LogDataSetMetadata: type: object description: Payload for SET_METADATA log entries. Contains the target entity and the metadata that was set. properties: targetType: type: string enum: - ACCOUNT - TRANSACTION description: Type of the target entity targetId: description: Identifier of the entity the metadata was set on, either an account address or a transaction ID oneOf: - type: string description: Account address (when targetType is ACCOUNT) - type: integer format: bigint description: Transaction ID (when targetType is TRANSACTION) metadata: $ref: "#/components/schemas/V2Metadata" required: - targetType - targetId - metadata example: targetType: "ACCOUNT" targetId: "users:001" metadata: status: "active" tier: "premium" V2LogDataRevertedTransaction: type: object description: Payload for REVERTED_TRANSACTION log entries. Contains both the original reverted transaction and the new reverting transaction. properties: revertedTransaction: description: The original transaction that was reverted allOf: - $ref: "#/components/schemas/V2LogTransaction" transaction: description: The new reverting transaction created to cancel the original allOf: - $ref: "#/components/schemas/V2LogTransaction" required: - revertedTransaction - transaction example: revertedTransaction: id: 1234 postings: - source: "world" destination: "users:001" amount: 100 asset: "USD/2" metadata: {} timestamp: "2024-01-15T10:30:00Z" reverted: true transaction: id: 1235 postings: - source: "users:001" destination: "world" amount: 100 asset: "USD/2" metadata: revert: "1234" timestamp: "2024-01-15T11:00:00Z" reverted: false V2LogDataDeleteMetadata: type: object description: Payload for DELETE_METADATA log entries. Contains the target entity and the metadata key that was deleted. properties: targetType: type: string enum: - ACCOUNT - TRANSACTION description: Type of the target entity targetId: description: >- Identifier of the entity the metadata was deleted from, either an account address or a transaction ID oneOf: - type: string description: Account address (when targetType is ACCOUNT) - type: integer format: bigint description: Transaction ID (when targetType is TRANSACTION) key: type: string description: The metadata key that was deleted required: - targetType - targetId - key example: targetType: "ACCOUNT" targetId: "users:001" key: "temporary_flag" V2LogDataInsertedSchema: type: object description: Payload for INSERTED_SCHEMA log entries. Contains the schema that was inserted into the ledger. properties: schema: $ref: "#/components/schemas/V2Schema" required: - schema V2CreateTransactionResponse: properties: data: $ref: "#/components/schemas/V2Transaction" type: object required: - data V2RevertTransactionResponse: $ref: "#/components/schemas/V2CreateTransactionResponse" V2GetTransactionResponse: properties: data: $ref: "#/components/schemas/V2Transaction" type: object required: - data V2StatsResponse: properties: data: $ref: "#/components/schemas/V2Stats" type: object required: - data V2ConfigInfoResponse: $ref: "#/components/schemas/V2ConfigInfo" V2Volume: type: object properties: input: type: integer format: bigint description: Total amount credited for this asset output: type: integer format: bigint description: Total amount debited for this asset balance: type: integer format: bigint description: Net balance, equal to input minus output required: - input - output example: input: 100 output: 20 balance: 80 V2Volumes: type: object description: Volumes per asset for a single account additionalProperties: $ref: "#/components/schemas/V2Volume" example: USD: input: 100 output: 10 balance: 90 EUR: input: 100 output: 10 balance: 90 V2AggregatedVolumes: type: object description: Volumes aggregated per account and per asset additionalProperties: $ref: "#/components/schemas/V2Volumes" example: orders:1: USD: input: 100 output: 10 balance: 90 orders:2: USD: input: 100 output: 10 balance: 90 V2ErrorResponse: type: object required: - errorCode - errorMessage properties: errorCode: $ref: "#/components/schemas/V2ErrorsEnum" errorMessage: type: string description: Human-readable description of the error example: "[VALIDATION] invalid 'cursor' query param" details: type: string description: >- Optional link carrying additional context about the error, such as a Numscript playground URL reproducing it example: >- https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9 V2ErrorsEnum: type: string description: Machine-readable error code identifying the failure enum: - INTERNAL - INSUFFICIENT_FUND - VALIDATION - CONFLICT - COMPILATION_FAILED - METADATA_OVERRIDE - NOT_FOUND - REVERT_OCCURRING - ALREADY_REVERT - NO_POSTINGS - LEDGER_NOT_FOUND - IMPORT - TIMEOUT - BULK_SIZE_EXCEEDED - INTERPRETER_PARSE - INTERPRETER_RUNTIME - LEDGER_ALREADY_EXISTS - SCHEMA_ALREADY_EXISTS - SCHEMA_NOT_SPECIFIED - OUTDATED_SCHEMA example: VALIDATION V2LedgerInfoResponse: type: object properties: data: $ref: "#/components/schemas/V2LedgerInfo" V2LedgerInfo: type: object description: Runtime information about a ledger, including the state of its storage migrations properties: name: type: string description: Name of the ledger example: ledger001 storage: type: object description: Storage backend information, including the migrations applied to the ledger's bucket properties: migrations: type: array items: $ref: "#/components/schemas/V2MigrationInfo" V2MigrationInfo: type: object properties: version: type: string description: Sequence number of the migration example: 11 name: type: string description: Name of the migration example: migrations:001 date: type: string format: date-time description: When the migration was applied state: type: string description: Current state of the migration enum: - TO DO - DONE - PROGRESS V2Bulk: type: array items: $ref: "#/components/schemas/V2BulkElement" V2BaseBulkElement: type: object required: - action properties: action: type: string description: The bulk action this element performs ik: type: string description: Idempotency key scoped to this element, making it safe to retry the bulk request V2BulkElement: type: object oneOf: - $ref: "#/components/schemas/V2BulkElementCreateTransaction" - $ref: "#/components/schemas/V2BulkElementAddMetadata" - $ref: "#/components/schemas/V2BulkElementRevertTransaction" - $ref: "#/components/schemas/V2BulkElementDeleteMetadata" discriminator: propertyName: action mapping: CREATE_TRANSACTION: "#/components/schemas/V2BulkElementCreateTransaction" ADD_METADATA: "#/components/schemas/V2BulkElementAddMetadata" REVERT_TRANSACTION: "#/components/schemas/V2BulkElementRevertTransaction" DELETE_METADATA: "#/components/schemas/V2BulkElementDeleteMetadata" V2BulkElementCreateTransaction: type: object allOf: - $ref: "#/components/schemas/V2BaseBulkElement" - type: object properties: data: $ref: "#/components/schemas/V2PostTransaction" V2TargetId: oneOf: - type: string - type: integer format: bigint V2TargetType: type: string enum: - TRANSACTION - ACCOUNT V2BulkElementAddMetadata: type: object allOf: - $ref: "#/components/schemas/V2BaseBulkElement" - type: object properties: data: type: object properties: targetId: $ref: "#/components/schemas/V2TargetId" targetType: $ref: "#/components/schemas/V2TargetType" metadata: type: object additionalProperties: type: string required: - targetId - targetType - metadata V2BulkElementRevertTransaction: type: object allOf: - $ref: "#/components/schemas/V2BaseBulkElement" - type: object properties: data: type: object properties: id: type: integer format: bigint force: type: boolean atEffectiveDate: type: boolean metadata: $ref: "#/components/schemas/V2Metadata" required: - id V2BulkElementDeleteMetadata: type: object allOf: - $ref: "#/components/schemas/V2BaseBulkElement" - type: object properties: data: type: object properties: targetId: $ref: "#/components/schemas/V2TargetId" targetType: $ref: "#/components/schemas/V2TargetType" key: type: string required: - targetId - targetType - key V2BulkResponse: type: object properties: data: type: array description: Result of each element of the bulk request, in submission order items: $ref: "#/components/schemas/V2BulkElementResult" errorCode: $ref: "#/components/schemas/V2ErrorsEnum" errorMessage: type: string description: Human-readable description of the error example: "[VALIDATION] invalid 'cursor' query param" V2BulkElementResult: type: object oneOf: - $ref: "#/components/schemas/V2BulkElementResultCreateTransaction" - $ref: "#/components/schemas/V2BulkElementResultAddMetadata" - $ref: "#/components/schemas/V2BulkElementResultRevertTransaction" - $ref: "#/components/schemas/V2BulkElementResultDeleteMetadata" - $ref: "#/components/schemas/V2BulkElementResultError" discriminator: propertyName: responseType mapping: CREATE_TRANSACTION: "#/components/schemas/V2BulkElementResultCreateTransaction" ADD_METADATA: "#/components/schemas/V2BulkElementResultAddMetadata" REVERT_TRANSACTION: "#/components/schemas/V2BulkElementResultRevertTransaction" DELETE_METADATA: "#/components/schemas/V2BulkElementResultDeleteMetadata" ERROR: "#/components/schemas/V2BulkElementResultError" V2BaseBulkElementResult: type: object properties: responseType: type: string description: The action this result corresponds to logID: type: integer description: Identifier of the log entry produced by this element required: - responseType - logID V2BulkElementResultCreateTransaction: allOf: - $ref: "#/components/schemas/V2BaseBulkElementResult" - type: object properties: data: $ref: "#/components/schemas/V2Transaction" required: - data V2BulkElementResultAddMetadata: allOf: - $ref: "#/components/schemas/V2BaseBulkElementResult" V2BulkElementResultRevertTransaction: allOf: - $ref: "#/components/schemas/V2BaseBulkElementResult" - type: object properties: data: $ref: "#/components/schemas/V2Transaction" required: - data V2BulkElementResultDeleteMetadata: allOf: - $ref: "#/components/schemas/V2BaseBulkElementResult" V2BulkElementResultError: allOf: - $ref: "#/components/schemas/V2BaseBulkElementResult" - type: object properties: errorCode: type: string errorDescription: type: string errorDetails: type: string required: - errorCode - errorDescription V2ChartAccountRules: type: object description: Rules applied to accounts matching a chart-of-accounts segment V2ChartAccountMetadata: type: object properties: default: type: string description: Value applied to this metadata key when an account matching the segment is created V2ChartSegment: type: object description: "Segment within a chart of accounts" properties: .self: type: object description: Rules and metadata applied to the segment's own account, as opposed to its children .pattern: type: string description: Regular expression every child segment name must match .rules: $ref: "#/components/schemas/V2ChartAccountRules" .metadata: type: object description: Metadata applied to accounts matching this segment, keyed by metadata key additionalProperties: $ref: "#/components/schemas/V2ChartAccountMetadata" additionalProperties: $ref: "#/components/schemas/V2ChartSegment" example: users: $userID: .pattern: "^[0-9]{16}$" V2ChartOfAccounts: type: object description: "Chart of account" additionalProperties: $ref: "#/components/schemas/V2ChartSegment" example: users: $userID: .pattern: "^[0-9]{16}$" Runtime: type: string description: The numscript runtime used to execute the script. Uses "machine" by default, unless the "--experimental-numscript-interpreter" feature flag is passed. enum: - experimental-interpreter - machine V2TransactionTemplate: type: object properties: description: type: string description: Human-readable description of what the template does script: type: string description: The Numscript program the template executes runtime: $ref: "#/components/schemas/Runtime" required: - script V2TransactionTemplates: type: object description: Transaction templates additionalProperties: $ref: "#/components/schemas/V2TransactionTemplate" V2QueryTemplateVar: type: object properties: type: type: string description: Type of the variable default: description: Value used when the variable is not supplied at query time required: - type V2QueryResource: type: string description: The resource a query template targets enum: [transactions, accounts, logs, volumes] V2QueryParams: type: object description: Parameters applied when running a query template properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 description: | The maximum number of results to return per page. example: 100 cursor: description: > Parameter used in pagination requests. Maximum page size is set to 15. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== expand: type: string description: Additional data to include in the response, such as volumes items: type: string pit: type: string format: date-time description: Point-in-time. Returns the state as it existed at this timestamp sort: type: string description: | Sort results using a field name and order (ascending or descending). Format: `:`, where `` is the field name and `` is either `asc` or `desc`. example: id:desc discriminator: propertyName: resource oneOf: - x-speakeasy-name-override: QueryTemplateAccountParams required: [resource] properties: resource: type: string enum: - accounts - x-speakeasy-name-override: QueryTemplateTransactionParams required: [resource] properties: resource: type: string enum: - transactions - x-speakeasy-name-override: QueryTemplateLogParams required: [resource] properties: resource: type: string enum: - logs - x-speakeasy-name-override: QueryTemplateVolumeParams required: [resource] properties: resource: type: string enum: - volumes insertionDate: type: boolean groupBy: type: integer V2QueryTemplate: type: object properties: description: type: string description: Human-readable description of what the query returns resource: $ref: "#/components/schemas/V2QueryResource" params: $ref: "#/components/schemas/V2QueryParams" vars: type: object description: Variables the query accepts, keyed by variable name additionalProperties: $ref: "#/components/schemas/V2QueryTemplateVar" body: type: object additionalProperties: true description: The filter expression the query evaluates V2QueryTemplates: type: object description: Query templates additionalProperties: $ref: "#/components/schemas/V2QueryTemplate" V2SchemaData: type: object description: Schema data structure for ledger schemas properties: chart: $ref: "#/components/schemas/V2ChartOfAccounts" transactions: $ref: "#/components/schemas/V2TransactionTemplates" queries: $ref: "#/components/schemas/V2QueryTemplates" required: - chart V2Schema: type: object description: Complete schema structure with metadata allOf: - type: object required: - version - createdAt properties: version: type: string description: Schema version example: "v1.0.0" createdAt: type: string format: date-time description: Schema creation timestamp example: "2023-01-01T00:00:00Z" - $ref: "#/components/schemas/V2SchemaData" V2SchemaResponse: properties: data: $ref: "#/components/schemas/V2Schema" type: object required: - data V2SchemasCursorResponse: properties: cursor: $ref: "#/components/schemas/V2SchemasCursor" type: object required: - cursor V2SchemasCursor: properties: data: type: array description: The schemas on this page items: $ref: "#/components/schemas/V2Schema" hasMore: type: boolean description: Whether further pages are available previous: type: string description: Cursor for the previous page, absent on the first page example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string description: Cursor for the next page, absent on the last page example: aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ= pageSize: type: integer description: Number of items requested per page type: object description: Paginated cursor over the ledger's schemas required: - data - hasMore - pageSize V2CreateLedgerRequest: type: object properties: bucket: type: string description: Name of the storage bucket backing the ledger. Ledgers sharing a bucket share a database schema metadata: $ref: "#/components/schemas/V2Metadata" features: type: object description: Feature flags to enable on the ledger, keyed by feature name additionalProperties: type: string V2Ledger: type: object description: A ledger and its configuration properties: name: type: string description: Name of the ledger addedAt: type: string format: date-time description: When the ledger was created bucket: type: string description: Name of the storage bucket backing the ledger deletedAt: type: string format: date-time nullable: true description: When the ledger was deleted, absent for active ledgers metadata: $ref: "#/components/schemas/V2Metadata" features: type: object description: Feature flags enabled on the ledger, keyed by feature name additionalProperties: type: string id: type: integer description: Unique sequential identifier for the ledger required: - name - addedAt - bucket V2LedgerListResponse: type: object required: - cursor properties: cursor: type: object description: Paginated cursor wrapping the list of ledgers required: - pageSize - hasMore - data properties: pageSize: type: integer format: int64 minimum: 1 maximum: 1000 example: 15 hasMore: type: boolean example: false previous: type: string example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string example: aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ= data: type: array items: $ref: "#/components/schemas/V2Ledger" V2UpdateLedgerMetadataRequest: $ref: "#/components/schemas/V2Metadata" V2GetLedgerResponse: type: object required: - data properties: data: $ref: "#/components/schemas/V2Ledger" V2ImportLogsRequest: type: object required: - file properties: file: type: string format: binary description: The log export to import, as produced by the export endpoint V2RevertTransactionRequest: type: object properties: metadata: type: object description: Metadata to attach to the compensating transaction created by the revert additionalProperties: type: string V2CreatePipelineRequest: type: object properties: exporterID: type: string description: Identifier of the exporter this pipeline feeds required: - exporterID V2CreateExporterRequest: $ref: "#/components/schemas/V2ExporterConfiguration" V2UpdateExporterRequest: $ref: "#/components/schemas/V2ExporterConfiguration" V2PipelineConfiguration: properties: ledger: type: string description: Name of the ledger the pipeline reads from exporterID: type: string description: Identifier of the exporter the pipeline feeds required: - ledger - exporterID V2ExporterConfiguration: type: object properties: driver: type: string description: Name of the exporter driver to use config: type: object additionalProperties: true description: Driver-specific configuration for the exporter required: - driver - config V2Exporter: type: object allOf: - $ref: "#/components/schemas/V2ExporterConfiguration" - type: object properties: id: type: string createdAt: type: string format: date-time required: - id - createdAt V2Pipeline: allOf: - $ref: "#/components/schemas/V2PipelineConfiguration" - type: object properties: id: type: string createdAt: type: string format: date-time lastLogID: type: integer enabled: type: boolean required: - id - createdAt parameters: sort: name: sort in: query description: | Sort results using a field name and order (ascending or descending). Format: `:`, where `` is the field name and `` is either `asc` or `desc`. required: false schema: type: string example: id:desc responses: V2CreatePipelineResponse: description: Created ipeline content: application/json: schema: type: object properties: data: $ref: "#/components/schemas/V2Pipeline" required: - data V2ListPipelinesResponse: description: Pipelines list content: application/json: schema: $ref: "#/components/schemas/V2PipelinesCursorResponse" V2GetPipelineStateResponse: description: Pipeline information content: application/json: schema: type: object properties: data: $ref: "#/components/schemas/V2Pipeline" required: - data V2CreateExporterResponse: description: Created exporter content: application/json: schema: type: object properties: data: $ref: "#/components/schemas/V2Exporter" required: - data V2ListExportersResponse: description: Exporters list content: application/json: schema: $ref: "#/components/schemas/V2ExportersCursorResponse" V2GetExporterStateResponse: description: Exporter information content: application/json: schema: type: object properties: data: $ref: "#/components/schemas/V2Exporter" required: - data servers: - url: http://localhost:8080/