curl --request POST \
--url https://sandbox-api.marqeta.com/v3/exception-file/{cardToken} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'X-Marqeta-Program-Short-Code: <x-marqeta-program-short-code>' \
--data '
{
"action_code": "CLOS"
}
'import requests
url = "https://sandbox-api.marqeta.com/v3/exception-file/{cardToken}"
payload = { "action_code": "CLOS" }
headers = {
"X-Marqeta-Program-Short-Code": "<x-marqeta-program-short-code>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Marqeta-Program-Short-Code': '<x-marqeta-program-short-code>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({action_code: 'CLOS'})
};
fetch('https://sandbox-api.marqeta.com/v3/exception-file/{cardToken}', 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://sandbox-api.marqeta.com/v3/exception-file/{cardToken}",
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([
'action_code' => 'CLOS'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"X-Marqeta-Program-Short-Code: <x-marqeta-program-short-code>"
],
]);
$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://sandbox-api.marqeta.com/v3/exception-file/{cardToken}"
payload := strings.NewReader("{\n \"action_code\": \"CLOS\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Marqeta-Program-Short-Code", "<x-marqeta-program-short-code>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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://sandbox-api.marqeta.com/v3/exception-file/{cardToken}")
.header("X-Marqeta-Program-Short-Code", "<x-marqeta-program-short-code>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"action_code\": \"CLOS\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.marqeta.com/v3/exception-file/{cardToken}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Marqeta-Program-Short-Code"] = '<x-marqeta-program-short-code>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action_code\": \"CLOS\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Request accepted for processing"
}Add Card to Exception File
Adds the specified card to the exception file
curl --request POST \
--url https://sandbox-api.marqeta.com/v3/exception-file/{cardToken} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'X-Marqeta-Program-Short-Code: <x-marqeta-program-short-code>' \
--data '
{
"action_code": "CLOS"
}
'import requests
url = "https://sandbox-api.marqeta.com/v3/exception-file/{cardToken}"
payload = { "action_code": "CLOS" }
headers = {
"X-Marqeta-Program-Short-Code": "<x-marqeta-program-short-code>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Marqeta-Program-Short-Code': '<x-marqeta-program-short-code>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({action_code: 'CLOS'})
};
fetch('https://sandbox-api.marqeta.com/v3/exception-file/{cardToken}', 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://sandbox-api.marqeta.com/v3/exception-file/{cardToken}",
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([
'action_code' => 'CLOS'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"X-Marqeta-Program-Short-Code: <x-marqeta-program-short-code>"
],
]);
$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://sandbox-api.marqeta.com/v3/exception-file/{cardToken}"
payload := strings.NewReader("{\n \"action_code\": \"CLOS\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Marqeta-Program-Short-Code", "<x-marqeta-program-short-code>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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://sandbox-api.marqeta.com/v3/exception-file/{cardToken}")
.header("X-Marqeta-Program-Short-Code", "<x-marqeta-program-short-code>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"action_code\": \"CLOS\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.marqeta.com/v3/exception-file/{cardToken}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Marqeta-Program-Short-Code"] = '<x-marqeta-program-short-code>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action_code\": \"CLOS\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Request accepted for processing"
}TERMINATED state, and your program must be enabled for Exception File Management.
See Exception File Management for prerequisites and guidance on choosing an action code.
The Marqeta platform processes this request asynchronously.
Subscribe to the pan.exception_file.added webhook event to confirm when the card network completes the action.
See Exception File Management events for details.Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Headers
Program short code of the program managing the card.
Path Parameters
Card token to be added to the exception file.
Body
Request to add or update a card on the exception file.
Code representing the action to be taken on the card.
CLOS- Card terminated / closed accountLCPU- Lost cardSCPU- Stolen cardINVA- Invalid / not found accountPUWF- Fraud pickup (non-specific)PUNF- Pickup (no fraud)EXPC- Expired card (authorization only; declines with response code 54)DNTH- General block (authorization only; declines with response code 05)
CLOS, LCPU, SCPU, INVA, PUWF, PUNF, EXPC, DNTH Purge date of the record in exception file, in YYYY-MM-DD format. Evaluated in UTC. Must be between 30 days and 24 months from the current date. Defaults to 90 days from the current date if not provided.
^\d{4}-\d{2}-\d{2}$Response
Request accepted for processing. The card is added to the exception file asynchronously.
Human-readable message describing the result of the request.
Was this page helpful?