Peekback API reference
Read and update reports, create recording links and receive webhooks. JSON in, JSON out.
Overview
The base URL is https://app.peekback.dev/api/v1. Requests and responses are JSON, except file uploads, which send the raw file.
The examples use two placeholder keys: sk_live_YOUR_SECRET_KEY and pk_live_YOUR_PUBLISHABLE_KEY. Replace them with your own.
On the hosted service, uploads are limited to 50 MB and one IP address can create 20 reports an hour. Reports of Peekback's own demo project are deleted 14 days after they are created; the reports of a workspace are kept until you delete them. These are the settings of the hosted service today and can change.
To put the widget on a site instead, see the install guides.
Authentication
Send your key in the X-Peekback-Key header, or as a bearer token in Authorization. Both work.
X-Peekback-Key: sk_live_YOUR_SECRET_KEY
Authorization: Bearer sk_live_YOUR_SECRET_KEYThere are two kinds of key. Both are listed in the back office under API keys. The secret key is shown in full only once, when you sign up or rotate it, and after that only its last characters.
| Key | Where to use it | What it can do |
|---|---|---|
| Publishable | Safe in the browser. | Create a report, upload that report's files and finalize it. It cannot read anything. |
| Secret | Server side only. | Reads and updates everything in the workspace, creates recording links and runs triage again. It can also do everything the publishable key can. |
Each workspace has one pair of keys. There is little key management yet: you cannot create more keys or limit what a key can do. You can rotate the secret key in the back office; the old one stops working at once.
Errors
Every error has the same shape. code is only present on some errors.
{ "error": { "message": "A secret key (sk_...) is required", "status": 401 } }Codes you can get:
| code | Status | When |
|---|---|---|
cross_site_request | 403 | A change was sent from another website while using a back office login instead of a key. Calls with a key are not affected. |
link_not_found | 404 | A recording link token does not exist. |
link_used | 410 | A single-use recording link was already used. |
link_expired | 410 | A recording link has expired. |
rate_limited | 429 | Your secret key went over its limit of calls a minute. See Rate limits. The limits by IP address answer 429 with the same code, without the rate limit headers. |
session_required | 401 | The action needs a back office login, and a key is not accepted for it. |
Statuses used:
| Status | Meaning |
|---|---|
| 400 | Invalid JSON or an invalid value, for example an unknown status, or a file for an attachment you did not declare. |
| 401 | The key is missing or wrong, or a secret key is required for this call. |
| 403 | A signed media link expired or is invalid, or a cross-site request was refused. |
| 404 | The report, link or route does not exist. |
| 405 | A public examples address was called with anything other than GET or HEAD. |
| 409 | That file was already uploaded for this report, or you asked to run triage again while the report is still being processed. |
| 410 | A recording link was already used, or it expired. |
| 413 | The file is larger than the upload limit (50 MB on the hosted service), or the JSON body is larger than 2 MB. |
| 429 | Too many requests. See Rate limits. |
Rate limits
| Limit | Applies to |
|---|---|
| 120 requests a minute per key | Every call that sends a secret key. A key that matches no project is counted per IP address instead. Calls made from the back office with its login are not counted. |
| 20 new reports an hour from one IP address | Creating reports with a publishable key. This is the hosted service; a server you run sets its own number. |
| 30 an hour per IP address | Running AI triage again (POST /submissions/:id/triage). |
| 60 requests a minute per IP address | The public examples, which need no key. |
| 200 triage runs a day per workspace, 2,000 a day in total | AI triage (a UTC day). Not an HTTP error: triage ends as skipped with daily AI limit reached (the workspace's own limit, checked first) or server AI limit reached for today (the total). See AI triage. |
Every response to a call with a valid secret key carries these headers. A server you run sets the number with API_RATE_LIMIT_PER_MIN; 0 switches the limit off, and then there are no headers.
X-RateLimit-Limit: calls allowed in the current minute.X-RateLimit-Remaining: calls left in it.X-RateLimit-Reset: when the minute ends, in unix seconds.
Over the limit you get 429 with a Retry-After header (seconds) and the error code rate_limited. The three headers above are on that answer too. Wait that long, then try again:
async function peekback(path, options = {}, attempt = 0) {
const res = await fetch('https://app.peekback.dev/api/v1' + path, {
...options,
headers: { 'X-Peekback-Key': 'sk_live_YOUR_SECRET_KEY', 'Content-Type': 'application/json', ...options.headers },
});
if (res.status === 429 && attempt < 3) {
const seconds = Number(res.headers.get('Retry-After')) || 5;
await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
return peekback(path, options, attempt + 1);
}
return res;
}Retry-After is only sent for the per-key limit. The limits that count by IP address (including a key that matches no project) answer 429 with the same rate_limited code and a message, but without the X-RateLimit-* headers and without Retry-After. Wait a minute for the public examples and a wrong key, and up to an hour for the other two.
Reports
A report is called a submission in the API. Calls on this page need a secret key unless it says otherwise.
GET/submissions
Lists reports, newest first.
| Query | Meaning |
|---|---|
status | new, in_progress or done. A report that is still being processed has the status processing, which you can filter on too. |
q | Text search in the description, the summary title, the page address, the reporter's name and email, the conversation id and the link reference. Without a triage filter, q only searches the newest page of results (up to limit), not older reports; with a triage filter it searches all the matching reports. |
limit | Reports per page. Default 50, at most 200. |
before | An ISO time. Returns reports created before it. Pass nextBefore from the previous page. |
category, sentiment, severity New | Filter on the AI triage values, for example severity=high. Use the exact lower-case values from the triage table; any other value is a 400. Only reports whose triage is done can match, and category here is the AI category, not the one the sender chose. You can combine them with each other and with status, q, limit and before. |
The response is { data: [...], counts: { all, new, in_progress, done }, nextBefore }. counts is for the whole inbox, not for the filtered list; it also has a processing count while some reports are still being processed. To read everything, ask for the next page with before=nextBefore until data is empty. There is a loop in the code examples.
GET/submissions/:id
One report, trimmed here:
{
"id": "sub_9c1e4f0a2b7d6e35",
"reference": "PB-1042",
"number": 1042,
"status": "new",
"aiState": "done",
"assignee": null,
"priority": null,
"category": "bug",
"description": "The transfer screen never finishes calculating fees.",
"reporter": { "name": "Sara", "email": "sara@example.com" },
"url": "https://app.example.com/#overview",
"pageTitle": "Overview",
"source": "widget",
"meta": {
"browser": { "name": "Chrome", "os": "macOS" },
"consoleErrors": [{ "level": "error", "message": "TypeError: Cannot read properties of undefined (reading 'fxRate')" }],
"networkErrors": [{ "method": "GET", "url": "https://app.example.com/api/fees", "status": 500, "ms": 412 }],
"breadcrumbs": [{ "type": "click", "label": "Send money", "tag": "button" }]
},
"media": {
"video": { "type": "video/webm", "duration": 42, "hasAudio": true, "uploaded": true, "size": 2481920,
"url": "https://app.peekback.dev/api/v1/submissions/sub_9c1e4f0a2b7d6e35/media/video?exp=1795600000&sig=..." }
},
"transcript": { "provider": "...", "language": "en", "text": "I press send and it just spins...", "segments": [] },
"summary": { "title": "...", "category": "bug", "severity": "high", "summary": "...", "steps": ["..."], "suspectedCause": "...", "suggestedReply": "...", "tags": [] },
"triage": { "state": "done", "category": "bug", "sentiment": "negative", "severity": "high", "summary": "..." },
"link": null,
"links": { "backOffice": "https://app.peekback.dev/admin/#/s/sub_9c1e4f0a2b7d6e35" },
"createdAt": "2026-11-25T09:58:40.120Z",
"updatedAt": "2026-11-25T10:02:11.402Z"
}source is widget, api or link. transcript and summary are separate from AI triage. A server only writes a real transcript when a speech-to-text key is set, and a real summary when an Anthropic key is set. Without them both are demo text, marked "provider": "mock".
PATCH/submissions/:id
Send any of these as JSON. The response is the updated report.
status:new,in_progressordone. Anything else is a400.assignee: a name, up to 60 characters. Sendnullor an empty string to unassign.priority:low,medium,high, ornullto clear it.note: text added to the report's activity, up to 2000 characters.actor: the name shown in the activity for this change, up to 60 characters. DefaultAPI.
DELETE/submissions/:id
Deletes the report and its files. If the report was shared as a public example, that example is removed too. The response is { "deleted": true }.
Media
Each uploaded file in media.video, media.audio and media.screenshot has a signed url. It works without a key for 6 hours. Fetch the report again to get a fresh one. Range requests work, so video can seek.
Create a report from your own code
The widget does all of this for you. If you build your own form or app, use a publishable or a secret key:
POST /submissionswith the details. The response is201with{ id, reference, uploads, finalize }.PUT /submissions/:id/media/:kindwith the raw file as the body, for each attachment you declared.:kindisvideo,audioorscreenshot. The upload limit is 50 MB on the hosted service; a self-run server sets its own limit withMAX_UPLOAD_MB.POST /submissions/:id/finalizeto start processing. The response is202. The report has the statusprocessinguntil that is done, thennew.
Body fields for step 1, all optional:
| Field | Meaning |
|---|---|
description | The message, up to 5000 characters. |
category | What the sender chose: feedback, problem, complaint, idea, bug, question, praise or other (default). |
reporter | { name, email }. |
url, pageTitle | The page the report is about. |
meta | { browser, consoleErrors, networkErrors, breadcrumbs, custom }. The last 50 console errors, 50 network errors and 40 breadcrumbs are kept. |
attachments | A list of { kind, type, duration, hasAudio }, for example { "kind": "video", "type": "video/webm" }. uploads in the response has an upload path for each one. |
A report with no attachments starts processing straight away, and you do not need to call finalize.
curl -X POST https://app.peekback.dev/api/v1/submissions \
-H "X-Peekback-Key: pk_live_YOUR_PUBLISHABLE_KEY" \
-H "Content-Type: application/json" \
-d '{"description":"Card payment fails","attachments":[{"kind":"video","type":"video/webm"}]}'
curl -X PUT https://app.peekback.dev/api/v1/submissions/SUBMISSION_ID/media/video \
-H "X-Peekback-Key: pk_live_YOUR_PUBLISHABLE_KEY" \
--data-binary @recording.webm
curl -X POST https://app.peekback.dev/api/v1/submissions/SUBMISSION_ID/finalize \
-H "X-Peekback-Key: pk_live_YOUR_PUBLISHABLE_KEY"AI triage New
Each report gets a triage object when processing finishes. It is separate from the older summary object. state tells you whether triage ran. A report that is still processing, or that was made before the server had triage, can have no triage object.
Triage only runs on a server that has an OpenRouter key. On a server without one, state is skipped and nothing is sent anywhere. The same happens for a workspace whose owner has not confirmed their email address.
"triage": {
"state": "done",
"category": "bug",
"sentiment": "negative",
"sentimentScore": -0.6,
"severity": "high",
"summary": "Transfer screen stays on \"calculating fees\"; rent payment blocked.",
"model": "openai/gpt-6-luna",
"attempts": 1,
"costUsd": 0.00011,
"at": "2026-11-25T10:02:11.000Z"
}state
pending: running, or waiting to retry.attemptscounts the tries so far.done: finished.error: it stopped. That is after 3 attempts, or at once when the AI service answers with an error that trying again cannot fix, for example a rejected key.errorholds the reason.skipped: not run, and nothing was sent.errorsays why:AI triage not configured,confirm your email address to turn on AI triage,daily AI limit reachedorserver AI limit reached for today.
The result fields (category, sentiment, sentimentScore, severity, summary, model, costUsd) are only present when state is done.
| Field | Values |
|---|---|
category | bug, ux, feature_request, question, billing, praise, other |
sentiment | negative, neutral, positive |
sentimentScore | A number from -1 to 1. |
severity | low, medium, high, critical |
summary | One line, at most 140 characters. |
model | The model that answered. The server tries a second model when the first one fails. |
costUsd | Only present when the model provider reports a cost. |
What is sent to the model
The text goes to OpenRouter, which passes it to the AI model. It is the customer's message and the category they chose, the page title and the URL path, the transcript text, the last console errors, the last failed requests and the last clicks. All of it is cut to 12,000 characters.
Before it is sent, the reporter's name and email, other email addresses, phone numbers, card numbers, IP addresses, keys, tokens and passwords are removed. Web addresses are cut to their path, with no host and no query string. A name of someone else typed into the message is not recognised.
Triage never sends the video, the audio or the screenshot. The same OpenRouter key also turns on speech-to-text, and that does send the voice of a recording or voice note to OpenRouter.
POST/submissions/:id/triage
Runs triage again and returns the report, the same object as GET /submissions/:id. A re-run counts as one run against the daily limit. The answer is 404 for an unknown report, 409 while the report is still being processed, and 429 after 30 re-runs an hour from one IP address.
If the server has no OpenRouter key, the email address is not confirmed or a daily limit is used up, the answer is still 200, and triage.state becomes skipped. That replaces an earlier result. If the first attempt fails and is retried, the answer can show pending, and the result is saved on the report when it arrives. The server-wide webhook also sends it as submission.triaged.
GET/triage/status
Shows whether triage is switched on and how much of today's limit the workspace has used. It takes a secret key (or a back office login) and counts against the per-key rate limit.
curl https://app.peekback.dev/api/v1/triage/status \
-H "X-Peekback-Key: sk_live_YOUR_SECRET_KEY"{
"configured": true,
"model": "openai/gpt-6-luna",
"fallbackModel": "google/gemini-2.5-flash-lite",
"today": { "day": "2026-11-25", "runs": 12, "limit": 200 }
}configured is false when the server has no OpenRouter key. today counts runs for the current UTC day: new reports, re-runs and reports picked up when the server starts.
Recording links
A recording link is a page where a customer can show you a problem without the widget, for example when a support bot can post a link but cannot install anything. Create one, post the URL in the chat, and the report comes back tagged with your conversation.
POST/links
| Field | Meaning |
|---|---|
expiresInHours | A number above 0, at most 720 (30 days). Default 72. |
singleUse | Default true: the link stops working after one report. false allows several. |
reference | Your own reference, up to 120 characters. |
customer | { name, email }. The email must be valid. |
conversationId | Your conversation id, up to 200 characters. It comes back on the report and in the webhook. |
metadata | Any JSON object, up to 8 KB. It comes back on the report and in the webhook. |
message | Text shown to the customer on the link page, up to 1000 characters. |
redirectUrl | An http:// or https:// address. The link page offers it to the customer after they have sent their recording. |
The response is 201 with the link, including its url. The url is only returned when you create the link, so store or post it then.
GET/links/:id
The same object without url. status is open, used or expired. Once the customer has sent a report, submissionId and submission ({ id, reference, status }) point to it.
Webhooks
Peekback POSTs JSON to a webhook address. The events and the body on this page are those of the server-wide webhook, which belongs to Peekback's demo project today and is set by Peekback: ask us. Its deliveries are not signed and not retried, and Peekback ignores your response. A workspace can add its own signed webhook under Integrations in the back office. That one sends submission.ready only, and its body is a little different (link is at submission.link). Treat a webhook as a hint, and fetch the report with your secret key.
The body is the same for every event (trimmed here):
{
"event": "submission.ready",
"createdAt": "2026-11-25T10:02:12.004Z",
"link": { "id": "lnk_1a2b3c4d5e6f7a8b", "reference": "ticket-8841", "conversationId": "conv_123", "metadata": {} },
"submission": { "id": "sub_9c1e4f0a2b7d6e35", "reference": "PB-1042", "status": "new", "triage": { "state": "done" } }
}link is null unless the report came from a recording link. submission is the same object as GET /submissions/:id, including triage.
| Event | When |
|---|---|
submission.ready | The report finished processing, after the first triage attempt had ended. Its triage holds the result of the first attempt; if that attempt failed and is being retried, triage.state is pending. |
submission.triaged New | A triage result arrived after submission.ready was sent: after the retries of a first attempt that failed, after a re-run (whatever its result, also skipped), or when the server picked up unfinished triage as it started. Same body. It is not sent when the result was already in submission.ready. Only the server-wide webhook gets this event today. |
Public examples New
No key needed. These are anonymised example reports, the ones on the examples page. CORS is open, so you can call them from a browser. Only GET and HEAD work, and the limit is 60 requests a minute per IP address.
GET /public/examplesreturns{ data: [...], count }: the newest first, at most 60. It is cached for 5 minutes, so a new or removed example can take that long to show.GET /public/examples/:id/imagereturns the blurred screenshot as a JPEG, at most 960 pixels wide. The answer is404when the example has no image.
{
"id": "ex_3f9a1c2b7d4e",
"source": "peekback-demo",
"label": "Example from Peekback's demo site",
"title": "Transfer screen stays on \"calculating fees\"",
"day": "2026-11-24",
"reporter": "A customer",
"reporterCategory": "bug",
"triage": { "category": "bug", "sentiment": "negative", "severity": "high", "summary": "…" },
"description": "…",
"transcriptExcerpt": null,
"steps": ["Opened /#overview", "Clicked \"Send money\""],
"consoleErrors": ["TypeError: Cannot read properties of undefined (reading 'fxRate')"],
"browser": { "name": "Chrome", "os": "macOS" },
"image": null
}| Field | Meaning |
|---|---|
id | ex_ and 12 hex characters. It is not the id of the report. |
source, label | peekback-demo (label "Example from Peekback's demo site"): made from Peekback's own fictional demo reports, not from a customer. shared (label "Shared with permission, anonymised"): a report that its owner chose to share. |
title | The triage summary when there is one, otherwise the first sentence of the message. At most 140 characters. |
day | The UTC day the report was made, YYYY-MM-DD, or null. No exact time. |
reporter | Always A customer. |
reporterCategory | What the sender chose: bug, idea, question, praise or other. |
triage | { category, sentiment, severity, summary } with the same values as AI triage (no score, model or cost), or null when no finished triage was available. |
description | The customer's message, anonymised. At most 1,000 characters. |
transcriptExcerpt | The start of a real transcript, at most 600 characters, or null. Demo text is never used. |
steps | Up to 8 sentences about what the customer did. Typed values are never included. |
consoleErrors | The messages of up to 3 console errors, without stacks. |
browser | { name, os } or null. No version. |
image | null, or the absolute URL of the blurred JPEG. |
On its first start a server adds four entries made from Peekback's own demo site, unless it is started with GALLERY_SEED=0. Their triage is filled in later, once the server has triaged the matching demo report, so it can be null at first.
Publishing is not available with a key. Only a person who is logged in to the back office can share a report, one at a time. The back office shows a preview first, and the call needs a confirmation. An example from a workspace is then reviewed by Peekback before it appears here; until it is approved it is not in the list above. These calls answer 401 with the code session_required when you send a key: POST /submissions/:id/public-example/preview, POST /submissions/:id/public-example with { "consent": true, "includeImage": false }, DELETE /submissions/:id/public-example, GET /gallery and DELETE /gallery/:exampleId.
Code examples
The JavaScript examples use fetch in Node 18 or later, or any modern browser-like runtime. Keep the secret key on your server.
List with filters, and read every page
curl "https://app.peekback.dev/api/v1/submissions?status=new&severity=high&limit=50" \
-H "X-Peekback-Key: sk_live_YOUR_SECRET_KEY"
# next page: pass nextBefore from the previous response
curl "https://app.peekback.dev/api/v1/submissions?status=new&severity=high&limit=50&before=2026-11-24T09:30:00.000Z" \
-H "X-Peekback-Key: sk_live_YOUR_SECRET_KEY"const BASE = 'https://app.peekback.dev/api/v1';
const headers = { 'X-Peekback-Key': 'sk_live_YOUR_SECRET_KEY' };
let before = '';
for (;;) {
const params = new URLSearchParams({ status: 'new', severity: 'high', limit: '100' });
if (before) params.set('before', before);
const res = await fetch(BASE + '/submissions?' + params, { headers });
if (!res.ok) throw new Error('HTTP ' + res.status);
const page = await res.json();
if (!page.data.length) break;
for (const report of page.data) console.log(report.reference, report.description);
before = page.nextBefore;
}Get one report
curl https://app.peekback.dev/api/v1/submissions/SUBMISSION_ID \
-H "X-Peekback-Key: sk_live_YOUR_SECRET_KEY"const res = await fetch('https://app.peekback.dev/api/v1/submissions/SUBMISSION_ID', {
headers: { 'X-Peekback-Key': 'sk_live_YOUR_SECRET_KEY' },
});
const report = await res.json();
console.log(report.status, report.triage && report.triage.state);Change the status
curl -X PATCH https://app.peekback.dev/api/v1/submissions/SUBMISSION_ID \
-H "X-Peekback-Key: sk_live_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"status":"in_progress","assignee":"Jelena"}'const res = await fetch('https://app.peekback.dev/api/v1/submissions/SUBMISSION_ID', {
method: 'PATCH',
headers: { 'X-Peekback-Key': 'sk_live_YOUR_SECRET_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ status: 'in_progress', assignee: 'Jelena' }),
});
console.log((await res.json()).status);Create a recording link
curl -X POST https://app.peekback.dev/api/v1/links \
-H "X-Peekback-Key: sk_live_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"conversationId":"conv_123","customer":{"name":"Sara"},"message":"Could you show me what happens?"}'const res = await fetch('https://app.peekback.dev/api/v1/links', {
method: 'POST',
headers: { 'X-Peekback-Key': 'sk_live_YOUR_SECRET_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({
conversationId: 'conv_123',
customer: { name: 'Sara' },
message: 'Could you show me what happens?',
}),
});
const link = await res.json();
console.log(link.url); // post this in the chat; it is only returned nowRun AI triage again
curl -X POST https://app.peekback.dev/api/v1/submissions/SUBMISSION_ID/triage \
-H "X-Peekback-Key: sk_live_YOUR_SECRET_KEY"const res = await fetch('https://app.peekback.dev/api/v1/submissions/SUBMISSION_ID/triage', {
method: 'POST',
headers: { 'X-Peekback-Key': 'sk_live_YOUR_SECRET_KEY' },
});
const report = await res.json();
console.log(report.triage);A webhook receiver
This uses only Node's http. It answers right away, then fetches the report with the secret key instead of trusting the body.
const http = require('node:http');
const BASE = 'https://app.peekback.dev/api/v1';
const KEY = 'sk_live_YOUR_SECRET_KEY';
http.createServer((req, res) => {
if (req.method !== 'POST') { res.writeHead(405).end(); return; }
let raw = '';
req.on('data', (chunk) => { raw += chunk; });
req.on('end', async () => {
res.writeHead(200).end('ok');
try {
const event = JSON.parse(raw);
if (event.event !== 'submission.ready' && event.event !== 'submission.triaged') return;
const r = await fetch(BASE + '/submissions/' + encodeURIComponent(event.submission.id), {
headers: { 'X-Peekback-Key': KEY },
});
const report = await r.json();
console.log(event.event, report.reference, report.triage && report.triage.state, event.link && event.link.conversationId);
} catch (err) {
console.error('webhook failed:', err.message);
}
});
}).listen(3000);