API Documentation
Integrate BugZap into your app using the REST API, embeddable widget, or TypeScript SDK.
REST API
Submit bug reports programmatically from any language or platform.
POST
/api/bugs/reportSubmit a new bug report to a project.
Headers
| Header | Value | Required |
|---|---|---|
| X-API-Key | Your project API key | Yes |
| Content-Type | application/json | Yes |
Request Body
{
"title": "Button not clickable on mobile",
"description": "The submit button is hidden behind the footer on iPhone 14",
"severity": "high",
"email": "tester@example.com",
"pageUrl": "https://myapp.com/checkout",
"screenshot": "data:image/png;base64,iVBOR...",
"metadata": {
"browser": "Safari 17",
"os": "iOS 17.4"
}
}| Field | Type | Required | Description |
|---|---|---|---|
| title | string | Yes | Bug title (max 500 chars) |
| description | string | No | Detailed description or repro steps |
| severity | string | No | low, medium (default), high, or critical |
| string | No | Reporter's email address | |
| pageUrl | string | No | URL where the bug occurred |
| screenshot | string | No | Base64-encoded PNG/JPEG (max 5MB) |
| metadata | object | No | Custom key-value pairs |
Response
// 201 Created
{ "success": true, "bugId": "uuid-here" }
// 401 Unauthorized
{ "error": "Missing API key" }
// 429 Too Many Requests
{ "error": "Rate limit exceeded", "retryAfter": 45 }GET
/api/bugs/reportFetch project branding config for the widget.
// 200 OK
{
"projectName": "My Project",
"branding": {
"primaryColor": "#22d3ee",
"buttonText": "Report Bug",
"position": "bottom-right"
}
}JavaScript Widget
Drop-in bug report button for any website. No build step required.
Installation
<script src="https://bugzap.dev/widget.js" data-project-key="YOUR_API_KEY" data-position="bottom-right" data-color="#22d3ee" data-text="Report Bug" ></script>
Configuration
| Attribute | Default | Description |
|---|---|---|
| data-project-key | - | Required. Your project API key |
| data-position | bottom-right | bottom-right or bottom-left |
| data-color | #22d3ee | Primary accent color (hex) |
| data-text | Report Bug | Button label text |
| data-api-url | bugzap.dev | Override API base URL (self-hosted) |
TypeScript SDK
Programmatic bug reporting with auto-capture of errors, console logs, and user context.
Installation
npm install @bugzap/sdk
Quick Start
import BugZap from '@bugzap/sdk';
// Initialize with your API key
BugZap.init({
apiKey: 'YOUR_API_KEY',
debug: true, // enable console logging
});
// Set user context (optional)
BugZap.setUser({ id: 'user_123', email: 'user@example.com' });
// Report a bug manually
await BugZap.report({
title: 'Checkout fails on Safari',
description: 'Payment form does not submit',
severity: 'high',
});
// Capture an exception
try {
await riskyOperation();
} catch (error) {
await BugZap.captureException(error);
}Configuration
BugZap.init({
apiKey: 'YOUR_API_KEY',
endpoint: 'https://bugzap.dev', // custom API URL
debug: false, // console logging
beforeSend: (report) => {
// Filter or modify reports before sending
// Return null to drop the report
if (report.title.includes('ignore')) return null;
return report;
},
});Auto-Capture
When initialized in a browser, the SDK automatically captures:
- •Uncaught errors and unhandled promise rejections
- •Console logs (all levels) — attached as metadata
- •Page URL and user agent
- •User context (if set via
setUser())
Rate Limits
| Scope | Limit | Window |
|---|---|---|
| Per IP address | 10 requests | 60 seconds |
| Per API key | 30 requests | 60 seconds |
| Max payload size | 1 MB | - |
| Max screenshot size | 5 MB (decoded) | - |
When rate limited, the API returns 429 Too Many Requests with a retryAfter field in seconds.