Validate Authentication
curl --request GET \
--url https://app.cardclan.io/api/integration/auth/validate \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.cardclan.io/api/integration/auth/validate"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.cardclan.io/api/integration/auth/validate', 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://app.cardclan.io/api/integration/auth/validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.cardclan.io/api/integration/auth/validate"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.cardclan.io/api/integration/auth/validate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cardclan.io/api/integration/auth/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Bearer token authentication successful",
"user_id": "60f7b2b5b8f4a20015a4f5a3"
}{
"error": "Bad Request",
"message": "Card ID is required",
"statusCode": 400,
"timestamp": "2024-01-15T10:30:00.000Z"
}{
"error": "Bad Request",
"message": "Card ID is required",
"statusCode": 400,
"timestamp": "2024-01-15T10:30:00.000Z"
}Integration API
Validate Authentication
Validates the provided Bearer token and returns user information
GET
/
integration
/
auth
/
validate
Validate Authentication
curl --request GET \
--url https://app.cardclan.io/api/integration/auth/validate \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.cardclan.io/api/integration/auth/validate"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.cardclan.io/api/integration/auth/validate', 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://app.cardclan.io/api/integration/auth/validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.cardclan.io/api/integration/auth/validate"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.cardclan.io/api/integration/auth/validate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cardclan.io/api/integration/auth/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Bearer token authentication successful",
"user_id": "60f7b2b5b8f4a20015a4f5a3"
}{
"error": "Bad Request",
"message": "Card ID is required",
"statusCode": 400,
"timestamp": "2024-01-15T10:30:00.000Z"
}{
"error": "Bad Request",
"message": "Card ID is required",
"statusCode": 400,
"timestamp": "2024-01-15T10:30:00.000Z"
}Validates the provided Bearer token and returns user information. This endpoint is useful for testing your authentication setup and verifying that your integration key is working correctly.
Use Cases
- Health Check: Verify your integration key is valid and active
- User Identification: Get the user ID associated with your integration key
- Connection Testing: Test your API setup before making other requests
- Debugging: Troubleshoot authentication issues
Response Details
A successful response confirms that:- Your Bearer token is valid and properly formatted
- The integration key exists in our system
- The associated user account is active
- You can proceed to make other API requests
user_id in the response can be used for:
- Creating integration configurations
- Tracking API usage
- Debugging and support requests
Common Issues
401 - Authorization header with Bearer token required
401 - Authorization header with Bearer token required
Cause: Missing or malformed Authorization headerSolution: Include
Authorization: Bearer YOUR_INTEGRATION_KEY in your request headers# ✅ Correct format
curl -H "Authorization: Bearer 550e8400-e29b-41d4-a716-446655440000"
# ❌ Common mistakes
curl -H "Authorization: YOUR_INTEGRATION_KEY" # Missing "Bearer "
curl -H "Bearer YOUR_INTEGRATION_KEY" # Missing "Authorization:"
401 - Bearer token is empty
401 - Bearer token is empty
Cause: Authorization header is present but the token value after “Bearer ” is emptySolution: Ensure your integration key is properly set in your environment or configuration
// Check your environment variable is set
console.log(process.env.CARDCLAN_API_KEY); // Should not be undefined
const headers = {
'Authorization': `Bearer ${process.env.CARDCLAN_API_KEY}`
};
404 - Invalid bearer token - user not found
404 - Invalid bearer token - user not found
Cause: The integration key is not valid or doesn’t exist in our systemSolution:
- Verify you’re using the correct integration key
- Check if the key was regenerated and update your configuration
- Generate a new key if necessary using the Create Key endpoint
Response Example
{
"success": true,
"message": "Bearer token authentication successful",
"user_id": "60f7b2b5b8f4a20015a4f5a3"
}
Testing Your Setup
Use this endpoint to test your authentication setup:curl -X GET "https://api.cardclan.com/api/integration/auth/validate" \
-H "Authorization: Bearer YOUR_INTEGRATION_KEY"
const response = await fetch('https://api.cardclan.com/api/integration/auth/validate', {
headers: {
Authorization: `Bearer ${process.env.CARDCLAN_API_KEY}`,
},
});
if (response.ok) {
const data = await response.json();
console.log('Authentication successful:', data);
} else {
console.error('Authentication failed:', await response.json());
}
import requests
import os
headers = {
'Authorization': f'Bearer {os.getenv("CARDCLAN_API_KEY")}'
}
response = requests.get(
'https://api.cardclan.com/api/integration/auth/validate',
headers=headers
)
if response.status_code == 200:
print('Authentication successful:', response.json())
else:
print('Authentication failed:', response.json())
Was this page helpful?