> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.docs.siftsy.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.siftsy.com/_mcp/server.

# Rename a content tag

PATCH https://api.siftsy.app/analyst/v1/tags/{tag}
Content-Type: application/json

Requires `posts:write`. Renames the tag on every team post that has it
and in the team's saved tags, the same as renaming a tag in the app.
`{tag}` matches any casing, with or without a leading `#`. The new
`name` is trimmed and at most 60 characters; a rename that only
changes casing is allowed. If the team already has a tag called `name`, the two merge:
posts that had both keep one. Renaming to the current spelling is a
no-op with `postsAffected: 0`.

`failed` lists post ids that could not be rewritten; retry the same
request to finish them. Rate class `team_tags` (5 / minute, 100 / day per key).

Reference: https://api.docs.siftsy.com/api-reference/siftsy-analyst-api/rename-tag

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.
- `X-Api-Key` header (required) — API Key authentication via header

## Servers

- `https://api.siftsy.app/analyst/v1` (Production, default)
- `http://localhost:3000/analyst/v1` (Local development)

## Request

### Path parameters

- `tag` (string, required) — The tag's current name (URL-encoded).

### Body (application/json)

This endpoint expects an object.

- `name` (string, required)

## Response

### 200

The tag was renamed

- `data` (EnvelopeRenamedTagData, optional)
- `meta` (EnvelopeRenamedTagMeta, optional)

## Errors

### 400 Bad Request Error

Invalid request

- `any`

### 403 Forbidden Error

Missing required scope

- `any`

### 404 Not Found Error

Resource not found

- `any`

## Types

### EnvelopeRenamedTagData

- `name` (string, optional)
- `previousName` (string, optional) — The tag as the team spelled it before the rename
- `postsAffected` (integer, optional) — Posts whose tags were rewritten
- `failed` (list of string, optional) — Post ids that could not be rewritten

### EnvelopeRenamedTagMeta

## Examples

**Request**

```json
{
  "name": "Q4 launch"
}
```

**Response**

```json
{
  "data": {
    "name": "Q4 launch",
    "previousName": "launch",
    "postsAffected": 42,
    "failed": []
  },
  "meta": {}
}
```

**SDK Code**

```python content_renameTag_example
import requests

url = "https://api.siftsy.app/analyst/v1/tags/tag"

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

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

print(response.json())
```

```javascript content_renameTag_example
const url = 'https://api.siftsy.app/analyst/v1/tags/tag';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"Q4 launch"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go content_renameTag_example
package main

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

func main() {

	url := "https://api.siftsy.app/analyst/v1/tags/tag"

	payload := strings.NewReader("{\n  \"name\": \"Q4 launch\"\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(res)
	fmt.Println(string(body))

}
```

```ruby content_renameTag_example
require 'uri'
require 'net/http'

url = URI("https://api.siftsy.app/analyst/v1/tags/tag")

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  \"name\": \"Q4 launch\"\n}"

response = http.request(request)
puts response.read_body
```

```java content_renameTag_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.siftsy.app/analyst/v1/tags/tag")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Q4 launch\"\n}")
  .asString();
```

```php content_renameTag_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.siftsy.app/analyst/v1/tags/tag', [
  'body' => '{
  "name": "Q4 launch"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp content_renameTag_example
using RestSharp;

var client = new RestClient("https://api.siftsy.app/analyst/v1/tags/tag");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Q4 launch\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift content_renameTag_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["name": "Q4 launch"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.siftsy.app/analyst/v1/tags/tag")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```