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

# Add or remove file tags

PATCH https://api.uploadcare.com/files/{uuid}/tags/
Content-Type: application/json

Adds and/or removes tags in a single atomic operation. `add` and `delete` are both optional and default to `[]`.

Delete is applied first, then add — a tag can be removed and re-added in the same request.
Tags in `add` that are already present are silently skipped. Tags in `delete` that are not present are silently ignored.

If the resulting tag count would exceed 50, the request fails with 400.
An empty body `{}` is valid and returns the current tag state unchanged.

Tags are normalized before storage (lowercased, whitespace-stripped, duplicates removed).

Reference: https://uploadcare.com/docs/api/rest/file-tags/patch-tags

## Authentication

- `Authorization` header (required) — Every request made to `https://api.uploadcare.com/` MUST be signed. HTTPS SHOULD be used with any authorization scheme. Requests MUST contain the `Authorization` header defining `auth-scheme` and `auth-param`: `Authorization: auth-scheme auth-param`. Every request MUST contain the `Accept` header identifying the REST API version: `Accept: application/vnd.uploadcare-v0.7+json`. There are two available authorization schemes: * For production: `Uploadcare`, a scheme where a `signature`, not your Secret API Key MUST be specified. Signatures SHOULD be generated on backend. * For quick tests: `Uploadcare.Simple`, a simple scheme where your [Secret API Key](https://app.uploadcare.com/projects/-/api-keys/) MUST be specified in every request's `auth-param`.

## Request

### Path parameters

- `uuid` (string, required) — File UUID.

### Headers

- `Accept` (string, required) — Version header.

### Body (application/json)

This endpoint expects an object.

- `add` (list of string, optional) — Tags to add. Tags already present are silently skipped.
- `delete` (list of string, optional) — Tags to remove. Tags not present are silently ignored.

## Response

### 200

Tags updated successfully.

- `tags` (list of string, required) — Resulting tag list in storage order.
- `added` (list of string, required) — Tags that were actually added (not already present).
- `deleted` (list of string, required) — Tags that were actually removed.

## Errors

### 400 Bad Request Error

Validation error.

- `PatchTagsRequestBadRequestError`

### 401 Unauthorized Error

Authorization errors.

- `detail` (enum, optional)
  - Allowed values: `Incorrect authentication credentials.`, `Public key {public_key} not found.`, `Secret key not found.`, `Invalid signature. Please check your Secret key.`

### 404 Not Found Error

File not found.

- `detail` (string, optional) — Not found.

### 406 Not Acceptable Error

Invalid version header `Accept` for this endpoint.

- `detail` (string, optional, default: Incorrect Accept header provided. Make sure to specify API version. Refer to REST API docs for details.)

### 415 Unsupported Media Type Error

Unsupported media type. Use `Content-Type: application/json`.

- `any`

## Types

### PatchTagsRequestBadRequestError0

- `detail` (string, required)

## Examples

### Tags Updated

**Response**

```json
{
  "tags": [
    "pet",
    "cat"
  ],
  "added": [
    "cat"
  ],
  "deleted": [
    "dog"
  ]
}
```

**SDK Code**

```shell cURL
curl -X PATCH "https://api.uploadcare.com/files/FILE_UUID/tags/" \
     -H "Accept: application/vnd.uploadcare-v0.7+json" \
     -H "Authorization: Uploadcare.Simple YOUR_PUBLIC_KEY:YOUR_SECRET_KEY" \
     -H "Content-Type: application/json" \
     -d '{"add": ["holiday", "summer"], "delete": ["old-tag"]}'

```

```python Tags Updated
import requests

url = "https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/"

headers = {
    "Accept": "application/vnd.uploadcare-v0.7+json",
    "Authorization": "<apiKey>"
}

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

print(response.json())
```

```javascript Tags Updated
const url = 'https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/';
const options = {
  method: 'PATCH',
  headers: {Accept: 'application/vnd.uploadcare-v0.7+json', Authorization: '<apiKey>'}
};

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

```go Tags Updated
package main

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

func main() {

	url := "https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/"

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

	req.Header.Add("Accept", "application/vnd.uploadcare-v0.7+json")
	req.Header.Add("Authorization", "<apiKey>")

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

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

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

}
```

```ruby Tags Updated
require 'uri'
require 'net/http'

url = URI("https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/")

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

request = Net::HTTP::Patch.new(url)
request["Accept"] = 'application/vnd.uploadcare-v0.7+json'
request["Authorization"] = '<apiKey>'

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

```java Tags Updated
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/")
  .header("Accept", "application/vnd.uploadcare-v0.7+json")
  .header("Authorization", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/', [
  'headers' => [
    'Accept' => 'application/vnd.uploadcare-v0.7+json',
    'Authorization' => '<apiKey>',
  ],
]);

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

```csharp Tags Updated
using RestSharp;

var client = new RestClient("https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Accept", "application/vnd.uploadcare-v0.7+json");
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Tags Updated
import Foundation

let headers = [
  "Accept": "application/vnd.uploadcare-v0.7+json",
  "Authorization": "<apiKey>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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 and Remove Tags

**Request**

```json
{
  "add": [
    "holiday",
    "summer"
  ],
  "delete": [
    "old-tag"
  ]
}
```

**Response**

```json
{
  "tags": [
    "pet",
    "cat"
  ],
  "added": [
    "cat"
  ],
  "deleted": [
    "dog"
  ]
}
```

**SDK Code**

```shell cURL
curl -X PATCH "https://api.uploadcare.com/files/FILE_UUID/tags/" \
     -H "Accept: application/vnd.uploadcare-v0.7+json" \
     -H "Authorization: Uploadcare.Simple YOUR_PUBLIC_KEY:YOUR_SECRET_KEY" \
     -H "Content-Type: application/json" \
     -d '{"add": ["holiday", "summer"], "delete": ["old-tag"]}'

```

```python Add and Remove Tags
import requests

url = "https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/"

payload = {
    "add": ["holiday", "summer"],
    "delete": ["old-tag"]
}
headers = {
    "Accept": "application/vnd.uploadcare-v0.7+json",
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Add and Remove Tags
const url = 'https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/';
const options = {
  method: 'PATCH',
  headers: {
    Accept: 'application/vnd.uploadcare-v0.7+json',
    Authorization: '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"add":["holiday","summer"],"delete":["old-tag"]}'
};

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

```go Add and Remove Tags
package main

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

func main() {

	url := "https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/"

	payload := strings.NewReader("{\n  \"add\": [\n    \"holiday\",\n    \"summer\"\n  ],\n  \"delete\": [\n    \"old-tag\"\n  ]\n}")

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

	req.Header.Add("Accept", "application/vnd.uploadcare-v0.7+json")
	req.Header.Add("Authorization", "<apiKey>")
	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 and Remove Tags
require 'uri'
require 'net/http'

url = URI("https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/")

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

request = Net::HTTP::Patch.new(url)
request["Accept"] = 'application/vnd.uploadcare-v0.7+json'
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"add\": [\n    \"holiday\",\n    \"summer\"\n  ],\n  \"delete\": [\n    \"old-tag\"\n  ]\n}"

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

```java Add and Remove Tags
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/")
  .header("Accept", "application/vnd.uploadcare-v0.7+json")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"add\": [\n    \"holiday\",\n    \"summer\"\n  ],\n  \"delete\": [\n    \"old-tag\"\n  ]\n}")
  .asString();
```

```php Add and Remove Tags
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/', [
  'body' => '{
  "add": [
    "holiday",
    "summer"
  ],
  "delete": [
    "old-tag"
  ]
}',
  'headers' => [
    'Accept' => 'application/vnd.uploadcare-v0.7+json',
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Add and Remove Tags
using RestSharp;

var client = new RestClient("https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Accept", "application/vnd.uploadcare-v0.7+json");
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"add\": [\n    \"holiday\",\n    \"summer\"\n  ],\n  \"delete\": [\n    \"old-tag\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add and Remove Tags
import Foundation

let headers = [
  "Accept": "application/vnd.uploadcare-v0.7+json",
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "add": ["holiday", "summer"],
  "delete": ["old-tag"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/")! 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()
```