Everything you need to make your first request.
Every request must include your API key in the Authorization header as a bearer token. Keys are created from the API Keys page.
const CARDIENT_API_KEY = process.env.CARDIENT_API_KEY;
const response = await fetch("https://api.cardient.dev/v1/lookup", {
method: "POST",
headers: {
"Authorization": `Bearer ${CARDIENT_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ cardNumber: "4539418765210012" })
});Send a POST request with the card number in the JSON body.
// lookup.js
const response = await fetch("https://api.cardient.dev/v1/lookup", {
method: "POST",
headers: {
"Authorization": "Bearer ck_live_your_api_key",
"Content-Type": "application/json"
},
body: JSON.stringify({
cardNumber: "4539418765210012"
})
});
const data = await response.json();
console.log(data);A successful lookup returns the bank, country and network as JSON.
// 200 OK
{
"bank": {
"name": "Chase Bank",
"logo": "https://cdn.cardient.dev/logos/chase.svg"
},
"country": {
"name": "United States",
"code": "US"
},
"network": "Visa",
"bin": "453941"
}Errors are returned with a matching HTTP status code and a consistent shape.
// 401 Unauthorized — missing or invalid API key
{
"error": {
"code": "invalid_api_key",
"message": "The API key provided is invalid or has been revoked."
}
}
// 422 Unprocessable Entity — malformed card number
{
"error": {
"code": "invalid_card_number",
"message": "The cardNumber field must contain 12-19 digits."
}
}Looking for other languages? Node.js examples are available now — Python, Ruby and PHP examples are planned for a future release.