Skip to main content
PATCH
/
datasets
/
tags
Update Knowledge Tag
curl --request PATCH \
  --url https://{api_base_url}/datasets/tags \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "tag_id": "<string>",
  "name": "<string>"
}
'
import requests

url = "https://{api_base_url}/datasets/tags"

payload = {
"tag_id": "<string>",
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({tag_id: '<string>', name: '<string>'})
};

fetch('https://{api_base_url}/datasets/tags', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/datasets/tags",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'tag_id' => '<string>',
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{api_base_url}/datasets/tags"

payload := strings.NewReader("{\n \"tag_id\": \"<string>\",\n \"name\": \"<string>\"\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://{api_base_url}/datasets/tags")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tag_id\": \"<string>\",\n \"name\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{api_base_url}/datasets/tags")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tag_id\": \"<string>\",\n \"name\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d",
  "name": "Product Docs",
  "type": "knowledge",
  "binding_count": "0"
}
{
"status": 400,
"code": "invalid_param",
"message": "Tag name already exists"
}
{
"status": 404,
"code": "not_found",
"message": "Tag not found"
}

Authorizations

Authorization
string
header
required

Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).

Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).

Body

application/json
tag_id
string
required

ID of the tag to rename. See List Knowledge Type Tags.

name
string
required

New name for the tag. Must be unique within the workspace.

Required string length: 1 - 50

Response

Tag updated successfully.

id
string

Tag identifier.

name
string

Tag display name.

type
string

Tag type. Always knowledge for knowledge base tags.

binding_count
string | null

Number of knowledge bases bound to this tag.