API Reference: Auto Report
This document details the RESTful API endpoints for the Auto Report module.
1. Authentication
All requests MUST include a Platform JWT in the Authorization header.
http
Authorization: Bearer <JWT>2. Template API
GET /templates
List all report templates for the organization.
POST /templates
Create a new automated report template.
Request Body:
json
{
"name": "Weekly Hiring Summary",
"sources": ["hrm/employees", "hrm/departments"],
"systemPrompt": "Analyze the new hires this week and summarize by department.",
"scheduleCron": "0 9 * * 1"
}PUT /templates/:id
Update an existing template or change its schedule status (active / paused).
DELETE /templates/:id
Remove a template and its configuration. History is preserved.
3. Execution & Results API
POST /templates/:id/run
Trigger a manual execution of the report template.
GET /executions
List the history of report executions.
Query Parameters:
templateId: Filter by template.status:success,error, etc.
GET /executions/:id/result
Fetch the generated Markdown content and data snapshot.
GET /executions/:id/export
Generate and download a PDF of the report.
4. Webhooks & Callbacks
POST /callbacks/mastra
Internal endpoint used by the Mastra worker to update report status on completion.
5. Standard Error Codes
| Status Code | Description |
|---|---|
400 Bad Request | Invalid cron string or source list. |
403 Forbidden | Insufficient permissions for S2S data ingestion. |
404 Not Found | Template or execution log does not exist. |
422 Unprocessable Entity | Data source returned an empty result or error. |
500 Server Error | LLM generation timeout or PDF service failure. |