Skip to content

Modify PIN

Request URL

POST /card/:AFiCardId/pin

Description

This endpoint changes a card's PIN. The card is identified by a path parameter, and the new PIN must be given as 8 digits in the JSON formatted body of the request. However, only digits 3-6 will be extracted and sent to the back office as the actual PIN. The PIN is stored by the back office and cannot be retrieved.

Schema

Property table for card/:AFiCardId/pin

Property Description Required Schema
AFiCardId ampliFi ID for the card Yes {
  "type": "string"
}
pin A four digit PIN with two dummy characters at each end (for a pin value of 12345678, the four digit PIN is 3456) Yes {
  "type": "string",
  "pattern": "^[0-9]{8}$"
}

Request Body

{
    "pin": "12341235"
}

Snippet Examples

javascript

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

Successful Response Examples

200 CARD/:AFICARDID/PIN SUCCESSFUL RESPONSE CARD PIN CHANGE

HEADERS

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

PARAMETERS

Parameter Description Value
AFiCardId [required] qwegalgnuyocdfoxg

REQUEST BODY

{
    "pin": "12341235"
}

RESPONSE BODY

{
    "success": true
}