# Dynamic Analysis Report API — Spectra Analyze

> Generate and download PDF or HTML reports for samples analyzed in ReversingLabs Cloud Sandbox via Spectra Analyze API.

This API allows creating and downloading PDF or HTML reports for samples that have gone through dynamic analysis in the [ReversingLabs Cloud Sandbox](../dynamic-analysis.md#reversinglabs-cloud-sandbox).

```
GET /api/rl_dynamic_analysis/export/summary/{hash_value}/{format}/{endpoint}/
```

## Request Format

### Request Parameters

All parameters are **path parameters** and all are required.

| NAME         | DESCRIPTION                                                  |
| :----------- | :----------------------------------------------------------- |
| `hash_value` | The hash value of the sample for which the dynamic analysis report should be returned. Supported hash types: **SHA1**. |
| `format`     | The format of the report. Supported types: `html`, `pdf`.    |
| `endpoint`   | This parameter defines whether the report is being created or downloaded, or its status checked. Possible values: `create`, `download`, `status`. The request must end with a trailing forward slash (`/`) after this parameter. |

### Request Examples

**cURL**

```bash
# Add --insecure before the URL if you are using a self-signed SSL certificate
curl -X GET 'https://appliance.example.com/api/rl_dynamic_analysis/export/summary/1eb64281e23c4af1b655f7f90b3d8bce723acaf7/pdf/download/ \
  --header 'Authorization: Token exampletoken'
```

**Python**

```python

# Change the values of token and hash_value
token = "exampletoken"
hash_value = "examplehash"
# Change the host name in the URL and the fields to be included in the response
url = f"https://appliance.example.com/api/rl_dynamic_analysis/export/summary/{hash_value}/html/create/"

headers = {
    "Authorization": f"Token {token}"
}

# Add verify=False in the request if you are using a self-signed SSL certificate
response = requests.get(url, headers=headers)
print(response.text)
```

## Response Format

The `download` endpoint returns an HTML or PDF file. The other endpoints return a JSON response with relevant information. Depending on which endpoint is used, the following fields will be present:

```yaml
properties:
  status:
    type: int
  message:
    type: string
  status_endpoint:
    type: string
  download_endpoint:
    type: string
```

### Response Examples

**Creation**:

```json
{
    "status_endpoint": "/api/rl_dynamic_analysis/export/summary/1eb64281e23c4af1b655f7f90b3d8bce723acaf7/pdf/status/",
    "download_endpoint": "/api/rl_dynamic_analysis/export/summary/1eb64281e23c4af1b655f7f90b3d8bce723acaf7/pdf/download/"
}
```

**Status check**:

```json
{
    "status": 2,
    "message": "PDF is ready for download."
}
```
