Skip to main content

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.

note

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:

  1. GET .../ranges returns a list of encoded key partitions that evenly split the dataset. You must call this endpoint first. It accepts an optional partitions query parameter (integer, default 10) that sets the desired number of partitions. Mambu returns at most this many partitions, and may return fewer for small datasets.
  2. POST .../filedownload accepts 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 optional detailsLevel query parameter: BASIC (default) or FULL.

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 modeRequest bodyDescription
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/json content type.
  • The ranges endpoints return application/vnd.mambu.v2+json.
  • The filedownload endpoints return a single streamed application/vnd.mambu.v2+octetstream payload 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 codeDescription
200 OKBinary file stream (application/vnd.mambu.v2+octetstream).
400 Bad RequestValidation error, for example, an invalid date format or both filter modes provided in the same request.
401 Unauthorized / 403 ForbiddenAuthentication 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.

EntityEquivalent search endpointGet rangesDownload fileQuery parameters
Deposit accountsPOST /api/deposits:searchGET /api/deposits/rangesPOST /api/deposits/filedownload
  • Ranges: partitions (integer, optional, default: 10)
  • Download: detailsLevel (BASIC default, or FULL)
Loan accountsPOST /api/loans:searchGET /api/loans/rangesPOST /api/loans/filedownload
  • Ranges: partitions (integer, optional, default: 10)
  • Download: detailsLevel (BASIC default, or FULL)
Deposit transactionsPOST /api/deposits/transactions:searchGET /api/deposits/transactions-search/rangesPOST /api/deposits/transactions-search/filedownload
  • Ranges: partitions (integer, optional, default: 10)
  • Download: detailsLevel (BASIC default, or FULL)
Loan transactionsPOST /api/loans/transactions:searchGET /api/loans/transactions/rangesPOST /api/loans/transactions/filedownload
  • Ranges: partitions (integer, optional, default: 10)
  • Download: detailsLevel (BASIC default, or FULL)
note

We are actively expanding the list of supported entities. Next to be added: GL Journal Entries and API Clients.

tip

For high-volume transaction exports, we recommend starting with 10 to 20 partitions.

AspectCursor-based searchParallel File Download
EndpointsPOST /api/{entity}:search with cursor and limitGET .../ranges and POST .../filedownload. Paths vary by entity, see Supported entities.
ConcurrencySingle sequential streamMultiple partitions downloaded in parallel, driven by your client
FilteringFull filterCriteria and sortingCriteriaDate range or encoded key range only
Database index dependencyRequires an index on the cursor columnIndependent of indexes, uses encoded key partitioning
Response schemaAs per the API v2 :search endpoint (application/vnd.mambu.v2+json)Identical per-record schema, streamed as application/vnd.mambu.v2+octetstream
Best suited forInteractive, filter-rich pagingBulk export, data warehouse loads, and replication
AvailabilityAll entities with a search endpointDeposit 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)))