Skip to main content
POST
/
categories
Create Category
curl --request POST \
  --url https://api.fabric.inc/v3/categories \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "parentCategoryId": "507f1f77bcf86cd799439011",
  "name": "Color",
  "localizedProperties": {
    "en-US": {
      "name": "Color"
    },
    "en-IN": {
      "name": "Colour"
    }
  },
  "isLocalizable": true,
  "categoryAttributes": [
    {
      "id": "607f1f77bcf86cd799439011",
      "value": "blue"
    }
  ],
  "productAttributes": [
    {
      "id": "557f1f77bcf86cd799439015",
      "isMandatory": true
    }
  ]
}'
{
  "id": "53184766610c0e32a86d875",
  "name": "Color",
  "localizedProperties": {
    "en-US": {
      "name": "Color"
    },
    "en-IN": {
      "name": "Colour"
    }
  },
  "isLocalizable": true,
  "isRoot": true,
  "isLeaf": false,
  "hasProducts": true,
  "categoryAttributes": [
    {
      "id": "64184766610c0e32a86d8758",
      "name": "color",
      "localizedProperties": {
        "en-US": {
          "name": "Color"
        },
        "en-IN": {
          "name": "Colour"
        }
      },
      "isLocalizable": true,
      "isInherited": true,
      "type": "TEXT",
      "validation": {
        "dateFormat": "MM-DD-YYYY"
      },
      "value": "blue"
    }
  ],
  "productAttributes": [
    {
      "id": "33184766610c0e32a86d8759",
      "name": "Color",
      "localizedProperties": {
        "en-US": {
          "name": "Color"
        },
        "en-IN": {
          "name": "Colour"
        }
      },
      "isLocalizable": true,
      "isInherited": true,
      "type": "TEXT",
      "isMandatory": true
    }
  ],
  "productIds": [
    "64184766610c0e32a86d8758"
  ],
  "children": [
    {
      "id": "33184766610c0e32a86d8759",
      "name": "Color",
      "localizedProperties": {
        "en-US": {
          "name": "Color"
        },
        "en-IN": {
          "name": "Colour"
        }
      },
      "isLocalizable": true,
      "isLeaf": false,
      "hasProducts": true
    }
  ],
  "updatedBy": "test@eamil.com",
  "updatedAt": "2023-04-20T10:24:36.162Z",
  "createdAt": "2021-04-20T10:24:36.162Z"
}

Authorizations

Authorization
string
header
required

S2S access token (JWT) from fabric Identity service (during Login)

Headers

x-fabric-tenant-id
string

A header used by fabric to identify the tenant making the request. You must include tenant id in the authentication header for an API request to access any of fabric’s endpoints. You can retrieve the tenant id , which is also called account id, from Copilot. This header is required.

Example:

"517fa9dfd42d8b00g1o3k312"

x-fabric-request-id
string

Unique request ID

Example:

"263e731c-45c8-11ed-b878-0242ac120002"

Body

application/json

Details to create category

parentCategoryId
string

24-character system-generated ID of parent category

Example:

"507f1f77bcf86cd799439011"

name
string

Non-localized category name

Example:

"Color"

localizedProperties
object

Localized properties Localized details

Example:
{
"en-US": { "name": "Color" },
"en-IN": { "name": "Colour" }
}
isLocalizable
boolean

true: Category name is translated into different languages or localized for different regions. <br /> false: Category name isn't localized. Note: Refer to localizedProperties to get relevant details based on locale.

Example:

true

categoryAttributes
object[]

Details of attributes assigned to a category

productAttributes
object[]

List attributes applicable for all products in the specified category

Response

OK

Category details

id
string

24-character system-generated category ID

Example:

"53184766610c0e32a86d875"

name
string

Non-localized category name

Example:

"Color"

localizedProperties
object

Localized properties of category Localized details

Example:
{
"en-US": { "name": "Color" },
"en-IN": { "name": "Colour" }
}
isLocalizable
boolean

true: Category name is translated into different languages or localized for different regions <br /> false: Category name isn't localized Note: Refer to localizedProperties to get relevant details based on locale

Example:

true

isRoot
boolean

true: This is a root category <br /> false: This isn't a root category

Example:

true

isLeaf
boolean

true: This is the last category of the branch with no further children categories <br /> false: This isn't the last category of the branch and has children categories

Example:

false

hasProducts
boolean

true: This is the leaf category of the branch which has some products in it <br /> false: This branch doesn't have any direct products assigned to it

Example:

true

categoryAttributes
object[]

Attributes assigned to the specified category

productAttributes
object[]

Attributes assigned for all products in the specified category.

productIds
string[]

System-generated 24-character product IDs associated with a category

children
object[]

Immediate children of the specified category

updatedBy
string

Email of user who last update the category

Example:

"test@eamil.com"

updatedAt
string

Time of last update to category

Example:

"2023-04-20T10:24:36.162Z"

createdAt
string

Time of category creation

Example:

"2021-04-20T10:24:36.162Z"