Skip to main content
POST
/
v0
/
cards
/
{id}
/
deactivate
Deactivate a card
curl --request POST \
  --url https://api.sandbox.lead.bank/v0/cards/{id}/deactivate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --data '
{
  "status_reason": "dormant"
}
'
import requests

url = "https://api.sandbox.lead.bank/v0/cards/{id}/deactivate"

payload = { "status_reason": "dormant" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({status_reason: 'dormant'})
};

fetch('https://api.sandbox.lead.bank/v0/cards/{id}/deactivate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.lead.bank/v0/cards/{id}/deactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'status_reason' => 'dormant'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.sandbox.lead.bank/v0/cards/{id}/deactivate"

payload := strings.NewReader("{\n \"status_reason\": \"dormant\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.sandbox.lead.bank/v0/cards/{id}/deactivate")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status_reason\": \"dormant\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sandbox.lead.bank/v0/cards/{id}/deactivate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status_reason\": \"dormant\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "card_xyz123",
  "client_card_id": "<string>",
  "account_id": "account_xyz123",
  "entity_id": "entity_xyz123",
  "status_reason": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "details": {
    "card_product_name": "<string>",
    "is_virtual": true,
    "expiry_date": "2023-12-25",
    "last_four": "1234",
    "replacement_for": "card_xyz123",
    "closed_at": "2023-11-07T05:31:56Z"
  },
  "metadata": {}
}
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}
{
"code": "invalid_status_transition",
"title": "Invalid status transition.",
"detail": "Card cannot be deactivated from current status.",
"invalid_parameters": []
}
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"status": "<string>",
"invalid_parameters": [
{
"parameter": "transaction_type",
"reason": "<string>"
}
],
"instance": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string
required

Unique key to ensure idempotent requests

Maximum string length: 255

Path Parameters

id
string
required

The server-generated Card ID. The server-generated ID of the Card object.

Pattern: ^card_\w+$
Example:

"card_xyz123"

Body

application/json

Request body for deactivating a card.

status_reason
enum<string>
required

Valid reasons for deactivating a card.

Available options:
dormant,
frozen,
other

Response

Card deactivated successfully.

A card object

id
string

The server-generated ID of the Card object.

Pattern: ^card_\w+$
Example:

"card_xyz123"

client_card_id
string
read-only

Client-provided identifier for the card. Optional: present only for cards created via file upload, and omitted for cards created through the API, which are identified solely by their server-generated ID.

account_id
string

The ID of the Account object.

Pattern: ^account_\w+$
Example:

"account_xyz123"

entity_id
string

The ID of your entity.

Pattern: ^entity_[^\s]{1,33}$
Example:

"entity_xyz123"

status
enum<string>

Status is system-managed and cannot be set on create; status changes go through the status-transition endpoints.

Available options:
active,
inactive,
closed
status_reason
string
read-only

The reason for the card's current status. Empty when the card is active; otherwise populated. Set via the status-transition endpoints.

created_at
string<date-time>
read-only

Creation timestamp.

updated_at
string<date-time>
read-only

Last update timestamp.

details
object

Physical and product attributes of the card.

metadata
object

A set of key-value pairs that can be used to store additional information related to this object.