Create product category
Add new product category
createProductCategory
Creates a new product category. Returns the created ProductCategory object.
Method
POST
Path
/graphql
Authentication
Bearer Token
Request Body Schema
Content-type: application/json
Variables
| Name | Type | Required | Description |
|---|---|---|---|
input.name | String | Required | Category name |
input.base_price | Float | Optional | Base price for this category |
input.description | String | Optional | Category description |
input.custom_fields | JSON | Optional | Arbitrary additional data |
Example Payload
{
"query": "mutation ($input: CreateProductCategoryInput!) { createProductCategory(input: $input) { id name base_price description created_at } }",
"variables": {
"input": {
"name": "Sensors",
"base_price": 50.0,
"description": "Industrial sensor products"
}
}
}
Response
Returns the newly created ProductCategory object.
Example Response
{
"data": {
"createProductCategory": {
"id": "01JNQX4KZB7WNVR3MPXT6A0DYE",
"name": "Sensors",
"base_price": 50.0,
"description": "Industrial sensor products",
"created_at": "2026-06-03 08:00:00"
}
}
}
Errors
Validation errors are returned when required fields are missing.
Example Response
{
"errors": [
{
"message": "Validation failed for the field [createProductCategory].",
"extensions": {
"validation": {
"input.name": ["The input.name field is required."]
}
}
}
]
}
Method
POSTPath
/graphql