Query Reporting
Every API request is logged server-side and assigned a unique log ID returned in a response header. When something goes wrong, users can submit a report that the VPT team can investigate from the admin panel.
Overview
The query logging & reporting system works in two steps:
-
Capture — the server records every API request
and returns a
X-VPT-Log-Idheader in every response. Your application should read and store this value. -
Report — when a user encounters a problem, your
application calls
reportQuerywith the stored log ID and a short description. The VPT team is notified by email and can review the full request/response trace in the admin panel.
reportQuery requires the user to be logged in. The
request must include the user's JWT as a Bearer token
in the Authorization header. api_key is
not accepted for this endpoint.
X-VPT-Log-Id header
linking the interaction to the server-side trace.
dev_key, password,
tokens) are automatically redacted from stored request bodies.
Log ID Header
Every monitored API response includes the following HTTP header:
X-VPT-Log-Id: 12345
Read this value from every response and store it alongside the
result shown to the user. If the user later wants to report an
issue, pass it as data.logId in the
reportQuery call.
Log entries are automatically deleted after 3 days unless they have been reported. Once a user submits a report, the entry is kept indefinitely until an admin resolves it. Avoid storing log IDs for longer than 3 days before presenting the report option to the user.
reportQuery
Submit a user-initiated issue report against a previously logged API call.
/api
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Required |
Bearer <jwt> — the user's JWT obtained from
the login endpoint
|
| Content-Type | Required | application/json |
Request Body
{
"query": "reportQuery",
"dev_key": "your_developer_key",
"data": {
"logId": 12345,
"severity": "MEDIUM",
"description": "The takeoff result was missing the climb gradient value."
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | string | Required | Must be "reportQuery" |
| dev_key | string | Required | Your developer key |
data object
|
|||
| logId | integer | Required |
The value from the X-VPT-Log-Id response header
of the call being reported
|
| severity | string | Required |
LOW, MEDIUM, or HIGH
|
| description | string | Required | User's description of the problem (max 4 000 characters) |
Success Response
{
"Success": true,
"ReportId": 42
}
Return ReportId to the user as a reference number they
can quote to the support team.
Error Responses
| Condition | Error message |
|---|---|
| Missing or invalid Bearer token | Authentication required. Provide a valid Bearer token in the Authorization header. |
logId not found or belongs to another user |
Log entry not found or does not belong to this user. |
Invalid severity value |
Invalid severity. Use LOW, MEDIUM, or HIGH. |
description is empty |
Description is required. |
Full Example
// After every API call, store the log ID
const logId = parseInt(response.headers.get('X-VPT-Log-Id') ?? '0', 10);
// When the user submits a report
const reportResponse = await fetch('https://api.virtualperformancetool.com/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${jwt}` // user JWT from login
},
body: JSON.stringify({
query: 'reportQuery',
dev_key: 'your_developer_key',
data: {
logId,
severity: 'MEDIUM',
description: 'The takeoff result was missing the climb gradient value.'
}
})
});
const result = await reportResponse.json();
if (result.Success) {
showToUser(`Report submitted. Reference: #${result.ReportId}`);
}
Retention & Privacy
Log retention
| Table | Default retention | If reported |
|---|---|---|
api_query_logs |
3 days | Kept until report is resolved or dismissed by an admin |
calculation_logs |
30 days | Kept until report is resolved or dismissed by an admin |
Stored data & redaction
The following fields are automatically redacted from stored request bodies before writing to the database:
dev_keyapi_keypassword- Any field whose name contains
token
Request and response bodies larger than 1 MB are truncated.
Integration Tips
-
On every API response, read and store the
X-VPT-Log-Idheader value alongside the displayed result. - Show a discreet "Report an issue" action near the result (button, menu item, or long-press gesture).
-
When tapped, present a small form with:
-
Severity —
LOW/MEDIUM/HIGH(e.g. a segmented control) - Description — free-text field (max 4 000 chars)
-
Severity —
-
POST
reportQuerywith the storedlogIdand the user's input. -
Display the returned
ReportIdto the user as a support reference number.
The report button should only be visible when a user is authenticated, as the endpoint requires a valid Bearer token. For anonymous contexts, consider directing users to the support page instead.