# Categories Screen

## Categories API

The Categories API is a critical endpoint that provides access to the list of product categories available in the e-commerce application. This API enables users to explore and browse products conveniently based on different product categories and tags.

<figure><img src="https://3686328336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fd1Iq7THDAagTQzeC9rTN%2Fuploads%2F8PiGkmrrE4O2u4Ah0Vbv%2Fimage.png?alt=media&#x26;token=e0d7d068-b363-43d9-bcc2-cbe65c57a016" alt=""><figcaption><p><strong>Categories interface</strong></p></figcaption></figure>

### Endpoint

* `{{baseurl}}/api/v1/categories`

### **Method**

* **GET**

### **Request Parameters:**

* `lang_code` (optional): A two-letter language code (e.g., "en" for English, "es" for Spanish, etc.) to support language-based localization. If provided, the API returns category names and descriptions in the specified language.
* `page` (optional): The page number to retrieve when using pagination. If not specified, the API defaults to the first page.
* `limit` (optional): The maximum number of categories to return per page. If not specified, the API defaults to 15 categories per page.

### **Request Body:**

* None

### **Authorization**

The API requires a bearer token in the request header for authentication. Users need to include their valid bearer token in the "Authorization" header of the HTTP request to access the categories.

### **Response Format**

The API responds with a JSON array containing category objects. Each category object represents a specific product category and includes details such as category ID, name, description, and more.

```json
{
    "success": true,
    "data": {
        "categories": [
            {
                "id": 60,
                "name": "DESIGN STICKER'S",
                "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/504-C.jpg",
                "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/503-A.jpg",
                "children": [
                    {
                        "id": 49,
                        "name": "BABY",
                        "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/504-C.jpg",
                        "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/505-C.jpg",
                        "children": [
                            {
                                "id": 55,
                                "name": "Cartoons",
                                "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/73ddbcb0672a30b12dee12440507051f.jpg",
                                "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/73ddbcb0672a30b12dee12440507051f.jpg",
                                "children": []
                            }
                        ]
                    },
                    {
                        "id": 76,
                        "name": "LARGE",
                        "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/504-C.jpg",
                        "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/503-A.jpg",
                        "children": []
                    }
                ]
            },
            {
                "id": 61,
                "name": null,
                "banner": null,
                "icon": null,
                "children": [
                    {
                        "id": 67,
                        "name": "INSTANT HENNA",
                        "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/502-C.jpg",
                        "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/504-C.jpg",
                        "children": []
                    },
                    {
                        "id": 68,
                        "name": "DIP HENNA",
                        "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/505-C.jpg",
                        "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/503-A.jpg",
                        "children": []
                    },
                    {
                        "id": 70,
                        "name": "NAIL HENNA",
                        "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/504-C.jpg",
                        "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/505-C.jpg",
                        "children": []
                    },
                    {
                        "id": 71,
                        "name": "FRESH HENNA CONE",
                        "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/505-A.jpg",
                        "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/501-B.jpg",
                        "children": []
                    },
                    {
                        "id": 72,
                        "name": "NATURAL HENNA POWDER",
                        "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/505-C.jpg",
                        "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/502-C.jpg",
                        "children": []
                    }
                ]
            },
            {
                "id": 50,
                "name": null,
                "banner": null,
                "icon": null,
                "children": [
                    {
                        "id": 56,
                        "name": "Full hand Stickers",
                        "banner": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/m3ame_512.webp",
                        "icon": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/m3ame_512.webp",
                        "children": []
                    }
                ]
            }
        ],
        "pagination": {
            "total": 3,
            "count": 3,
            "limit": 15,
            "current_page": 1,
            "total_pages": 1
        }
    },
    "message": "Success",
    "status_code": 200
}
```

### Features:

* The Categories API allows users to retrieve a list of product categories and sub categories available in the e-commerce application.
* Each category object includes essential details such as ID, name, banner and icon, providing users with a clear understanding of each category.
* Categories can be associated with tags, making it easier for users to find specific product types within a category.

### Usage:

The Categories API is used to present a comprehensive list of product categories to users, enabling them to navigate through different product offerings efficiently. Users can explore various categories and find products that match their preferences.
