Overview
XpatAI uses API keys to authenticate requests. You can view and manage your API keys in your dashboard. Your API keys carry many privileges, so be sure to keep them secure.
Never share your API keys in publicly accessible areas such as GitHub, client-side code, or blog posts.
Authentication Methods
Bearer Authentication
The recommended way to authenticate requests is using Bearer authentication with your API key.
Authorization: Bearer YOUR_API_KEY
Replace YOUR_API_KEY with your actual API key
Query Parameter
Alternatively, you can authenticate by including your API key as a query parameter.
https://api.xpatai.xyz/v1/endpoint?api_key=YOUR_API_KEY
Note: Query parameter authentication is less secure and should only be used for testing.
Code Examples
JavaScript/Node.js
const response = await fetch('https://api.xpatai.xyz/v1/countries', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
Python
import requests
response = requests.get(
'https://api.xpatai.xyz/v1/countries',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
cURL
curl -X GET 'https://api.xpatai.xyz/v1/countries' \
-H 'Authorization: Bearer YOUR_API_KEY'