Skip to content

Create tag

POST
/v1/tags
curl --request POST \
--url https://api.defined.net/v1/tags \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "description": "example", "configOverrides": [ { "key": "tun.mtu", "value": 1300 } ], "before": "example", "after": "example", "routeSubscriptions": [ "example" ], "firewallRules": [ { "protocol": "example", "description": "example", "allowedRoleID": "example", "allowedTags": [ "example" ], "portRange": { "from": 1, "to": 1 } } ] }'

Create a new tag, optionally with config overrides.

Token scope required: tags:create

Media typeapplication/json
object
name
required

Name of the new tag. Key must not be longer than 20 characters. Value must not be longer than 50 characters. No whitespace around either allowed.

string format: key:value
description

Optional description

string
<= 255 characters
configOverrides

List of config overrides for the nebula config. Each key may appear at most once. Responses may include keys that aren’t documented; since setting overrides replaces the whole list, keep entries you don’t recognize when writing a list back.

Array<object>
ConfigOverride

A single Nebula config override. key names the Nebula config option and determines the type of value; see Config override keys for the documented keys and their value types, and the Nebula config reference for what each option does.

object
key
required
string

Example

tun.mtu
value
required

The override’s value. Its type depends on key.

Example

1300
before

If specified, the new tag will be inserted before this tag (i.e. will have a lower priority / precedence than the “before” tag.) Cannot specify this in combination with “after.”

string format: key:value
after

If specified, the new tag will be inserted after this tag (i.e. will have a higher priority / precedence than the “after” tag.) Cannot specify this in combination with “before.”

string format: key:value
routeSubscriptions

A list of route IDs to which any hosts with this tag will be subscribed.

Array<string>
<= 100 items
firewallRules

A list of inbound firewall rules to apply to every host that carries this tag, in addition to the rules from the host’s role.

Array<object>
<= 50 items
object
protocol
required

One of ANY, TCP, UDP or ICMP when creating or updating a rule. Responses may include protocols added later, so clients should accept values not listed here.

string
description
string
<= 255 characters
allowedRoleID

Role ID to allow with this firewall rule. If not specified, all roles are included.

string | null
allowedTags

Tags to allow with this firewall rule. An empty list allows all tags; responses return null instead of an empty list. key is max 20 characters, value is max 50 characters, no whitespace around either allowed

Array<string> | null
portRange

Range of ports for this firewall rule. If not provided or set to null, all ports are allowed.

object
from
required

First port number included in range.

integer
>= 1 <= 65535
to
required

Last port number included in range. Must be greater than from port.

integer
>= 1 <= 65535

Successful operation

Media typeapplication/json
object
data
required
object
name
required

Key is max 20 characters, value is max 50 characters, no whitespace around either allowed

string format: key:value
description
required
string
configOverrides
required

List of config overrides for the nebula config. Each key may appear at most once. Responses may include keys that aren’t documented; since setting overrides replaces the whole list, keep entries you don’t recognize when writing a list back.

Array<object>
ConfigOverride

A single Nebula config override. key names the Nebula config option and determines the type of value; see Config override keys for the documented keys and their value types, and the Nebula config reference for what each option does.

object
key
required
string
value
required

The override’s value. Its type depends on key.

priority
required

Priority is managed by the API. Use “before” and “after” inputs to order tags. Config overrides associated with tags of a higher (greater) priority take precedence over lower priorities.

integer
hostCount
required

Count of hosts which have the tag assigned.

integer format: int64
routeSubscriptions
required

Route IDs to which any hosts with this tag will be subscribed.

Array<string>
firewallRules
required

Inbound firewall rules applied to every host that carries this tag, in addition to the rules from the host’s role.

Array
object
protocol
required

One of ANY, TCP, UDP or ICMP when creating or updating a rule. Responses may include protocols added later, so clients should accept values not listed here.

string
description
required
string
<= 255 characters
allowedRoleID
required

Role ID to allow with this firewall rule. If not specified, all roles are included.

string | null
allowedTags
required

Tags to allow with this firewall rule. An empty list allows all tags; responses return null instead of an empty list. key is max 20 characters, value is max 50 characters, no whitespace around either allowed

Array<string> | null
portRange
required

Range of ports for this firewall rule. If not provided or set to null, all ports are allowed.

object
from
required

First port number included in range.

integer
>= 1 <= 65535
to
required

Last port number included in range. Must be greater than from port.

integer
>= 1 <= 65535

Examples

ExampleExample
{
"data": {
"name": "env:prod",
"description": "Hosts which have live in or have access to production resources",
"configOverrides": [
{
"key": "logging.level",
"value": "info"
}
],
"priority": 3,
"hostCount": 10,
"routeSubscriptions": [],
"firewallRules": [
{
"protocol": "TCP",
"description": "allow SSH access from admins",
"allowedRoleID": "role-G3TWUQ4FASQEF44MGMTSRBTYKM",
"allowedTags": [
"user-type:admin"
],
"portRange": {
"from": 22,
"to": 22
}
}
]
}
}

Validation error

Media typeapplication/json
object
errors
required
Array<object>
object
code
required

A static name for the error type

string
message
required

A short human readable description of the error

string
path

Describes the variable missing or malformed

string
param

The query parameter the error relates to, such as filter.targetType

string
extra

Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.

object
limit

The maximum number of resources allowed

integer
limitName

The kind of resource the limit applies to

string
key
additional properties
any

Examples

A tag already exists with the name.

{
"errors": [
{
"code": "ERR_DUPLICATE_VALUE",
"message": "value already exists",
"path": "name"
}
]
}

The API key is missing, invalid or expired.

Media typeapplication/json
object
errors
required
Array<object>
object
code
required

A static name for the error type

string
message
required

A short human readable description of the error

string
path

Describes the variable missing or malformed

string
param

The query parameter the error relates to, such as filter.targetType

string
extra

Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.

object
limit

The maximum number of resources allowed

integer
limitName

The kind of resource the limit applies to

string
key
additional properties
any

Example

{
"errors": [
{
"code": "ERR_UNAUTHORIZED",
"message": "unauthorized"
}
]
}

The API key lacks a required scope.

Media typeapplication/json
object
errors
required
Array<object>
object
code
required

A static name for the error type

string
message
required

A short human readable description of the error

string
path

Describes the variable missing or malformed

string
param

The query parameter the error relates to, such as filter.targetType

string
extra

Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.

object
limit

The maximum number of resources allowed

integer
limitName

The kind of resource the limit applies to

string
key
additional properties
any

Examples

ExamplemissingScope

The API key lacks a required scope.

{
"errors": [
{
"code": "ERR_FORBIDDEN",
"message": "api key must support the following scopes: hosts:read"
}
]
}

The organization has exceeded its API request rate limit. Retry the request after a short delay.

Media typeapplication/json
object
errors
required
Array<object>
object
code
required

A static name for the error type

string
message
required

A short human readable description of the error

string
path

Describes the variable missing or malformed

string
param

The query parameter the error relates to, such as filter.targetType

string
extra

Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.

object
limit

The maximum number of resources allowed

integer
limitName

The kind of resource the limit applies to

string
key
additional properties
any

Example

{
"errors": [
{
"code": "ERR_TOO_MANY_REQUESTS",
"message": "too many requests"
}
]
}