# Get Products

- Sandbox: `GET https://sandbox.payme.io/api/products`
- Production: `GET https://live.payme.io/api/products`

## Credentials

- Header `Authorization: Bearer <token>`

The GET /products endpoint provides access to product data, enabling clients to filter and sort through available products. Clients can specify parameters such as product status, creation date range, currency, description, order columns, and directions. Additionally, the endpoint allows for pagination and setting price ranges.

The response will include a list of products that match the specified query parameters, along with metadata such as the total number of products available and pagination details. This endpoint is essential for applications that require dynamic and flexible product searches.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `status` | query | string | yes | The product status - indicates if the product is available or not. |
| `created_at[]` | query | string | no | Common date range. Use [min] / [max] on query parameters. |
| `due_date` | query | string | no | Common date range. Use [min] / [max] on query parameters. |
| `items_per_page` | query | integer | no | The count of items returned under the page, up to 500 per page. |
| `page` | query | integer | no | The page number |
| `name` | query | string | no | The product name. |
| `description` | query | string | no | The product description. |
| `currency` | query | string | no | The product currency - ISO 3 letters. |
| `price_inc_vat_min` | query | number | no | The minimum price include VAT -> Store Price only. (store_configuration) |
| `price_inc_vat_max` | query | number | no | The maximum price include VAT -> Store price only. (store_configuration) |
| `sort_by` | query | string | no | The column name that will be used for ordering the results. |
| `sort_direction` | query | string | no | The direction of ordering. |

## Code samples

### curl

```bash
curl -X GET 'https://sandbox.payme.io/api/products?status=<status>' \
  -H 'Authorization: Bearer <YOUR_TOKEN>'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/products?status=<status>", {
  method: "GET",
  headers: {
    "Authorization": "Bearer <YOUR_TOKEN>",
  },
});

console.log(await response.text());
```

### Python

```python
import requests

response = requests.get(
    "https://sandbox.payme.io/api/products?status=<status>",
    headers={
        "Authorization": "Bearer <YOUR_TOKEN>",
    },
)

print(response.text)
```

### PHP

```php
<?php

$ch = curl_init('https://sandbox.payme.io/api/products?status=<status>');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer <YOUR_TOKEN>',
    ],
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

## Responses

### 200 — Request validated. (success)

| Field | Type | Description |
| --- | --- | --- |
| `guid` | string |  |
| `product_remote_id` | string |  |
| `name` | string |  |
| `status` | integer |  |
| `category` | string |  |
| `description` | string |  |
| `store_prices` | object |  |
| `store_prices.currency` | string |  |
| `store_prices.vat_free` | boolean |  |
| `store_prices.price_without_vat` | number |  |
| `store_prices.price_include_vat` | number |  |
| `costs` | object |  |
| `costs.currency` | string |  |
| `costs.vat_free` | boolean |  |
| `costs.price_without_vat` | integer |  |
| `costs.price_include_vat` | number |  |

```json
{
  "guid": "PRODUCT123-123-123-123",
  "product_code": "PROD001",
  "name": "Example Product",
  "status": 1,
  "category": 3,
  "description": "This is a description of the example product.",
  "store_configuration": {
    "currency": "USD",
    "vat_free": false,
    "Price_without_vat": 99.99,
    "Price_include_vat": 117.99
  },
  "costs_details": {
    "currency": "USD",
    "vat_free": false,
    "Price_without_vat": 50,
    "Price_include_vat": 58.5
  }
}
```

### 400 — Bad Request (error)

| Field | Type | Description |
| --- | --- | --- |
| `message` | object |  |
| `message.error_text` | string |  |
| `message.error_code` | string |  |

```json
{
  "status_code": 1,
  "message": "Bad Request",
  "status_error_code": 400
}
```

### 401 — Unauthorized (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer |  |
| `message` | string |  |
| `status_error_code` | integer |  |

```json
{
  "status_code": 1,
  "message": "unauthorized request",
  "status_error_code": 401
}
```

### 500 — Internal Server Error (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer |  |
| `message` | string |  |
| `status_error_code` | integer |  |

```json
{
  "status_code": 1,
  "message": "Internal Server Error",
  "status_error_code": 500
}
```
