Retrieve account transactions
In this tutorial, learn how to use the J.P. Morgan Business Direct Connect API to retrieve a list of transactions for consented accounts. By the end of this tutorial, you will know how to:
- Retrieve a list of accounts.
- Fetch transactions for a specific account and date range.
- Handle paginated transaction results.
Before you begin
To use this capability, you will need to have:
- Complete onboarding and get client credentials.
- Complete the consent flow and get a valid access token.
Send a request
To retrieve transactions for consented accounts, follow these steps:
Retrieve a list of accounts:
Send aGETrequest to the/accountsendpoint, setting theresultTypeparameter to lightweight or details to retrieve a list of accounts with their associated descriptors. IfresultTypeis not specified, it defaults to lightweight.Fetch transactions for each account:
For each account, send aGETrequest to the/accounts/{accountId}/transactionsendpoint to retrieve transactions.
Fetching transactions for a given date range
- Specify both
startTimeandendTimequery parameters to define the date range. - If only the
startTimeis specified, the end date defaults to the previous day. - The
startTimemust be less than or equal to theendTime. If not the API returns an invalid date range error (code 703, HTTP 400). - If the date range includes future dates, the response may be empty, as there are no future posted transactions.
Handling pagination
- The page object in the response contains pagination metadata, such as the total number of records.
- The links object provides navigation links for paginated results:
links.next.href: Use this URL to fetch the next page of results.links.next.action: Indicates the HTTP method (usually "GET").links.next.rel: Relationship type (e.g., "next" for next page).links.next.types: Expected response type (e.g., "application/fdx+json").
pageMetadata.totalElements: Provides the total number of records.pageMetadata.nextOffSetandpageMetadata.prevOffSet, as well aslinks.prev.href, are not supported and do not need to be used.
Request and response details
A successful response will return a paginated list of transactions for the specified account and date range. For details on required and optional parameters, error codes, response formats, and request and response examples, refer to the API specification.