Create New Product Category

With Payiano Create Product Category, you can make a new category for your products. Imagine you start selling accessories like hats and scarves, but you don’t have a category for them. You can use this endpoint to create a new category called 'Accessories'. This helps keep your new items organized and makes it easier for you and your customers to find them.

POST/product_categories
Sandbox: https://api.payiano.dev/v1/product_categories
Live: https://api.payiano.com/v1/product_categories
Security
  • Authorization header with access token is required to access this endpoint: Bearer ACCESS-TOKEN
  • Your access token should be associated to this permission product_categories_create
Request
Request body schema:
application/json
Query parameters:
includes
Type: array_of_enums|null
Possible values:
[
"product_category.products_count", "product_category.categories_count", "product_category.parent_category", "product_category.parent_category.products_count", "product_category.parent_category.categories_count", "product_category.parent_category.metadata", "product_category.metadata" ]

A list of additional product category relations to return, if available. Feel free to send the relations you would like to return with every item. See Including Resources to better understand how this is working.

Request body:
name
required
Type: string
Min: 1
Max: 255

The attribute is like a title that succinctly captures the essence of what the category represents. For example, if you have a category for sports shoes, the name could be something straightforward like "Sports Shoes." This attribute is crucial because it's the first thing customers and staff see. It should be clear, concise, and reflective of the contents of the category. A well-chosen name helps users quickly understand what types of products they can expect to find under this category, enhancing their browsing and shopping experience. Please notice that duplicate values are not allowed.

is_active
Type: boolean
Default: true

This value indicates whether the product category is active or not. This flag can be used to control the product category's availability in runtime environments or listings without deleting or removing the product category from records. A true value means the product category is active and functioning, while a false value implies that the product category is deactivated or not in use.

reference_id
Type: string|null
Max: 50

It's a unique identifier assigned to each product category. It's primary role is to distinguish one product category from another, ensuring that each product category can be individually tracked and managed without any confusion. Please notice that duplicate values are not allowed and it's allowed to use alpha dash only [A-Za-z0-9-_]. The reference_id value is used to Identify Resource when you consume any product category endpoint with sending identify_by query parameter with value reference_id.

slug
Type: string
Min: 1
Max: 255

This attribute is a URL-friendly version of the category name. It's used in the web address to help users and search engines find the category page easily. For instance, if you have a category named "Sports Shoes" the slug might be "sports-shoes". It's a simplified version of the name and without spaces. Slugs are important for website navigation and SEO . A well-crafted slug makes it easier for customers to remember and type the URL, and it helps improve the category's visibility in search engine results. Please notice that duplicate values are not allowed and it's allowed to use alpha dash only [A-Za-z0-9-_]. If the slug value is not provided, the Payiano system automatically generates one based on the provided name attribute. This auto-generation of the slug ensures consistency and convenience, eliminating the need for manual slug entry.

parent_category_id
Type: ulid|null

This attribute establishes a hierarchical relationship between categories. It's used to show that one category is a subcategory of another. For example, if you have a main category called "Footwear" and a subcategory called "Sports Shoes" the "Sports Shoes" category would have "Footwear" as its parent category. The parent_category_id attribute would be the unique identifier of the "Footwear" category. This attribute is crucial for organizing categories in a structured and logical manner. It helps users navigate through different levels of categories smoothly, making it easier to browse products and understand their classification.

description
Type: string|null
Min: 1
Max: 10000

This attribute provides more detailed information about the product category. It's like a brief paragraph that explains what the category is about and what it includes. This attribute is important because it gives context and depth to the category name, offering users a clearer understanding of what's included and potentially the types of customers the category is aimed at. A good description can also help in search optimization, making it easier for customers to find what they're looking for through search engines.

metadata
Type: object|null

The product category metadata model details. Metadata serves as a tool for keeping extra, organized details about a resource. For example, you can use it to store a user's preferences like prefered color, notes or any other data that aids in personalizing services, improving customer relations, or optimizing internal workflows. This information isn't utilized by Payiano – meaning it's not involved in authorizing or declining transactions and remains invisible to your users. Its value is entirely private for your internal use, and we ensure it remains confidential, not shared with any external parties.

info
Type: array_of_objects
Max: 50

This array consists of objects, each containing a key and a value. These pairs of key-value are structured in a way that's more suitable for programmatic access. You can add up to 50 objects.

key
required
Type: string
Min: 1
Max: 50

It's a unique identifier to avoid confusion or data overlap. The keys serve as identifiers for the corresponding values, making it easier to retrieve specific pieces of information as needed.

value
required
Type: string
Min: 1
Max: 255

The value is the actual data associated with that key. It could be a simple string, a number, a URL, or any other data format that conveys the necessary information.

list
Type: array_of_strings
Max: 50

The list attribute is particularly useful for scenarios where the data needs to be presented in a straightforward, unstructured format. It's ideal for quick overviews, simple data logging, or when the information does not require the more complex organization that nested JSON objects provide. Please notice that duplicate values are not allowed, you can add up to 50 item and the max list item length is 255 characters.

Response
201
Response schema:
application/json
Response body:
product_category
Type: object

The product category model details.

id
Type: ulid
Length: 26

The unique ID assigned to each product category which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every product category. This ULID is automatically created by our system and is used to uniquely identify and track each product category in our database.

name
Type: string
Min: 1
Max: 255

The attribute is like a title that succinctly captures the essence of what the category represents. For example, if you have a category for sports shoes, the name could be something straightforward like "Sports Shoes." This attribute is crucial because it's the first thing customers and staff see. It should be clear, concise, and reflective of the contents of the category. A well-chosen name helps users quickly understand what types of products they can expect to find under this category, enhancing their browsing and shopping experience. Please notice that duplicate values are not allowed.

is_active
Type: boolean
Default: true

This value indicates whether the product category is active or not. This flag can be used to control the product category's availability in runtime environments or listings without deleting or removing the product category from records. A true value means the product category is active and functioning, while a false value implies that the product category is deactivated or not in use.

reference_id
Type: string|null
Max: 50

It's a unique identifier assigned to each product category. It's primary role is to distinguish one product category from another, ensuring that each product category can be individually tracked and managed without any confusion. Please notice that duplicate values are not allowed and it's allowed to use alpha dash only [A-Za-z0-9-_]. The reference_id value is used to Identify Resource when you consume any product category endpoint with sending identify_by query parameter with value reference_id.

slug
Type: string
Min: 1
Max: 255

This attribute is a URL-friendly version of the category name. It's used in the web address to help users and search engines find the category page easily. For instance, if you have a category named "Sports Shoes" the slug might be "sports-shoes". It's a simplified version of the name and without spaces. Slugs are important for website navigation and SEO . A well-crafted slug makes it easier for customers to remember and type the URL, and it helps improve the category's visibility in search engine results. Please notice that duplicate values are not allowed and it's allowed to use alpha dash only [A-Za-z0-9-_]. If the slug value is not provided, the Payiano system automatically generates one based on the provided name attribute. This auto-generation of the slug ensures consistency and convenience, eliminating the need for manual slug entry.

parent_category_id
Type: ulid|null

This attribute establishes a hierarchical relationship between categories. It's used to show that one category is a subcategory of another. For example, if you have a main category called "Footwear" and a subcategory called "Sports Shoes" the "Sports Shoes" category would have "Footwear" as its parent category. The parent_category_id attribute would be the unique identifier of the "Footwear" category. This attribute is crucial for organizing categories in a structured and logical manner. It helps users navigate through different levels of categories smoothly, making it easier to browse products and understand their classification.

description
Type: string|null
Min: 1
Max: 10000

This attribute provides more detailed information about the product category. It's like a brief paragraph that explains what the category is about and what it includes. This attribute is important because it gives context and depth to the category name, offering users a clearer understanding of what's included and potentially the types of customers the category is aimed at. A good description can also help in search optimization, making it easier for customers to find what they're looking for through search engines.

is_deleted
Type: boolean
Default: false

This value indicates whether the product category is deleted or not. This flag can be used to control the product category's availability in runtime without actual deleting or removing the product category from records. A true value means the product category is deleted, while a false value implies that the product category is not deleted and functioning.

products_count
Type: integer

This attribute represents the total number of products that directly fall under a specific product category. This is a numerical value that provides immediate insight into the size and scope of each category.

categories_count
Type: integer

This attribute is a numerical value that represents the total number of direct child categories contained within a specific parent product category. Essentially, it acts as a counter for the subcategories under a given category.

parent_category
Type: object

The attribute is a reference to the category that a given category falls under in the hierarchy of product categorization. It's essentially a link to the 'parent' category of which the current category is a subcategory.

id
Type: ulid
Length: 26

The unique ID assigned to each product category which is generated by our system using the ULID format. Each ID is precisely 26 characters long, ensuring a unique and consistent identifier for every product category. This ULID is automatically created by our system and is used to uniquely identify and track each product category in our database.

name
Type: string
Min: 1
Max: 255

The attribute is like a title that succinctly captures the essence of what the category represents. For example, if you have a category for sports shoes, the name could be something straightforward like "Sports Shoes." This attribute is crucial because it's the first thing customers and staff see. It should be clear, concise, and reflective of the contents of the category. A well-chosen name helps users quickly understand what types of products they can expect to find under this category, enhancing their browsing and shopping experience. Please notice that duplicate values are not allowed.

is_active
Type: boolean
Default: true

This value indicates whether the product category is active or not. This flag can be used to control the product category's availability in runtime environments or listings without deleting or removing the product category from records. A true value means the product category is active and functioning, while a false value implies that the product category is deactivated or not in use.

reference_id
Type: string|null
Max: 50

It's a unique identifier assigned to each product category. It's primary role is to distinguish one product category from another, ensuring that each product category can be individually tracked and managed without any confusion. Please notice that duplicate values are not allowed and it's allowed to use alpha dash only [A-Za-z0-9-_]. The reference_id value is used to Identify Resource when you consume any product category endpoint with sending identify_by query parameter with value reference_id.

slug
Type: string
Min: 1
Max: 255

This attribute is a URL-friendly version of the category name. It's used in the web address to help users and search engines find the category page easily. For instance, if you have a category named "Sports Shoes" the slug might be "sports-shoes". It's a simplified version of the name and without spaces. Slugs are important for website navigation and SEO . A well-crafted slug makes it easier for customers to remember and type the URL, and it helps improve the category's visibility in search engine results. Please notice that duplicate values are not allowed and it's allowed to use alpha dash only [A-Za-z0-9-_]. If the slug value is not provided, the Payiano system automatically generates one based on the provided name attribute. This auto-generation of the slug ensures consistency and convenience, eliminating the need for manual slug entry.

parent_category_id
Type: ulid|null

This attribute establishes a hierarchical relationship between categories. It's used to show that one category is a subcategory of another. For example, if you have a main category called "Footwear" and a subcategory called "Sports Shoes" the "Sports Shoes" category would have "Footwear" as its parent category. The parent_category_id attribute would be the unique identifier of the "Footwear" category. This attribute is crucial for organizing categories in a structured and logical manner. It helps users navigate through different levels of categories smoothly, making it easier to browse products and understand their classification.

description
Type: string|null
Min: 1
Max: 10000

This attribute provides more detailed information about the product category. It's like a brief paragraph that explains what the category is about and what it includes. This attribute is important because it gives context and depth to the category name, offering users a clearer understanding of what's included and potentially the types of customers the category is aimed at. A good description can also help in search optimization, making it easier for customers to find what they're looking for through search engines.

is_deleted
Type: boolean
Default: false

This value indicates whether the product category is deleted or not. This flag can be used to control the product category's availability in runtime without actual deleting or removing the product category from records. A true value means the product category is deleted, while a false value implies that the product category is not deleted and functioning.

products_count
Type: integer

This attribute represents the total number of products that directly fall under a specific product category. This is a numerical value that provides immediate insight into the size and scope of each category.

categories_count
Type: integer

This attribute is a numerical value that represents the total number of direct child categories contained within a specific parent product category. Essentially, it acts as a counter for the subcategories under a given category.

metadata
Type: object|null

The product category metadata model details. Metadata serves as a tool for keeping extra, organized details about a resource. For example, you can use it to store a user's preferences like prefered color, notes or any other data that aids in personalizing services, improving customer relations, or optimizing internal workflows. This information isn't utilized by Payiano – meaning it's not involved in authorizing or declining transactions and remains invisible to your users. Its value is entirely private for your internal use, and we ensure it remains confidential, not shared with any external parties.

info
Type: array_of_objects
Max: 50

This array consists of objects, each containing a key and a value. These pairs of key-value are structured in a way that's more suitable for programmatic access. You can add up to 50 objects.

key
Type: string
Min: 1
Max: 50

It's a unique identifier to avoid confusion or data overlap. The keys serve as identifiers for the corresponding values, making it easier to retrieve specific pieces of information as needed.

value
Type: string
Min: 1
Max: 255

The value is the actual data associated with that key. It could be a simple string, a number, a URL, or any other data format that conveys the necessary information.

list
Type: array_of_strings
Max: 50

The list attribute is particularly useful for scenarios where the data needs to be presented in a straightforward, unstructured format. It's ideal for quick overviews, simple data logging, or when the information does not require the more complex organization that nested JSON objects provide. Please notice that duplicate values are not allowed, you can add up to 50 item and the max list item length is 255 characters.

created_at
Type: datetime

The created datetime of the product category. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

updated_at
Type: datetime

The updated datetime of the product category. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

deleted_at
Type: datetime|null

The deleted datetime of the product category. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

metadata
Type: object|null

The product category metadata model details. Metadata serves as a tool for keeping extra, organized details about a resource. For example, you can use it to store a user's preferences like prefered color, notes or any other data that aids in personalizing services, improving customer relations, or optimizing internal workflows. This information isn't utilized by Payiano – meaning it's not involved in authorizing or declining transactions and remains invisible to your users. Its value is entirely private for your internal use, and we ensure it remains confidential, not shared with any external parties.

info
Type: array_of_objects
Max: 50

This array consists of objects, each containing a key and a value. These pairs of key-value are structured in a way that's more suitable for programmatic access. You can add up to 50 objects.

key
Type: string
Min: 1
Max: 50

It's a unique identifier to avoid confusion or data overlap. The keys serve as identifiers for the corresponding values, making it easier to retrieve specific pieces of information as needed.

value
Type: string
Min: 1
Max: 255

The value is the actual data associated with that key. It could be a simple string, a number, a URL, or any other data format that conveys the necessary information.

list
Type: array_of_strings
Max: 50

The list attribute is particularly useful for scenarios where the data needs to be presented in a straightforward, unstructured format. It's ideal for quick overviews, simple data logging, or when the information does not require the more complex organization that nested JSON objects provide. Please notice that duplicate values are not allowed, you can add up to 50 item and the max list item length is 255 characters.

created_at
Type: datetime

The created datetime of the product category. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

updated_at
Type: datetime

The updated datetime of the product category. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

deleted_at
Type: datetime|null

The deleted datetime of the product category. This attribute can be formatted as an ISO 8601 string or a UNIX timestamp in milliseconds, depending on the preferred datetime format specified in the request header (e.g., 2024-08-04T14:22:01Z or 1722572118554). By default, the format is UNIX timestamp in milliseconds.

Response sample:
1
{
2
"product_category": {
3 "id": "01hqjp622m9rykncnmtsyey5d8", 4 "name": "Sports Shoes", 5 "is_active": true, 6 "reference_id": "7193edd2-7574-3b76-9103-e0e37580129b", 7 "slug": "sports-shoes", 8 "parent_category_id": null, 9 "description": "Featuring top brands and the latest technology for comfort and performance.", 10 "is_deleted": false, 11 "products_count": 0, 12 "categories_count": 0, 13
"parent_category": {
14 "id": "01hqjp6ftspfxgk2ews9y7wfc2", 15 "name": "Footwear", 16 "is_active": true, 17 "reference_id": "f58bc0b0-7d1a-395b-88c5-a17a380b3885", 18 "slug": "footwear", 19 "parent_category_id": null, 20 "description": "A wide range of athletic footwear suitable for various sports activities.", 21 "is_deleted": false, 22 "products_count": 0, 23 "categories_count": 1, 24
"metadata": {
25
"info": [
26
{
27 "key": "Company name", 28 "value": "Pyngy" 29 } 30 ], 31
"list": [
32 "Cairo, Nasr City, 7th District, Building 12 floor 5" 33 ] 34 }, 35 "created_at": "1722572118554", 36 "updated_at": "1722572118554", 37 "deleted_at": null 38 }, 39
"metadata": {
40
"info": [
41
{
42 "key": "Company name", 43 "value": "Pyngy" 44 } 45 ], 46
"list": [
47 "Cairo, Nasr City, 7th District, Building 12 floor 5" 48 ] 49 }, 50 "created_at": "1722572118554", 51 "updated_at": "1722572118554", 52 "deleted_at": null 53 } 54}