Skip to main content

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.

SurfaceRouteIntended Caller
Widget browser routePOST /api/mastra/sdac/uploadBrowser/widget clients on the widget origin
Mastra runtime routePOST /sdac/uploadServer-to-server callers and widget server proxy
Ingestion worker routePOST /sdac/upload on the worker originInternal 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:

FieldMastra /sdac/upload and widget /api/mastra/sdac/upload
Workbook filefile
Uploader emailuser_email
Uploader nameuser_name
District labeldistrict
Force re-ingestforce_reingest=true

Duplicate Handling

Workbook uploads are deduplicated by file hash.

  • If the hash already exists and force_reingest is 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:

  1. Mastra creates a durable upload job
  2. the ingestion worker parses the workbook
  3. workbook rows are inserted into SDAC.data_CostReports and SDAC.data_PersonnelRecords
  4. Mastra starts the post-ingestion report-analysis workflow
  5. 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.