Appearance
Scheduled Reports API
Manage scheduled compliance-style reports (for example compliance, HIPAA, or audit PDFs) for your organization. All routes require admin authentication (Authentication) via a Bearer token with admin privileges.
Base path: /api/admin/scheduled-reports
Replace YOUR_ADMIN_TOKEN with an admin-capable Bearer token. For local development, use http://localhost:8000.
List scheduled reports
GET /api/admin/scheduled-reportsReturns all scheduled reports for the authenticated admin’s organization.
Example
bash
curl -s "https://api.ghostai.com/api/admin/scheduled-reports" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"Create scheduled report
POST /api/admin/scheduled-reportsRequest body
| Field | Type | Required | Description |
|---|---|---|---|
report_type | string | Yes | One of: compliance, hipaa, audit |
schedule | string | Yes | weekly or monthly |
day_of_week | integer | Cond. | For weekly: day of week 0–6 (0 = Monday). Required when schedule is weekly. |
day_of_month | integer | Cond. | For monthly: day 1–28. Required when schedule is monthly. |
recipients | string[] | Yes | At least one email address |
Example
bash
curl -X POST "https://api.ghostai.com/api/admin/scheduled-reports" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"report_type": "compliance",
"schedule": "weekly",
"day_of_week": 1,
"recipients": ["compliance@example.com"]
}'Get, update, or delete a report
GET /api/admin/scheduled-reports/{report_id}
PUT /api/admin/scheduled-reports/{report_id}
DELETE /api/admin/scheduled-reports/{report_id}- GET returns the report if it belongs to your organization.
- PUT accepts partial updates (
report_type,schedule,day_of_week,day_of_month,recipients,enabled, etc.). - DELETE removes the schedule after verifying organization access.
Examples
bash
curl -s "https://api.ghostai.com/api/admin/scheduled-reports/rep_abc123" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"bash
curl -X PUT "https://api.ghostai.com/api/admin/scheduled-reports/rep_abc123" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled": false}'bash
curl -X DELETE "https://api.ghostai.com/api/admin/scheduled-reports/rep_abc123" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"Send report now
Manually triggers generation and delivery for a scheduled report.
POST /api/admin/scheduled-reports/{report_id}/send-nowExample
bash
curl -X POST "https://api.ghostai.com/api/admin/scheduled-reports/rep_abc123/send-now" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"