PDF Export API
API endpoints for exporting data as CSV, JSON, and PDF — KPI data, action logs, board items, and problem-solving sheets.
Overview
The Export API provides data export capabilities for boards, KPIs, actions, and problem-solving sheets. Exports are returned as CSV or JSON strings that the client can download as files. PDF export is planned for a future release.
All procedures are tenant-scoped via organizationId — exported data only includes records from the caller’s organization.
Export KPI Data
Export KPI values for a board within a date range as CSV.
GET /api/trpc/export.exportKpiData?input={"json":{"boardId":"brd_01HXK5...","startDate":"2026-01-01","endDate":"2026-03-25"}}
| Parameter | Type | Required | Description |
|---|---|---|---|
boardId | string | Yes | Board whose KPIs to export |
startDate | string | Yes | Start of date range (ISO 8601: YYYY-MM-DD) |
endDate | string | Yes | End of date range (ISO 8601: YYYY-MM-DD) |
Response: CSV string with columns:
| Column | Description |
|---|---|
| KPI Name | Name of the KPI definition |
| Category | SQCDP category |
| Unit | Measurement unit |
| Date | Measurement date |
| Value | Measured value |
| Source | Data source (manual, import, api) |
| Comment | Optional comment |
Example CSV output:
KPI Name,Category,Unit,Date,Value,Source,Comment
OEE,quality,%,2026-03-20,85.2,manual,
Defect Rate,quality,ppm,2026-03-20,120,manual,Uptick due to material batch change
Export Action Log
Export all actions for a board as CSV.
GET /api/trpc/export.exportActionLog?input={"json":{"boardId":"brd_01HXK5..."}}
| Parameter | Type | Required | Description |
|---|---|---|---|
boardId | string | Yes | Board whose actions to export |
Response: CSV string with columns: Title, Description, Type, Status, Priority, Source, Category, Tier Level, Due Date, Created At, Updated At.
The action log export includes all actions for the board (historical and active), ordered by creation date descending. There is no date filter — use the KPI export for date-bounded queries.
Export Board Items
Export all board items with their column values as CSV. Dynamic columns are flattened into the CSV based on the board’s column definitions.
GET /api/trpc/export.exportBoard?input={"json":{"boardId":"brd_01HXK5..."}}
| Parameter | Type | Required | Description |
|---|---|---|---|
boardId | string | Yes | Board to export |
Response: CSV string with static columns (Group, Item Name, Created At) followed by one column per board column definition. Complex cell values (objects) are serialized as JSON strings.
Export Problem-Solving Sheet
Export a single problem-solving sheet as formatted JSON. JSON is used instead of CSV because problem-solving data is hierarchical (nested whys, categorized causes) and does not flatten into tabular format.
GET /api/trpc/export.exportProblemSheet?input={"json":{"id":"ps_01HXK5..."}}
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Problem-solving sheet ID |
Response:
{
"result": {
"data": {
"json": "{\"id\":\"ps_01HXK5...\",\"type\":\"five_whys\",\"title\":\"OEE drop on Line 3\",\"status\":\"reviewed\",\"data\":{\"whys\":[{\"question\":\"Why did OEE drop?\",\"answer\":\"Machine 3 downtime\"},{\"question\":\"Why was there downtime?\",\"answer\":\"Bearing failure\"}]},\"createdAt\":\"2026-03-20T09:00:00.000Z\",\"updatedAt\":\"2026-03-21T14:30:00.000Z\",\"reviewedAt\":\"2026-03-22T10:00:00.000Z\"}"
}
}
}
The response is a JSON-formatted string containing:
| Field | Description |
|---|---|
id | Sheet ID |
type | Methodology (five_whys, ishikawa, wwwhwwh) |
title | Problem title |
status | Lifecycle status |
actionId | Linked action ID (if any) |
data | Full analysis data payload |
createdAt | Creation timestamp |
updatedAt | Last update timestamp |
reviewedAt | Review timestamp (if reviewed) |
PDF Export (Planned)
PDF generation is not yet available. It requires a server-side rendering engine (Puppeteer, PDFKit) that adds significant infrastructure complexity. This feature is planned for a future release.
When available, PDF export will support:
- Problem-solving sheets — Formatted 5 Whys chains, Ishikawa fishbone diagrams, and WWWHWWH tables rendered as professional PDF documents.
- 5S Audit reports — Scored audit sessions with radar charts, photo evidence, and generated action summaries.
- Gemba walk reports — Walk route observations with photos, classifications, and linked actions.
- KPI dashboards — Board-level KPI summary with traffic-light status, trend charts, and Safety Cross visualizations.
The planned endpoint will follow this pattern:
POST /api/trpc/export.generatePdf
{
"json": {
"type": "problem_sheet",
"id": "ps_01HXK5...",
"options": {
"includeMetadata": true,
"includeAuditTrail": true
}
}
}
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Export type: problem_sheet, audit_report, gemba_report, kpi_dashboard |
id | string | Yes | Entity ID to export |
options.includeMetadata | boolean | No | Include creation/update timestamps and user info |
options.includeAuditTrail | boolean | No | Include activity log entries for the entity |
The response will return a presigned S3 URL for downloading the generated PDF file.
Was this page helpful?