Skip to main content

Fetch Account and Transaction Data with Connect

Legacy Guide

This guide is for Platform API v2011101. For guidance on the newest version, see Connectivity Integration Guides.

This guide assumes you are following MX's recommendation to use the Connect Widget. If your use case requires you to use API endpoints only, see our separate guide on this type of integration.

Prerequisites

Before you follow the steps in this guide make sure that you have:

  1. Signed up for the Platform API and received your development API Keys.
  2. Integrated the Connect Widget into your application or website. The best way to do this is to use one of the widget SDKs mentioned in Integration Guides that MX has created for this purpose.
Step 1

Create a User

A user represents your end user in the MX Platform. Make a request to the Create User endpoint (POST /users).

We recommend that you include a unique id of your choice with the request. You may also include metadata, such as the date the user was created or the end user's name. Don't include any sensitive information here, such as credentials.

info

None of these parameters are required, but the user object can't be empty. We recommend that you always set the id parameter when creating a user.

In the response, the API gives each new user an MX-defined guid (or user_guid when appearing outside the user object). Between your id and the guid, you can map between your system and ours. You'll need the user guid for nearly every request on the MX API, at least when using basic authorization.

Request
Response
Language:shell

_12
curl -i -X POST 'https://int-api.mx.com/users' \
_12
-u 'client_id:api_key' \
_12
-H 'Accept: application/vnd.mx.api.v1+json' \
_12
-H 'Content-Type: application/json' \
_12
-d '{
_12
"user": {
_12
"id": "partner-2345",
_12
"is_disabled": false,
_12
"email": "example@example.com",
_12
"metadata": "Some metadata"
_12
}
_12
}'

Step 2

Request a Connect Widget URL

There are many configuration options for the Connect Widget for performing various tasks. Default configuration values are set with account aggregation in mind, so little configuration is required for simple aggregation. Nevertheless, you should carefully read the documentation on configuration options as they may be important for your particular use case.

Make a POST request to the /users/{user_guid}/widget_urls endpoint.

  • In the body, set the widget_type parameter to connect_widget.
  • In the path, set the user_guid to the value for the user you created in step 1.

The response will contain a URL to Connect Widget which you will load in the next step.

Request
Response
Language:shell

_10
curl -i -X POST 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/widget_urls' \
_10
-u '{client_id}:{api_key}' \
_10
-H 'Accept: application/vnd.mx.api.v1+json' \
_10
-H 'Content-Type: application/json' \
_10
-d '{
_10
"widget_url": {
_10
"widget_type": "connect_widget",
_10
"color_scheme": "dark"
_10
}
_10
}'

Step 3

Load the URL and Let the End User Interact

info

If you're following this guide for testing purposes, you must search for the test institution in the widget and enter the credentials mentioned in one of our testing guides.

Load the URL in your application or website. At this point the end user will interact with the Connect Widget. The widget handles the creation of a member as well as the aggregation process and any MFA that may be encountered. It automatically asks end users to search for an institution, give their credentials, or authenticate with OAuth. It also deals with any errors along the way.

You'll need to listen for a couple important event messages from the Connect Widget:

  • member status updated which gives you the member GUID and the current connection_status.
  • member connected tells you that the member has been successfully connected and you can move on to the next steps.

Alternatively, if the end user closes the Connect Widget early or some other problem occurs before you see a CONNECTED status, you can use the member_guid to immediately check the member's connection status with a dedicated API endpoint.

Request
Response
Language:shell

_10
curl -i 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/members/MBR-3bdc7d6b-efd4-1497-a0af-b23501cf9bd0/status' \
_10
-H 'Accept: application/vnd.mx.api.v1+json' \
_10
-u 'client_id:api_key'

Step 4

List Account Data

The aggregation process was successful and you can now read account information.

Make a GET request to the /users/{user_guid}/members/{member_guid}/accounts endpoint. The response will include all the accounts belonging to the member.

Request
Response
Language:shell

_10
curl -i -X GET 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/members/MBR-3bdc7d6b-efd4-1497-a0af-b23501cf9bd0/accounts' \
_10
-H 'Accept: application/vnd.mx.api.v1+json' \
_10
-u 'client_id:api_key'

info

There is another endpoint for listing accounts which may be more suitable for your use case: GET /users/{user_guid}/accounts.

You may also consider reading the attributes of a specific account. There are two endpoints for this which return the same information, provided for code convenience:

GET /users/{user_guid}/members/{member_guid}/accounts/{account_guid}

GET /users/{user_guid}/accounts/{account_guid}

Step 5

List Transaction Data

You can now read all the transaction data that has been gathered. Keep in mind that all list endpoints in the Platform API are paginated. To get the full list of transactions, you'll need to pay attention to the pagination object and make multiple requests specifying the page and the records_per_page in order to see all the available data. You can also limit results to a specific time frame using from_date and to_date.

Request
Response
Language:shell

_10
curl -i -X GET 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/members/BR-3bdc7d6b-efd4-1497-a0af-b23501cf9bd0/transactions?from_date=2022-09-20&page=1&records_per_page=10&to_date=2023-10-20' \
_10
-H 'Accept: application/vnd.mx.api.v1+json' \
_10
-u 'client_id:api_key'

info

There are multiple endpoints for listing transactions provided for code convenience. The others are:

GET /users/{user_guid}/accounts/{account_guid}/transactions

GET /users/{user_guid}/transactions

You may also wish to read the details of a specific account:

GET /users/{user_guid}/transactions/{transaction_guid}