Pytrium is a Python 2/3 client library for the MX Atrium API.
pip install pytrium
- requests
- future
This client library wraps all the available endpoints of the MX Atrium API. For additional information regarding data attributes, available query parameters, and typical work flows, visit the full documentation at https://atrium.mx.com/documentation
-
First you'll need to create a free developer account at https://atrium.mx.com. This will provide you with a
MX-API-KEY
andMX-CLIENT-ID
, both of which are required to hit the API. Please keep this information confidential. -
Create your API instance.
from atrium import Api,
api = Api(key="SAMPLE_KEY_XXX", client_id="SAMPLE_CLIENT_ID_XXX")
- Create a user. See the Docs for more options.
import json
user = api.createUser(payload={
"identifier": "U123987",
"metadata": json.dumps({
"first_name": "Charles",
"last_name": "Xavier",
"email": "[email protected]"
})
})
- Find the institution the user banks at.
query = api.getInstitutions(queryParams={
"name": "Awesome Bank"
})
institution = query['institutions'][0]
- Get the required credentials for a specific institution via the
guid
.
creds = api.getCredentials(institution['code'])
- Create a member for our user with the credentials above. A member is a connection between an institution and a user. Creating a member automatically attempt to authenticate and gather account data (aggregate).
member = api.createMember(user['guid'], payload={
"institution_code": institution['code'],
"credentials": [
{
"guid": creds[0]['guid'],
"value": "AwesomeBankUserName"
},
{
"guid": creds[1]['guid'],
"value": "AwesomeBankPassword"
}
]
})
- Once the member has been created, you can check the aggregation status. A list of all statuses are available in the Docs
status = api.getMemberStatus(user['guid'], member['guid'])
If the institution requires Multi-Factor Authentication (MFA), the status will return as CHALLENGED
along side a credentials
list with the additional authentication requirements.
{
"status": "CHALLENGED",
"challenges": [
{
"type": "TEXT",
"guid": "CRD-678",
"label": "What city were you born in?",
}
]
}
The MFA required credentials can also be retrieved with the getMemberChallenges
method.
Resume the aggregation by answering MFA
api.resumeMemberAgg(user['guid'], member['guid'], payload={
"challenges": [
{
"guid": "CRD-678",
"value": "New York"
}
]
})
- Download all the datas!
api.getTransactions(user['guid'], queryParams={
"results_per_page": 100
})
api.getAccounts(user['guid'])
-
getUsers(queryParams={})
Get a list of all the available users. Supports pagination query params.
-
createUser(payload={})
Create a user with the attributes provided in payload.
-
readUser(userGuid)
Read a user by a user GUID.
-
updateUser(userGuid, payload={})
Update a user by its GUID with the attributes provided in payload.
-
deleteUser(userGuid)
Delete a user by its GUID.
-
getTransactions(userGuid, queryParams={})
Get a list of transactions by a user GUID. Supports pagination, and date filtering through query parameters.
-
getTransactionsByAccount(userGuid, acctGuid, queryParams={})
Get a list of transactions for a specific account by a user GUID and account GUID. Supports pagination, and date filtering through query parameters.
-
readTransaction(userGuid, transGuid)
Read a specific transaction by user GUID and transaction GUID.
-
getAccounts(userGuid, queryParams={})
Get a list of accounts by a user GUID. Supports pagination query parameters.
-
readAccount(userGuid, acctGuid)
Read a specific account by a user GUID and account GUID.
-
getInstitutions(queryParams={})
Get a list of institutions. Supports pagination query params and searching by name.
-
readInstitution(instGuid)
Read a specific institution by the institution GUID.
-
getCredentials(instGuid)
Get a list of required credentials by the institution GUID.
-
getMembers(userGuid, queryParams={})
Get a list of members by a user GUID. Supports pagination query parameters.
-
createMember(userGuid, payload={})
Create a member for a user by user GUID with attributes provided in payload.
-
readMember(userGuid, memGuid)
Read a member by user GUID and member GUID.
-
updateMember(userGuid, memGuid, payload={})
Update a member by user GUID and member GUID with attributes provided in payload.
-
deleteMember(userGuid, memGuid)
Delete a member by user GUID and member GUID.
-
getMemberStatus(userGuid, memGuid)
Get the status for a member by user GUID and member GUID.
-
getMemberChallenges(userGuid, memGuid)
Get a list of challenges for a member by user GUID and member GUID. Returns an empty object if there are no challenges.
-
startMemberAgg(userGuid, memGuid)
Aggregate a member by user GUID and member GUID. Returns an empty object on success.
-
resumeMemberAgg(userGuid, memGuid, payload={})
Resume member aggregation by user GUID and member GUID for when it was challenged. Payload should contain the answered MFA credentials.
Coming Soon