Auto-Funding
Request URL
POST /externalaccount/autofunding
Description
Setup or modify auto-funding for this account. Auto-funding transfers a set amount from the external account on a regular schedule, or cadence. The transfer may be weekly, monthly, or when the user's account is low.
If cadence is "weekly", the optional "weekday" property specifies the day for the transfer. The default weekday is Sunday if not specified.
If cadence is "monthly", the "day" property is required to specify the day of the month for the transfer to occur. If the "day" property value is greater than 0 and less than or equal to the current day of the month, the date of the next transfer will be the specified day of the following month. If the "day" property value is greater than the current day of the month and less than or equal to the number of days in the current month, the date of the next transfer will be the specified day of the current month. If the "day" property value is greater than the total number of days in the current month, the date of the next transfer will be a certain number of days from the current date (where days from the current date = the value of "days" - the number of days in the current month). See the chart below for some examples of how the "day" value corresponds to the date of the next transfer.
Value of day property | Current Month | Current Day | Current Year | dtsNext | Date of Next Transfer |
---|---|---|---|---|---|
0 | November | 22nd | 2022 | "2022-11-30T14:00:14.403Z" | 2022-11-30 |
1 | November | 22nd | 2022 | "2022-12-01T14:00:18.229Z" | 2022-12-01 |
5 | November | 22nd | 2022 | "2022-12-05T14:00:31.808Z" | 2022-12-05 |
21 | November | 22nd | 2022 | "2022-12-21T14:00:06.122Z" | 2022-12-21 |
22 | November | 22nd | 2022 | "2022-12-22T14:00:43.849Z" | 2022-12-22 |
30 | November | 22nd | 2022 | "2022-11-30T14:00:00.981Z" | 2022-11-30 |
31 | November | 22nd | 2022 | "2022-12-01T14:00:17.342Z" | 2022-12-01 |
35 | November | 22nd | 2022 | "2022-12-05T14:00:34.368Z" | 2022-12-05 |
50 | November | 22nd | 2022 | "2022-12-20T14:00:39.114Z" | 2022-12-20 |
100 | November | 22nd | 2022 | "2023-02-08T14:00:58.911Z" | 2023-02-08 |
500 | November | 22nd | 2022 | "2024-03-14T13:00:14.749Z" | 2024-03-14 |
If cadence is "when_low", the "lowAmount" property specifies the low limit.
Schema
Property table for schema 1 for externalaccount/autofunding
Property | Description | Required | Schema |
---|---|---|---|
AFiExternalAccountId | The external account ID in ampliFi | Yes | { "type": "string" } |
amount | Amount | Yes | { "type": "number" } |
currency | 3-letter ISO alphabetic code to identify the currency | Yes | { "type": "string", "enum": [ "USD" ] } |
cadence | How often the account should be auto-funded | Yes | { "type": "string", "enum": [ "weekly" ] } |
weekday | Used if cadence is weekly to specify the day for the transfer |
Yes | { "type": "string", "enum": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "default": "Sun" } |
Property table for schema 2 for externalaccount/autofunding
Property | Description | Required | Schema |
---|---|---|---|
AFiExternalAccountId | The external account ID in ampliFi | Yes | { "type": "string" } |
amount | Amount | Yes | { "type": "number" } |
currency | 3-letter ISO alphabetic code to identify the currency | Yes | { "type": "string", "enum": [ "USD" ] } |
cadence | How often the account should be auto-funded | Yes | { "type": "string", "enum": [ "monthly" ] } |
day | The day of the month | Yes | { "type": "string" } |
Property table for schema 3 for externalaccount/autofunding
Property | Description | Required | Schema |
---|---|---|---|
AFiExternalAccountId | The external account ID in ampliFi | Yes | { "type": "string" } |
amount | Amount | Yes | { "type": "number" } |
currency | 3-letter ISO alphabetic code to identify the currency | Yes | { "type": "string", "enum": [ "USD" ] } |
cadence | How often the account should be auto-funded | Yes | { "type": "string", "enum": [ "when_low" ] } |
lowAmount | Used if cadence is when_low to indicate the threshold at which to top up the account |
Yes | { "type": "number" } |
Request Body
{
"AFiExternalAccountId": "qweealasn0avuygieaupmevow",
"cadence": "when_low",
"amount": 100,
"currency": "USD",
"lowAmount": 10.00
}
Snippet Examples
javascript
const axios = require('axios');
const data = {
"AFiExternalAccountId": "qweealasn0avuygieaupmevow",
"cadence": "when_low",
"amount": 100,
"currency": "USD",
"lowAmount": 10.00
};
const config = {
method: 'POST',
url: '${AMPLIFI_BASE_URL}/externalaccount/autofunding',
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/autofunding" --data "{ \"AFiExternalAccountId\":\"qweealasn0avuygieaupmevow\", \"cadence\":\"when_low\", \"amount\":100, \"currency\":\"USD\", \"lowAmount\":10.00}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request"
Successful Response Examples
200 EXTERNALACCOUNT/AUTOFUNDING SUCCESSFUL RESPONSE FOR WHEN_LOW CADENCE
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
token | A long random string token received from /token request |
REQUEST BODY
{
"AFiExternalAccountId": "qweealasn0avuygieaupmevow",
"cadence": "when_low",
"amount": 100,
"currency": "USD",
"lowAmount": 10.00
}
RESPONSE BODY
{
"success": true,
"autofunding": {
"AFiUserId": "qweaurl8kgtlv9pc",
"AFiExternalAccountId": "qweealasn0avuygieaupmevow",
"amount": 100,
"currency": "USD",
"cadence": "when_low",
"dtsModified": "2023-12-14T13:18:24.747Z",
"lowAmount": 10,
"dtsNext": "2023-12-14T13:18:24.747Z",
"isSyncedToServer": true
}
}
200 EXTERNALACCOUNT/AUTOFUNDING SUCCESSFUL RESPONSE FOR WEEKLY CADENCE
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
token | A long random string token received from /token request |
REQUEST BODY
{
"AFiExternalAccountId": "qweealasn0avuygieaupmevow",
"cadence": "weekly",
"amount": 100,
"currency": "USD"
}
RESPONSE BODY
{
"success": true,
"autofunding": {
"AFiUserId": "qweaurl8kgtlv9pc",
"AFiExternalAccountId": "qweealasn0avuygieaupmevow",
"amount": 100,
"currency": "USD",
"cadence": "weekly",
"dtsModified": "2023-12-14T13:19:35.552Z",
"dtsNext": "2023-12-17T14:00:35.554Z",
"isSyncedToServer": true
}
}
200 EXTERNALACCOUNT/AUTOFUNDING SUCCESSFUL RESPONSE FOR MONTHLY CADENCE
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
token | A long random string token received from /token request |
REQUEST BODY
{
"AFiExternalAccountId": "qweealasn0avuygieaupmevow",
"cadence": "monthly",
"amount": 100,
"currency": "USD",
"day": "15"
}
RESPONSE BODY