Skip to content

Recovery Code

Request URL

POST /recovery/code

Description

This endpoint is used to generate a random recovery code for a device.

Schema

Property table for recovery/code

Property Description Required Schema
deviceTag The device tag (id) Yes {
  "type": "string"
}
deviceData A device-specific set of data Yes deviceData object
pushMessToken A message token to push No {
  "type": "string",
  "nullable": true
}

Property table for deviceData object

Property Description Required Schema
platform The device platform No {
  "type": "string",
  "nullable": true
}

Request Body

  {
    "deviceTag": "o1vd1oc0nw8"
  }

Snippet Examples

javascript

const axios = require('axios');
const data =   {
    "deviceTag": "o1vd1oc0nw8"
  };
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/recovery/code',
  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/recovery/code" --data "  {    \"deviceTag\":\"o1vd1oc0nw8\"  }" --header "Content-Type: application/json" --header "token: A long random string token received from /token request"