Authentication
How to config the authentification.
This is a guide for how to generate SQL queries by using your API key. The API key allows you to authenticate and make requests to our SQL generation endpoints.
Never share or expose your API key publicly. Keep it secure and treat it like a password. If compromised, immediately rotate your API key from your account settings.
API Key Authentication
Each user in the system is automatically assigned a unique API key upon registration. This API key can be used to authenticate API requests to the system without requiring a full login session.
Finding Your API Key
You can find your API key in your account settings page. Navigate to the settings page and look for the API key section.
Using Your API Key for API Requests
To use your API key for API requests, you need to include it in the Authorization
header of your HTTP requests with the Bearer
prefix:
Authorization: Bearer sk_your_api_key_here
Example API Request
Here's an example of how to make an authenticated API request using your API key:
// Example using fetch API
const apiKey = 'sk_your_api_key_here';
fetch('https://app.chatdb.live/api/resource', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
API Key Security
Keep your API key secure and do not share it publicly. If you believe your API key has been compromised, you can generate a new one from your account settings page.
Your API key grants access to your account and data. Treat it like a password and never expose it in client-side code or public repositories.