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/report

Submit a new bug report to a project.

Headers

HeaderValueRequired
X-API-KeyYour project API keyYes
Content-Typeapplication/jsonYes

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"
  }
}
FieldTypeRequiredDescription
titlestringYesBug title (max 500 chars)
descriptionstringNoDetailed description or repro steps
severitystringNolow, medium (default), high, or critical
emailstringNoReporter's email address
pageUrlstringNoURL where the bug occurred
screenshotstringNoBase64-encoded PNG/JPEG (max 5MB)
metadataobjectNoCustom 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/report

Fetch 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

AttributeDefaultDescription
data-project-key-Required. Your project API key
data-positionbottom-rightbottom-right or bottom-left
data-color#22d3eePrimary accent color (hex)
data-textReport BugButton label text
data-api-urlbugzap.devOverride 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

ScopeLimitWindow
Per IP address10 requests60 seconds
Per API key30 requests60 seconds
Max payload size1 MB-
Max screenshot size5 MB (decoded)-

When rate limited, the API returns 429 Too Many Requests with a retryAfter field in seconds.