Skip to content

Sync User

Request URL

POST /user

Description

Change elements of a user record. The user is identified by the token supplied. The request body should contain only fields that actually are to be changed.

Schema

Property table for schema 1 for deletedAddresses array item object

Property Description Required Schema
addressLine1 addressLine1 Yes {
  "type": "string"
}
city city Yes {
  "type": "string"
}
state state Yes {
  "type": "string"
}
postalCode postalCode Yes {
  "type": "string"
}
countryCode 3-letter ISO 3166-1 alpha-3 format country code (for checking/savings accounts) or 2-letter country code (for debit cards) Yes {
  "type": "string"
}

Property table for schema 1 for newAddresses array item object

Property Description Required Schema
addressLine1 addressLine1 Yes {
  "type": "string"
}
city city Yes {
  "type": "string"
}
state state Yes {
  "type": "string"
}
postalCode postalCode Yes {
  "type": "string"
}
countryCode 3-letter ISO 3166-1 alpha-3 format country code (for checking/savings accounts) or 2-letter country code (for debit cards) Yes {
  "type": "string"
}

Property table for schema 2 for deletedAddresses array item object

Property Description Required Schema
addressLine1 addressLine1 Yes {
  "type": "string"
}
city city Yes {
  "type": "string"
}
state state Yes {
  "type": "string"
}
postalCode postalCode Yes {
  "type": "string"
}
country Country code Yes {
  "type": "string"
}

Property table for schema 2 for newAddresses array item object

Property Description Required Schema
addressLine1 addressLine1 Yes {
  "type": "string"
}
city city Yes {
  "type": "string"
}
state state Yes {
  "type": "string"
}
postalCode postalCode Yes {
  "type": "string"
}
country Country code Yes {
  "type": "string"
}

Property table for user

Property Description Required Schema
dtsModified The date-time stamp when the account details were last modified in ampliFi No {
  "type": "string",
  "nullable": true
}
phoneNumber phoneNumber No {
  "type": "string",
  "nullable": true
}
phoneNumbers phoneNumbers No array of {
  "type": "string"
}
mobile The user's mobile phone number No {
  "type": "string",
  "nullable": true
}
email The user's email address No {
  "type": "string",
  "nullable": true
}
emails emails No array of {
  "type": "string"
}
newAddresses newAddresses No array of newAddresses array item object
deletedAddresses deletedAddresses No array of deletedAddresses array item object
firstName First name No {
  "type": "string",
  "nullable": true
}
lastName Last name No {
  "type": "string",
  "nullable": true
}
languageCode The user's primary language or device language No {
  "type": "string",
  "nullable": true
}
isMetric isMetric No {
  "type": "boolean",
  "nullable": true
}
postOnboardingStepsRequired postOnboardingStepsRequired No {
  "type": "string",
  "nullable": true
}
faceImage faceImage No {
  "type": "string",
  "nullable": true
}

Request Body

{
    "dtsModified": "Fri Dec 08 2023 19:52:54 GMT+0300",
    "mobile": "1234567891", 
    "email": "test@sample.com",
    "addresses": [
        {
            "_id": "6333313534c6bb97175184bf",
            "addressLine1": "123 Main Str.",
            "addressLine2": null,
            "city": "Harrisburg",
            "state": "PA",
            "postalCode": "12345",
            "countryCode": "US",
            "AFiUserId": "qweaurl8kgtlv9pc",
            "dtsRecorded": "2022-09-27T17:21:57.953Z",
            "AFiUserAddressId":"qwebeteysxkycnkcyddoziktasubadowcprrvwjsjri",
            "dtsModified": "2022-09-27T17:21:57.953Z"
        },
        {
            "_id": "640b70180d0584a378ef7f0b",
            "AFiUserAddressId": "qweawual8kgtlv9pclf2uet6vk7xak7j28betkrtm0d9k",
            "addressLine1": "123 Main Str.",
            "city": "Harrisburg",
            "state": "PA",
            "countryCode": "US",
            "postalCode": "12345",
            "dtsModified": "1978-10-15T04:00:00.000Z",
            "isMain": false,
            "AFiUserId": "qweaurl8kgtlv9pc",
            "dtsRecorded": "2023-03-10T17:59:52.917Z"
        }
    ],
    "languageCode": "en",
    "postOnboardingStepsRequired": null,
    "homecurrency": "USD"
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
    "dtsModified": "Fri Dec 08 2023 19:52:54 GMT+0300",
    "mobile": "1234567891", 
    "email": "test@sample.com",
    "addresses": [
        {
            "_id": "6333313534c6bb97175184bf",
            "addressLine1": "123 Main Str.",
            "addressLine2": null,
            "city": "Harrisburg",
            "state": "PA",
            "postalCode": "12345",
            "countryCode": "US",
            "AFiUserId": "qweaurl8kgtlv9pc",
            "dtsRecorded": "2022-09-27T17:21:57.953Z",
            "AFiUserAddressId":"qwebeteysxkycnkcyddoziktasubadowcprrvwjsjri",
            "dtsModified": "2022-09-27T17:21:57.953Z"
        },
        {
            "_id": "640b70180d0584a378ef7f0b",
            "AFiUserAddressId": "qweawual8kgtlv9pclf2uet6vk7xak7j28betkrtm0d9k",
            "addressLine1": "123 Main Str.",
            "city": "Harrisburg",
            "state": "PA",
            "countryCode": "US",
            "postalCode": "12345",
            "dtsModified": "1978-10-15T04:00:00.000Z",
            "isMain": false,
            "AFiUserId": "qweaurl8kgtlv9pc",
            "dtsRecorded": "2023-03-10T17:59:52.917Z"
        }
    ],
    "languageCode": "en",
    "postOnboardingStepsRequired": null,
    "homecurrency": "USD"
};
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/user',
  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/user" --data "{    \"dtsModified\":\"Fri Dec 08 2023 19:52:54 GMT+0300\",   \"mobile\":\"1234567891\",    \"email\":\"test@sample.com\",   \"addresses\":[        {            \"_id\":\"6333313534c6bb97175184bf\",           \"addressLine1\":\"123 Main Str.\",           \"addressLine2\":null,           \"city\":\"Harrisburg\",           \"state\":\"PA\",           \"postalCode\":\"12345\",           \"countryCode\":\"US\",           \"AFiUserId\":\"qweaurl8kgtlv9pc\",           \"dtsRecorded\":\"2022-09-27T17:21:57.953Z\",           \"AFiUserAddressId\":\"qwebeteysxkycnkcyddoziktasubadowcprrvwjsjri\",           \"dtsModified\":\"2022-09-27T17:21:57.953Z\"        },       {            \"_id\":\"640b70180d0584a378ef7f0b\",           \"AFiUserAddressId\":\"qweawual8kgtlv9pclf2uet6vk7xak7j28betkrtm0d9k\",           \"addressLine1\":\"123 Main Str.\",           \"city\":\"Harrisburg\",           \"state\":\"PA\",           \"countryCode\":\"US\",           \"postalCode\":\"12345\",           \"dtsModified\":\"1978-10-15T04:00:00.000Z\",           \"isMain\":false,           \"AFiUserId\":\"qweaurl8kgtlv9pc\",           \"dtsRecorded\":\"2023-03-10T17:59:52.917Z\"        }    ],   \"languageCode\":\"en\",   \"postOnboardingStepsRequired\":null,   \"homecurrency\":\"USD\"}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 USER SUCCESSFUL RESPONSE MODIFIED USER EMAIL AND PHONE

HEADERS

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

REQUEST BODY

{
    "dtsModified": "Fri Dec 08 2023 19:52:12 GMT+0300",
    "mobile": "1234567891", 
    "email": "test@sample.com"
}

RESPONSE BODY

{
    "success": true,
    "user": {
        "_id": "6333311334c6bb97175184bb",
        "AFiUserId": "qweaurl8kgtlv9pc",
        "dtsCreated": "2022-09-27T17:21:23.445Z",
        "names": [],
        "name": {
            "firstName": "John",
            "middleName": "",
            "lastName": "Testman"
        },
        "firstName": "John",
        "sortId": "s7j",
        "languageCode": "en",
        "dtsModified": "2023-03-10T17:59:52.933Z",
        "dtsCreatedAtUsers": "2022-09-27T17:21:23.445Z",
        "segment": "demo",
        "referralCode": "BBBUTHZFE",
        "extras": {
            "sex": "male",
            "eyeColor": "BRO",
            "hairColor": "BLK",
            "heightMetric": "181",
            "weightMetric": "85"
        },
        "private": true,
        "isFullyRegistered": true,
        "isIdleUser": false,
        "uiStage": "firstContact",
        "middleName": "",
        "lastName": "Testman",
        "dosDob": "1978-10-15",
        "dobDay": "15",
        "dobMonth": "10",
        "dobYear": "1978",
        "addresses": [
            {
                "_id": "6333313534c6bb97175184bf",
                "addressLine1": "123 Main Str.",
                "addressLine2": null,
                "city": "Harrisburg",
                "state": "PA",
                "postalCode": "12345",
                "countryCode": "US",
                "AFiUserId": "qweaurl8kgtlv9pc",
                "dtsRecorded": "2022-09-27T17:21:57.953Z",
                "AFiUserAddressId": "qwebeteysxkycnkcyddoziktasubadowcprrvwjsjri",
                "dtsModified": "2022-09-27T17:21:57.953Z"
            },
            {
                "_id": "640b70180d0584a378ef7f0b",
                "AFiUserAddressId": "qweawual8kgtlv9pclf2uet6vk7xak7j28betkrtm0d9k",
                "addressLine1": "123 Main Str.",
                "city": "Harrisburg",
                "state": "PA",
                "countryCode": "US",
                "postalCode": "12345",
                "dtsModified": "1978-10-15T04:00:00.000Z",
                "isMain": false,
                "AFiUserId": "qweaurl8kgtlv9pc",
                "dtsRecorded": "2023-03-10T17:59:52.917Z"
            }
        ],
        "mobile": "1234567891",
        "email": "test@sample.com",
        "homecurrency": "USD",
        "isActive": true,
        "dtsRegistered": "2022-09-27T17:21:57.913Z",
        "isMetric": false,
        "faceImage": "a+very+long+string",
        "mainAFiAccountId": "qwegal8kgtmysmels",
        "phoneNumber": "1234567891"
    }
}

200 USER SUCCESSFUL RESPONSE MODIFIED MULTIPLE USER DETAILS

HEADERS

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

REQUEST BODY

{
    "dtsModified": "Fri Dec 08 2023 19:52:12 GMT+0300",
    "mobile": "1234567891", 
    "email": "test@sample.com",
    "addresses": [
        {
            "_id": "6333313534c6bb97175184bf",
            "addressLine1": "123 Main Str.",
            "addressLine2": null,
            "city": "Harrisburg",
            "state": "PA",
            "postalCode": "12345",
            "countryCode": "US",
            "AFiUserId": "qweaurl8kgtlv9pc",
            "dtsRecorded": "2022-09-27T17:21:57.953Z",
            "AFiUserAddressId":"qwebeteysxkycnkcyddoziktasubadowcprrvwjsjri",
            "dtsModified": "2022-09-27T17:21:57.953Z"
        },
        {
            "_id": "640b70180d0584a378ef7f0b",
            "AFiUserAddressId": "qweawual8kgtlv9pclf2uet6vk7xak7j28betkrtm0d9k",
            "addressLine1": "123 Main Str.",
            "city": "Harrisburg",
            "state": "PA",
            "countryCode": "US",
            "postalCode": "12345",
            "dtsModified": "1978-10-15T04:00:00.000Z",
            "isMain": false,
            "AFiUserId": "qweaurl8kgtlv9pc",
            "dtsRecorded": "2023-03-10T17:59:52.917Z"
        }
    ],
    "languageCode": "en",
    "postOnboardingStepsRequired": null,
    "homecurrency": "USD",
    "faceImage": "/9j/2wBDA..."
}

RESPONSE BODY

{
    "success": true,
    "user": {
        "AFiUserId": "qweaurl8kgtlv9pc",
        "dtsCreated": "2022-09-27T17:21:23.445Z",
        "names": [],
        "name": {
            "firstName": "John",
            "middleName": "",
            "lastName": "Testman"
        },
        "firstName": "John",
        "sortId": "s7j",
        "languageCode": "en",
        "dtsModified": "2023-12-08T17:15:07.206Z",
        "dtsCreatedAtUsers": "2022-09-27T17:21:23.445Z",
        "segment": "demo",
        "postOnboardingStepsRequired": null,
        "referralCode": "BBBUTHZFE",
        "extras": {
            "sex": "male",
            "eyeColor": "BRO",
            "hairColor": "BLK",
            "heightMetric": "181",
            "weightMetric": "85"
        },
        "private": true,
        "isFullyRegistered": true,
        "isIdleUser": false,
        "uiStage": "firstContact",
        "middleName": "",
        "lastName": "Testman",
        "dosDob": "1978-10-15",
        "dobDay": "15",
        "dobMonth": "10",
        "dobYear": "1978",
        "addresses": [
            {
                "addressLine1": "123 Main Str.",
                "addressLine2": null,
                "city": "Harrisburg",
                "state": "PA",
                "postalCode": "12345",
                "countryCode": "US",
                "AFiUserId": "qweaurl8kgtlv9pc",
                "dtsRecorded": "2022-09-27T17:21:57.953Z",
                "AFiUserAddressId": "qwebeteysxkycnkcyddoziktasubadowcprrvwjsjri",
                "dtsModified": "2022-09-27T17:21:57.953Z"
            },
            {
                "AFiUserAddressId": "qweawual8kgtlv9pclf2uet6vk7xak7j28betkrtm0d9k",
                "addressLine1": "123 Main Str.",
                "city": "Harrisburg",
                "state": "PA",
                "countryCode": "US",
                "postalCode": "12345",
                "dtsModified": "1978-10-15T04:00:00.000Z",
                "isMain": false,
                "AFiUserId": "qweaurl8kgtlv9pc",
                "dtsRecorded": "2023-03-10T17:59:52.917Z"
            }
        ],
        "mobile": "1234567891",
        "email": "test@sample.com",
        "homecurrency": "USD",
        "isActive": true,
        "dtsRegistered": "2022-09-27T17:21:57.913Z",
        "isMetric": false,
        "faceImage": "a+very+long+string",
        "mainAFiAccountId": "qwegal8kgtmysmels",
        "isEmailConfirmed": false,
        "isMobilePhoneConfirmed": false
    }
}