> ## 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.

# Order documents

> Order a document for a company using the V2 create order API.

## Create Order

The Create Order call allows ordering filings from the registry. This POST call requires details to be provided in the body.

[Create order API reference](/api-reference/orders/create-order)

#### Required fields

* KyckrID
* productId (This is the `id` from the documents search)

#### Optional parameter

* Customer Reference

#### Request

```curl theme={null}
curl --location 'https://api.kyckr.com/v2/orders?customerReference=Example%20Ref' \
--header 'Authorization:{{apiKey}}' \
--header 'Content-Type: application/json' \
--data '{
    "kyckrId": "GB|MTE2NTUyOTA" ,
    "productId": "Q0hPTl9RMGhmUTI5dGNHRnVlVTF2Y25SbllXZGxjMTh4X01URTJOVFV5T1RBPQ=="
}'
```

The responce will confirm that the order has been succesfully placed and will provide a unique order ID.

### Example response

```json theme={null}
   {
    "correlationId": "4ca0f21f4b6b4b93a9f64a040914ea4a",
    "customerReference": "Example Ref",
    "timeStamp": "2024-01-25T11:32:26.7086668Z",
    "details": "Success",
    "data": {
        "status": "Pending",
        "orderId": 302151
   }
```

### Retrieve documents

Ordered documents can be retrieved using the [GET /orders](/api-reference/orders/get-list-of-orders) call, which returns a list of all ordered documents. The number of orders in the response can be controlled using the parameters `pageNumber`, `pageSize`, `startDate`, and `endDate`.

The `status` field shows the status of the document.

| Order status | Description                |
| ------------ | -------------------------- |
| Pending      | Order in progress          |
| Complete     | Document ready to download |
| Failed       | Order failed               |

#### Request

```curl theme={null}
curl --location 'https://api.kyckr.com/v2/orders?pageNumber=1&pageSize=100&startDate=2023-11-20%20&endDate=2023-11-22%20' \
--header 'Authorization:{{apiKey}}' \
--header 'Content-Type: application/json'
```

#### Example response

```json theme={null}
{
    "correlationId": "48b9e32527974ca0bc1f606d198669c8",
    "customerReference": "",
    "timeStamp": "2024-01-25T12:55:22.351548Z",
    "details": "Success",
    "data": {
        "accountId": 123456,
        "pageNumber": 1,
        "pageSize": 100,
        "totalCount": 5,
        "orders": [
            {
                "orderId": 302151,
                "customerReference": "Example Ref",
                "status": "Pending",
                "creditCost": 1,
                "productDetails": {
                    "productName": "CH_CompanyMortgages_1",
                    "productCategory": "Company Mortgages"
                },
                "companyDetails": {
                    "kyckrId": "GB|MTE2NTUyOTA",
                    "companyNumber": "11655290",
                    "companyName": "Kyckr                                                                                                                                                 "
                }
```

#### Retrieving a single order

To just retrieve a single document order, add an `OrderId` to the path - see example below.

#### Request

```curl theme={null}
curl --location 'https://api.kyckr.com/v2/orders/302151' \
--header 'Authorization:{{apiKey}}' \
--header 'Content-Type: application/json'
```
