Reliable integrations
Pagination & exports
Read scoped collections with cursors and download CSV pages.
Read a collection page by page
Scoped resource collections return items and nextCursor. Records are ordered by identifier descending. Use a page size from 1 to 200; the default is 50.
Send the returned nextCursor as before to continue. A null cursor means the collection is exhausted. A final empty page is possible when the preceding page contained exactly the requested limit.
const cards = [];
let before;
do {
const url = new URL('https://api.digitalcard.technology/api/v1/cards');
url.searchParams.set('programId', process.env.DIGITALCARD_PROGRAM_ID);
url.searchParams.set('limit', '100');
if (before) url.searchParams.set('before', before);
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.DIGITALCARD_API_KEY}` },
});
const page = await response.json();
if (!response.ok) throw new Error(page.error.message);
cards.push(...page.items);
before = page.nextCursor;
} while (before); Apply scope and filters
Use programId to filter program-owned collections. The programs collection already returns programs themselves. The operations collection additionally accepts kind, such as issue, load or funding.
companyId is an administrator-only filter. Company tokens remain scoped to their own company even if they include another company identifier. Beneficiary sessions are further restricted to their own program and records.
Export the current page
Add format=csv to a scoped collection request to download the current page with the same filters and cursor. Repeat over the collection if you need a complete export. This option applies to programs, beneficiaries, cards, wallets, operations, transactions, ledger, domains, documents, tickets and activity.
CSV exports escape formulas for spreadsheet safety. A CSV export does not combine currencies or normalize financial values into one reporting currency.
curl --fail-with-body 'https://api.digitalcard.technology/api/v1/transactions?programId=<program_id>&format=csv&limit=200' \
-H "Authorization: Bearer $DIGITALCARD_API_KEY" \
--output transactions.csv Errors & troubleshooting ↗
Use stable error codes and request identifiers to resolve integration failures.