Create a Question Category

Create a Question Category

Create a top-level category or add a child to an existing top-level category.

Send requests to create siblings with the same name sequentially to avoid duplicates from concurrent writes.

A child category’s enabled setting controls whether it participates in automatic matching for new questions. Disabling it keeps it in the directory with enabled: false and preserves existing matches on past questions.

Send only name to create an empty top-level category. Omit enabled or set it to true; setting it to false returns 40000.

When a parent already has 10 children, adding another returns 40000. Disabled children count toward the limit. Deleting a child frees a slot; existing children can still be edited at the limit. The count is checked before insertion, so send creates sequentially near the limit.

Request Method

POST

Request URL

https://api-sg.gptbots.ai/v1/question-categories/create

Authentication

Use the API key for the Agent. The project plan must include API integration and issue recognition. Use the endpoint for your organization's data center. API Overview

Request Frequency

Requests share the project's per-minute Analytics API quota. Exceeding it returns 40008.

Request

Request Example

curl -X POST "https://api-sg.gptbots.ai/v1/question-categories/create" \ -H "Authorization: Bearer your_apikey" \ -H "Content-Type: application/json" \ -d '{ "name": "Refund status", "parent_id": "66a1b2c3d4e5f60001000001", "enabled": true, "description": "Questions about when a refund will arrive" }'
                      
                      curl -X POST "https://api-sg.gptbots.ai/v1/question-categories/create" \
  -H "Authorization: Bearer your_apikey" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Refund status",
  "parent_id": "66a1b2c3d4e5f60001000001",
  "enabled": true,
  "description": "Questions about when a refund will arrive"
}'

                    
This code block in the floating window

Request Headers

Field Type Description
Authorization string Bearer your_apikey
Content-Type string application/json

Request Parameters

Top-level names must be unique within the Agent; child names must be unique within their parent. Different parents may have children with the same name.

Field Type Required Description
name string Yes Category name, 1–50 characters after trimming.
parent_id string No Parent ID. Omit or pass null for a top-level category. Otherwise specify a top-level category belonging to this Agent.
enabled boolean No Children are enabled by default. For a top-level category, omit this field or pass true.
description string No Description for a child only, up to 100 characters. Omit for a top-level category.

Response

Response Example

{ "id": "66a1b2c3d4e5f60001000002", "name": "Refund status", "level": 2, "parent_id": "66a1b2c3d4e5f60001000001", "enabled": true, "description": "Questions about when a refund will arrive", "children": [] }
                      
                      {
  "id": "66a1b2c3d4e5f60001000002",
  "name": "Refund status",
  "level": 2,
  "parent_id": "66a1b2c3d4e5f60001000001",
  "enabled": true,
  "description": "Questions about when a refund will arrive",
  "children": []
}

                    
This code block in the floating window

Successful Response

Field Type Description
id string Category ID
name string Category name
level int Level: 1 for a top-level category, 2 for a child.
parent_id string / null Parent ID; null at the top level.
enabled boolean Whether the category is enabled
description string / null Description for a child only, up to 100 characters. Omit for a top-level category.
children array Direct children. Empty for a leaf.

Failed Response

Field Type Description
code int Error code.
message string Error description information.

Error Codes

Code Message
40000 Invalid parameters
40008 Analytics API rate limit exceeded
40100 The Agent does not have access to the resource
40101 Missing Authorization header
40127 Invalid Agent API key
20055 API access is disabled for the Agent
40353 Plan lacks required features
200264 A sibling category already has this name
50000 Internal server error