> For the complete documentation index, see [llms.txt](https://knowledgebase.fabricdata.com/insights/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.fabricdata.com/insights/api/reports.md).

# Reports

Report creation and listing

## Create a user report

> Triggers report generation by forwarding the request to the Windmill workflow engine.\
> Returns 200 OK when the job is successfully queued.<br>

```json
{"openapi":"3.0.3","info":{"title":"Fabric API","version":"1.0.0"},"tags":[{"name":"Reports","description":"Report creation and listing"}],"servers":[{"url":"https://{apiId}.execute-api.{region}.amazonaws.com/{environment}","description":"AWS API Gateway","variables":{"apiId":{"default":"api-id","description":"API Gateway ID"},"region":{"default":"us-east-2","description":"AWS Region"},"environment":{"default":"dev","enum":["dev","prod"],"description":"Environment"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key for authentication"}},"parameters":{"ApiKeyHeader":{"name":"x-api-key","in":"header","description":"API key for authentication","required":true,"schema":{"type":"string"}}},"responses":{"BadRequest":{"description":"Bad request - invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized - missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"InternalError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"}}}}},"paths":{"/insights/reports/create":{"post":{"summary":"Create a user report","description":"Triggers report generation by forwarding the request to the Windmill workflow engine.\nReturns 200 OK when the job is successfully queued.\n","operationId":"createReport","tags":["Reports"],"parameters":[{"$ref":"#/components/parameters/ApiKeyHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","user_email","report_name","product","transform"],"properties":{"url":{"type":"string","description":"The insights API URL to fetch data from"},"user_email":{"type":"string","description":"Email of the user requesting the report"},"report_name":{"type":"string","description":"Name of the report"},"product":{"type":"string","description":"Product name"},"transform":{"type":"string","description":"The transform to apply to the report data"},"branch":{"type":"string","description":"Git branch to use for the transform","default":"main"}}}}}},"responses":{"200":{"description":"Report creation triggered successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## List user reports

> Lists all reports for a given user email by reading the S3 key structure.\
> Reports with status "done" include a presigned download URL.\
> Results are sorted by timestamp descending (most recent first).<br>

```json
{"openapi":"3.0.3","info":{"title":"Fabric API","version":"1.0.0"},"tags":[{"name":"Reports","description":"Report creation and listing"}],"servers":[{"url":"https://{apiId}.execute-api.{region}.amazonaws.com/{environment}","description":"AWS API Gateway","variables":{"apiId":{"default":"api-id","description":"API Gateway ID"},"region":{"default":"us-east-2","description":"AWS Region"},"environment":{"default":"dev","enum":["dev","prod"],"description":"Environment"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key for authentication"}},"parameters":{"ApiKeyHeader":{"name":"x-api-key","in":"header","description":"API key for authentication","required":true,"schema":{"type":"string"}}},"responses":{"BadRequest":{"description":"Bad request - invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized - missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"InternalError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"}}}}},"paths":{"/insights/reports/list":{"get":{"summary":"List user reports","description":"Lists all reports for a given user email by reading the S3 key structure.\nReports with status \"done\" include a presigned download URL.\nResults are sorted by timestamp descending (most recent first).\n","operationId":"getReportsList","tags":["Reports"],"parameters":[{"$ref":"#/components/parameters/ApiKeyHeader"},{"name":"email","in":"query","description":"User email address to list reports for","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string"},"product":{"type":"string"},"report_name":{"type":"string"},"filters":{"type":"string"},"status":{"type":"string","enum":["done","processing"]},"filename":{"type":"string"},"url":{"type":"string","description":"Presigned S3 download URL (only present when status is \"done\")"}}}},"userId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```
