Skip to content

Accounts

An account in AmpliFi is represented by an account record in the form of a JSON object. This is a model for an actual account at a specific backoffice.

Methods at this endpoint access and modify account records. In addition they may list and modify transactions.

Account Object

AmpliFi represents accounts by a JSON object. This table lists properties usually included in an account. Some details may vary depending on the account type.

Property Type Required? (default) Description
AFiAccountId string yes AmpliFi id for this account
isSync boolean no (true) true if processing should be synchronous
name string no (none) nickname for the account (maintained by the BO)
AFiUserId string yes AmpliFi id for the user of this account
primaryUserAFiUserId string no (same) id for the primary user, if different
AFiCardId string no (none) id for the card associated with this account, if any
accountIdBO string yes account id at the backoffice
backOfficeId string yes backoffice id
backOfficeName string yes backoffice name
typeID string or number yes account type code
rn number no (depends on type) routing number, if applicable
num number no (depends on type) account number, if applicable
balance object yes account balance; see below
status enum yes account status ("active", "blocked")
isActive boolean no (true) is the account active?
isMain boolean no (true) is this the user's main account?
isClosed boolean no (false) is the account closed?
dtsOpened dts yes date/time account was opened
dtsUpdated dts yes date/time account was last updated

Balance:

Property Type Required? (default) Description
currency string yes 3 letter currency code
native number yes actual balance
available number yes available balance

Get all Accounts

GET /accounts

Get an array of records for all accounts belonging to the current user.

Response body:

  {
    "success": true,
    "accounts": [  //array of account objects
          ],
    "dtsUpdateNext": "2021-10-28T03:06:18.604Z", // Date/time by which data should be refreshed
  }

Get an Account

GET /accounts/:AFiAccountId

Get the record for one specific account. The account is identified by the path parameter. The account must belong to the current user.

Response body example:

{
    "success": true,
    "account": { // account object
     },
    "userId": "qweaurl47i0h4xfy" // the user who owns the account
}

Modify an Account

POST /accounts/:AFiAccountId

Make changes to an account's properties. The account is identified by the path parameter.

Only the properties to be changed should be specified in the payload. AmpliFi will modify only the properties that are permitted to be changed.

Request body:

{
    "payload": { // object specifying properties to be modified
    }
}

Response body:

{
    "success": true,
    "account": { // account object
     }
}

Close an Account

DELETE /accounts/:AFiAccountId

Closes an account. The account is identified by the path parameter. The account must belong to the current user.

If the closed account was the main account, this will assign another account as the main. If the account has a balance, it will be transferred to the new main account.

If the user has no other accounts, this API will mark the user as inactive and will fire an event with the message:

Account closed money needs to be returned.

Response body:

  {
    "success": true
  }

Get Transactions

GET /accounts/:AFiAccountId/transactions/:dateStart/:dateEnd

Get an array containing records of all transactions for a specified account for a given time period. The account is identified by the path parameter AFiAccountId. The time period is defined by the path parameters dateStart and dateEnd. The dates are given in ISO date format. The period runs from dateStart to dateEnd, inclusive.

Transaction records include various fields depending on their nature, status, and circumstances.

Response body example:

  [
    {
      "AFiAccountId": "gakl6w7zryqamzqgnjvyfs",
      "amount": 0.1,
      "currency": "USD",
      "transactionState": "confirmed",
      "narrativeDestination": "Transfer within my accounts",  
      "internal": {
        "fromAFiUserId": "aurwujqaxhhbx",
        "txnType": "card2card",
        "sourceAFiAccountId": "gakdt961ztngvlakvzthic",
        "sourceAccountAFiUserId": "aurxqdjkmjqso"
      },
      "attachments": null,
      "reference": "rr8jf5l3mpjkzv",
      "AFiUserId": "aurxqdjkmjqso",
      "transactionId": "trn8jf5leperqkrkyioogrbukaofz",
      "dtsRecorded": "2021-10-26T20:24:43.538Z",
      "dtsValue": "2021-10-26T20:24:43.569Z",
      "narrativeSource": null,
      "labels": [],
      "dtsCompleted": "2021-10-26T20:24:44.925Z",
      "AFiCardId": "gakl6w81b8uftdhinpdtzb",
      "narrative": "Transfer within my accounts",
      "txnType": "card2card",
      "typeName": "Transfer within AmpliFi",
      "debitTransactionId": "trn8jf5l3mndrjcqrqseexdykggbv",
      "creditTransactionId": "trn8jf5leperqkrkyioogrbukaofz",
      "sourceAFiAccountId": "gakdt961ztngvlakvzthic",
      "destinationAFiAccountId": "gakl6w7zryqamzqgnjvyfs",
      "details": {
        "memos": [
          "Transfer within AmpliFi"
        ]
      },
      "transactionIdBO": "tx_4qwwyrlf9dv3t",
      "debit": 0,
      "credit": 0.1,
      "isPending": false, //true for transactions which have not settled yet
      "isComplete": true, 
      "isDeclined": false, //true for transactions which were actively rejected
      "dtsBooked": "2021-10-26T20:24:44.812Z"
    }
  ]

Get Latest Transactions

GET /accounts/:AFiAccountId/transactions/latest

Get an array containing records of the last 30 transactions for a specified account, or all transactions within the last 12 months, whichever is fewer. The account is identified by the path parameter AFiAccountId.

Response body example: see above

Modify a Transaction

POST /account/:AFiAccountId/transaction/:transactionId

Makes changes to a transaction record, as long as the specified items can be changed. The account is identified by the path parameter AFiAccountId, and the transaction is identified by the path parameter transactionId.

NOTE: "account" may also be given as "accounts", and "transaction" may also be given as "transactions".

Request body:

{
  "changes": {} //JSON with fields which need to be changed.
{

Response:

  {
    "success": true,
    "transaction": {} //the new transaction with the changes applied
  }