Skip to main content
Setup keys are used to enroll new peers into your NetBird network without requiring interactive authentication. They’re ideal for automated deployments, IoT devices, and server installations.

List All Setup Keys

Returns a list of all setup keys.
string
Unique setup key identifier
string
Setup key as a masked secret (full key only shown on creation)
string
Setup key name identifier
string
Expiration date (ISO 8601 format)
string
Key type: reusable or one-off
boolean
Whether the key is currently valid
boolean
Whether the key has been revoked
integer
Number of times this key has been used
string
Last time the key was used (ISO 8601 format)
string
Key state: valid, overused, expired, or revoked
array
Group IDs to auto-assign to peers using this key
integer
Usage limit (0 = unlimited)
boolean
Whether peers enrolled with this key are ephemeral
boolean
Allow extra DNS labels to be added to the peer

Get a Setup Key

Retrieve details about a specific setup key.
string
required
The unique identifier of the setup key
Example

Create a Setup Key

Generate a new setup key for peer enrollment.
string
required
Setup key name
string
required
Key type: reusable or one-off
integer
required
Expiration time in seconds (86400-31536000, i.e., 1 day to 1 year)
array
required
Group IDs to auto-assign to peers registered with this key
integer
required
Usage limit (0 = unlimited)
boolean
required
Whether peers should be ephemeral
boolean
required
Allow extra DNS labels to be added to peers
The full setup key is only returned when created. Save it securely - you won’t be able to retrieve it again!

Update a Setup Key

Update setup key configuration.
string
required
The unique identifier of the setup key
boolean
required
Revoke or un-revoke the setup key
array
required
Group IDs to auto-assign (replaces existing groups)

Delete a Setup Key

Permanently delete a setup key.
string
required
The unique identifier of the setup key
Example
Deleting a setup key does NOT remove peers that were enrolled with it. It only prevents future enrollments.

Key Types

Reusable Keys

Can be used multiple times until expired or revoked:
Use cases:
  • Server deployments
  • Container orchestration
  • IoT device fleets
  • Development environments

One-Off Keys

Can only be used once:
Use cases:
  • Individual device enrollment
  • Temporary access
  • High-security environments

Key States

Valid

Key is active and can be used

Expired

Key has passed its expiration date

Revoked

Key has been manually revoked

Overused

Key has exceeded its usage limit

Ephemeral Peers

Peers enrolled with ephemeral keys are automatically cleaned up:
Ephemeral peers:
  • Automatically removed when disconnected
  • Don’t persist in the network
  • Ideal for temporary access or testing

Using Setup Keys

Linux/macOS

Windows

Docker

Kubernetes

Auto-Groups

Peers enrolled with a setup key are automatically added to specified groups:
This enables:
  • Automatic policy application
  • Simplified network segmentation
  • Role-based access control

Security Best Practices

Limit expiration - Use the shortest reasonable expiration period
Use one-off keys - For individual devices when possible
Set usage limits - Prevent unlimited use of reusable keys
Revoke unused keys - Regularly audit and revoke old keys
Rotate keys - Create new keys periodically for ongoing deployments
Secure storage - Store keys in secrets managers, not version control
Monitor usage - Track used_times and last_used to detect anomalies

Common Patterns

CI/CD Deployments

IoT Devices

Temporary Contractor Access