TheDocumentation Index
Fetch the complete documentation index at: https://docs.formance.com/llms.txt
Use this file to discover all available pages before exploring further.
_bulk endpoint allows for efficient processing of multiple requests in a single operation. It supports streaming, parallel or sequential processing, and atomic execution.
Request formats
Non-streaming
For standard bulk requests, send operations as a JSON array withContent-Type: application/json:
Streaming
Bulk requests can be streamed without requiring the entire request to be loaded into memory. To enable streaming, include one of the following content type headers in your HTTP request:- For a script stream, include content type
application/vnd.formance.ledger.api.v2.bulk+script-stream - For a JSON stream, include content type
application/vnd.formance.ledger.api.v2.bulk+json-stream
//script and //end delimiters:
CREATE_TRANSACTION only):
CREATE_TRANSACTION- Create a new transactionADD_METADATA- Add metadata to an account or transactionREVERT_TRANSACTION- Revert a transaction (supports optionalmetadatato attach to the compensating transaction)DELETE_METADATA- Delete metadata from an account or transaction
Processing options
Parallel v. Sequential Processing
Bulk elements can be processed either in parallel or sequentially, controlled by theparallel query parameter:
parallel=true: Elements are processed in parallel, improving throughput.parallel=false: Elements are processed sequentially, maintaining order.
Atomic Bulk Execution
Bulk elements can be committed atomically or independently using theatomic query parameter:
atomic=true: The entire batch is committed as a single transaction. If any element fails, the entire batch is rolled back.atomic=false: Each element is processed independently. If one element fails, it does not affect the others.
Since requests can be processed either in parallel or atomically, you cannot set
parallel=true and atomic=true at the same time.Continue on Failure
ThecontinueOnFailure query parameter controls how the bulk endpoint handles errors during sequential processing:
continueOnFailure=false(default): Processing stops at the first error. Subsequent elements are not processed.continueOnFailure=true: Processing continues even if individual elements fail. Failed elements are reported in the response.
Idempotency
Idempotency keys prevent duplicate transactions when replaying bulk requests after failures. Each bulk element can specify its own key. For script streams, addik=<key> to the script header:
ik field to each element:
Idempotency-Hit: true header. This helps clients distinguish between new and replayed requests.
This header is also returned on individual API endpoints (not just bulk) when using the Idempotency-Key request header.
Configuration
Bulk size limits
The 100 item limit applies only to non-streaming requests. If your use case requires a larger limit, you can configure it using the--bulk-max-size flag or BULK_MAX_SIZE environment variable: