> For the complete documentation index, see [llms.txt](https://docs.gem-suite.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gem-suite.com/api-reference/resources/categories.md).

# Categories

## List all categories

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

This endpoint allows you to get the list of your categories.

#### Headers

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

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

```json
{
  "data": [
    {
      "id": 3,
      "code": "500",
      "name_fr": "Job",
      "name_en": "Job"
    },
    {
      "id": 2,
      "code": "200",
      "name_fr": "Pieces",
      "name_en": "Parts"
    },
    {
      "id": 1,
      "code": "DEFAULT",
      "name_fr": "DEFAULT",
      "name_en": "Default"
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 500,
    "total": 3
  },
  "success": true
}
```

{% endtab %}
{% endtabs %}

## Retrieve a specific sale product

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

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

#### Path Parameters

| Name | Type    | Description                         |
| ---- | ------- | ----------------------------------- |
| id   | integer | The ID of the category to retrieve. |

#### Headers

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

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

```json
{
  "data": [
    {
      "id": 2,
      "code": "200",
      "name_fr": "Pieces",
      "name_en": "Parts"
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

## Create a category

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

#### Headers

| Name           | Type   | Description                  |
| -------------- | ------ | ---------------------------- |
| Authentication | string | Bearer Token                 |
| Content-type   | string | Should be application/json   |
| Accept         | string | Should be `application/json` |

#### Request Body

| Name     | Type   | Description              |
| -------- | ------ | ------------------------ |
| code     | string | Code                     |
| name\_fr | string | Category name in French  |
| name\_en | string | Category name in English |

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

```json
{
  "data": [
    {
      "id": 5,
      "code": "005",
      "name_fr": "La Franchise",
      "name_en": "Franchise"
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

#### Body Example

```json
{
    "code": "005",
    "name_fr": "La Franchise",
    "name_en": "Franchise"
}
```

## Update a category

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

This endpoint allows you to update a specific category. \
Returns the updated category.

#### Path Parameters

| Name | Type    | Description            |
| ---- | ------- | ---------------------- |
| id   | integer | Category ID to update. |

#### Headers

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

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

```json
{
  "data": [
    {
      "id": 4,
      "code": "100",
      "name_fr": "Entreposage de pneus",
      "name_en": "Tire storage"
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

#### Body Example

```json
{
    "code": "100",
    "name_fr": "Entreposage de pneus",
    "name_en": "Tire storage"
}
```
