Retrieve account transactions
In this tutorial, you’ll learn how to use the J.P. Morgan Business Direct Connect API to retrieve transactions for a specific consented account. By the end of this tutorial, you’ll know how to:
- Retrieve a lightweight list of consented accounts.
- Retrieve transactions for a specific account and date range.
- Retrieve additional pages of transaction results.
Before you begin
To use this capability, you'll need to:
- Complete onboarding and obtain client credentials.
- Complete the consent flow and obtain a valid access token.
Send a request
To retrieve transactions for consented accounts, follow these steps:
Retrieve a lightweight account list
Send a
GETrequest to the/accountsendpoint. SetresultTypetolightweight, or omit the parameter becauselightweightis the default. The response contains minimal descriptive information and anaccountIdfor each returned account.Retrieve transactions for an account
Use the
accountIdreturned by theaccount-listrequest to send aGETrequest to/accounts/{accountId}/transactions. Replace{accountId}with the identifier for the account you want to query.
Fetch transactions for a given date range
Specify the date range using one of the following parameter pairs. You can use only one pair at a time.
| Parameter pair | Format | Example | Notes |
|---|---|---|---|
startTime + endTime |
ISO 8601 timestamp | 2024-01-01T00:00:00Z | Supports date and time values. |
startDate + endDate |
yyyy-MM-dd | 2024-01-01 | Available starting in FDX v6.5. |
Rules and behavior
- You must provide a start value (
startTimeorstartDate). - If you omit the corresponding end value (
endTimeorendDate), the API defaults it to the previous day. - The start value must be less than or equal to the end value.
- Otherwise, the API returns Invalid Date Range (code 703, HTTP
400).
- Otherwise, the API returns Invalid Date Range (code 703, HTTP
- The
startDate/endDateandstartTime/endTimeparameter pairs are mutually exclusive.- If you specify both pairs in the same request, the API returns Invalid Input (code 401, HTTP
400) with the message:
- If you specify both pairs in the same request, the API returns Invalid Input (code 401, HTTP
- If the date range includes future dates, the response may be empty because future posted transactions don't exist.
Handle pagination
When a response contains multiple pages of results, use the pagination information in the response to retrieve additional records and understand the size of the result set.
Pagination fields
| Field | What it's used for |
|---|---|
links.next.href |
Use this URL to retrieve the next page of results. |
links.next.action |
Shows the HTTP method to use when retrieving the next page. In most cases, this value is GET. |
links.next.rel |
Identifies the relationship of the link. For example, next indicates the next page of results. |
links.next.types |
Shows the expected response content type, such as application/fdx+json. |
pageMetadata.totalElements |
Shows the total number of records available across all pages. |
Additional information
- The page object contains pagination details, including the total number of available records.
- You don't need to use
pageMetadata.nextOffSet,pageMetadata.prevOffSet, orlinks.prev.href. These fields aren't supported.
Retrieve additional transaction results
Transaction responses are paginated and return a maximum of 100 transactions per page, regardless of the limit value.
To retrieve the next page:
- Check the response for
links.next. - Use the URL in
links.next.hrefto request the next set of transactions. - Use the HTTP method identified by
links.next.action.
The next-page link may also include:
links.next.rel, which identifies the link’s relationship to the current response.links.next.types, which identifies the supported response content type.
Don’t use offset or pageKey to paginate transaction results. The transactions endpoint supports forward navigation through response links and doesn’t support a previous-page link.
Request and response details
A successful response returns 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.