# Orders

## Get Orders

<mark style="color:blue;">`GET`</mark> `https://api.vaultoro.com/v1/private/orders`

This endpoint allows you to retrieve orders. To fetch your own orders, just pass self=true with the request.

#### Query Parameters

| Name          | Type    | Description                                                                                               |
| ------------- | ------- | --------------------------------------------------------------------------------------------------------- |
| queued        | string  | Sets the status filter to OPEN and QUEUED.                                                                |
| status        | string  | The status of the order. This can be OPEN, CLOSED, FILLED, CANCELLED, or QUEUED for the private endpoint. |
| since         | string  | Unix timestamp to filter results until.                                                                   |
| until         | string  | Unix timestamp to filter results until.                                                                   |
| self          | boolean | Return a list of your own orders. Must be set to true.                                                    |
| sortDirection | number  | The direction of the sorting. Either 1 or -1.                                                             |
| sort          | string  | Sort the results by createdAt or updatedAt                                                                |
| matchType     | string  | Filter the type of order. Currently only LIMIT.                                                           |
| pair          | string  | Filter by available pairs.                                                                                |
| status        | string  | The status of the order. Should be OPEN, CLOSED, FILLED, CANCELLED.                                       |
| type          | string  | The type of order. Should be BUY or SELL.                                                                 |
| limit         | string  | Limit the number of results.                                                                              |
| page          | number  | Return a specific page.                                                                                   |

#### Headers

| Name   | Type   | Description                              |
| ------ | ------ | ---------------------------------------- |
| VTOKEN | string | Your API token to authenticate requests. |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
    "data": [
        {
            "createdAt": 1595357594,
            "initialQuantity": 12,
            "matchType": "LIMIT",
            "pair": "GOLDBTC",
            "quantity": "0.0000",
            "status": "FILLED",
            "type": "SELL",
            "updatedAt": 1595357766,
            "value": "0.00615450"
        },
        {
            "createdAt": 1595357730,
            "initialQuantity": 12,
            "matchType": "LIMIT",
            "pair": "GOLDBTC",
            "quantity": "0.0000",
            "status": "FILLED",
            "type": "SELL",
            "updatedAt": 1595358200,
            "value": "0.00615450"
        }
    ]
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
{
    "data": []
}
```

{% endtab %}
{% endtabs %}

## Create Order

<mark style="color:green;">`POST`</mark> `https://api.vaultoro.com/v1/private/orders`

The endpoint allows you to create an order. After creation, your order will be placed in a queue and further checks run. Only one order can be made at a time.

#### Headers

| Name           | Type   | Description                                                                              |
| -------------- | ------ | ---------------------------------------------------------------------------------------- |
| wallet-origin  | string |                                                                                          |
| Authentication | string | Authentication token.                                                                    |
| VTOKEN         | string | Use an API token to authorise the requests instead of the standard authentication token. |

#### Request Body

| Name      | Type   | Description                                            |
| --------- | ------ | ------------------------------------------------------ |
| price     | number | The price of the order you wish to make.               |
| type      | string | The type of order, BUY or SELL.                        |
| quantity  | number | The quantity you wish you purchase.                    |
| matchType | string | The match type, must be set to LIMIT or OTC right now. |
| pair      | string | The pair you wish to trade.                            |

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

```
{
    "data": {
        "result": {
            "referenceId": "1nod461th2kpqzsr56",
            "createdAt": 1623335089,
            "matchType": "LIMIT",
            "price": "0.2121",
            "quantity": "0.5",
            "type": "SELL"
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Cancel an order

<mark style="color:red;">`DELETE`</mark> `https://api.vaultoro.com/v1/private/orders/{referenceId}`

Cancel an order that's currently processing.&#x20;

#### Path Parameters

| Name        | Type   | Description                                             |
| ----------- | ------ | ------------------------------------------------------- |
| referenceId | string | The referenceId for the order that's returned on create |

#### Headers

| Name   | Type   | Description     |
| ------ | ------ | --------------- |
| VTOKEN | string | Your API Token. |

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

```
{"data":{"cancelled":true}}
```

{% endtab %}
{% endtabs %}

## Get an Order

<mark style="color:blue;">`GET`</mark> `https://api.vaultoro.com/v1/private/orders/{referenceId}`

The endpoint allows you to retrieve a single order using the referenceId.

#### Path Parameters

| Name        | Type   | Description                                             |
| ----------- | ------ | ------------------------------------------------------- |
| referenceId | string | The referenceId for the order that's returned on create |

#### Headers

| Name   | Type   | Description     |
| ------ | ------ | --------------- |
| VTOKEN | string | Your API token. |

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

```
```

{% endtab %}
{% endtabs %}
