Skip to content

Toggle Card On-Off

Request URL

POST /cards/:AFiCardId/:onoff

Description

Turning a card off means no transactions will be authorized. The card status will be set to "blocked" and the isActive property will be set to false.

Turning a card on means that transactions can be authorized. The card status will be set to "active" and the isActive property will be set to true.

The card is identified by a path parameter. There is no request body.

Schema

Property table for cards/:AFiCardId/:onoff

Property Description Required Schema
AFiCardId ampliFi ID for the card Yes {
  "type": "string"
}
onoff onoff No {
  "type": "string",
  "enum": [ "on", "off" ]
}

Snippet Examples

javascript

const axios = require('axios');
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/cards/:AFiCardId/:onoff',
  headers: {
    'Content-Type': "application/json",
    'token': "A long random string token received from /token request"
  },
};

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/cards/:AFiCardId/:onoff"  --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 CARDS/:AFICARDID/:ONOFF SUCCESSFUL RESPONSE CARD TURNED ON

HEADERS

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

PARAMETERS

Parameter Description Value
AFiCardId [required] qwegalgnuyocdfoxg
onoff [required] on

REQUEST BODY

none

RESPONSE BODY

{
    "success": true,
    "status": "active",
    "isActive": true,
    "card": {
        "_id": "64400ae79ccda0668817092a",
        "AFiCardId": "qwegalgnuyocdfoxg",
        "AFiAccountId": "qwegalgnuyocdfoxg",
        "typeId": "virtual",
        "AFiUserId": "qweaurl8kgtlv9pc",
        "cardIdBO": "cd_5cws26xjxlfbb",
        "accountIdBO": "cd_5cws26xjxlfbb",
        "backOfficeId": "evolve",
        "backOfficeName": "evolve",
        "status": "active",
        "isActive": true,
        "isActivated": true,
        "isClosed": false,
        "num": "123456******1234",
        "dtsOpened": "2023-04-19T15:38:14.436Z",
        "dtsExpiry": "2026-05-01T03:59:59.999Z",
        "currency": "USD",
        "name_on_card": "JOHN TESTMAN",
        "image": "images/card3.png",
        "primaryUserAFiUserId": null,
        "dtsUpdated": "2023-12-11T14:27:25.037Z",
        "dtsActivated": "2023-12-11T14:27:25.123Z"
    },
    "userId": "qweaurl8kgtlv9pc"
}