Skip to content

Pull From External Account

Request URL

POST /externalaccount/pull

Description

This method pulls a specified amount of money from the external account. The external account ID must be specified in the request body, along with the amount and currency. The amount is deposited in a specified account or in the user's main account. It may be subject to a pre-specified maximum and minimum. Optionally, the pull may be labeled as recurring, to indicate that it is part of a repeating series.

The request will be presented for fulfillment to a suitable back office. If the external account is already linked to a back office, this will be used. Otherwise a back office will be selected if possible.

Schema

Property table for externalaccount/pull

Property Description Required Schema
amount Amount Yes {
  "type": "number",
  "minimum": 20,
  "maximum": 200
}
currency 3-letter ISO alphabetic code to identify the currency Yes {
  "type": "string",
  "enum": [ "USD" ]
}
AFiExternalAccountId The external account ID in ampliFi Yes {
  "type": "string"
}
isRecurring true if this transaction is recurring No {
  "type": "boolean",
  "default": false,
  "nullable": true
}
AFiEARequestId The external account request ID in ampliFi No {
  "type": "string",
  "nullable": true
}
AFiAccountId ampliFi ID for the account No {
  "type": "string",
  "nullable": true
}
account Account details No account object

Property table for account object

Property Description Required Schema
AFiAccountId ampliFi ID for the account No {
  "type": "string",
  "nullable": true
}

Request Body

{
  "AFiExternalAccountId": "qweealasn0avuygieaupmevow",
  "amount": 200,
  "currency": "USD",
  "recurring": true
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
  "AFiExternalAccountId": "qweealasn0avuygieaupmevow",
  "amount": 200,
  "currency": "USD",
  "recurring": true
};
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/externalaccount/pull',
  headers: {
    'Content-Type': "application/json",
    'token': "A long random string token received from /token request"
  },
  data
};

let result;
try {
  result = await axios.request(config);
  if (result.status === 200) {
    console.log(JSON.stringify(result.data));
  }
} catch (err) {
  console.log({
    errCode: err.code,
    responseStatus: err.response && err.response.status,
    data: err.response && JSON.stringify(err.response.data)
  });
}

cURL

curl --location "AMPLIFI_BASE_URL/externalaccount/pull" --data "{  \"AFiExternalAccountId\":\"qweealasn0avuygieaupmevow\", \"amount\":200, \"currency\":\"USD\", \"recurring\":true}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 EXTERNALACCOUNTS/PULL SUCCESSFUL RESPONSE TOP UP FROM EXTERNAL ACCOUNT

HEADERS

Header Value
Content-Type application/json
token A long random string token received from /token request

REQUEST BODY

{
  "AFiExternalAccountId": "qweealasn0avuygieaupmevow",
  "amount": 20,
  "currency": "USD",
  "recurring": true
}

RESPONSE BODY

{
    "success": true
}