Edit metadata fields
Edit metadata fields
Edit metadata fields in batches. Only display_label, description, and ai_search_filter can be changed. Properties included in the request are updated; omitted properties remain unchanged. You can edit up to 50 fields per request.
Batch rules:
You can edit up to 50 fields per request. If the request exceeds this limit, the entire batch is rejected.
Duplicate IDs within the request: only the first item is retained; subsequent duplicates are marked as failed.
Request Method
PUT
Endpoint
https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/update
Authentication
For authentication details, see API Overview.
Request
Request Example
curl -X PUT 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/update' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"fields": [
{
"id": "665f1c8a9b2e4d001a3f0001",
"display_label": "Document category",
"description": "Business category of the document",
"ai_search_filter": false
}
]
}'
curl -X PUT 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/update' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"fields": [
{
"id": "665f1c8a9b2e4d001a3f0001",
"display_label": "Document category",
"description": "Business category of the document",
"ai_search_filter": false
}
]
}'
This code block in the floating window
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer ${API Key} | Authenticate with Authorization: Bearer ${API Key}. Obtain the API Key from the API Keys page. |
| Content-Type | application/json | Data type, set to application/json. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| fields | Array<Object> | Yes | A list of fields to edit, up to 50 at a time. |
| id | String | Yes | Metadata field ID, used to locate the field. |
| display_label | String | No | New display name, up to 64 characters. Updated only when provided and must be unique. |
| description | String | No | New field description, up to 50 characters. Updated only when provided. |
| ai_search_filter | Boolean | No | New AI Search filter setting. Updated only when provided. |
Response
Response Example
{
"success_count": 1,
"failure_count": 2,
"results": [
{
"id": "665f1c8a9b2e4d001a3f0001",
"success": true
},
{
"id": "665f1c8a9b2e4d001a3f0002",
"success": false,
"error_message": "display_label already exists"
},
{
"id": "665f1c8a9b2e4d001a3f0001",
"success": false,
"error_message": "duplicate id in request"
}
]
}
{
"success_count": 1,
"failure_count": 2,
"results": [
{
"id": "665f1c8a9b2e4d001a3f0001",
"success": true
},
{
"id": "665f1c8a9b2e4d001a3f0002",
"success": false,
"error_message": "display_label already exists"
},
{
"id": "665f1c8a9b2e4d001a3f0001",
"success": false,
"error_message": "duplicate id in request"
}
]
}
This code block in the floating window
Success Response
| Field | Type | Description |
|---|---|---|
| success_count | Integer | Number of successfully edited fields. |
| failure_count | Integer | The number of fields that failed to be edited. |
| results | Array<Object> | Field-by-field results, returned in request order. |
| id | String | Field ID. |
| success | Boolean | Whether the editing was successful. |
| error_message | String | Reason for failure: display_label already exists (the display name conflicts with an existing one) / duplicate id in request (id is repeated in the request) / field not found (the field does not exist). |
Error Response
| Field | Type | Description |
|---|---|---|
| code | Integer | Error code. |
| message | String | Error details. |
