> 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/purchases/products.md).

# Products

## List all purchase products

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

This endpoint allows you to get the list of your purchase products.&#x20;

#### 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": 1,
      "purchase_id": 2,
      "product_id": "5",
      "produit_compte": "67",
      "product_name": "Breaks",
      "product_description": "",
      "produit_projet": null,
      "product_quantity": "8.00",
      "produit_quantite_receive": "0.00",
      "produit_quantite_onhold": "8.00",
      "produit_poids": "0.000",
      "produit_poids_receive": "0.000",
      "produit_poids_onhold": "0.000",
      "product_price": "30.0000",
      "product_discount": "0.00",
      "product_serialnumber": "",
      "produit_total": "240.00",
      "taxes_rules_id": 2,
      "gestion_taxes": "[]",
      "province_id": 0,
      "system_id": 99217
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 500,
    "total": 1
  },
  "success": true
}
```

{% endtab %}
{% endtabs %}

## Retrieve a specific sale product

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

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

#### Path Parameters

| Name | Type    | Description                              |
| ---- | ------- | ---------------------------------------- |
| id   | integer | The ID of the sales product 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": 1,
      "purchase_id": 2,
      "product_id": "5",
      "produit_compte": "67",
      "product_name": "Breaks",
      "product_description": "",
      "produit_projet": null,
      "product_quantity": "8.00",
      "produit_quantite_receive": "0.00",
      "produit_quantite_onhold": "8.00",
      "produit_poids": "0.000",
      "produit_poids_receive": "0.000",
      "produit_poids_onhold": "0.000",
      "product_price": "30.0000",
      "product_discount": "0.00",
      "product_serialnumber": "",
      "produit_total": "240.00",
      "taxes_rules_id": 2,
      "gestion_taxes": "[]",
      "province_id": 0,
      "system_id": 99217
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

## Create a purchase product

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

#### 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 |
| ------------ | ------ | ----------- |
| purchase\_id | string | Invoice ID  |
| product\_id  | string | Product ID  |

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

```json
{
  "data": [
    {
      "id": 2,
      "purchase_id": 5,
      "product_id": "3",
      "product_name": "timing belt",
      "product_description": "",
      "product_quantity": "0.00",
      "product_price": "0.0000",
      "product_discount": "0.00",
      "product_serialnumber": "",
      "produit_cost": "0.00",
      "taxes_rules_id": 2,
      "province_id": 0,
      "system_id": 99217
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

#### Body Example

```
{
    "purchase_id": 5,
    "product_id": 3,
    "product_name": "timing belt"
}
```

## Update a purchase product

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

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

#### Path Parameters

| Name | Type    | Description                    |
| ---- | ------- | ------------------------------ |
| id   | integer | Purchase product 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": 2,
      "purchase_id": 5,
      "product_id": "3",
      "product_name": "timing belt",
      "product_description": "",
      "product_quantity": "0.00",
      "product_price": "0.0000",
      "product_discount": "0.00",
      "product_serialnumber": "",
      "produit_cost": "0.00",
      "taxes_rules_id": 2,
      "province_id": 0,
      "system_id": 99217
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

#### Body Example

```json
{
    "product_name": "Timing Belt",
    "product_quantity": 10,
    "product_price": 30
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gem-suite.com/api-reference/resources/purchases/products.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
