Skip to content

Modify Account

Request URL

POST /accounts/:AFiAccountId

Description

This endpoint may be used to make changes to an account's properties. The account is identified by the path parameter, AFiAccountId. Only the properties to be modified should be specified in the payload, and the ampliFi API will only add or update the permitted (editable) properties.

Schema

Property table for accounts/:AFiAccountId

Property Description Required Schema
AFiAccountId ampliFi ID for the account Yes {
  "type": "string"
}
name Name of the entity No {
  "type": "string",
  "nullable": true
}
isMain true if this is the main account or card No {
  "type": "boolean",
  "nullable": true
}
isHidden true if hidden No {
  "type": "boolean",
  "nullable": true
}

Request Body

{
    "name": "MainAccount",
    "isMain": true,
    "isHidden": false
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
    "name": "MainAccount",
    "isMain": true,
    "isHidden": false
};
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/accounts/:AFiAccountId',
  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/accounts/:AFiAccountId" --data "{    \"name\":\"MainAccount\",   \"isMain\":true,   \"isHidden\":false}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 ACCOUNTS/:AFIACCOUNTID SUCCESSFUL RESPONSE FOR ACCOUNT MODIFICATION

HEADERS

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

PARAMETERS

Parameter Description Value
AFiAccountId [required] qwegalgnuyocdfoxg

REQUEST BODY

{
    "name": "MainAccount",
    "isMain": true,
    "isHidden": false
}

RESPONSE BODY

{
    "success": true,
    "userId": "qweaurl8kgtlv9pc"
}