Skip to main content
POST
/
tags
Create a tag definition
curl --request POST \
  --url https://v1.api.altostrat.io/tags \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "Site Status",
  "color": "#4CAF50",
  "mandatory_on": [
    "site"
  ]
}
'
import requests

url = "https://v1.api.altostrat.io/tags"

payload = {
"key": "Site Status",
"color": "#4CAF50",
"mandatory_on": ["site"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({key: 'Site Status', color: '#4CAF50', mandatory_on: ['site']})
};

fetch('https://v1.api.altostrat.io/tags', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://v1.api.altostrat.io/tags",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'key' => 'Site Status',
'color' => '#4CAF50',
'mandatory_on' => [
'site'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://v1.api.altostrat.io/tags"

payload := strings.NewReader("{\n \"key\": \"Site Status\",\n \"color\": \"#4CAF50\",\n \"mandatory_on\": [\n \"site\"\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(string(body))

}
HttpResponse<String> response = Unirest.post("https://v1.api.altostrat.io/tags")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"Site Status\",\n \"color\": \"#4CAF50\",\n \"mandatory_on\": [\n \"site\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://v1.api.altostrat.io/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 \"key\": \"Site Status\",\n \"color\": \"#4CAF50\",\n \"mandatory_on\": [\n \"site\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "tag_01E8Z4Q6J7B6A5P4E3D2C1B0A9",
  "key": "Region",
  "color": "#3F51B5",
  "mandatory_on": [
    "site"
  ],
  "created_at": "2025-10-29T12:00:00Z",
  "updated_at": "2025-10-29T12:30:00Z"
}
{
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "The 'name' parameter is required for this request.",
"doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "The 'name' parameter is required for this request.",
"doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}

Authorizations

Authorization
string
header
required

A bearer token is required for all API requests.

Body

application/json

The details of the tag definition to create.

key
string
required

The display name for the tag category.

Maximum string length: 100
Example:

"Customer Segment"

color
string
required

A hex color code for UI display.

Pattern: ^#[0-9A-Fa-f]{6}$
Example:

"#FF9800"

mandatory_on
enum<string>[]

A list of resource types for which this tag is mandatory.

The type of resource being correlated.

Available options:
site,
user,
wan,
account

Response

The tag definition was created successfully.

id
string

The unique identifier for the tag definition.

Example:

"tag_01E8Z4Q6J7B6A5P4E3D2C1B0A9"

key
string

The display name for the tag category (e.g., "Region", "Priority").

Example:

"Region"

color
string

A hex color code used for UI display.

Example:

"#3F51B5"

mandatory_on
enum<string>[]

A list of resource types where this tag must be applied.

The type of resource being correlated.

Available options:
site,
user,
wan,
account
created_at
string<date-time>

The timestamp when the tag definition was created.

Example:

"2025-10-29T12:00:00Z"

updated_at
string<date-time>

The timestamp when the tag definition was last updated.

Example:

"2025-10-29T12:30:00Z"