> ## Documentation Index
> Fetch the complete documentation index at: https://docs.artu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Reports

> Access generated regulatory reports

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

1. **Create** an alert and add items (see [Alerts](/guides/alerts))
2. **Validate** and **generate** the alert
3. A Report is created automatically with the output file
4. **Retrieve** and **download** the report

## Retrieving Reports

```typescript theme={null}
const report = await sdk.reports.retrieve("report_123");

console.log(report.id);
console.log(report.status); // "completed"
console.log(report.createdAt);
```

## Listing Reports

```typescript theme={null}
// 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

```typescript theme={null}
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:

```typescript theme={null}
const { url, expiresAt } = await sdk.reports.getDownloadUrl("report_123");

// Download the file
const response = await fetch(url);
const xml = await response.text();
```

<Warning>
  Download URLs are temporary. Use them immediately or within the expiry window.
</Warning>

## Counting Reports

```typescript theme={null}
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](/sdk/resources) for full details on parameters and return types.
