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

# Download documents

> Poll order status and download documents when ready.

To obtain the URL link to the PDF document, use the order status call. A specific order can be targeted using an order reference, or all orders within a certain time period can be retrieved.

[Order status API reference](/api-reference/registry-documents/order-status)

### Polling

For documents with a delivery time, poll the system until the document becomes available.  The order is ready when the `statusField` changes form `1` to either a `2, 21, 3, 5 or 9`.

Polling once every minute is recommended, but more bespoke setups can be arranged depending on the jurisdictions and documents typically ordered.

### Document status

The `statusField` describes the state of the document order.

| statusField    | Description                        |
| -------------- | ---------------------------------- |
| `1`            | Pending – Order in progress        |
| `2`, `21`, `3` | Ready - Document ready to download |
| `5`            | Order failed                       |
| `9`            | Order cancelled                    |

### Order status

When retrieving a list of product orders, all orders can be fetched. Specific orders can also be found using `orderRef`. The number of results returned can also be reduced by passing a parameter for orders placed within a certain number of days.

Parameters:

* `OrderRef` (specified in the product order POST method)
* `OrderedWithin`  (the of days returned in the response)

#### Example request by orderRef

The example below uses a customer provided order ref to check the status

```curl theme={null}
curl --location 'https://rest.kyckr.com/test/core/filing/order-status/30?orderRef=Example%201' \
--header 'Authorization: {{apiKey}}'
```

#### Example response

```json theme={null}
{
        "aVAILABLEField": 1,
        "aWAITING_DELIVERYField": 0,
        "dELIVERY_ERRORField": 0,
        "accountIdField": 0,
        "nodeIdField": "GBR_1000",
        "orderDateTimeField": "2023-02-21T09:25:44.417",
        "orderReferenceField": "Example 1",
        "descriptionField": "Company Mortgages",
        "productOrderIdField": 2573359,
        "sentToClientField": false,
        "statusField": 3,
        "urlField": "https://data.kyckr.com/integration/1603863699",
        "formatField": "",
        "filingOrderIdField": "CHON_Q0hfQ29tcGFueU1vcnRnYWdlc18x_MTE2NTUyOTA="
    }
```
