Get User Details
curl --request GET \
--url https://api.example.com/v1/user \
--header 'Authorization: <authorization>' \
--header 'x-client-key: <x-client-key>'import requests
url = "https://api.example.com/v1/user"
headers = {
"x-client-key": "<x-client-key>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-client-key': '<x-client-key>', Authorization: '<authorization>'}
};
fetch('https://api.example.com/v1/user', 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.example.com/v1/user",
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: <authorization>",
"x-client-key: <x-client-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"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/user"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-client-key", "<x-client-key>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/user")
.header("x-client-key", "<x-client-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/user")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-client-key"] = '<x-client-key>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"message": "Not authenticated"
}
{
"message": "Not authorized"
}
{
"message": "Internal server error"
}
User
Get User Details
Retrieves profile information for the authenticated user, including personal details, contact information, and verification status
GET
/
v1
/
user
Get User Details
curl --request GET \
--url https://api.example.com/v1/user \
--header 'Authorization: <authorization>' \
--header 'x-client-key: <x-client-key>'import requests
url = "https://api.example.com/v1/user"
headers = {
"x-client-key": "<x-client-key>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-client-key': '<x-client-key>', Authorization: '<authorization>'}
};
fetch('https://api.example.com/v1/user', 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.example.com/v1/user",
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: <authorization>",
"x-client-key: <x-client-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"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/user"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-client-key", "<x-client-key>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/user")
.header("x-client-key", "<x-client-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/user")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-client-key"] = '<x-client-key>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"message": "Not authenticated"
}
{
"message": "Not authorized"
}
{
"message": "Internal server error"
}
Overview
Use this endpoint to retrieve complete profile information for the authenticated user. This endpoint is essential for:- Displaying user profile data in your application
- Checking verification state before performing operations that require verified users
- Validating user information before card orders or wallet operations
- Syncing user data with your application’s database
Authentication
This endpoint requires both client authentication and user authentication:string
required
Your client public key for API authentication
string
required
Bearer token obtained from OAuth flow or login endpoint
boolean
default:"false"
Set to
true to route requests to the US backend environment (if available for your client). Defaults to international environment.Response
string
Unique identifier for the user (UUID format)
string
User’s first name
string
User’s last name
string
User’s date of birth in YYYY-MM-DD format
string
User’s email address
string
Current verification status of the user. Possible values:
UNVERIFIED- User has not started verificationPENDING- Verification is in progressVERIFIED- User is fully verifiedREJECTED- Verification was rejected
string
User’s phone number without country code
string
Phone number country code (e.g., “+44”, “+1”)
string
Primary address line
string | null
Secondary address line (optional)
string
City of residence
string
Postal/ZIP code
string
ISO 3166-1 alpha-2 country code of residence (e.g., “GB”, “US”)
string
ISO 3166-1 alpha-2 country code of nationality (e.g., “GB”, “US”)
string | null
US state code (only for US residents, null otherwise)
string | null
Social Security Number (only for US residents, null otherwise)
string
Timestamp when the user account was created (ISO 8601 format with timezone)
Examples
curl --request GET \
--url https://dev.api.baanx.com/v1/user \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'x-client-key: YOUR_CLIENT_KEY'
const response = await fetch('https://dev.api.baanx.com/v1/user', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'x-client-key': 'YOUR_CLIENT_KEY'
}
});
const user = await response.json();
console.log(user);
interface User {
id: string;
firstName: string;
lastName: string;
dateOfBirth: string;
email: string;
verificationState: 'UNVERIFIED' | 'PENDING' | 'VERIFIED' | 'REJECTED';
phoneNumber: string;
phoneCountryCode: string;
addressLine1: string;
addressLine2: string | null;
city: string;
zip: string;
countryOfResidence: string;
countryOfNationality: string;
usState: string | null;
ssn: string | null;
createdAt: string;
}
const response = await fetch('https://dev.api.baanx.com/v1/user', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'x-client-key': 'YOUR_CLIENT_KEY'
}
});
const user: User = await response.json();
import requests
url = "https://dev.api.baanx.com/v1/user"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"x-client-key": "YOUR_CLIENT_KEY"
}
response = requests.get(url, headers=headers)
user = response.json()
print(user)
Response Example
{
"id": "100a99cf-f4d3-4fa1-9be9-2e9828b20ebb",
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "2000-01-01",
"email": "email@example.com",
"verificationState": "VERIFIED",
"phoneNumber": "7400846282",
"phoneCountryCode": "+44",
"addressLine1": "23 Werrington Bridge Rd",
"addressLine2": "Milking Nook",
"city": "Peterborough",
"zip": "PE6 7PP",
"countryOfResidence": "GB",
"countryOfNationality": "GB",
"usState": null,
"ssn": null,
"createdAt": "2023-03-27 17:07:12.662+03"
}
Error Responses
{
"message": "Not authenticated"
}
{
"message": "Not authorized"
}
{
"message": "Internal server error"
}
Error Response Details
Error Response Details
401 Unauthorized
The access token is missing, invalid, or expired. You need to:- Ensure the Authorization header is present and properly formatted
- Verify the access token hasn’t expired (6-hour lifetime)
- Obtain a new access token using the refresh token if expired
403 Forbidden
The access token is valid but doesn’t have permission to access this resource. This may occur if:- The token doesn’t belong to a valid user
- The client key doesn’t match the user’s associated client
- The user account has been suspended or disabled
500 Internal Server Error
An unexpected error occurred on the server. If this persists:- Check the API status page
- Contact support with the request timestamp
- Implement retry logic with exponential backoff
Use Cases
Check Verification Status Before Card Order
Before allowing users to order a card, verify their verification state:async function canOrderCard(accessToken: string): Promise<boolean> {
const response = await fetch('https://dev.api.baanx.com/v1/user', {
headers: {
'Authorization': `Bearer ${accessToken}`,
'x-client-key': 'YOUR_CLIENT_KEY'
}
});
const user = await response.json();
return user.verificationState === 'VERIFIED';
}
Display User Profile
Retrieve and display user information in your application:async function getUserProfile(accessToken: string) {
const response = await fetch('https://dev.api.baanx.com/v1/user', {
headers: {
'Authorization': `Bearer ${accessToken}`,
'x-client-key': 'YOUR_CLIENT_KEY'
}
});
if (!response.ok) {
throw new Error('Failed to fetch user profile');
}
const user = await response.json();
return {
fullName: `${user.firstName} ${user.lastName}`,
email: user.email,
phone: `${user.phoneCountryCode}${user.phoneNumber}`,
address: [
user.addressLine1,
user.addressLine2,
user.city,
user.zip
].filter(Boolean).join(', '),
isVerified: user.verificationState === 'VERIFIED'
};
}
Important Notes
Verification State: Most operations (card orders, wallet operations) require users to have
VERIFIED status. Always check the verificationState field before allowing protected operations.Sensitive Data: The response contains sensitive personal information including SSN (for US users). Ensure you:
- Handle this data securely in your application
- Never log sensitive fields
- Comply with data protection regulations (GDPR, CCPA, etc.)
- Only store what’s necessary for your use case
Caching: User profile data doesn’t change frequently. Consider implementing caching with appropriate TTL (5-15 minutes) to reduce API calls and improve performance.
Edge Cases & Limitations
Regional Variations
US Users: US-specific fields are populated:{
"usState": "CA",
"ssn": "***-**-1234"
}
{
"usState": null,
"ssn": null
}
Verification States
UNVERIFIED State
UNVERIFIED State
User has registered but hasn’t started the verification process. They can:
- Access their profile
- Update basic information
- View wallet balances
- Order cards
- Perform withdrawals
- Access certain wallet features
PENDING State
PENDING State
Verification is in progress. The user should wait for verification to complete. Typical processing time is 5-30 minutes, but may take longer for manual review.
VERIFIED State
VERIFIED State
Full access to all platform features. This is the required state for most financial operations.
REJECTED State
REJECTED State
Verification failed. The user needs to:
- Contact support to understand the rejection reason
- Provide additional documentation if requested
- Re-submit verification with corrected information
Optional Fields
The following fields may benull depending on user registration flow and region:
addressLine2- Not required for all addressesusState- Only populated for US residentsssn- Only populated for US residents who provided SSN
Rate Limiting
This endpoint is subject to standard rate limits:- 1000 requests per minute per access token
- 10000 requests per hour per client
Related Endpoints
- Start User Verification - Initiate identity verification process
- Get Card Status - Check if user has ordered a card
- Get External Wallets - View user’s registered external wallet balances
Was this page helpful?