Report export API
Status: draft contract for P2.16 implementation.
The repository does not currently ship an OpenAPI/Swagger document or generated API client. The report export contract is represented by:
- Go API structs in
pkg/models/report_export.go. - The community signing extension point in
pkg/ext/report_signer.go. - Handwritten frontend TypeScript types in
frontend/src/types.ts. - The handwritten frontend API client in
frontend/src/api/client.ts.
Evidence pack preview
POST /api/reports/evidence-pack
Request headers:
Content-Type: application/json
Request body: ReportExportRequest.
Response:
200 OKContent-Type: application/json- Body:
EvidencePack
Evidence pack export
POST /api/reports/evidence-pack/export?format=markdown|csv|pdf
Request headers:
Content-Type: application/json
Request body: ReportExportRequest.
The format query parameter selects the exported content type. Implementations may default to markdown when it is omitted, but clients should send it explicitly.
Successful responses:
| Format | Status | Content-Type | Body |
|---|---|---|---|
markdown |
200 OK |
text/markdown; charset=utf-8 |
Deterministic Markdown evidence pack |
csv |
200 OK |
text/csv; charset=utf-8 |
Deterministic flat evidence table |
pdf |
200 OK |
application/pdf |
Deterministic minimal PDF evidence pack |
Export responses should include Content-Disposition: attachment; filename="evidence-pack-<inputs_hash_12>.<ext>".
If PDF export is unavailable, the endpoint returns 501 Not Implemented with JSON body:
Request body
ReportExportRequest fields:
schema_version: currentlyreport_export_request.v1.report_type: currentlyevidence_pack.scope: exactly one ofworkload_ids,group_id, orselector, with optionalsinceanduntilbounds.include: booleans forworkload_summary,config_history,current_config,config_plan,drift_findings,version_intelligence,alerts,workload_events,rollback_readiness, andaudit_verification.redaction: currentlystrict;noneis reserved and unsupported in community v1.
EvidencePack response body
EvidencePack fields:
schema_version: currentlyevidence_pack.v1.generated_at: UTC RFC3339/RFC3339Nano timestamp chosen by the service.inputs_hash: lowercase SHA-256 over canonical request and resolved inputs.report_hash: lowercase SHA-256 over the final redacted canonical payload excluding signatures.scope: resolved scope metadata.sections: orderedEvidenceSection[]with stable section IDs andEvidenceItem[].signatures: optional report payload signatures; community usesscheme=noneandverifier=community-none.signed_audit: optional signed audit-chain verification metadata when an enterprise verifier is wired.warnings: optional deterministic warning codes such aspdf_minimal_rendereror truncation notices.
CSV exports use these fixed v1 columns:
section_id,item_id,resource,resource_id,observed_at,severity,summary,key,value,content_hash,redacted
Error responses
Common JSON error bodies use APIErrorResponse shape plus report-export-specific fields where needed:
400 invalid JSON body400 unsupported report_type400 unsupported export format400 invalid scope400 invalid time range400 unsupported redaction mode401 unauthorized403 forbidden404 workload not found409 report scope empty413 request body too large500 failed to build evidence pack501 pdf export unavailablewithfallback_format: "markdown"503 audit unavailable503 report signing unavailable