Reports are generated from alerts and contain the regulatory output files (e.g., XML for Mexico). Reports are read-only — they are created automatically when you generate an alert.
Report Workflow
- Create an alert and add items (see Alerts)
- Validate and generate the alert
- A Report is created automatically with the output file
- Retrieve and download the report
Retrieving Reports
const report = await sdk.reports.retrieve("report_123");
console.log(report.id);
console.log(report.status); // "completed"
console.log(report.createdAt);
Listing Reports
// List all reports
const { data: reports } = await sdk.reports.list({
filter: { status: "completed" },
sort: { field: "createdAt", order: "desc" },
limit: 20,
});
// Async iteration
for await (const report of sdk.reports.iterate()) {
console.log(report.id, report.status);
}
Reports for a Specific Alert
const { data: alertReports } = await sdk.reports.listByAlert("alert_123", {
currentOnly: true, // Only the latest version
});
Downloading Reports
Reports contain generated files (XML, etc.) stored in cloud storage. Use getDownloadUrl to get a temporary presigned URL:
const { url, expiresAt } = await sdk.reports.getDownloadUrl("report_123");
// Download the file
const response = await fetch(url);
const xml = await response.text();
Download URLs are temporary. Use them immediately or within the expiry window.
Counting Reports
const count = await sdk.reports.count({ status: "completed" });
console.log(`${count} completed reports`);
Report Status
| Status | Description |
|---|
completed | Report generated successfully |
failed | Report generation failed |
processing | Report is being generated |
Available Methods
| Method | Description |
|---|
retrieve | Get a report by ID |
list | List reports with filters |
listByAlert | List reports for a specific alert |
count | Count reports matching a filter |
getDownloadUrl | Get presigned download URL |
iterate | Async iterate over all reports |
See the SDK reference for full details on parameters and return types.