Skip to Content
API ReferenceGET /api/download

GET /api/download

Generates a 1-hour signed URL for the standardized Output File and returns a human-readable filename suitable for the browser’s download dialog.

Request

Method: GET

Query Parameters:

ParameterTypeRequiredDescription
job_idstringYesUUID of a completed job

Headers: Authorization: Bearer <token>

GET /api/download?job_id=abc-123-def Authorization: Bearer <token>

Processing Steps

  1. Authenticate via checkAuth()
  2. Validate query parameter and fetch the full job row
  3. Check status — job must be complete and have an output_storage_path
  4. Generate signed URL — create a Supabase Storage signed URL for the Output File with a 3600-second (1-hour) expiry
  5. Build filename — assemble a clean, human-readable filename from job metadata

Filename Format

The filename is built from the job’s property_name and report_date:

[Property Name] - Standardized - [Month Year].xlsx

Examples:

property_namereport_dateGenerated Filename
Montrose at Vintage Park2025-02-10Montrose at Vintage Park - Standardized - February 2025.xlsx
The Heights on Main2027-01-15The Heights on Main - Standardized - January 2027.xlsx
(empty)2025-06-01Rent Roll - Standardized - June 2025.xlsx
Oak Creek Apartments(null)Oak Creek Apartments - Standardized.xlsx

Special characters in the property name are stripped (only alphanumeric characters and spaces are kept). If the property name is empty, "Rent Roll" is used as a fallback. If the report date is null or unparseable, the date segment is omitted.

Response

Success (200):

{ "url": "https://xyz.supabase.co/storage/v1/object/sign/etl-files/outputs/.../output.xlsx?token=...", "filename": "Montrose at Vintage Park - Standardized - February 2025.xlsx", "unit_count": 312 }
FieldTypeDescription
urlstringSigned URL valid for 1 hour
filenamestringSuggested download filename
unit_countnumberTotal extracted Units (convenience field from the job row)

Validation Errors

CheckStatusMessage
Missing job_id400Missing job_id
Job not found500Job not found
Job not complete400Job not complete. Status: [status]
No Output File404No output file found
Bad/missing token401Unauthorized

Error (400):

{ "error": "Job not complete. Status: extracting" }

Error (404):

{ "error": "No output file found" }

Usage Notes

  • The signed URL expires after 1 hour. If the user needs to download the Output File again after expiry, call this endpoint again to generate a fresh URL.
  • The filename field is a suggestion for the client. When triggering a browser download, set the Content-Disposition header or use the download attribute on an anchor tag:
<a href={url} download={filename}>Download</a>
  • The unit_count field is included as a convenience so the download UI can display how many Units are in the Output File without making a separate API call.
Last updated on