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

# Replace file tags

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

Replaces the entire tag set of a file. Tags not in the new list are deleted.
An empty array clears all tags.

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

Calling PUT with the same set of tags (regardless of case or order) produces no write — `added` and `deleted` will both be empty.


Reference: https://uploadcare.com/docs/api/rest/file-tags/put-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.

- `tags` (list of string, required) — New tag list. Must be a JSON array (not null, not a string). An empty array clears all tags.

## Response

### 200

Tags replaced successfully.

- `tags` (list of string, required) — Resulting tag list in storage order.
- `added` (list of string, required) — Tags present in the new set but not in the previous set (sorted alphabetically).
- `deleted` (list of string, required) — Tags present in the previous set but not in the new set (sorted alphabetically).

## Errors

### 400 Bad Request Error

Validation error.

- `map from string to FilesUuidTagsPutResponsesContentApplicationJsonSchema`

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

### FilesUuidTagsPutResponsesContentApplicationJsonSchema

## Examples

**Request**

```json
{
  "tags": [
    "cat",
    "animal",
    "cute"
  ]
}
```

**Response**

```json
{
  "tags": [
    "cat",
    "animal",
    "cute"
  ],
  "added": [
    "animal",
    "cute"
  ],
  "deleted": [
    "old-tag"
  ]
}
```

**SDK Code**

```python Tags Replaced
import requests

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

payload = { "tags": ["cat", "animal", "cute"] }
headers = {
    "Accept": "application/vnd.uploadcare-v0.7+json",
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Tags Replaced
const url = 'https://api.uploadcare.com/files/21975c81-7f57-4c7a-aef9-acfe28779f78/tags/';
const options = {
  method: 'PUT',
  headers: {
    Accept: 'application/vnd.uploadcare-v0.7+json',
    Authorization: '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"tags":["cat","animal","cute"]}'
};

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

```go Tags Replaced
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  \"tags\": [\n    \"cat\",\n    \"animal\",\n    \"cute\"\n  ]\n}")

	req, _ := http.NewRequest("PUT", 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 Tags Replaced
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::Put.new(url)
request["Accept"] = 'application/vnd.uploadcare-v0.7+json'
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"tags\": [\n    \"cat\",\n    \"animal\",\n    \"cute\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.put("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  \"tags\": [\n    \"cat\",\n    \"animal\",\n    \"cute\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Tags Replaced
using RestSharp;

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

```swift Tags Replaced
import Foundation

let headers = [
  "Accept": "application/vnd.uploadcare-v0.7+json",
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["tags": ["cat", "animal", "cute"]] 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 = "PUT"
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()
```