# List Products

### Endpoint

<mark style="color:green;">**`GET`**</mark> `https://api.keepup.store/v2.0/products`

### Headers

`Authorization: Bearer API_KEY`

### Query Parameters

<table data-full-width="false"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><h4>product_name</h4><p>string</p></td><td>optional</td><td>Name of the product to filter by. Example: "Widget A"</td></tr><tr><td><h4>SKU</h4><p>string</p></td><td>optional</td><td>Stock Keeping Unit to filter by. Example: "SKU12345"</td></tr><tr><td><h4>barcode</h4><p><em>string</em></p></td><td>optional</td><td>Barcode to filter by. Example: "0123456789012"</td></tr><tr><td><h4>category</h4><p><em>string</em></p></td><td>optional</td><td>Category of the products. Example: "Electronics"</td></tr><tr><td><h4><strong>s</strong>tatus</h4><p>string</p></td><td>optional</td><td>Stock status to filter by, options are 'in_stock', 'out_of_stock', 'low_stock', 'all'. Example: "in_stock"</td></tr><tr><td><h4>expired</h4><p><em>string</em></p></td><td>optional</td><td>Filter for products based on expiration, options are 'yes', 'no'. Example: "no"</td></tr><tr><td><h4>limit</h4><p><em>string</em></p></td><td>optional</td><td>Limits the number of products returned. Use 'all' for no limit. Example: "10"</td></tr><tr><td><h4><strong>page</strong></h4><p>string</p></td><td>optional</td><td>Specifies the page number for pagination. Example: "1"</td></tr></tbody></table>

### Sample Requests

{% tabs %}
{% tab title="Node.js" %}
{% code fullWidth="true" %}

```javascript
const axios = require('axios');

const config = {
    method: 'get',
    url: 'https://api.keepup.store/v2.0/inventory',
    headers: {
        'Authorization': 'Bearer API_KEY' // Replace 'API_KEY' with your actual API key
    },
    params: {
        product_name: "Widget A",
        SKU: "SKU12345",
        barcode: "0123456789012",
        category: "Electronics",
        status: "in_stock",
        expired: "no",
        limit: "10",
        page: "1"
    }
};

axios(config).then(function (response) {
    console.log(JSON.stringify(response.data));
}).catch(function (error) {
    console.error(error);
});

```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.keepup.store/v2.0/inventory?product_name=Widget%20A&sku=SKU12345&barcode=0123456789012&category=Electronics&status=in_stock&expired=no&limit=10&page=1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer API_KEY' // Replace 'API_KEY' with your actual API key
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

?>

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://example.com/api/inventory'
headers = {'Authorization': 'Bearer your_access_token'}
params = {
    'product_name': 'Widget A',
    'SKU': 'SKU12345',
    'barcode': '0123456789012',
    'category': 'Electronics',
    'status': 'in_stock',
    'expired': 'no',
    'limit': '10',
    'page': '1'
}

response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
    print(response.json())
else:
    print('Failed to retrieve products:', response.status_code, response.text)

```

{% endtab %}
{% endtabs %}

## Sample Response

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

```json
{
    "status": 200,
    "message": "products found: 1",
    "data": {
        "meta": {
            "total_records": 1,
            "total_quantity": 0,
            "total_products_in_stock": 0,
            "total_products_out_of_stock": 1,
            "selling_price_total_amount": "0.00",
            "cost_price_total_amount": "0.00",
            "total_expired_products": 0,
            "total_soon_to_expired_products": 0
        },
        "products": [
            {
                "product_id": 19842,
                "product_name": "6:16",
                "description": "<p>6:16 description</p>",
                "cost_price": "0.00",
                "selling_price": "37.00",
                "stock_limit": "unlimited",
                "stock_status": "out_of_stock",
                "quantity": 0,
                "images": [],
                "restock_level": 1,
                "barcode": null,
                "SKU": null,
                "location": null,
                "category": null,
                "show_on_storefront": "yes",
                "featured_product": "no",
                "created_at": "2024-05-11 16:18",
                "updated_at": "2024-05-11 17:00"
            }
        ]
    }
}
```

{% endtab %}

{% tab title="Error" %}

```json
{
    "status": 401,
    "error": "Authentication invalid"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.keepup.store/docs/api/products/list-products.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
