> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rmz.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# List & Search Products

> Browse, filter, sort, and search the store's product catalog.

## GET /products

List products with filtering, sorting, and pagination.

### Authentication

None required.

### Query Parameters

| Parameter  | Type    | Required | Description                                                                                                          |
| ---------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| category   | string  | No       | Filter by category slug                                                                                              |
| search     | string  | No       | Search in product name and description (max 255 chars)                                                               |
| sort       | string  | No       | Sort order: `price_asc`, `price_desc`, `name_asc`, `name_desc`, `created_asc`, `created_desc`. Default: newest first |
| per\_page  | integer | No       | Items per page (1-50). Default: `12`                                                                                 |
| page       | integer | No       | Page number. Default: `1`                                                                                            |
| featured   | boolean | No       | Filter featured products only                                                                                        |
| type       | string  | No       | Filter by product type: `digital`, `subscription`, `course`                                                          |
| price\_min | number  | No       | Minimum price filter                                                                                                 |
| price\_max | number  | No       | Maximum price filter                                                                                                 |
| in\_stock  | boolean | No       | Filter to only in-stock products                                                                                     |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://front.rmz.gg/api/products?category=electronics&sort=price_asc&per_page=12&page=1"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    category: "electronics",
    sort: "price_asc",
    per_page: "12",
    page: "1"
  });
  const response = await fetch(`https://front.rmz.gg/api/products?${params}`);
  const data = await response.json();
  ```

  ```python Python theme={null}
  response = requests.get("https://front.rmz.gg/api/products", params={
      "category": "electronics",
      "sort": "price_asc",
      "per_page": 12,
      "page": 1
  })
  data = response.json()
  ```

  ```php PHP theme={null}
  $response = Http::get("https://front.rmz.gg/api/products", [
      "category" => "electronics",
      "sort" => "price_asc",
      "per_page" => 12,
      "page" => 1
  ]);
  $data = $response->json();
  ```
</CodeGroup>

### Response

#### Success (200)

```json theme={null}
{
  "success": true,
  "data": [
    {
      "id": 101,
      "name": "Premium Game Key",
      "marketing_title": null,
      "slug": "premium-game-key",
      "description": "Premium game activation key for PC",
      "short_description": "Premium game activation key for PC...",
      "type": "code",
      "status": 1,
      "is_featured": false,
      "is_noticeable": false,
      "is_new": false,
      "is_discounted": false,
      "is_discount_expired": false,
      "show_reviews": true,
      "price": {
        "original": 199.99,
        "actual": 199.99,
        "discount": null,
        "discount_expiry": null,
        "show_discount_countdown": false,
        "show_discount_savings": false,
        "savings_amount": 0,
        "formatted": "199.99 ر.س",
        "formatted_original": "199.99 ر.س",
        "discount_percentage": 0,
        "currency": "SAR"
      },
      "stock": {
        "available": 50,
        "unlimited": false,
        "min_qty": 1,
        "codes_count": 50,
        "is_in_stock": true
      },
      "sales": {
        "badge": null
      },
      "image": {
        "id": 1,
        "url": "https://...",
        "full_link": "https://...",
        "path": "...",
        "filename": "image.webp",
        "alt_text": "Premium Game Key"
      },
      "categories": [
        {
          "id": 1,
          "name": "Games",
          "slug": "games",
          "description": null,
          "image": null,
          "icon": null,
          "is_active": true,
          "sort_order": 0,
          "created_at": "2024-01-01T00:00:00.000000Z",
          "updated_at": "2024-06-15T10:30:00.000000Z"
        }
      ],
      "fields": null,
      "meta": null,
      "metadata": null,
      "tags": null,
      "seo": {
        "meta_title": null,
        "meta_description": null,
        "meta_keywords": null
      },
      "created_at": "2024-06-15T10:30:00.000000Z",
      "updated_at": "2024-06-15T10:30:00.000000Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "last_page": 5,
    "per_page": 12,
    "total": 60,
    "from": 1,
    "to": 12,
    "has_more_pages": true,
    "next_page_url": "https://front.rmz.gg/api/products?page=2",
    "prev_page_url": null
  }
}
```

***

## GET /products/search

Search products with advanced filters and relevance scoring.

### Authentication

None required.

### Query Parameters

| Parameter  | Type    | Required | Description                                                                                                          |
| ---------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| q          | string  | Yes      | Search query (2-255 characters)                                                                                      |
| category   | string  | No       | Filter by category slug                                                                                              |
| price\_min | number  | No       | Minimum price filter                                                                                                 |
| price\_max | number  | No       | Maximum price filter                                                                                                 |
| type       | string  | No       | Filter by type: `digital`, `subscription`, `course`                                                                  |
| sort       | string  | No       | Sort order: `relevance`, `price_asc`, `price_desc`, `name_asc`, `name_desc`, `created_desc`. Default: `created_desc` |
| per\_page  | integer | No       | Items per page (1-50). Default: `12`                                                                                 |

<Note>
  When `sort=relevance`, results are ranked by a relevance score. Name matches score higher than description matches.
</Note>

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://front.rmz.gg/api/products/search?q=game+key&sort=relevance&per_page=12"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://front.rmz.gg/api/products/search?q=game+key&sort=relevance");
  const data = await response.json();
  ```

  ```python Python theme={null}
  response = requests.get("https://front.rmz.gg/api/products/search", params={
      "q": "game key",
      "sort": "relevance",
      "per_page": 12
  })
  data = response.json()
  ```

  ```php PHP theme={null}
  $response = Http::get("https://front.rmz.gg/api/products/search", [
      "q" => "game key",
      "sort" => "relevance",
      "per_page" => 12
  ]);
  $data = $response->json();
  ```
</CodeGroup>

### Response

Same paginated format as `GET /products`.

#### Error Responses

| Status | Description                                          |
| ------ | ---------------------------------------------------- |
| 422    | Validation error (`q` is required, min 2 characters) |

***

## GET /featured-products

Get featured (highlighted) products.

### Authentication

None required.

### Query Parameters

| Parameter | Type    | Required | Description                                       |
| --------- | ------- | -------- | ------------------------------------------------- |
| limit     | integer | No       | Number of products to return (1-20). Default: `8` |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://front.rmz.gg/api/featured-products?limit=8"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://front.rmz.gg/api/featured-products?limit=8");
  const data = await response.json();
  ```

  ```python Python theme={null}
  response = requests.get("https://front.rmz.gg/api/featured-products", params={"limit": 8})
  data = response.json()
  ```

  ```php PHP theme={null}
  $response = Http::get("https://front.rmz.gg/api/featured-products", ["limit" => 8]);
  $data = $response->json();
  ```
</CodeGroup>

### Response

#### Success (200)

Returns the same `ProductResource` structure as `GET /products`. See the full response schema above.

```json theme={null}
{
  "success": true,
  "data": [
    {
      "id": 101,
      "name": "Premium Game Key",
      "marketing_title": null,
      "slug": "premium-game-key",
      "description": "Premium game activation key for PC",
      "short_description": "Premium game activation key for PC...",
      "type": "code",
      "status": 1,
      "is_featured": false,
      "is_noticeable": true,
      "is_new": false,
      "is_discounted": false,
      "is_discount_expired": false,
      "show_reviews": true,
      "price": {
        "original": 199.99,
        "actual": 199.99,
        "discount": null,
        "discount_expiry": null,
        "show_discount_countdown": false,
        "show_discount_savings": false,
        "savings_amount": 0,
        "formatted": "199.99 ر.س",
        "formatted_original": "199.99 ر.س",
        "discount_percentage": 0,
        "currency": "SAR"
      },
      "stock": {
        "available": 50,
        "unlimited": false,
        "min_qty": 1,
        "codes_count": 50,
        "is_in_stock": true
      },
      "sales": {
        "badge": null
      },
      "image": {
        "id": 1,
        "url": "https://...",
        "full_link": "https://...",
        "path": "...",
        "filename": "image.webp",
        "alt_text": "Premium Game Key"
      },
      "categories": [
        {
          "id": 1,
          "name": "Games",
          "slug": "games",
          "description": null,
          "image": null,
          "icon": null,
          "is_active": true,
          "sort_order": 0,
          "created_at": "2024-01-01T00:00:00.000000Z",
          "updated_at": "2024-06-15T10:30:00.000000Z"
        }
      ],
      "fields": null,
      "meta": null,
      "metadata": null,
      "tags": null,
      "seo": {
        "meta_title": null,
        "meta_description": null,
        "meta_keywords": null
      },
      "created_at": "2024-06-15T10:30:00.000000Z",
      "updated_at": "2024-06-15T10:30:00.000000Z"
    }
  ]
}
```

<Tip>
  Featured products are those marked as "noticeable" in the store dashboard. They are returned sorted by newest first.
</Tip>
