Back to Home

Documentation

Everything you need to know to get the most out of DiscountFlow. Find guides, tutorials, and API references.

Quick Start
API References
FAQs
API References
/
API Endpoints
/
Create product category

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

NameTypeRequiredDescription
input.nameStringRequiredCategory name
input.base_priceFloatOptionalBase price for this category
input.descriptionStringOptionalCategory description
input.custom_fieldsJSONOptionalArbitrary 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."]
        }
      }
    }
  ]
}