Skip to main content

Widget API Reference

The BugPin Widget API is a public REST API that allows any application to submit bug reports programmatically, without using the browser-based widget. This is useful for building custom feedback forms, server-side report submission, automated testing pipelines, or integrating with non-browser environments. Authentication uses API key headers rather than session cookies.

Submit Report​

Submit a new bug report.

POST /api/widget/submit

Authentication​

Send the project API key in the X-Api-Key header:

POST /api/widget/submit
X-Api-Key: your-project-api-key

The apiKey query parameter is no longer accepted. Requests that use it are rejected with 400 Bad Request and the error DEPRECATED.

Request Body (JSON)​

{
"title": "Button not working on checkout page",
"description": "When I click the submit button, nothing happens.",
"priority": "high",
"reporterName": "John Doe",
"reporterEmail": "[email protected]",
"metadata": {
"url": "https://example.com/checkout",
"title": "Checkout - Example Store",
"referrer": "https://example.com/cart",
"browser": {
"name": "Chrome",
"version": "120.0.0",
"userAgent": "Mozilla/5.0..."
},
"device": {
"type": "desktop",
"os": "macOS",
"osVersion": "14.0"
},
"viewport": {
"width": 1920,
"height": 1080,
"devicePixelRatio": 2,
"orientation": "landscape"
},
"timestamp": "2024-01-15T10:30:00.000Z",
"timezone": "America/New_York",
"pageLoadTime": 1234,
"consoleErrors": [
{
"type": "error",
"message": "Uncaught TypeError: Cannot read property 'submit' of null",
"source": "checkout.js",
"line": 42,
"timestamp": "2024-01-15T10:29:55.000Z"
}
]
}
}

Request Body (Multipart Form Data)​

For requests with screenshots:

curl -X POST "https://bugs.example.com/api/widget/submit" \
-H "X-Api-Key: your-project-api-key" \
-F 'data={"title":"Bug report","description":"Description here","priority":"medium","metadata":{...}}' \

Fields​

FieldTypeRequiredDescription
titlestringYesReport title (4-200 characters)
descriptionstringNoDetailed description
prioritystringNolowest, low, medium (default), high, highest
reporterNamestringNoName of the person reporting
reporterEmailstringNoEmail of the reporter
metadataobjectYesBrowser and page context
annotationsobjectNoAnnotation data from the editor
submissionIdstringNoUnique report ID for safe retries (see below)
localestringNoReporter's language, used for reporter emails when the project allows it
mediaMetadataarrayNoCapture details for attached files (see below)

Files are sent as multipart parts next to data: screenshots and uploaded files as media (repeatable), and a screen recording made in the widget as recording. Recordings are refused with 403 SCREEN_RECORDING_DISABLED when screen recording is off for the project.

Media Metadata​

Each entry in mediaMetadata describes one attached file, matched by its multipart filename. The Admin Console shows these details in the Media card of the report. Images keep the dimensions the server reads from the file; the submitted values are used when the server cannot read them.

FieldTypeRequiredDescription
filenamestringYesFilename of the matching media or recording part
capturedAtstringNoISO 8601 time the screenshot or recording was taken
widthnumberNoWidth in pixels
heightnumberNoHeight in pixels
durationMsnumberNoVideo length in milliseconds
recordingQualitystringNolow, standard, or high. Only stored for the recording

Metadata Object​

FieldTypeRequiredDescription
urlstringYesCurrent page URL
titlestringNoPage title
referrerstringNoReferring page URL
browserobjectYesBrowser information
deviceobjectYesDevice information
viewportobjectYesViewport dimensions
timestampstringYesISO 8601 timestamp
timezonestringNoUser's timezone
pageLoadTimenumberNoPage load time in ms
consoleErrorsarrayNoCaptured console errors

Browser Object​

FieldTypeDescription
namestringBrowser name (Chrome, Firefox, Safari, etc.)
versionstringBrowser version
userAgentstringFull user agent string

Device Object​

FieldTypeDescription
typestringdesktop, tablet, or mobile
osstringOperating system name
osVersionstringOS version (optional)

Viewport Object​

FieldTypeDescription
widthnumberViewport width in pixels
heightnumberViewport height in pixels
devicePixelRationumberDevice pixel ratio
orientationstringlandscape or portrait (optional)

Console Error Object​

FieldTypeDescription
typestringerror, warn, or log
messagestringError message
sourcestringSource file (optional)
linenumberLine number (optional)
timestampstringWhen the error occurred

Success Response​

A new report is answered with HTTP 201:

{
"success": true,
"reportId": "rpt_abc123def456",
"message": "Bug report submitted successfully"
}

Retries and Duplicates​

To make retries safe, send a submissionId in the request body (or in the data field of a multipart request). It is a string of 8 to 64 characters made of letters, digits, - or _, generated once per report, for example with crypto.randomUUID(). The widget sends one with every report.

If a submission repeats a submissionId that the project has already received, BugPin does not create a new report. It answers with HTTP 200 and the ID of the existing report:

{
"success": true,
"reportId": "rpt_abc123def456",
"duplicate": true,
"message": "Bug report already received"
}

Error Responses​

401 Unauthorized - Missing API key (UNAUTHORIZED) or unknown API key (INVALID_API_KEY):

{
"success": false,
"error": "INVALID_API_KEY",
"message": "Invalid API key"
}

403 Forbidden - Origin not allowed (ORIGIN_NOT_ALLOWED), project paused (PROJECT_INACTIVE), or screen recording disabled (SCREEN_RECORDING_DISABLED):

{
"success": false,
"error": "ORIGIN_NOT_ALLOWED",
"message": "Origin not allowed"
}

413 Payload Too Large - A file exceeds the image or video size limit (FILE_TOO_LARGE). details names the file, its size, the limit, and whether it is an image or a video.

415 Unsupported Media Type - A file type the server does not accept (UNSUPPORTED_MEDIA_TYPE).

400 Bad Request - The recording contains audio although microphone recording is not allowed (RECORDING_AUDIO_NOT_ALLOWED), or it is longer than the maximum recording duration (RECORDING_TOO_LONG).

400 Bad Request - Validation error:

{
"success": false,
"error": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "title",
"message": "Title must be at least 4 characters"
}
]
}

429 Too Many Requests - Rate limited. The limit is the Requests per Minute setting under Security → General (default: 10), counted per client address and project. The Retry-After header and retryAfter field give the seconds until the limit resets:

{
"success": false,
"error": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please try again later.",
"retryAfter": 42
}

A 429 with VIDEO_QUOTA_EXCEEDED means the project reached its daily video upload limit. Send the report again without the video, or wait until older uploads leave the rolling 24-hour window.


Get Widget Configuration​

Retrieve widget configuration for a project.

GET /api/widget/config/:apiKey

Parameters​

ParameterLocationDescription
apiKeypathProject API key

Success Response​

{
"success": true,
"config": {
"projectName": "My Project",
"branding": {},
"brandingPrimaryColor": "#6366f1",
"features": {
"screenshot": true,
"annotation": true,
"attachments": false,
"consoleCapture": true,
"screenRecording": false,
"recordingMicrophone": false
},
"theme": "auto",
"position": "bottom-right",
"buttonText": null,
"buttonShape": "rectangle",
"buttonIcon": "bug",
"buttonIconSize": 18,
"buttonIconStroke": 2,
"lightButtonColor": "#6366f1",
"lightTextColor": "#ffffff",
"lightButtonHoverColor": "#4f46e5",
"lightTextHoverColor": "#ffffff",
"darkButtonColor": "#818cf8",
"darkTextColor": "#1e1b4b",
"darkButtonHoverColor": "#a5b4fc",
"darkTextHoverColor": "#1e1b4b",
"dialogLightButtonColor": "#ebebeb",
"dialogLightTextColor": "#575757",
"dialogLightButtonHoverColor": "#ebebeb",
"dialogLightTextHoverColor": "#575757",
"dialogDarkButtonColor": "#3c3c3c",
"dialogDarkTextColor": "#c3c3c3",
"dialogDarkButtonHoverColor": "#3c3c3c",
"dialogDarkTextHoverColor": "#c3c3c3",
"enableHoverScaleEffect": true,
"tooltipEnabled": false,
"tooltipText": null,
"captureMethod": "visible",
"useScreenCaptureAPI": false,
"maxScreenshotSizeMb": 10,
"maxImageUploadSizeMb": 10,
"maxVideoUploadSizeMb": 50,
"maxRecordingDurationSeconds": 180,
"recordingQuality": "standard"
}
}

Error Response​

404 Not Found - Invalid API key:

{
"success": false,
"error": "INVALID_API_KEY",
"message": "Invalid API key"
}

Example: Custom Integration​

Here's a complete example of submitting a bug report from a custom form:

async function submitBugReport(formData) {
const metadata = {
url: window.location.href,
title: document.title,
referrer: document.referrer,
browser: {
name: getBrowserName(),
version: getBrowserVersion(),
userAgent: navigator.userAgent,
},
device: {
type: getDeviceType(),
os: getOS(),
},
viewport: {
width: window.innerWidth,
height: window.innerHeight,
devicePixelRatio: window.devicePixelRatio,
},
timestamp: new Date().toISOString(),
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
};

const response = await fetch("https://bugs.example.com/api/widget/submit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "your-project-api-key",
},
body: JSON.stringify({
title: formData.title,
description: formData.description,
priority: formData.priority || "medium",
reporterName: formData.name,
reporterEmail: formData.email,
metadata,
}),
});

const result = await response.json();

if (result.success) {
console.log("Report submitted:", result.reportId);
} else {
console.error("Submission failed:", result.message);
}

return result;
}

With Screenshot Upload​

async function submitWithScreenshot(formData, screenshotBlob) {
const metadata = {
/* ... same as above ... */
};

const body = new FormData();
body.append(
"data",
JSON.stringify({
title: formData.title,
description: formData.description,
priority: formData.priority || "medium",
metadata,
}),
);
body.append("media", screenshotBlob, "screenshot.png");

const response = await fetch("https://bugs.example.com/api/widget/submit", {
method: "POST",
headers: { "X-Api-Key": "your-project-api-key" },
body,
});

return response.json();
}

We use cookies for analytics to improve our website. More information in our Privacy Policy.