# Report

{% hint style="warning" %}
This endpoint is currently in **beta** and subject to change.
{% endhint %}

## Generate Report

<mark style="color:blue;">`GET`</mark> `https://api.halosecurity.com/api/v1/report/generate.json`

Initiate the report generator.  After a successful call, the `work_id` can be monitored to determine when the report is ready.  The `file_id` can then be used to download the file.

[https://app.halosecurity.com/user/security/report/<br>](https://app.halosecurity.com/user/security/report/)

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "success": 1,
    "work_id": "[ID]",
    "file_id": "[ID]"
}
```

{% endtab %}
{% endtabs %}

## Common Parameters

<table><thead><tr><th width="156">Name</th><th width="114">Type</th><th>Default</th><th>Detail</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>none</td><td>Required.  See reports below.</td></tr><tr><td>targets</td><td>String</td><td>none</td><td>Filter targets. <a href="../appendix/targets-filter">See Appendix</a></td></tr><tr><td>expire_days</td><td>Integer</td><td>7</td><td>File will be deleted after this many days.</td></tr><tr><td>theme</td><td>String</td><td>dark</td><td>The color scheme of the PDF: <code>light</code> or <code>dark</code> .</td></tr><tr><td>folder</td><td>String</td><td>none</td><td>Folder name to put the file in.</td></tr><tr><td>filename</td><td>String</td><td>dyanmic</td><td>Override the default filename for the report.</td></tr></tbody></table>

{% content-ref url="../appendix/targets-filter" %}
[targets-filter](https://docs.halosecurity.com/api/appendix/targets-filter)
{% endcontent-ref %}

### Report - Executive Summary

<table><thead><tr><th width="170">Name</th><th width="120">Type</th><th>Detail</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>executive-summary</td></tr></tbody></table>

### Report - Target

<table><thead><tr><th width="170">Name</th><th width="120">Type</th><th>Detail</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>target</td></tr><tr><td>target_id</td><td>Integer</td><td>Required.</td></tr></tbody></table>

### Report - Issue

<table><thead><tr><th width="173">Name</th><th width="119">Type</th><th>Detail</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>issue</td></tr><tr><td>issue_id</td><td>Integer</td><td>Required.</td></tr></tbody></table>

### Report - Security

<table><thead><tr><th width="175">Name</th><th width="123">Type</th><th>Detail</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>security</td></tr><tr><td>scan_id</td><td>String</td><td>Optional.  Defaults to the most recent scan.</td></tr></tbody></table>

### Report - Remediation

<table><thead><tr><th width="174">Name</th><th width="124">Type</th><th>Detail</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>remediation</td></tr><tr><td>date_range</td><td>String</td><td>Examples: 7d, lastweek. <a href="../appendix/date-match">See Appendix</a></td></tr><tr><td>date_start</td><td>String</td><td>YYYY-MM-DD</td></tr><tr><td>date_end</td><td>String</td><td>YYYY-MM-DD</td></tr></tbody></table>

### Report - Dark Web

<table><thead><tr><th width="175">Name</th><th width="122">Type</th><th>Detail</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>darkweb</td></tr><tr><td>domain_id</td><td>Integer</td><td>Optional. Supports multiple. Restricts report to these domains.</td></tr></tbody></table>

### Example

```
#!/bin/bash

KEY="YOUR-API-KEY-HERE"
HOST="api.halosecurity.com"

### INITIATE REPORT GENERATOR
JSON=$(curl -s --header "x-apikey: $KEY" "https://$HOST/api/v1/report/generate.json?id=executive-summary")
WORK_ID=$(echo $JSON | jq -r .work_id)
FILE_ID=$(echo $JSON | jq -r .file_id)
echo "report work id $WORK_ID"
echo "report file id $FILE_ID"

### WAIT FOR REPORT COMPLETE
while true; do
   sleep 1
   echo report working
   JSON=$(curl -s --header "x-apikey: $KEY" "https://$HOST/api/v1/work/get.json?id=$WORK_ID")
   DONE=$(echo $JSON | jq -r .work.complete)
   if [ $DONE == 1 ]; then
      echo pdf ready
      break
   fi
done

### WAIT FOR REPORT FILE PROCESSING
while true; do
   sleep 1
   echo report file processing
   JSON=$(curl -s --header "x-apikey: $KEY" "https://$HOST/api/v1/file/get.json?file_id=$FILE_ID")
   DONE=$(echo $JSON | jq -r .file.ready)
   if [ $DONE == 1 ]; then
      echo file ready
      echo $JSON | jq
      URL=$(echo $JSON | jq -r .file.url)
      break
   fi
done

### DOWNLOAD REPORT FILE
echo "Downloading File $URL"
curl --header "x-apikey: $KEY"  $URL > report.pdf
ls -lah report.pdf
```
