API Overview
BugPin exposes a REST API for both the embeddable widget and programmatic admin access. The Widget API is public and uses API key authentication for submitting bug reports and fetching widget configuration. The Admin API requires session authentication and covers reports, projects, users, settings, and integrations. This page provides an overview of all endpoints, authentication methods, rate limiting, response formats, and CORS behavior.
Base URL
All API endpoints are relative to your BugPin server URL:
https://your-bugpin-server.com/api
API Categories
Widget API (Public)
The widget API is used by the embeddable widget and does not require session authentication. It uses API keys for project identification.
| Endpoint | Method | Description |
|---|---|---|
/api/widget/submit | POST | Submit a bug report |
/api/widget/config/:apiKey | GET | Get widget configuration |
See Widget API Reference for details.
Admin API (Authenticated)
The admin API requires session authentication and is used by the admin dashboard.
| Endpoint | Description |
|---|---|
/api/auth | Authentication (login, logout, session) |
/api/reports | Bug report management |
/api/projects | Project management |
/api/users | User management |
/api/settings | Application settings |
/api/integrations | Third-party integrations (GitHub) |
/api/webhooks | Outgoing webhooks (Enterprise Edition) |
Webhooks (Enterprise Edition)
Webhooks send report events to your own endpoint. When a webhook has a signing secret, each delivery carries an X-BugPin-Signature header with an HMAC-SHA256 signature of the body in the form sha256=<hex>, next to X-BugPin-Event and X-BugPin-Delivery.
The signing secret is write-only. Webhook responses never include it; they return secretSet (true or false) instead. When updating a webhook with PATCH /api/webhooks/:id, leave out secret to keep the saved secret, send a new value to replace it, or send "" to remove it. The webhook editor in the Admin Console works the same way and has a Remove secret link.
Authentication
Widget API
Widget endpoints use API keys for authentication. Send the key in the X-Api-Key header; the apiKey query parameter is rejected with 400 DEPRECATED:
POST /api/widget/submit
X-Api-Key: bp_proj_abc123
Admin API
Admin endpoints require session-based authentication:
- Call
/api/auth/loginwith credentials - Include the session cookie in subsequent requests
The Admin API is same-origin only. Browser requests from other origins are refused, while server-side clients such as curl work normally.
If the account still has to replace its initial password, every endpoint except /api/auth/change-password and /api/auth/logout returns 403 with the error PASSWORD_CHANGE_REQUIRED. API tokens of such a user (Enterprise Edition) are refused on every endpoint with the same error until the password is changed.
If the two-factor policy requires the account to set up a second factor and it has none yet, every endpoint except sign-out, password change and the two-factor and passkey endpoints under /api/auth returns 403 with the error TWO_FACTOR_SETUP_REQUIRED until it does. This also applies to requests made with that user's API tokens (Enterprise Edition).
# Login
curl -X POST https://bugs.example.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "your-password"}' \
-c cookies.txt
# Use session cookie
curl https://bugs.example.com/api/reports \
-b cookies.txt
Rate Limiting
Widget submission endpoints are rate limited to prevent abuse:
- Default: 10 submissions per minute per client address, counted separately for each project
- Configurable under Security → General in the Admin Console
Rate limit headers are included in responses:
X-RateLimit-Limit: 10
X-RateLimit-Remaining: 9
X-RateLimit-Reset: 42
X-RateLimit-Reset is the number of seconds until the window resets.
When rate limited, the API returns a 429 Too Many Requests response.
Sign-in endpoints have fixed limits per client address, counted separately for each endpoint, and IPv6 clients are counted by their /64 network. See Rate Limiting.
Response Format
All API responses follow a consistent format:
Success Response
{
"success": true,
"data": { ... }
}
Error Response
{
"success": false,
"error": "ERROR_CODE",
"message": "Human-readable error message",
"details": [ ... ] // Optional validation errors
}
Error Codes
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid authentication |
FORBIDDEN | 403 | Origin not allowed or insufficient permissions |
NOT_FOUND | 404 | Resource not found |
VALIDATION_ERROR | 400 | Request validation failed |
DEPRECATED | 400 | API key sent as a query parameter instead of the X-Api-Key header |
PASSWORD_CHANGE_REQUIRED | 403 | The account must replace its initial password first |
TWO_FACTOR_SETUP_REQUIRED | 403 | The two-factor policy requires the account to set up a second factor first |
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
TOO_MANY_ATTEMPTS | 429 | Second-factor sign-in is locked for 15 minutes after 10 failed attempts |
FILE_TOO_LARGE | 413 | An uploaded file exceeds its size limit |
UNSUPPORTED_MEDIA_TYPE | 415 | The file type is not accepted |
SCREEN_RECORDING_DISABLED | 403 | A recording was sent although screen recording is off for the project |
VIDEO_QUOTA_EXCEEDED | 429 | The project reached its daily video upload limit |
RECORDING_AUDIO_NOT_ALLOWED | 400 | The recording has audio although microphone recording is not allowed |
RECORDING_TOO_LONG | 400 | The recording exceeds the maximum recording duration |
INTERNAL_ERROR | 500 | Server error |
Content Types
JSON Requests
curl -X POST https://bugs.example.com/api/widget/submit \
-H "Content-Type: application/json" \
-H "X-Api-Key: your-project-api-key" \
-d '{"title": "Bug report", ...}'
Multipart Form Data
For requests with file uploads (screenshots):
curl -X POST https://bugs.example.com/api/widget/submit \
-H "X-Api-Key: your-project-api-key" \
-F "data={\"title\": \"Bug report\", ...}" \
-F "[email protected]"
CORS
The widget API (/api/widget/*) supports Cross-Origin Resource Sharing (CORS) for browser-based requests from any origin, without cookies or credentials. All other endpoints are same-origin only.
Origin Restrictions
Projects can configure allowed origins in the admin panel. When configured:
- Only requests from allowed origins are accepted
- Subdomains of allowed domains are automatically permitted
Allowed: example.com
Accepts: example.com, www.example.com, app.example.com
Health Check
A health check endpoint is available for monitoring:
GET /health
Returns 200 OK when the server is healthy.