Update token status
Relevant webhooks
For this endpoint be sure you have registered for these webhooks:
- Cards.Token.ProvisioningReceived
- Cards.Token.ActivationReceived
- Cards.Token.CompletionReceived
API reference
Update token status (suspend, resume, delete).
Endpoint: /cardmanagement/v1/cards/{cardId}/tokens/{tokenId}
PUT
https://sandbox.crbcos.com/cardmanagement/v1/cards/{cardId}/tokens/{tokenId}
Path Parameters
- cardIdstringrequiredDescription
- tokenIdstringrequiredDescription
Body Parameters
- requestobjectrequiredDescription
- tokenActionstringrequiredDescription
- reasonstringDescription
Response
- tokenIdstring
- statusstringDescription
curl
curl --location --request PUT 'https://sandbox.crbcos.com/cardmanagement/v1/cards/89a3ca77-10dc-4b88-b0a7-b4480095d104/tokens/c25cabee-2533-4a46-a52b-c74991559bd7' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"tokenAction": "Activate",
"reason": "It'\''s time"
}'nodejs
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://sandbox.crbcos.com/cardmanagement/v1/cards/89a3ca77-10dc-4b88-b0a7-b4480095d104/tokens/c25cabee-2533-4a46-a52b-c74991559bd7',
'headers': {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: '{\r\n "tokenAction": "Activate",\r\n "reason": "It\'s time"\r\n}'
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
python
import requests
url = "https://sandbox.crbcos.com/cardmanagement/v1/cards/89a3ca77-10dc-4b88-b0a7-b4480095d104/tokens/c25cabee-2533-4a46-a52b-c74991559bd7"
payload = "{\r\n \"tokenAction\": \"Activate\",\r\n \"reason\": \"It's time\"\r\n}"
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "net/http"
url = URI("https://sandbox.crbcos.com/cardmanagement/v1/cards/89a3ca77-10dc-4b88-b0a7-b4480095d104/tokens/c25cabee-2533-4a46-a52b-c74991559bd7")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = "{\r\n \"tokenAction\": \"Activate\",\r\n \"reason\": \"It's time\"\r\n}"
response = https.request(request)
puts response.read_body
go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.crbcos.com/cardmanagement/v1/cards/89a3ca77-10dc-4b88-b0a7-b4480095d104/tokens/c25cabee-2533-4a46-a52b-c74991559bd7"
method := "PUT"
payload := strings.NewReader(`{
"tokenAction": "Activate",
"reason": "It's time"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}200
{
"tokenId": "c25cabee-2533-4a46-a52b-c74991559bd7",
"status": "ACTIVE"
}