Skip to main content

Partner-Managed Data

Overview

Rather than relying on our aggregation services to bring in your held account and transaction data, you can manage all that yourself — down to the last detail — with partner-managed resources.

This guide demonstrates the process of adding one of your held transactions using the Platform API. We’ll also outline best practices and cover common problems you might run into.

The MX Data Architecture

Every resource on the MX platform has to fit into our existing data architecture. For instance, every transaction belongs to an account, every account belongs to a member, and every member belongs to a user. So, before we can deal with the transactions we’re most interested in, we need to deal with users, members, and accounts — in that order.

Consider your ultimate use case is going to be. Each of these four resources (users, members, accounts, and transactions) have many attributes that you can set, but not all of those attributes will be useful for every case, and some of them depend on other attributes. So, you’ll need to know exactly what information you plan on sending to MX and how it’s going to fit into the product you’re building with the Platform API.

Workflow

Here’s a general workflow for creating your first transaction with held data:

  1. Create a user (which represents your customer).
  2. Create a member belonging to that user (which represents the connection between the user and your special institution).
  3. Create an account (which represents the account the customer holds with you).
  4. Create a transaction (which represents any instance in which money moves into or out of your customer’s account).

Once all those resources exist, workflows are mostly about updating accounts and transactions to reflect the latest information — like increasing an account balance after a paycheck is deposited, or, for that matter, creating a new transaction to represent that deposited paycheck.

Step 1

Create a User

A user represents your end user in the MX Platform. Make a POST request to the /users endpoint, as shown below.

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 cannot be empty. We recommend that partners 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": "totally.fake.email@notreal.com",
_12
"metadata": "Yada yada yada"
_12
}
_12
}'

Step 2

Create a Managed Member

This endpoint lists the institutions that you are allowed to use for creating managed members. You’ll most likely have only one available institution, but you may have a use case that requires more; this is determined when enabling managed data with MX.

You shouldn’t need to perform this step often since your list of available institutions won’t often change. Feel free to work from a cached list.

Capture the institution_code that gets returned.

Request
Response
Language:shell

_10
curl -i 'https://int-api.mx.com/managed_institutions' \
_10
-u 'client_id:api_key' \
_10
-H 'Accept: application/vnd.mx.api.v1+json'

Now that we’ve got a user_guid and your institution_code, we can create a member. As with creating a user, MX strongly encourages you to give the member a unique id so you can match the data on your systems with our systems.

If the request is successful, the response will contain the newly created member.

See the API reference for more detailed information on each parameter.

Request
Response
Language:shell

_11
curl -i -X POST 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/managed_members' \
_11
-u 'client_id:api_key' \
_11
-H 'Accept: application/vnd.mx.api.v1+json' \
_11
-H 'Content-Type: application/json' \
_11
-d '{
_11
"member": {
_11
"institution_code": "mxbank",
_11
"id": "partner-1234",
_11
"metadata": "this and that"
_11
}
_11
}'

Step 3

Create a Managed Account

Now we have a member, so it’s time to create an account.

Remember that a member represents the overall connection between your institution and the end user. So, if they open a new account with you, you don’t want to create a new member; you want to attach a new account to the member you just created. In other words, members can have multiple accounts, each one representing an account that user has with you: one for their savings account, another for their checking, another for their mortgage, etc.

See the API reference for more detailed information on each parameter.

Request
Response
Language:shell

_18
curl -i -X POST 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/managed_members/MBR-e6239750-24e8-4833-93a8-d4c2ecf2ec7e/accounts' \
_18
-u 'client_id:api_key' \
_18
-H 'Accept: application/vnd.mx.api.v1+json' \
_18
-H 'Content-Type: application/json' \
_18
-d'{
_18
"account": {
_18
"account_number": "12345",
_18
"balance": "10000",
_18
"id": "partner-account-7890",
_18
"is_closed": false,
_18
"metadata": "some metadata",
_18
"name": "Swiss Bank Acct",
_18
"nickname": "Swiss Account",
_18
"started_on": "1980-03-28",
_18
"subtype": "MONEY_MARKET",
_18
"type": "SAVINGS"
_18
}
_18
}'

Step 4

Create a Managed Transaction

Now that you have a user, member, and account, you can create a transaction.

This example represents a deposit into a savings account.

See the API reference for more detailed information on each parameter.

Request
Response
Language:shell

_18
curl -L -X POST 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/managed_members/MBR-e6239750-24e8-4833-93a8-d4c2ecf2ec7e/accounts/ACT-09c0ee66-51a8-4edf-b977-99534a471134/transactions' \
_18
-u 'client_id:api_key' \
_18
-H 'Accept: application/vnd.mx.api.v1+json' \
_18
-H 'Content-Type: application/json' \
_18
-d '{
_18
"transaction": {
_18
"id": "partner-transaction-3QP5X0",
_18
"status": "PENDING",
_18
"type": "CREDIT",
_18
"amount": 400,
_18
"description": "Savings Deposit",
_18
"is_international": false,
_18
"transacted_at": "2021-09-01T12:00:00Z",
_18
"category": "INCOME",
_18
"latitude": 40.429675,
_18
"longitude": -111.891982
_18
}
_18
}'

Step 5

Update a Managed Resource

You can now update the account you created so its balance reflects the deposit we just recorded by creating a new transaction. The account balance was $10,000 before, and you just deposited $400.

Request
Response
Language:shell

_10
curl -i -X PUT 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/managed_members/MBR-e6239750-24e8-4833-93a8-d4c2ecf2ec7e/accounts/ACT-1e194555-a690-44ec-b363-282165cf4dab' \
_10
-u 'client_id:api_key' \
_10
-H 'Accept: application/vnd.mx.api.v1+json' \
_10
-H 'Content-Type: application/json' \
_10
-d '{
_10
"account": {
_10
"balance": 10400.00
_10
}
_10
}'

Step 6

Delete a Managed Resource

Deletes on the MX platform cascade. If you delete a user, it deletes every member on that user, and every account on every member, and every transaction on every account. One delete on your end could mean thousands on our end.

If you need to make a lot of deletes that will result in a lot of cascades, reach out to MX.

Marking an account as closed or temporarily disabling a user might be better than deleting an account or user since you can still restore the data. But sometimes, deletes are necessary.

You won’t get a response body with a delete request. The status will be 204 No Content if it’s successful.

Request
Response
Language:shell

_10
curl -i -X DELETE 'https://int-api.mx.com/users/USR-11141024-90b3-1bce-cac9-c06ced52ab4c/managed_members/MBR-e6239750-24e8-4833-93a8-d4c2ecf2ec7e' \
_10
-u 'client_id:api_key' \
_10
-H 'Accept: application/vnd.mx.api.v1+json'

Pending and Posted Transactions

Because you are in full control of your held data with partner-managed resources, you are also responsible for reconciling pending and posted transactions. There are two different strategies for doing this:

  • The ideal case: Keep the same transaction and update it from a status of PENDING to a status of POSTED.
  • The other case: Delete all PENDING transactions and create entirely new transactions with a status of POSTED.

The Ideal Case

The best case scenario is to keep the existing Platform transaction and update it from PENDING to POSTED. This means the transaction will maintain the same GUID assigned by MX and ID assigned by you. If your systems use different IDs for associated pending/posted transactions, you’re free to update the ID in the Platform API as well.

This also means that if the end user has made any updates while the transaction was PENDING (like recategorizing it or changing the description), those end-user changes will be maintained.

If a PENDING transaction never becomes POSTED on your end, then you should simply delete the PENDING platform transaction.

This strategy only works if you can be absolutely certain on your own systems that the PENDING and POSTED transaction are the same. If you are unable to confidently tie the two transactions together, then you’ll need to use the second strategy.

Workflow of pending and posted transactions