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"}}
ParameterTypeRequiredDescription
boardIdstringYesBoard whose KPIs to export
startDatestringYesStart of date range (ISO 8601: YYYY-MM-DD)
endDatestringYesEnd of date range (ISO 8601: YYYY-MM-DD)

Response: CSV string with columns:

ColumnDescription
KPI NameName of the KPI definition
CategorySQCDP category
UnitMeasurement unit
DateMeasurement date
ValueMeasured value
SourceData source (manual, import, api)
CommentOptional 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..."}}
ParameterTypeRequiredDescription
boardIdstringYesBoard 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..."}}
ParameterTypeRequiredDescription
boardIdstringYesBoard 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..."}}
ParameterTypeRequiredDescription
idstringYesProblem-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:

FieldDescription
idSheet ID
typeMethodology (five_whys, ishikawa, wwwhwwh)
titleProblem title
statusLifecycle status
actionIdLinked action ID (if any)
dataFull analysis data payload
createdAtCreation timestamp
updatedAtLast update timestamp
reviewedAtReview 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
    }
  }
}
FieldTypeRequiredDescription
typestringYesExport type: problem_sheet, audit_report, gemba_report, kpi_dashboard
idstringYesEntity ID to export
options.includeMetadatabooleanNoInclude creation/update timestamps and user info
options.includeAuditTrailbooleanNoInclude activity log entries for the entity

The response will return a presigned S3 URL for downloading the generated PDF file.