# Company Risk Report

A comprehensive risk report that combines various data sources to provide insights into a company’s financial health, legal standing, and potential risks associated with business dealings.

## API Usage

The Company Risk Report uses three endpoints:

| Endpoint Name                                                 | Description                                                                |
|---------------------------------------------------------------| -------------------------------------------------------------------------- |
| [ASIC Company Search](#asic-company-search)                   | Search ASIC to find a company by name, ABN, or ACN.                         |
| [Company Risk](#company-risk)                                 | Request generation of a Company Risk Report using an ABN or ACN.           |
| [Retrieve Company Risk Report](#retrieve-company-risk-report) | Retrieve the report results (JSON) or download a PDF once it is ready.     |

## Quick Start

1. (Optional) Use **ASIC Company Search** to locate the company and note its `abn` or `acn`.
2. Use **Company Risk** with the `abn` or `acn` to start the report generation.
3. Use **Retrieve Company Risk Report** with the returned `api_reference` to poll for completion and retrieve the report.
4. Append `?pdf=true` to the show endpoint to return the report as a PDF.

### Processing Time

- Report generation usually completes within a few seconds.
- The show endpoint waits up to 30 seconds before returning a `202` response if the report is not ready.

### Billing

> Note: Calls to the Company Risk endpoint outside of the sandbox environment will be billed.
Refer to your commercial agreement or pricing documentation for details.

## API Endpoints

### ASIC Company Search

The ASIC Company Search endpoint is used to search the ASIC company register for a company using the company's name, ABN, or ACN.

This search returns a list of matching ASIC companies, including the `abn` and `acn` you must supply to the **Company Risk Report Request** endpoint.

This function is provided as a convenience to obtain the ABN/ACN for a company. Unlike the ASIC Extract Person Search process, there is **no requirement** to perform a company search before requesting an extract, as only the `abn` or `acn` is required by the extract endpoint.

See the [ASIC Company Search API documentation](/docs/reference/asic_company_search) for detailed information on the request and response.

#### Example Search

```json
{
    "search": "Marble Kookaburra Interiors",
    "status": "registered"
}
```

#### Example Response

```json
{
    "message": "Ok",
    "function": "asic_company_search",
    "api_reference": "c3c74e96-ead1-482d-bfb5-5b902090cf0c",
    "matches": [
        {
            "identifier": {
                "numberHeading": "ACN",
                "number": 655375652
            },
            "name": {
                "name": "MARBLE KOOKABURRA INTERIORS PTY LTD"
            },
            "abrEntity": {
                "abn": "84655375652",
                "entityName": "MARBLE KOOKABURRA INTERIORS PTY LTD",
                "entityType": "PRV",
                "effectiveDate": "2021-07-19"
            },
            ...
        }
    ],
    "more_results": false
}
```

### Company Risk

Request generation of a Company Risk Report. Supply **either** `abn` or `acn` (not both).

#### Example Request

```json
{
    "abn": "84655375652"
}
```

#### Example Response

```json
{
    "message": "Ok",
    "function": "company_risk",
    "api_reference": "0653317d-4d78-4e39-bd08-f7edbc30a656"
}
```

The endpoint returns immediately with an `api_reference`, and the system begins generating the extract in the background.

The returned `api_reference` can then be used to retrieve the results of the extract using the **Retrieve Company Risk Report** endpoint.

See the [Company Risk API documentation](/docs/reference/company_risk) for detailed information on the request and response.

### Retrieve Company Risk Report

Retrieve the report after requesting it.

#### Example Request

```
GET /company_risk/0653317d-4d78-4e39-bd08-f7edbc30a656
```

#### Example Response

```json
{
    "message": "Ok",
    "function": "company_risk_show",
    "api_reference": "9a2c2264-2e36-4b00-97a0-686a89f306c2",
    "report": {
        "cases": [
            {
                "name": "MARBLE KOOKABURRA INTERIORS PTY LTD",
                "type": "Court Case",
                "uuid": "1e3f9b52-5485-4c5e-8a0b-72e8792cf222",
                "state": "VIC",
                "suburb": "Melbourne",
                "parties": [
                    {
                        "abn": "84655375652",
                        "acn": "655375652",
                        "fax": "",
                        "name": "MARBLE KOOKABURRA INTERIORS PTY LTD",
                        "role": "Respondent",
                        "type": "Company",
                        "phone": "",
                        "address": "",
                        "representative_firm": "",
                        "representative_name": ""
                    },
                    ...
                ],
                ...
            },
            ...
        ],
        ...
    }
}
```

#### Example PDF Request

```
GET /company_risk/0653317d-4d78-4e39-bd08-f7edbc30a656?pdf=true
```

#### Waiting for the report to be ready

If the report is not yet complete, the endpoint will return a `202` response:

```json
{
    "message": "Report is still being processed. Please try again later."
}
```

You can then repeat the request with the same `api_reference` until the report is returned.

See the [Retrieve Company Risk Report API documentation](/docs/reference/company_risk_show) for detailed information on the request and response.
