Authentication
Retrieve authenticated user information by providing an API key
Authentication
This API allows you to retrieve the authenticated user's information by providing the API key.
Endpoint
GET https://zap.pandaidx.com/api/me?api_key={{api_key}}See guidelines on how to generate or obtain your API Key.
Authentication
You must provide an API key as a query parameter to authenticate the request. The key is used to identify and authorize the user making the request.
Query Parameters
api_key (required): The API key for authenticating the request. You can obtain this from the Panda IDX dashboard.
Request Examples
curl -X GET "https://zap.pandaidx.com/api/me?api_key=YOUR_API_KEY"// Example Request using Node.js (Fetch API)
const fetch = require("node-fetch");
const API_KEY = "your_api_key_here";
const url = `https://zap.pandaidx.com/api/me?api_key=${API_KEY}`;
fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));import requests
API_KEY = "your_api_key_here"
url = f"https://zap.pandaidx.com/api/me?api_key={API_KEY}"
response = requests.get(url, headers={"Content-Type": "application/json"})
data = response.json()
print(data)Response
The API returns a JSON object containing the authenticated user's information. The token is not included, but the user's account details are returned.
Response Fields
| Field | Type | Description |
|---|---|---|
_id | String | The unique identifier of the authenticated user. |
email | String | The email address of the authenticated user. |
name | String | The full name of the authenticated user. |
role | String | The role of the authenticated user (e.g., user, admin). |
createdAt | String | The date and time when the user was created (ISO 8601 format). |
updatedAt | String | The date and time when the user's information was last updated. |
domain | String | The domain associated with the authenticated user. |
Example Response
{
"_id": "66955f1f93c1be2dd9deb221",
"email": "user@example.com",
"name": "John Doe",
"role": "user",
"createdAt": "2023-09-12T12:34:56Z",
"updatedAt": "2023-09-15T12:34:56Z",
"domain": "12345"
}Errors
In the case of an error, the API will return an appropriate HTTP status code and an error message.
Error Codes
| HTTP Code | Error Type | Description |
|---|---|---|
401 | Unauthorized | The API key is invalid or missing. |
500 | ServerError | An internal server error occurred. |
Example Error Response
{
"error": "Unauthorized",
"message": "Invalid API key"
}Notes
- Ensure that the API key provided is valid and belongs to an authenticated user.
- Store your API key securely and never expose it in client-side code.
- Use environment variables to store your API key in production.