# Sales

## List all sales

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/sales`

This endpoint allows you to get the list of your sales. \
The transactions are returned sorted by most recent number.

#### Headers

| Name                                               | Type   | Description                  |
| -------------------------------------------------- | ------ | ---------------------------- |
| Authentification<mark style="color:red;">\*</mark> | string | Bearer Token                 |
| Accept                                             | string | Should be `application/json` |

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## List a specific sale

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/sales/:id`

This endpoint allows you to get one specific sale.&#x20;

#### Headers

| Name                                               | Type   | Description                  |
| -------------------------------------------------- | ------ | ---------------------------- |
| Authentification<mark style="color:red;">\*</mark> | string | Bearer Token                 |
| Accept                                             | string | Should be `application/json` |

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Create a sale

<mark style="color:green;">`POST`</mark> `https://app.gem-books.com/api/sales`

#### Headers

| Name             | Type   | Description                  |
| ---------------- | ------ | ---------------------------- |
| Authentification | string | Bearer Token                 |
| Accept           | string | Should be `application/json` |

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

#### Body Example

```
{
    "client_id": "1",
    "date": "2022-05-25"
}
```

## Update a sale

<mark style="color:orange;">`PUT`</mark> `https://app.gem-books.com/api/sales/:id`

#### Headers

| Name             | Type   | Description                  |
| ---------------- | ------ | ---------------------------- |
| Authentification | string | Bearer Token                 |
| Accept           | string | Should be `application/json` |

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

#### Body Example

```
{
    "action": "invoice", //This will create an invoice from the sale
    "action": "quote" //This will create a quote from the sale
}
```
