Update a Question Category

Update a Question Category

Update a single category. Supply at least one of name, enabled or description. Omitted fields retain their values.

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.

To rename a top-level category, send id and name. Supplying either enabled: true or enabled: false returns 40000 and the rename is not applied. For a child you can update name, enabled or description.

Request Method

PUT

Request URL

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

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 PUT "https://api-sg.gptbots.ai/v1/question-categories/update" \ -H "Authorization: Bearer your_apikey" \ -H "Content-Type: application/json" \ -d '{ "id": "66a1b2c3d4e5f60001000002", "enabled": false }'
                      
                      curl -X PUT "https://api-sg.gptbots.ai/v1/question-categories/update" \
  -H "Authorization: Bearer your_apikey" \
  -H "Content-Type: application/json" \
  -d '{
  "id": "66a1b2c3d4e5f60001000002",
  "enabled": false
}'

                    
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
id string Yes Category ID
name string No Category name, 1–50 characters after trimming.
enabled boolean No Only child categories can be enabled or disabled. Omit this field when updating a top-level category.
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": false, "description": "Questions about when a refund will arrive", "children": [] }
                      
                      {
  "id": "66a1b2c3d4e5f60001000002",
  "name": "Refund status",
  "level": 2,
  "parent_id": "66a1b2c3d4e5f60001000001",
  "enabled": false,
  "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