File Uploads
Upload Surfaces
SDAC workbook uploads are handled by Mastra upload orchestration. Browser widgets call the same-origin widget server, the widget server proxies to Mastra, and Mastra calls the ingestion worker internally.
| Surface | Route | Intended Caller |
|---|---|---|
| Widget browser route | POST /api/mastra/sdac/upload | Browser/widget clients on the widget origin |
| Mastra runtime route | POST /sdac/upload | Server-to-server callers and widget server proxy |
| Ingestion worker route | POST /sdac/upload on the worker origin | Internal Mastra-to-worker calls only |
Some deployments may additionally expose the Mastra runtime route through APIM
under /ai/sdac/upload, but that alias is deployment-specific and should be
verified in the target environment before integration. Browser clients should
not call the ingestion worker origin directly.
Accepted File Types
The ingestion upload flow accepts only Excel workbooks:
.xlsx.xls
Required Form Fields
The required metadata is submitted as multipart form data:
| Field | Mastra /sdac/upload and widget /api/mastra/sdac/upload |
|---|---|
| Workbook file | file |
| Uploader email | user_email |
| Uploader name | user_name |
| District label | district |
| Force re-ingest | force_reingest=true |
Duplicate Handling
Workbook uploads are deduplicated by file hash.
- If the hash already exists and
force_reingestis not set, the service returns the existing report reference instead of creating a new one. - If
force_reingest=true, the service accepts the duplicate workbook and creates a new report ID.
Processing Side Effects
Successful workbook uploads do more than return a report reference:
- Mastra creates a durable upload job
- the ingestion worker parses the workbook
- workbook rows are inserted into
SDAC.data_CostReportsandSDAC.data_PersonnelRecords - Mastra starts the post-ingestion report-analysis workflow
- the source file and metadata are archived
If processing fails after a report row is created, the service still attempts to archive failure metadata for that report.