# Categories

These keys are specified to use as defined in docs, they are case-sensitive. Any change in these keys may cause issues during data sync&#x20;

### Authentication&#x20;

\
Use your token provided inside converted.in after on boarding process to authenticate the request using form-data body

![](https://1119750375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7X1MfKrY7KCRp85qrV%2Fuploads%2F95Uk5AjrR567giaVG8rG%2Fimage.png?alt=media\&token=54cef01f-76d4-4a34-9148-0c6caa57dcf8)

## Categories API

<mark style="color:green;">`POST`</mark> `YOUR_BASEURL/convertedin/categories`

#### Request Body

| Name                                        | Type    | Description                         |
| ------------------------------------------- | ------- | ----------------------------------- |
| per\_page<mark style="color:red;">\*</mark> | integer | limit per page (default 100)        |
| page<mark style="color:red;">\*</mark>      | integer | page number                         |
| token<mark style="color:red;">\*</mark>     | string  | Fixed token provided by Convertedin |

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

```
{
    "current_page": 1, 
    "data": [ 
        {
            "id": 1,
            "title": "Uncategorized",
            "handle": "uncategorized",
            "content": "",
            "subcategories": []  // No subcategories for "Uncategorized"
        }, 
        {
            "id": 2,
            "title": "For him",
            "handle": "for-him",
            "content": "",
            "subcategories": [
                {
                    "id": 3,
                    "title": "Accessories",
                    "handle": "accessories",
                    "content": "",
                    "subcategories": []  // You can also have nested subcategories here
                },
                {
                    "id": 4,
                    "title": "Clothing",
                    "handle": "clothing",
                    "content": "",
                    "subcategories": [
                        {
                            "id": 5,
                            "title": "Shirts",
                            "handle": "shirts",
                            "content": ""
                        },
                        {
                            "id": 6,
                            "title": "Jackets",
                            "handle": "jackets",
                            "content": ""
                        }
                    ]
                }
            ]
        }
    ],
    "from": 1, // start for current page
    "last_page": 23, // last available page 
    "per_page": 100, // limit per page
    "to": 100,  // end for current page
    "total": 2220 // total number of categories
}

```

{% endtab %}
{% endtabs %}

| id            | category id linked to your products                                                     | **Required** |
| ------------- | --------------------------------------------------------------------------------------- | ------------ |
| title         | category name                                                                           | **Required** |
| handle        | category slug or url                                                                    | Not required |
| content       | category description or brief                                                           | Not required |
| subcategories | Each category object has a subcategories key, which is an array of subcategory objects. | **Required** |
| available     | is category publicly available                                                          | **Required** |
| published\_at | the date that the category was available on it.                                         | **Required** |

### Response

```json
{
    "data": [
        {
            "id": 841564295,
            "taxonomy": "Category > Sub Category",
            "handle": "ipods",
            "title": "IPods",
            "updated_at": "2008-02-01T19:00:00-05:00",
            "content": "<p>The best selling ipod ever</p>",
            "published_at": "2008-02-01T19:00:00-05:00",
            "available": true,
            "image": {
                "created_at": "2021-10-01T17:17:03-04:00",
                "alt": "MP3 Player 8gb",
                "width": 123,
                "height": 456,
                "src": "https://cdn.shopify.com/s/files/1/0006/9093/3842/collections/ipod_nano_8gb.jpg?v=1633123023"
            },
            "subcategories": [
                {
                    "id": 841564296,
                    "taxonomy": "Category > Sub Category > Sub Sub Category",
                    "handle": "ipod_nano",
                    "title": "IPod Nano",
                    "updated_at": "2008-03-01T19:00:00-05:00",
                    "content": "<p>Compact iPod Nano</p>",
                    "published_at": "2008-03-01T19:00:00-05:00",
                    "available": true,
                    "image": {
                        "created_at": "2021-10-01T18:00:00-04:00",
                        "alt": "iPod Nano",
                        "width": 100,
                        "height": 200,
                        "src": "https://cdn.shopify.com/s/files/1/0006/9093/3842/collections/ipod_nano.jpg?v=1633123024"
                    }
                }
            ]
        },
        {
            "id": 395646240,
            "taxonomy": "Category > Sub Category",
            "handle": "ipods_two",
            "title": "IPods Two",
            "updated_at": "2008-02-01T19:00:00-05:00",
            "body_html": "<p>The best selling ipod ever. Again</p>",
            "published_at": "2008-02-01T19:00:00-05:00",
            "sort_order": "manual",
            "template_suffix": null,
            "available": true,
            "image": null,
            "subcategories": []
        }
    ],
    "total": 1000,
    "per_page": 100,
    "current_page": 1,
    "last_page": 10,
    "from": 1,
    "to": 100
}

```
