Parallel File Download
Parallel File Download is an API v2 mechanism for exporting large volumes of data from Mambu as streamed files. It is designed for bulk export and data replication use cases where end-to-end throughput matters more than interactive paging.
Cursor-based search walks a single sequential cursor through an indexed column, so its performance depends heavily on database indexing. Parallel File Download instead uses a two-call workflow: you first split the dataset into independent partitions, then download those partitions concurrently.
Parallel File Download is enabled by default for all tenants on Mambu application v9.196 or later. Please contact Mambu Support if you have any questions or experience issues.
When to use Parallel File Download
We recommend Parallel File Download when:
- You need to export a full population or a large slice of an entity, for example, a full month of transactions.
- You are populating a data warehouse, BI store, or other downstream system where overall throughput matters more than individual request latency.
- You want predictable, parallelisable performance that does not depend on indexes on specific filter columns.
Parallel File Download is not the right choice when:
- You need a small, interactive result set with sorting and rich filter criteria. Use the standard API v2 search endpoints with cursor pagination instead.
- You only need the first few hundred records. The setup cost of calculating ranges is not worthwhile for small result sets.
- The entity is not one of the supported entities.
How it works
Parallel File Download uses two endpoints for each supported entity:
GET .../rangesreturns a list of encoded key partitions that evenly split the dataset. You must call this endpoint first. It accepts an optionalpartitionsquery parameter (integer, default10) that sets the desired number of partitions. Mambu returns at most this many partitions, and may return fewer for small datasets.POST .../filedownloadaccepts either a single partition or a date filter and streams back the matching records. You can send multiple requests concurrently to make full use of the available bandwidth. It accepts an optionaldetailsLevelquery parameter:BASIC(default) orFULL.
Filter modes
Each filedownload request must use exactly one of the following filter modes. If you provide both, the request returns a 400 Bad Request error.
| Filter mode | Request body | Description |
|---|---|---|
| Encoded key range | { "encodedKeyFrom": "...", "encodedKeyTo": "..." } | Used together with the ranges endpoint to run parallel downloads. The bounds must match the partitions returned by Mambu. |
| Last updated range | { "lastUpdatedFrom": "YYYY-MM-DD", "lastUpdatedTo": "YYYY-MM-DD" } | Filters records by lastModifiedDate. Dates are interpreted in UTC and both ends are inclusive. Useful for incremental exports without generating ranges. |
Request and response format
- Requests use the
application/jsoncontent type. - The
rangesendpoints returnapplication/vnd.mambu.v2+json. - The
filedownloadendpoints return a single streamedapplication/vnd.mambu.v2+octetstreampayload that contains a JSON array of records, with one entity per array element. The connection remains open until all records are written or the caller closes it.
Parallel File Download does not change response schemas. Each record in the streamed payload is identical to the equivalent record returned by the existing API v2 search endpoint for that entity.
| Response code | Description |
|---|---|
200 OK | Binary file stream (application/vnd.mambu.v2+octetstream). |
400 Bad Request | Validation error, for example, an invalid date format or both filter modes provided in the same request. |
401 Unauthorized / 403 Forbidden | Authentication failed or the caller does not have the required permissions. |
Permissions
Parallel File Download reuses the permissions of the existing search endpoints. Any user or API consumer who can call an entity's :search endpoint can also call the corresponding ranges and filedownload endpoints. For example, View Deposit Account Details (VIEW_SAVINGS_ACCOUNT_DETAILS) for deposit accounts, or View Loan Account Details (VIEW_LOAN_ACCOUNT_DETAILS) for loan accounts.
Supported entities
Parallel File Download currently supports the following entities. The path structure differs between entities, so use the exact paths listed below.
| Entity | Equivalent search endpoint | Get ranges | Download file | Query parameters |
|---|---|---|---|---|
| Deposit accounts | POST /api/deposits:search | GET /api/deposits/ranges | POST /api/deposits/filedownload |
|
| Loan accounts | POST /api/loans:search | GET /api/loans/ranges | POST /api/loans/filedownload |
|
| Deposit transactions | POST /api/deposits/transactions:search | GET /api/deposits/transactions-search/ranges | POST /api/deposits/transactions-search/filedownload |
|
| Loan transactions | POST /api/loans/transactions:search | GET /api/loans/transactions/ranges | POST /api/loans/transactions/filedownload |
|
We are actively expanding the list of supported entities. Next to be added: GL Journal Entries and API Clients.
For high-volume transaction exports, we recommend starting with 10 to 20 partitions.
Migrating from cursor-based search
| Aspect | Cursor-based search | Parallel File Download |
|---|---|---|
| Endpoints | POST /api/{entity}:search with cursor and limit | GET .../ranges and POST .../filedownload. Paths vary by entity, see Supported entities. |
| Concurrency | Single sequential stream | Multiple partitions downloaded in parallel, driven by your client |
| Filtering | Full filterCriteria and sortingCriteria | Date range or encoded key range only |
| Database index dependency | Requires an index on the cursor column | Independent of indexes, uses encoded key partitioning |
| Response schema | As per the API v2 :search endpoint (application/vnd.mambu.v2+json) | Identical per-record schema, streamed as application/vnd.mambu.v2+octetstream |
| Best suited for | Interactive, filter-rich paging | Bulk export, data warehouse loads, and replication |
| Availability | All entities with a search endpoint | Deposit accounts, loan accounts, deposit transactions, and loan transactions |
Example
The following Python example retrieves 10 partitions for deposit transactions and downloads them concurrently using a thread pool. Each partition is saved to a separate file.
import requests
from concurrent.futures import ThreadPoolExecutor
BASE = "https://TENANT_NAME.mambu.com"
AUTH = ("API_USER", "API_PASSWORD")
PATH = "/api/deposits/transactions-search"
def download_partition(idx, rng):
headers = {
"Accept": "application/vnd.mambu.v2+octetstream",
"Content-Type": "application/json",
}
# Open a streaming connection to download the partition
with requests.post(BASE + PATH + "/filedownload",
json=rng, headers=headers,
auth=AUTH, stream=True) as resp:
resp.raise_for_status()
# Write the streamed chunks to a separate local file per partition
with open(f"deposit_txn_{idx:02d}.json", "wb") as fh:
for chunk in resp.iter_content(chunk_size=64 * 1024):
fh.write(chunk)
# Step 1: Get the partitions from the ranges endpoint
ranges = requests.get(
BASE + PATH + "/ranges",
params={"partitions": 10},
headers={"Accept": "application/vnd.mambu.v2+json"},
auth=AUTH,
).json()
# Step 2: Download all partitions concurrently
with ThreadPoolExecutor(max_workers=10) as pool:
list(pool.map(lambda p: download_partition(*p), enumerate(ranges)))