curl --request GET \
--url https://api.thepurplebox.io/v1/api-keys/logs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>'{
"status": 200,
"message": "api key logs retrieved successfully.",
"data": {
"data": [
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/send",
"method": "POST",
"status_code": 201,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
"request_body": {
"to": "[email protected]",
"subject": "Welcome Email",
"body": "<redacted>"
},
"response_body": {
"status": 201,
"message": "email sent successfully"
},
"response_time": 245,
"error_message": null,
"created_at": "2025-11-21T14:30:15.123Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/emails",
"method": "GET",
"status_code": 200,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "axios/1.6.0",
"request_body": null,
"response_body": {
"status": 200,
"message": "emails retrieved successfully"
},
"response_time": 89,
"error_message": null,
"created_at": "2025-11-21T14:25:42.456Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/send",
"method": "POST",
"status_code": 429,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "node-fetch/2.6.1",
"request_body": {
"to": "[email protected]",
"subject": "Test Email",
"body": "<redacted>"
},
"response_body": {
"status": 429,
"message": "Rate limit exceeded. Please try again later."
},
"response_time": 12,
"error_message": "Rate limit exceeded",
"created_at": "2025-11-21T14:20:05.789Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "smtp",
"method": "SMTP",
"status_code": 200,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "nodemailer/6.9.7",
"request_body": {
"to": "[email protected]",
"subject": "SMTP Test",
"body": "<redacted>"
},
"response_body": {
"status": 200,
"message": "Email sent via SMTP"
},
"response_time": 310,
"error_message": null,
"created_at": "2025-11-21T14:15:30.123Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/domains",
"method": "POST",
"status_code": 201,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "curl/8.4.0",
"request_body": {
"value": "example.com"
},
"response_body": {
"status": 201,
"message": "domain added successfully"
},
"response_time": 156,
"error_message": null,
"created_at": "2025-11-21T14:10:22.789Z"
}
],
"pagination": {
"page": 1,
"total_records": 250,
"total_pages": 25,
"limit": 10
}
}
}
Retrieve activity logs for your API keys to monitor usage and track requests.
curl --request GET \
--url https://api.thepurplebox.io/v1/api-keys/logs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>'{
"status": 200,
"message": "api key logs retrieved successfully.",
"data": {
"data": [
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/send",
"method": "POST",
"status_code": 201,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
"request_body": {
"to": "[email protected]",
"subject": "Welcome Email",
"body": "<redacted>"
},
"response_body": {
"status": 201,
"message": "email sent successfully"
},
"response_time": 245,
"error_message": null,
"created_at": "2025-11-21T14:30:15.123Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/emails",
"method": "GET",
"status_code": 200,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "axios/1.6.0",
"request_body": null,
"response_body": {
"status": 200,
"message": "emails retrieved successfully"
},
"response_time": 89,
"error_message": null,
"created_at": "2025-11-21T14:25:42.456Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/send",
"method": "POST",
"status_code": 429,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "node-fetch/2.6.1",
"request_body": {
"to": "[email protected]",
"subject": "Test Email",
"body": "<redacted>"
},
"response_body": {
"status": 429,
"message": "Rate limit exceeded. Please try again later."
},
"response_time": 12,
"error_message": "Rate limit exceeded",
"created_at": "2025-11-21T14:20:05.789Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "smtp",
"method": "SMTP",
"status_code": 200,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "nodemailer/6.9.7",
"request_body": {
"to": "[email protected]",
"subject": "SMTP Test",
"body": "<redacted>"
},
"response_body": {
"status": 200,
"message": "Email sent via SMTP"
},
"response_time": 310,
"error_message": null,
"created_at": "2025-11-21T14:15:30.123Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/domains",
"method": "POST",
"status_code": 201,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "curl/8.4.0",
"request_body": {
"value": "example.com"
},
"response_body": {
"status": 201,
"message": "domain added successfully"
},
"response_time": 156,
"error_message": null,
"created_at": "2025-11-21T14:10:22.789Z"
}
],
"pagination": {
"page": 1,
"total_records": 250,
"total_pages": 25,
"limit": 10
}
}
}
application/json2025-11-01T00:00:00Z).2025-11-30T23:59:59Z).200, 429, 500)./v1/send, /v1/domains).200 when logs are retrieved successfully.Show properties
Show properties
/v1/send, /v1/emails, /v1/domains). For SMTP requests, this will be smtp.GET, POST, PUT, DELETE, PATCH. For SMTP requests, this will be SMTP.200, 201, 400, 429, 500).{
"status": 200,
"message": "api key logs retrieved successfully.",
"data": {
"data": [
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/send",
"method": "POST",
"status_code": 201,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
"request_body": {
"to": "[email protected]",
"subject": "Welcome Email",
"body": "<redacted>"
},
"response_body": {
"status": 201,
"message": "email sent successfully"
},
"response_time": 245,
"error_message": null,
"created_at": "2025-11-21T14:30:15.123Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/emails",
"method": "GET",
"status_code": 200,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "axios/1.6.0",
"request_body": null,
"response_body": {
"status": 200,
"message": "emails retrieved successfully"
},
"response_time": 89,
"error_message": null,
"created_at": "2025-11-21T14:25:42.456Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/send",
"method": "POST",
"status_code": 429,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "node-fetch/2.6.1",
"request_body": {
"to": "[email protected]",
"subject": "Test Email",
"body": "<redacted>"
},
"response_body": {
"status": 429,
"message": "Rate limit exceeded. Please try again later."
},
"response_time": 12,
"error_message": "Rate limit exceeded",
"created_at": "2025-11-21T14:20:05.789Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "smtp",
"method": "SMTP",
"status_code": 200,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "nodemailer/6.9.7",
"request_body": {
"to": "[email protected]",
"subject": "SMTP Test",
"body": "<redacted>"
},
"response_body": {
"status": 200,
"message": "Email sent via SMTP"
},
"response_time": 310,
"error_message": null,
"created_at": "2025-11-21T14:15:30.123Z"
},
{
"id": "xxxxx",
"api_key_id": 2,
"team_id": "xxxxx",
"endpoint": "/v1/domains",
"method": "POST",
"status_code": 201,
"ip_address": "xxx.xxx.xxx.xxx",
"user_agent": "curl/8.4.0",
"request_body": {
"value": "example.com"
},
"response_body": {
"status": 201,
"message": "domain added successfully"
},
"response_time": 156,
"error_message": null,
"created_at": "2025-11-21T14:10:22.789Z"
}
],
"pagination": {
"page": 1,
"total_records": 250,
"total_pages": 25,
"limit": 10
}
}
}
// Get all logs for a specific API key
const response = await fetch('https://api.thepurplebox.io/v1/api-keys/logs?api_key_id=2&limit=50', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const logs = await response.json();
console.log(`Total requests: ${logs.data.pagination.total_records}`);
// Filter by 429 status codes
const response = await fetch('https://api.thepurplebox.io/v1/api-keys/logs?status_code=429', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const rateLimitErrors = await response.json();
rateLimitErrors.data.data.forEach(log => {
console.log(`Rate limit hit at ${log.created_at} on ${log.endpoint}`);
});
// Get recent logs and check IP addresses
const response = await fetch('https://api.thepurplebox.io/v1/api-keys/logs?limit=100', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const logs = await response.json();
const uniqueIPs = [...new Set(logs.data.data.map(log => log.ip_address))];
console.log('Requests from IPs:', uniqueIPs);
// Filter by error status codes (4xx and 5xx)
const response = await fetch('https://api.thepurplebox.io/v1/api-keys/logs?start_date=2025-11-20T00:00:00Z', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const logs = await response.json();
const errors = logs.data.data.filter(log => log.status_code >= 400);
errors.forEach(log => {
console.log(`Error: ${log.status_code} - ${log.error_message}`);
console.log(`Endpoint: ${log.method} ${log.endpoint}`);
console.log(`Time: ${log.created_at}`);
});
/v1/send, /v1/emails, /v1/domains, etc.)