--- url: https://docs.youcan.shop/store-admin/categories/create.md --- # Create a Category Endpoint: `https://api.youcan.shop/categories` Method: `POST` ## Required Scopes * `edit-categories` ## Parameters | Param Name | Param Type | Description | Required | | -------------------- | ------------- | --------------------- | -------- | | `name` | string | Category name | yes | | `slug` | string | Category slug | no | | `description` | string | Category description | no | | `image` | File | Category image | no | | `parent_id` | uuid | Categorie's parent id | no | | `show_on_collection` | boolean | Category visibility | no | | `meta` | [Meta](#meta) | Category metadata | no | ## Meta | Param Name | Param Type | Description | Required | | ------------- | ---------- | ------------------------- | -------- | | `title` | string | category meta title | no | | `description` | string | category meta description | no | | `images` | File\[] | category meta images | yes | ## Response \[422] Unprocessable Entity ```json // Returned when category's parent is a child category { "status": 422, "code": "", "detail": "The parent category is not a top level category", "meta": [] } ``` \[201] Created ```json { "id": "dc20f000-cea4-4205-86be-dbec477bd958", "name": "test API", "image": "stores/d5feb68cb828b2f4ffee99ad61cf71cf/category/D8xnACeovM30k088bU2M6YDovXsKiq67ckwBaC58.png", "slug": "test-aypiay", "show_on_collection": false, "public_url": null, "description": "this is a description", "has_parent": false, "parent_id": null, "is_default": false, "images": [], "depth": 0, "meta": { "title": "test API", "description": "this is a description", "images": [ "stores/d5feb68cb828b2f4ffee99ad61cf71cf/category/CWn50KJRDEZ7VLqURlt0YajLw4ZmLfsROajePbPO.png", "stores/d5feb68cb828b2f4ffee99ad61cf71cf/category/me1dvG3MiVOgMBlb1vt7tkrzdb8gAk9oq47NIasZ.png" ], "images_urls": [] }, "created_at": "2021-04-13T18:09:57+00:00", "updated_at": "2021-04-13T18:09:57+00:00", "deleted_at": null, "parent": [] } ```