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

# Update Resource Tags

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

Adds, removes, or updates resource tags for the specified product.

This request will overwrite all tags. If existing tags are not included in the request, they will be removed. Ensure that you have included all existing tags in this request to keep them. Use [Get Resource Tags for Product](https://dev.megaport.com/#f9899897-aeb4-4432-8378-af36de8c734d) to retrieve the existing resource tags.

Supported **key** format (length 128): **a-z 0-9 _ : . / \\ -**

**Note:** Key value is lower case only.

Supported **value** format (length 256): **a-z A-Z 0-9 _ : . @ / + \\ - (space)**

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

## Servers

- `https://api.megaport.com` (Production environment, default)
- `https://api-staging.megaport.com` (Staging environment (test only, reset every 24 hours))

## Request

### Path parameters

- `productuid` (string, required)

### Body (application/json)

This endpoint expects an object.

- `resourceTags` (list of V2ProductProductuidTagsPutRequestBodyContentApplicationJsonSchemaResourceTagsItems, optional)

## Response

### 200

Update Resource Tags Example / Update Resource Tags Example

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

## Types

### V2ProductProductuidTagsPutRequestBodyContentApplicationJsonSchemaResourceTagsItems

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

## Examples

### Update Resource Tags Example

**Response**

```json
{
  "message": "Tags updated successfully",
  "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": "Tags updated successfully",
  "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()
```