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

# Actualizar Etiquetas de Recurso

PUT https://api.megaport.com/v2/product/{productuid}/tags
Content-Type: application/json

Agrega, elimina o actualiza las etiquetas de recursos para el producto especificado.

Esta solicitud sobrescribirá todas las etiquetas. Si las etiquetas existentes no se incluyen en la solicitud, se eliminarán. Asegúrese de haber incluido todas las etiquetas existentes en esta solicitud para mantenerlas. Use [Obtener etiquetas de recursos para producto](https://dev.megaport.com/#f9899897-aeb4-4432-8378-af36de8c734d) para recuperar las etiquetas de recursos existentes.

Formato de **clave** compatible (longitud 128): **a-z 0-9 _ : . / \\ -**

**Nota:** El valor de la clave solo debe estar en minúsculas.

Formato de **valor** compatible (longitud 256): **a-z A-Z 0-9 _ : . @ / + \\ - (espacio)**

Reference: https://es.megaport.ferndocs.com/es/api-reference/product-details/update-resource-tags

## Servers

- `https://api.megaport.com` (Entorno de producción, default)
- `https://api-staging.megaport.com` (Entorno de pruebas (solo pruebas, se restablece cada 24 horas))

## Request

### Path parameters

- `productuid` (string, required)

### Body (application/json)

This endpoint expects an object.

- `resourceTags` (list of V2ProductProductuidTagsPutRequestBodyContentApplicationJsonSchemaResourceTagsItems, optional)

## Response

### 200

Ejemplo de Actualización de Etiquetas de Recurso / Ejemplo de Actualización de Etiquetas de Recurso

- `message` (string, optional)
- `terms` (string, optional)

## Types

### V2ProductProductuidTagsPutRequestBodyContentApplicationJsonSchemaResourceTagsItems

- `key` (string, optional)
- `value` (string, optional)

## Examples

### Update Resource Tags Example

**Response**

```json
{
  "message": "Etiquetas actualizadas correctamente",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Update Resource Tags Example
import requests

url = "https://api.megaport.com/v2/product/productuid/tags"

response = requests.put(url)

print(response.json())
```

```javascript Update Resource Tags Example
const url = 'https://api.megaport.com/v2/product/productuid/tags';
const options = {method: 'PUT'};

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

```go Update Resource Tags Example
package main

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

func main() {

	url := "https://api.megaport.com/v2/product/productuid/tags"

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

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

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

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

}
```

```ruby Update Resource Tags Example
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v2/product/productuid/tags")

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

request = Net::HTTP::Put.new(url)

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

```java Update Resource Tags Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.megaport.com/v2/product/productuid/tags")
  .asString();
```

```php Update Resource Tags Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.megaport.com/v2/product/productuid/tags');

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

```csharp Update Resource Tags Example
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/product/productuid/tags");
var request = new RestRequest(Method.PUT);
IRestResponse response = client.Execute(request);
```

```swift Update Resource Tags Example
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/product/productuid/tags")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"

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

### Update Resource Tags

**Request**

```json
{
  "resourceTags": [
    {
      "key": "stringykey2",
      "value": "value2"
    }
  ]
}
```

**Response**

```json
{
  "message": "Etiquetas actualizadas correctamente",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Update Resource Tags
import requests

url = "https://api.megaport.com/v2/product/productuid/tags"

payload = { "resourceTags": [
        {
            "key": "stringykey2",
            "value": "value2"
        }
    ] }
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Update Resource Tags
const url = 'https://api.megaport.com/v2/product/productuid/tags';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json'},
  body: '{"resourceTags":[{"key":"stringykey2","value":"value2"}]}'
};

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

```go Update Resource Tags
package main

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

func main() {

	url := "https://api.megaport.com/v2/product/productuid/tags"

	payload := strings.NewReader("{\n  \"resourceTags\": [\n    {\n      \"key\": \"stringykey2\",\n      \"value\": \"value2\"\n    }\n  ]\n}")

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

	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 Update Resource Tags
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v2/product/productuid/tags")

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

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"resourceTags\": [\n    {\n      \"key\": \"stringykey2\",\n      \"value\": \"value2\"\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.put("https://api.megaport.com/v2/product/productuid/tags")
  .header("Content-Type", "application/json")
  .body("{\n  \"resourceTags\": [\n    {\n      \"key\": \"stringykey2\",\n      \"value\": \"value2\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.megaport.com/v2/product/productuid/tags', [
  'body' => '{
  "resourceTags": [
    {
      "key": "stringykey2",
      "value": "value2"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Update Resource Tags
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/product/productuid/tags");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"resourceTags\": [\n    {\n      \"key\": \"stringykey2\",\n      \"value\": \"value2\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update Resource Tags
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["resourceTags": [
    [
      "key": "stringykey2",
      "value": "value2"
    ]
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/product/productuid/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()
```