Events API
Send events to PingPanda to receive Discord notifications.
Endpoint
POST /api/v1/events
Request Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Request Body
{
"category": "sale",
"fields": {
"amount": 49.99,
"customer": "john@example.com",
"plan": "PRO"
},
"description": "New sale completed!"
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
category | string | Yes | Name of the event category (must exist in your account) |
fields | object | No | Custom fields to include in the Discord message |
description | string | No | Custom description (defaults to category-based message) |
Category Name Rules
- Must be lowercase
- Can contain letters, numbers, hyphens, and underscores
- Must be 1-50 characters
- Must already exist in your account
Fields
Fields can contain:
- Strings
- Numbers
- Booleans
All field values will be converted to strings in the Discord message.
Response
Success (200 OK)
{
"message": "Event processed successfully",
"eventId": "clx1234567890"
}
Error Responses
Invalid API Key (401)
{
"message": "Invalid API key"
}
Discord ID Not Set (403)
{
"message": "Please enter your discord ID in your account settings"
}
Category Not Found (404)
{
"message": "You dont have a category named \"sale\""
}
Rate Limit Exceeded (429)
{
"message": "Rate limit exceeded. Please try again later.",
"retryAfter": 45
}
Examples
Basic Event
curl -X POST https://pingpanda.com/api/v1/events \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"category": "sale"
}'
Event with Custom Fields
curl -X POST https://pingpanda.com/api/v1/events \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"category": "signup",
"fields": {
"email": "user@example.com",
"plan": "FREE"
}
}'
Event with Custom Description
curl -X POST https://pingpanda.com/api/v1/events \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"category": "error",
"description": "Payment processing failed",
"fields": {
"error_code": "PAYMENT_001",
"user_id": "12345"
}
}'