> 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.

# Add, replace, or remove tags on posts already on the team

POST https://api.siftsy.app/analyst/v1/content/posts/tags
Content-Type: application/json

Requires `posts:write`. Updates content tags on up to 100 posts that
are already on the team, by `postIds` and/or `links`. Responds `200`
immediately. Does not create posts and does not spend credits.

`operation`:
- `add` merges `tags` onto each post (case-insensitive; existing spelling wins)
- `set` overwrites the post's tags with `tags` (an empty list clears them)
- `replace` swaps one tag for another (`from` → `to`) and leaves the other tags. A post that does not have `from` is `rejected` with `tag_not_present`
- `remove` drops the listed tags (case-insensitive)

A leading `#` is stripped. A link that is not on the target team is
`rejected` with `not_on_team`. An unknown post id, or one on another
team, is `not_found`. The same post named twice is `duplicate_in_batch`
and only the first reference is written. `teamId` targets an Enterprise
sub-team as on the other content routes.

Rate class `content_post_tags` (20 / minute, 500 / day per key).


Reference: https://api.docs.siftsy.com/api-reference/siftsy-analyst-api/update-post-tags

## 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

### Body (application/json)

This endpoint expects an UpdatePostTagsRequest.

- `operation` (enum, required) — `add` merges. `set` overwrites the tag list (`tags: []` clears it). `replace` swaps `from` for `to` and leaves the other tags. `remove` drops the listed tags.
  - Allowed values: `add`, `set`, `replace`, `remove`
- `tags` (list of string, optional) — Content tags for `add`, `set`, and `remove`. A leading `#` is dropped. Must be non-empty for `add` and `remove`.
- `from` (string, optional) — `replace` only. The tag to swap out. Case-insensitive. A leading `#` is dropped.
- `to` (string, optional) — `replace` only. The tag to swap in. Other tags on the post stay.
- `postIds` (list of string, optional) — Post ids on the target team (from `GET /posts`)
- `links` (list of string, optional) — Post URLs already on the target team. A link that is not on the team is rejected.
- `teamId` (string, optional) — Enterprise keys only — a sub-team of the key's enterprise

## Response

### 200

Tag update applied. Per-post rows say what changed and what was rejected.

- `data` (EnvelopePostTagsData, optional)
- `meta` (EnvelopePostTagsMeta, optional)

## Errors

### 400 Bad Request Error

Invalid request

- `any`

### 403 Forbidden Error

Missing required scope

- `any`

### 404 Not Found Error

Resource not found

- `any`

### 429 Too Many Requests Error

A per-minute cap, a per-day budget, or the daily transfer cap was exceeded. `error.message` is `Rate limit exceeded`, `Daily request limit exceeded`, or `Daily transfer limit exceeded`. Honor `Retry-After` (next UTC minute for burst caps; UTC midnight for daily budgets). Sized for a scheduled BI refresh: burst caps that a sequential loop cannot trip, daily budgets that fit eight full refreshes a day of a 500-post workspace or one full refresh plus hourly incrementals. Defaults: 300/minute and 10,000/day globally, with class budgets for per-post comment samples (120/min, 1,000/day), analysis-wide comment samples (20/min, 300/day), collection posts (60/min, 1,000/day), analysis reads (60/min, 2,000/day), analysis create (10/min, 100/day), AI search and written answers (2/min, 10/day), scans, breakdowns, and link matching (20/min, 500/day each), analysis exports (30/min, 500/day), adding posts (10/min, 200/day), adding accounts (2/min, 20/day), refreshing posts (10/min, 200/day), tagging and archiving posts (20/min, 500/day each), share links (10/min, 200/day), and content job polls (60/min, 2,000/day). Daily transfer cap 500 MB. `POST /analyses` with AI also returns `429` with `error.code: ai_budget_exceeded` when the team's daily AI budget is spent; `error.budget` has `used`, `limit`, and `resetsAt`, and `Retry-After` runs to UTC midnight.

- `any`

## Types

### EnvelopePostTagsData

- `operation` (enum, optional)
  - Allowed values: `add`, `set`, `replace`, `remove`
- `from` (string, optional) — Present on `replace`. The tag that was swapped out.
- `to` (string, optional) — Present on `replace`. The tag that was swapped in.
- `teamId` (string, optional)
- `counts` (EnvelopePostTagsDataCounts, optional)
- `updated` (list of PostTagResult, optional)
- `rejected` (list of PostTagResult, optional)
- `failed` (list of PostTagResult, optional)

### EnvelopePostTagsMeta

### EnvelopePostTagsDataCounts

- `requested` (integer, optional)
- `updated` (integer, optional)
- `rejected` (integer, optional)
- `failed` (integer, optional)

### PostTagResult

- `postId` (string, optional, nullable)
- `link` (string, optional, nullable)
- `tags` (list of string, optional) — The post's tags after the update
- `reason` (string, optional, nullable) — `not_on_team`, `not_found`, `duplicate_in_batch`, `unsupported_platform`, `invalid_url`, `tag_not_present`, or `update_failed`

## Examples

### content_updatePostTags_example

**Response**

```json
{
  "data": {
    "operation": "add",
    "teamId": "team_2f8c1a",
    "counts": {
      "requested": 3,
      "updated": 2,
      "rejected": 1,
      "failed": 0
    },
    "updated": [
      {
        "postId": "post_01j9y",
        "link": "https://www.tiktok.com/@dove/video/7412345678901234567",
        "tags": [
          "launch",
          "holiday"
        ]
      },
      {
        "postId": "post_01j9z",
        "link": "https://www.instagram.com/reel/C9AbCdEfGhI/",
        "tags": [
          "holiday"
        ]
      }
    ],
    "rejected": [
      {
        "postId": null,
        "link": "https://www.tiktok.com/@missing/video/1",
        "reason": "not_on_team"
      }
    ],
    "failed": []
  },
  "meta": {}
}
```

**SDK Code**

```python content_updatePostTags_example
import requests

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

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript content_updatePostTags_example
const url = 'https://api.siftsy.app/analyst/v1/content/posts/tags';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go content_updatePostTags_example
package main

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

func main() {

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

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

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

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

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.post("https://api.siftsy.app/analyst/v1/content/posts/tags")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.siftsy.app/analyst/v1/content/posts/tags', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp content_updatePostTags_example
using RestSharp;

var client = new RestClient("https://api.siftsy.app/analyst/v1/content/posts/tags");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift content_updatePostTags_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.siftsy.app/analyst/v1/content/posts/tags")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Add a tag to posts already on the team

**Request**

```json
{
  "operation": "add",
  "tags": [
    "launch",
    "holiday"
  ],
  "links": [
    "https://www.tiktok.com/@dove/video/7412345678901234567"
  ]
}
```

**Response**

```json
{
  "data": {
    "operation": "add",
    "teamId": "team_2f8c1a",
    "counts": {
      "requested": 3,
      "updated": 2,
      "rejected": 1,
      "failed": 0
    },
    "updated": [
      {
        "postId": "post_01j9y",
        "link": "https://www.tiktok.com/@dove/video/7412345678901234567",
        "tags": [
          "launch",
          "holiday"
        ]
      },
      {
        "postId": "post_01j9z",
        "link": "https://www.instagram.com/reel/C9AbCdEfGhI/",
        "tags": [
          "holiday"
        ]
      }
    ],
    "rejected": [
      {
        "postId": null,
        "link": "https://www.tiktok.com/@missing/video/1",
        "reason": "not_on_team"
      }
    ],
    "failed": []
  },
  "meta": {}
}
```

**SDK Code**

```python Add a tag to posts already on the team
import requests

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

payload = {
    "operation": "add",
    "tags": ["launch", "holiday"],
    "links": ["https://www.tiktok.com/@dove/video/7412345678901234567"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Add a tag to posts already on the team
const url = 'https://api.siftsy.app/analyst/v1/content/posts/tags';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"operation":"add","tags":["launch","holiday"],"links":["https://www.tiktok.com/@dove/video/7412345678901234567"]}'
};

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

```go Add a tag to posts already on the team
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"operation\": \"add\",\n  \"tags\": [\n    \"launch\",\n    \"holiday\"\n  ],\n  \"links\": [\n    \"https://www.tiktok.com/@dove/video/7412345678901234567\"\n  ]\n}")

	req, _ := http.NewRequest("POST", 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 Add a tag to posts already on the team
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"operation\": \"add\",\n  \"tags\": [\n    \"launch\",\n    \"holiday\"\n  ],\n  \"links\": [\n    \"https://www.tiktok.com/@dove/video/7412345678901234567\"\n  ]\n}"

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

```java Add a tag to posts already on the team
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.siftsy.app/analyst/v1/content/posts/tags")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"operation\": \"add\",\n  \"tags\": [\n    \"launch\",\n    \"holiday\"\n  ],\n  \"links\": [\n    \"https://www.tiktok.com/@dove/video/7412345678901234567\"\n  ]\n}")
  .asString();
```

```php Add a tag to posts already on the team
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.siftsy.app/analyst/v1/content/posts/tags', [
  'body' => '{
  "operation": "add",
  "tags": [
    "launch",
    "holiday"
  ],
  "links": [
    "https://www.tiktok.com/@dove/video/7412345678901234567"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Add a tag to posts already on the team
using RestSharp;

var client = new RestClient("https://api.siftsy.app/analyst/v1/content/posts/tags");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"operation\": \"add\",\n  \"tags\": [\n    \"launch\",\n    \"holiday\"\n  ],\n  \"links\": [\n    \"https://www.tiktok.com/@dove/video/7412345678901234567\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add a tag to posts already on the team
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "operation": "add",
  "tags": ["launch", "holiday"],
  "links": ["https://www.tiktok.com/@dove/video/7412345678901234567"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.siftsy.app/analyst/v1/content/posts/tags")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```

### Swap one tag and leave the rest

**Request**

```json
{
  "operation": "replace",
  "from": "launch",
  "to": "paid",
  "postIds": [
    "post_01j9y"
  ]
}
```

**Response**

```json
{
  "data": {
    "operation": "add",
    "teamId": "team_2f8c1a",
    "counts": {
      "requested": 3,
      "updated": 2,
      "rejected": 1,
      "failed": 0
    },
    "updated": [
      {
        "postId": "post_01j9y",
        "link": "https://www.tiktok.com/@dove/video/7412345678901234567",
        "tags": [
          "launch",
          "holiday"
        ]
      },
      {
        "postId": "post_01j9z",
        "link": "https://www.instagram.com/reel/C9AbCdEfGhI/",
        "tags": [
          "holiday"
        ]
      }
    ],
    "rejected": [
      {
        "postId": null,
        "link": "https://www.tiktok.com/@missing/video/1",
        "reason": "not_on_team"
      }
    ],
    "failed": []
  },
  "meta": {}
}
```

**SDK Code**

```python Swap one tag and leave the rest
import requests

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

payload = {
    "operation": "replace",
    "from": "launch",
    "to": "paid",
    "postIds": ["post_01j9y"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Swap one tag and leave the rest
const url = 'https://api.siftsy.app/analyst/v1/content/posts/tags';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"operation":"replace","from":"launch","to":"paid","postIds":["post_01j9y"]}'
};

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

```go Swap one tag and leave the rest
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"operation\": \"replace\",\n  \"from\": \"launch\",\n  \"to\": \"paid\",\n  \"postIds\": [\n    \"post_01j9y\"\n  ]\n}")

	req, _ := http.NewRequest("POST", 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 Swap one tag and leave the rest
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"operation\": \"replace\",\n  \"from\": \"launch\",\n  \"to\": \"paid\",\n  \"postIds\": [\n    \"post_01j9y\"\n  ]\n}"

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

```java Swap one tag and leave the rest
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.siftsy.app/analyst/v1/content/posts/tags")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"operation\": \"replace\",\n  \"from\": \"launch\",\n  \"to\": \"paid\",\n  \"postIds\": [\n    \"post_01j9y\"\n  ]\n}")
  .asString();
```

```php Swap one tag and leave the rest
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.siftsy.app/analyst/v1/content/posts/tags', [
  'body' => '{
  "operation": "replace",
  "from": "launch",
  "to": "paid",
  "postIds": [
    "post_01j9y"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Swap one tag and leave the rest
using RestSharp;

var client = new RestClient("https://api.siftsy.app/analyst/v1/content/posts/tags");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"operation\": \"replace\",\n  \"from\": \"launch\",\n  \"to\": \"paid\",\n  \"postIds\": [\n    \"post_01j9y\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Swap one tag and leave the rest
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "operation": "replace",
  "from": "launch",
  "to": "paid",
  "postIds": ["post_01j9y"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.siftsy.app/analyst/v1/content/posts/tags")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```