Resources

Resource classes provide typed access to NetBird API endpoints. All resource classes inherit from BaseResource and follow consistent patterns.

Common Patterns

Most resources follow the standard CRUD pattern:

# List all
items = client.resource.list()

# Get one
item = client.resource.get("item-id")

# Create
from netbird.models import ResourceCreate
data = ResourceCreate(name="New Item")
item = client.resource.create(data)

# Update
from netbird.models import ResourceUpdate
update = ResourceUpdate(name="Updated")
item = client.resource.update("item-id", update)

# Delete
client.resource.delete("item-id")

All methods return Python dictionaries (not Pydantic models).

Core Resources

AccountsResource

class netbird.resources.accounts.AccountsResource(client)[source]

Handler for NetBird accounts API endpoints.

Provides methods to manage NetBird accounts including listing, updating settings, and account deletion.

list()[source]

List all accounts.

Returns a list of accounts. Always returns a list of one account as users can only access their own account.

Return type:

List[Dict[str, Any]]

Returns:

List of account dictionaries

Example

>>> accounts = client.accounts.list()
>>> print(f"Account ID: {accounts[0].id}")
update(account_id, settings)[source]

Update account settings.

Parameters:
  • account_id (str) – Unique identifier of the account

  • settings (AccountSettings) – Account settings to update

Return type:

Dict[str, Any]

Returns:

Updated account dictionary

Example

>>> settings = AccountSettings(
...     peer_login_expiration_enabled=True,
...     peer_login_expiration=3600
... )
>>> account = client.accounts.update("account-id", settings)
delete(account_id)[source]

Delete an account.

Deletes an account and all its resources. Only account owners can delete accounts.

Parameters:

account_id (str) – Unique identifier of the account

Return type:

None

Example

>>> client.accounts.delete("account-id")

Methods:

  • list() - List all accounts

  • get(account_id) - Get account by ID

  • update(account_id, data) - Update account settings

  • delete(account_id) - Delete account

UsersResource

class netbird.resources.users.UsersResource(client)[source]

Handler for NetBird users API endpoints.

Provides methods to manage NetBird users including listing, creating, updating, deleting users, and managing user invitations.

list()[source]

List all users.

Return type:

List[Dict[str, Any]]

Returns:

List of user dictionaries

Example

>>> users = client.users.list()
>>> for user in users:
...     print(f"{user['name']}: {user['email']}")
create(user_data)[source]

Create a new user.

Parameters:

user_data (UserCreate) – User creation data

Return type:

Dict[str, Any]

Returns:

Created user dictionary

Example

>>> user_data = UserCreate(
...     email="john@example.com",
...     name="John Doe",
...     role="user"
... )
>>> user = client.users.create(user_data)
get(user_id)[source]

Get a specific user by ID.

Parameters:

user_id (str) – Unique user identifier

Return type:

Dict[str, Any]

Returns:

User dictionary

Example

>>> user = client.users.get("user-123")
>>> print(f"User: {user['name']}")
update(user_id, user_data)[source]

Update an existing user.

Parameters:
  • user_id (str) – Unique user identifier

  • user_data (UserUpdate) – User update data

Return type:

Dict[str, Any]

Returns:

Updated user dictionary

Example

>>> user_data = UserUpdate(name="John Smith")
>>> user = client.users.update("user-123", user_data)
delete(user_id)[source]

Delete a user.

Parameters:

user_id (str) – Unique user identifier

Return type:

None

Example

>>> client.users.delete("user-123")
invite(user_id)[source]

Resend user invitation.

Parameters:

user_id (str) – Unique user identifier

Return type:

None

Example

>>> client.users.invite("user-123")
get_current()[source]

Get the current authenticated user.

Return type:

Dict[str, Any]

Returns:

Current user dictionary

Example

>>> current_user = client.users.get_current()
>>> print(f"Logged in as: {current_user['name']}")
approve(user_id)[source]

Approve a pending user.

Parameters:

user_id (str) – Unique user identifier

Return type:

Dict[str, Any]

Returns:

Approved user dictionary

reject(user_id)[source]

Reject a pending user.

Parameters:

user_id (str) – Unique user identifier

Return type:

None

change_password(user_id, old_password, new_password)[source]

Change a user’s password.

Parameters:
  • user_id (str) – Unique user identifier

  • old_password (str) – Current password

  • new_password (str) – New password

Return type:

None

list_invites()[source]

List all user invites.

Return type:

List[Dict[str, Any]]

Returns:

List of invite dictionaries

create_invite(invite_data)[source]

Create a user invite.

Parameters:

invite_data (UserInviteCreate) – Invite creation data

Return type:

Dict[str, Any]

Returns:

Created invite dictionary with token

delete_invite(invite_id)[source]

Delete a user invite.

Parameters:

invite_id (str) – Unique invite identifier

Return type:

None

regenerate_invite(invite_id, expires_in=None)[source]

Regenerate a user invite token.

Parameters:
  • invite_id (str) – Unique invite identifier

  • expires_in (Optional[int]) – Optional new expiration in seconds

Return type:

Dict[str, Any]

Returns:

Regenerated invite dictionary with new token

get_invite_info(token)[source]

Get public invite information by token.

Parameters:

token (str) – Invite token

Return type:

Dict[str, Any]

Returns:

Public invite details

accept_invite(token, password)[source]

Accept a user invite.

Parameters:
  • token (str) – Invite token

  • password (str) – Password for the new account

Return type:

Dict[str, Any]

Returns:

Acceptance confirmation

Methods:

  • list() - List all users

  • get(user_id) - Get user by ID

  • get_current() - Get current authenticated user

  • create(data) - Create a new user

  • update(user_id, data) - Update user

  • delete(user_id) - Delete user

  • approve(user_id) - Approve a pending user

  • reject(user_id) - Reject a pending user

  • change_password(user_id, data) - Change user password

  • list_invites() - List all pending invites

  • create_invite(data) - Create a user invite

  • delete_invite(invite_id) - Delete an invite

  • regenerate_invite(invite_id) - Regenerate invite link

  • get_invite_info(invite_id) - Get invite details

  • accept_invite(invite_id, data) - Accept an invite

# Get current user
me = client.users.get_current()
print(f"Role: {me['role']}")

# Create a service user
from netbird.models import UserCreate
user = client.users.create(UserCreate(
    email="bot@company.com",
    name="Bot",
    is_service_user=True
))

# Approve a pending user
client.users.approve("user-id")

TokensResource

class netbird.resources.tokens.TokensResource(client)[source]

Handler for NetBird tokens API endpoints.

Provides methods to manage user API tokens including listing, creating, retrieving, and deleting tokens.

list(user_id)[source]

List all tokens for a user.

Parameters:

user_id (str) – Unique user identifier

Return type:

List[Dict[str, Any]]

Returns:

List of token dictionaries

Example

>>> tokens = client.tokens.list("user-123")
>>> for token in tokens:
...     print(f"Token: {token['name']}")
create(user_id, token_data)[source]

Create a new token for a user.

Parameters:
  • user_id (str) – Unique user identifier

  • token_data (TokenCreate) – Token creation data

Return type:

Dict[str, Any]

Returns:

Created token dictionary

Example

>>> token_data = TokenCreate(
...     name="API Access Token",
...     expires_in=30  # 30 days
... )
>>> token = client.tokens.create("user-123", token_data)
get(user_id, token_id)[source]

Retrieve a specific token.

Parameters:
  • user_id (str) – Unique user identifier

  • token_id (str) – Unique token identifier

Return type:

Dict[str, Any]

Returns:

Token dictionary

Example

>>> token = client.tokens.get("user-123", "token-456")
>>> print(f"Token expires: {token['expiration_date']}")
delete(user_id, token_id)[source]

Delete a token.

Parameters:
  • user_id (str) – Unique user identifier

  • token_id (str) – Unique token identifier

Return type:

None

Example

>>> client.tokens.delete("user-123", "token-456")

Methods:

  • list(user_id) - List tokens for a user

  • get(user_id, token_id) - Get a specific token

  • create(user_id, data) - Create a new token

  • delete(user_id, token_id) - Delete a token

PeersResource

class netbird.resources.peers.PeersResource(client)[source]

Handler for NetBird peers API endpoints.

Provides methods to manage NetBird peers including listing, retrieving, updating, and deleting peers.

list(name=None, ip=None)[source]

List all peers with optional filtering.

Parameters:
  • name (Optional[str]) – Filter peers by name (optional)

  • ip (Optional[str]) – Filter peers by IP address (optional)

Return type:

List[Dict[str, Any]]

Returns:

List of peer dictionaries

Example

>>> # List all peers
>>> peers = client.peers.list()
>>>
>>> # Filter by name
>>> peers = client.peers.list(name="server-01")
>>>
>>> # Filter by IP
>>> peers = client.peers.list(ip="10.0.0.1")
get(peer_id)[source]

Retrieve a specific peer.

Parameters:

peer_id (str) – Unique peer identifier

Return type:

Dict[str, Any]

Returns:

Peer dictionary

Example

>>> peer = client.peers.get("peer-123")
>>> print(f"Peer: {peer['name']} ({peer['ip']})")
update(peer_id, peer_data)[source]

Update a peer.

Parameters:
  • peer_id (str) – Unique peer identifier

  • peer_data (PeerUpdate) – Peer update data

Return type:

Dict[str, Any]

Returns:

Updated peer dictionary

Example

>>> peer_data = PeerUpdate(
...     name="updated-server",
...     ssh_enabled=True
... )
>>> peer = client.peers.update("peer-123", peer_data)
delete(peer_id)[source]

Delete a peer.

Parameters:

peer_id (str) – Unique peer identifier

Return type:

None

Example

>>> client.peers.delete("peer-123")
get_accessible_peers(peer_id)[source]

List peers that a specific peer can connect to.

Parameters:

peer_id (str) – Unique peer identifier

Return type:

List[Dict[str, Any]]

Returns:

List of accessible peer dictionaries

Example

>>> accessible = client.peers.get_accessible_peers("peer-123")
>>> print(f"Can connect to {len(accessible)} peers")
create_temporary_access(peer_id, data)[source]

Create a temporary access peer.

Parameters:
  • peer_id (str) – Unique peer identifier

  • data (Dict[str, Any]) – Temporary access data (name, wg_pub_key, rules)

Return type:

Dict[str, Any]

Returns:

Created temporary access peer dictionary

list_jobs(peer_id)[source]

List all jobs for a peer.

Parameters:

peer_id (str) – Unique peer identifier

Return type:

List[Dict[str, Any]]

Returns:

List of job dictionaries

create_job(peer_id, job_data)[source]

Create a job for a peer.

Parameters:
  • peer_id (str) – Unique peer identifier

  • job_data (Dict[str, Any]) – Job creation data (workload)

Return type:

Dict[str, Any]

Returns:

Created job dictionary

get_job(peer_id, job_id)[source]

Retrieve a specific job for a peer.

Parameters:
  • peer_id (str) – Unique peer identifier

  • job_id (str) – Unique job identifier

Return type:

Dict[str, Any]

Returns:

Job dictionary

Methods:

  • list() - List all peers

  • get(peer_id) - Get peer by ID

  • update(peer_id, data) - Update peer

  • delete(peer_id) - Delete peer

  • accessible_peers(peer_id) - List peers accessible to a given peer

  • create_temporary_access(peer_id, data) - Grant temporary access

  • list_jobs(peer_id) - List peer jobs

  • create_job(peer_id, data) - Create a peer job

  • get_job(peer_id, job_id) - Get a specific job

# List connected peers
peers = client.peers.list()
connected = [p for p in peers if p['connected']]
print(f"{len(connected)}/{len(peers)} peers connected")

# Get accessible peers
accessible = client.peers.accessible_peers("peer-id")

SetupKeysResource

class netbird.resources.setup_keys.SetupKeysResource(client)[source]

Handler for NetBird setup keys API endpoints.

Provides methods to manage NetBird setup keys including listing, creating, retrieving, updating, and deleting setup keys.

list()[source]

List all setup keys.

Return type:

List[Dict[str, Any]]

Returns:

List of setup key dictionaries

Example

>>> keys = client.setup_keys.list()
>>> for key in keys:
...     print(f"Key: {key['name']} (Type: {key['type']})")
create(key_data)[source]

Create a new setup key.

Parameters:

key_data (SetupKeyCreate) – Setup key creation data

Return type:

Dict[str, Any]

Returns:

Created setup key dictionary

Example

>>> key_data = SetupKeyCreate(
...     name="Development Key",
...     type="reusable",
...     expires_in=86400,  # 24 hours
...     usage_limit=10
... )
>>> key = client.setup_keys.create(key_data)
get(key_id)[source]

Retrieve a specific setup key.

Parameters:

key_id (str) – Unique setup key identifier

Return type:

Dict[str, Any]

Returns:

Setup key dictionary

Example

>>> key = client.setup_keys.get("key-123")
>>> print(f"Key: {key['name']} - Valid: {key['valid']}")
update(key_id, key_data)[source]

Update a setup key.

Parameters:
  • key_id (str) – Unique setup key identifier

  • key_data (SetupKeyUpdate) – Setup key update data

Return type:

Dict[str, Any]

Returns:

Updated setup key dictionary

Example

>>> key_data = SetupKeyUpdate(revoked=True)
>>> key = client.setup_keys.update("key-123", key_data)
delete(key_id)[source]

Delete a setup key.

Parameters:

key_id (str) – Unique setup key identifier

Return type:

None

Example

>>> client.setup_keys.delete("key-123")

Methods:

  • list() - List all setup keys

  • get(key_id) - Get setup key by ID

  • create(data) - Create a new setup key

  • update(key_id, data) - Update setup key

  • delete(key_id) - Delete setup key

GroupsResource

class netbird.resources.groups.GroupsResource(client)[source]

Handler for NetBird groups API endpoints.

Provides methods to manage NetBird groups including listing, creating, retrieving, updating, and deleting groups.

list()[source]

List all groups.

Return type:

List[Dict[str, Any]]

Returns:

List of group dictionaries

Example

>>> groups = client.groups.list()
>>> for group in groups:
...     print(f"Group: {group['name']} ({group['peers_count']} peers)")
create(group_data)[source]

Create a new group.

Parameters:

group_data (GroupCreate) – Group creation data

Return type:

Dict[str, Any]

Returns:

Created group dictionary

Example

>>> group_data = GroupCreate(
...     name="Developers",
...     peers=["peer-1", "peer-2"]
... )
>>> group = client.groups.create(group_data)
get(group_id)[source]

Retrieve a specific group.

Parameters:

group_id (str) – Unique group identifier

Return type:

Dict[str, Any]

Returns:

Group dictionary

Example

>>> group = client.groups.get("group-123")
>>> print(f"Group: {group['name']}")
update(group_id, group_data)[source]

Update a group.

Parameters:
  • group_id (str) – Unique group identifier

  • group_data (GroupUpdate) – Group update data

Return type:

Dict[str, Any]

Returns:

Updated group dictionary

Example

>>> group_data = GroupUpdate(
...     name="Senior Developers",
...     peers=["peer-1", "peer-2", "peer-3"]
... )
>>> group = client.groups.update("group-123", group_data)
delete(group_id)[source]

Delete a group.

Parameters:

group_id (str) – Unique group identifier

Return type:

None

Example

>>> client.groups.delete("group-123")

Methods:

  • list() - List all groups

  • get(group_id) - Get group by ID

  • create(data) - Create a new group

  • update(group_id, data) - Update group

  • delete(group_id) - Delete group

NetworksResource

class netbird.resources.networks.NetworksResource(client)[source]

Handler for NetBird networks API endpoints.

Provides methods to manage NetBird networks including listing, creating, retrieving, updating, and deleting networks, as well as managing network resources and routers.

list()[source]

List all networks.

Return type:

List[Dict[str, Any]]

Returns:

List of network dictionaries

Example

>>> networks = client.networks.list()
>>> for network in networks:
...     print(f"Network: {network['name']}")
create(network_data)[source]

Create a new network.

Parameters:

network_data (NetworkCreate) – Network creation data

Return type:

Dict[str, Any]

Returns:

Created network dictionary

Example

>>> network_data = NetworkCreate(
...     name="Production Network",
...     description="Main production environment"
... )
>>> network = client.networks.create(network_data)
get(network_id)[source]

Retrieve a specific network.

Parameters:

network_id (str) – Unique network identifier

Return type:

Dict[str, Any]

Returns:

Network dictionary

Example

>>> network = client.networks.get("network-123")
>>> print(f"Network: {network['name']}")
update(network_id, network_data)[source]

Update a network.

Parameters:
  • network_id (str) – Unique network identifier

  • network_data (NetworkUpdate) – Network update data

Return type:

Dict[str, Any]

Returns:

Updated network dictionary

Example

>>> network_data = NetworkUpdate(
...     name="Updated Production Network"
... )
>>> network = client.networks.update("network-123", network_data)
delete(network_id)[source]

Delete a network.

Parameters:

network_id (str) – Unique network identifier

Return type:

None

Example

>>> client.networks.delete("network-123")
list_resources(network_id)[source]

List all resources in a network.

Parameters:

network_id (str) – Unique network identifier

Return type:

List[Dict[str, Any]]

Returns:

List of network resource dictionaries

Example

>>> resources = client.networks.list_resources("network-123")
create_resource(network_id, resource_data)[source]

Create a network resource.

Parameters:
  • network_id (str) – Unique network identifier

  • resource_data (Dict[str, Any]) – Resource creation data

Return type:

Dict[str, Any]

Returns:

Created network resource dictionary

get_resource(network_id, resource_id)[source]

Get a specific network resource.

Parameters:
  • network_id (str) – Unique network identifier

  • resource_id (str) – Unique resource identifier

Return type:

Dict[str, Any]

Returns:

Network resource dictionary

update_resource(network_id, resource_id, resource_data)[source]

Update a network resource.

Parameters:
  • network_id (str) – Unique network identifier

  • resource_id (str) – Unique resource identifier

  • resource_data (Dict[str, Any]) – Resource update data

Return type:

Dict[str, Any]

Returns:

Updated network resource dictionary

delete_resource(network_id, resource_id)[source]

Delete a network resource.

Parameters:
  • network_id (str) – Unique network identifier

  • resource_id (str) – Unique resource identifier

Return type:

None

list_routers(network_id)[source]

List all routers in a network.

Parameters:

network_id (str) – Unique network identifier

Return type:

List[Dict[str, Any]]

Returns:

List of network router dictionaries

create_router(network_id, router_data)[source]

Create a network router.

Parameters:
  • network_id (str) – Unique network identifier

  • router_data (Dict[str, Any]) – Router creation data

Return type:

Dict[str, Any]

Returns:

Created network router dictionary

get_router(network_id, router_id)[source]

Get a specific network router.

Parameters:
  • network_id (str) – Unique network identifier

  • router_id (str) – Unique router identifier

Return type:

Dict[str, Any]

Returns:

Network router dictionary

update_router(network_id, router_id, router_data)[source]

Update a network router.

Parameters:
  • network_id (str) – Unique network identifier

  • router_id (str) – Unique router identifier

  • router_data (Dict[str, Any]) – Router update data

Return type:

Dict[str, Any]

Returns:

Updated network router dictionary

delete_router(network_id, router_id)[source]

Delete a network router.

Parameters:
  • network_id (str) – Unique network identifier

  • router_id (str) – Unique router identifier

Return type:

None

list_all_routers()[source]

List all routers across all networks.

Return type:

List[Dict[str, Any]]

Returns:

List of network router dictionaries

Methods:

  • list() - List all networks

  • get(network_id) - Get network by ID

  • create(data) - Create a new network

  • update(network_id, data) - Update network

  • delete(network_id) - Delete network

  • list_resources(network_id) - List resources in a network

  • get_resource(network_id, resource_id) - Get a specific resource

  • create_resource(network_id, data) - Create a resource

  • update_resource(network_id, resource_id, data) - Update a resource

  • delete_resource(network_id, resource_id) - Delete a resource

  • list_routers(network_id) - List routers in a network

  • get_router(network_id, router_id) - Get a specific router

  • create_router(network_id, data) - Create a router

  • update_router(network_id, router_id, data) - Update a router

  • delete_router(network_id, router_id) - Delete a router

  • list_all_routers() - List all routers across all networks

# Create network with resources
from netbird.models import NetworkCreate
network = client.networks.create(NetworkCreate(
    name="Production",
    description="Production network"
))

# Add resources and routers
resources = client.networks.list_resources(network['id'])
routers = client.networks.list_routers(network['id'])

PoliciesResource

class netbird.resources.policies.PoliciesResource(client)[source]

Handler for NetBird policies API endpoints.

Provides methods to manage NetBird access control policies including listing, creating, retrieving, updating, and deleting policies.

list()[source]

List all policies.

Return type:

List[Dict[str, Any]]

Returns:

List of policy dictionaries

Example

>>> policies = client.policies.list()
>>> for policy in policies:
...     print(f"Policy: {policy['name']} (Enabled: {policy['enabled']})")
create(policy_data)[source]

Create a new policy.

Parameters:

policy_data (PolicyCreate) – Policy creation data

Return type:

Dict[str, Any]

Returns:

Created policy dictionary

Example

>>> from netbird.models import PolicyRule, PolicyCreate
>>> rule = PolicyRule(
...     name="Allow SSH",
...     action="accept",
...     protocol="tcp",
...     ports=["22"],
...     sources=["group-dev"],
...     destinations=["group-servers"]
... )
>>> policy_data = PolicyCreate(
...     name="Development Access",
...     description="Allow developers to access servers",
...     rules=[rule]
... )
>>> policy = client.policies.create(policy_data)
get(policy_id)[source]

Retrieve a specific policy.

Parameters:

policy_id (str) – Unique policy identifier

Return type:

Dict[str, Any]

Returns:

Policy dictionary

Example

>>> policy = client.policies.get("policy-123")
>>> print(f"Policy: {policy['name']}")
update(policy_id, policy_data)[source]

Update a policy.

Parameters:
  • policy_id (str) – Unique policy identifier

  • policy_data (PolicyUpdate) – Policy update data

Return type:

Dict[str, Any]

Returns:

Updated policy dictionary

Example

>>> policy_data = PolicyUpdate(
...     enabled=False,
...     description="Disabled for maintenance"
... )
>>> policy = client.policies.update("policy-123", policy_data)
delete(policy_id)[source]

Delete a policy.

Parameters:

policy_id (str) – Unique policy identifier

Return type:

None

Example

>>> client.policies.delete("policy-123")

Methods:

  • list() - List all policies

  • get(policy_id) - Get policy by ID

  • create(data) - Create a new policy

  • update(policy_id, data) - Update policy

  • delete(policy_id) - Delete policy

RoutesResource

class netbird.resources.routes.RoutesResource(client)[source]

Handler for NetBird routes API endpoints.

Provides methods to manage NetBird network routes including listing, creating, retrieving, updating, and deleting routes.

list()[source]

List all routes.

Return type:

List[Dict[str, Any]]

Returns:

List of route dictionaries

Example

>>> routes = client.routes.list()
>>> for route in routes:
...     print(f"Route: {route['network']} (Enabled: {route['enabled']})")
create(route_data)[source]

Create a new route.

Parameters:

route_data (RouteCreate) – Route creation data

Return type:

Dict[str, Any]

Returns:

Created route dictionary

Example

>>> route_data = RouteCreate(
...     description="Internal network route",
...     network_id="192.168.1.0/24",
...     network_type="ipv4",
...     peer="peer-123",
...     metric=100
... )
>>> route = client.routes.create(route_data)
get(route_id)[source]

Retrieve a specific route.

Parameters:

route_id (str) – Unique route identifier

Return type:

Dict[str, Any]

Returns:

Route dictionary

Example

>>> route = client.routes.get("route-123")
>>> print(f"Route: {route['network']}")
update(route_id, route_data)[source]

Update a route.

Parameters:
  • route_id (str) – Unique route identifier

  • route_data (RouteUpdate) – Route update data

Return type:

Dict[str, Any]

Returns:

Updated route dictionary

Example

>>> route_data = RouteUpdate(
...     enabled=False,
...     description="Route disabled for maintenance"
... )
>>> route = client.routes.update("route-123", route_data)
delete(route_id)[source]

Delete a route.

Parameters:

route_id (str) – Unique route identifier

Return type:

None

Example

>>> client.routes.delete("route-123")

Deprecated since version Routes: API is deprecated. Use the Networks API instead. All route methods emit DeprecationWarning.

Methods:

  • list() - List all routes

  • get(route_id) - Get route by ID

  • create(data) - Create a new route

  • update(route_id, data) - Update route

  • delete(route_id) - Delete route

DNSResource

class netbird.resources.dns.DNSResource(client)[source]

Handler for NetBird DNS API endpoints.

Provides methods to manage NetBird DNS settings including nameserver groups and DNS configuration.

list_nameserver_groups()[source]

List all nameserver groups.

Return type:

List[Dict[str, Any]]

Returns:

List of DNS nameserver group dictionaries

Example

>>> nameservers = client.dns.list_nameserver_groups()
>>> for ns in nameservers:
...     print(f"Nameserver Group: {ns['name']}")
create_nameserver_group(nameserver_data)[source]

Create a new nameserver group.

Parameters:

nameserver_data (Dict[str, Any]) – Nameserver group creation data

Return type:

Dict[str, Any]

Returns:

Created DNS nameserver group dictionary

Example

>>> nameserver_data = {
...     "name": "Corporate DNS",
...     "description": "Internal corporate nameservers",
...     "nameservers": ["10.0.0.10", "10.0.0.11"],
...     "enabled": True
... }
>>> ns_group = client.dns.create_nameserver_group(nameserver_data)
get_nameserver_group(group_id)[source]

Retrieve a specific nameserver group.

Parameters:

group_id (str) – Unique nameserver group identifier

Return type:

Dict[str, Any]

Returns:

DNS nameserver group dictionary

Example

>>> ns_group = client.dns.get_nameserver_group("ns-group-123")
>>> print(f"Nameservers: {ns_group['nameservers']}")
update_nameserver_group(group_id, nameserver_data)[source]

Update a nameserver group.

Parameters:
  • group_id (str) – Unique nameserver group identifier

  • nameserver_data (Dict[str, Any]) – Nameserver group update data

Return type:

Dict[str, Any]

Returns:

Updated DNS nameserver group dictionary

Example

>>> nameserver_data = {
...     "enabled": False,
...     "description": "Disabled for maintenance"
... }
>>> ns_group = client.dns.update_nameserver_group(
...     "ns-group-123", nameserver_data
... )
delete_nameserver_group(group_id)[source]

Delete a nameserver group.

Parameters:

group_id (str) – Unique nameserver group identifier

Return type:

None

Example

>>> client.dns.delete_nameserver_group("ns-group-123")
get_settings()[source]

Retrieve DNS settings.

Return type:

Dict[str, Any]

Returns:

DNS settings dictionary

Example

>>> settings = client.dns.get_settings()
>>> print(f"Disabled groups: {settings['disabled_management_groups']}")
update_settings(settings_data)[source]

Update DNS settings.

Parameters:

settings_data (Dict[str, Any]) – DNS settings update data

Return type:

Dict[str, Any]

Returns:

Updated DNS settings dictionary

Example

>>> settings_data = {
...     "disabled_management_groups": ["group-123"]
... }
>>> settings = client.dns.update_settings(settings_data)

Methods:

  • list() - List nameserver groups

  • get(ns_group_id) - Get nameserver group by ID

  • create(data) - Create nameserver group

  • update(ns_group_id, data) - Update nameserver group

  • delete(ns_group_id) - Delete nameserver group

  • get_settings() - Get DNS settings

  • update_settings(data) - Update DNS settings

DNSZonesResource

class netbird.resources.dns_zones.DNSZonesResource(client)[source]

Handler for NetBird DNS zones API endpoints.

This resource manages DNS zones and records. It is separate from the DNSResource which manages nameserver groups and DNS settings.

list()[source]

List all DNS zones.

Return type:

List[Dict[str, Any]]

Returns:

List of DNS zone dictionaries

create(zone_data)[source]

Create a new DNS zone.

Parameters:

zone_data (DNSZoneCreate) – DNS zone creation data

Return type:

Dict[str, Any]

Returns:

Created DNS zone dictionary

get(zone_id)[source]

Retrieve a specific DNS zone.

Parameters:

zone_id (str) – Unique zone identifier

Return type:

Dict[str, Any]

Returns:

DNS zone dictionary

update(zone_id, zone_data)[source]

Update a DNS zone.

Parameters:
  • zone_id (str) – Unique zone identifier

  • zone_data (DNSZoneUpdate) – DNS zone update data

Return type:

Dict[str, Any]

Returns:

Updated DNS zone dictionary

delete(zone_id)[source]

Delete a DNS zone.

Parameters:

zone_id (str) – Unique zone identifier

Return type:

None

list_records(zone_id)[source]

List all records in a DNS zone.

Parameters:

zone_id (str) – Unique zone identifier

Return type:

List[Dict[str, Any]]

Returns:

List of DNS record dictionaries

create_record(zone_id, record_data)[source]

Create a DNS record in a zone.

Parameters:
  • zone_id (str) – Unique zone identifier

  • record_data (DNSRecordCreate) – DNS record creation data

Return type:

Dict[str, Any]

Returns:

Created DNS record dictionary

get_record(zone_id, record_id)[source]

Retrieve a specific DNS record.

Parameters:
  • zone_id (str) – Unique zone identifier

  • record_id (str) – Unique record identifier

Return type:

Dict[str, Any]

Returns:

DNS record dictionary

update_record(zone_id, record_id, record_data)[source]

Update a DNS record.

Parameters:
  • zone_id (str) – Unique zone identifier

  • record_id (str) – Unique record identifier

  • record_data (DNSRecordUpdate) – DNS record update data

Return type:

Dict[str, Any]

Returns:

Updated DNS record dictionary

delete_record(zone_id, record_id)[source]

Delete a DNS record.

Parameters:
  • zone_id (str) – Unique zone identifier

  • record_id (str) – Unique record identifier

Return type:

None

Methods:

  • list() - List all DNS zones

  • get(zone_id) - Get zone by ID

  • create(data) - Create a DNS zone

  • update(zone_id, data) - Update zone

  • delete(zone_id) - Delete zone

  • list_records(zone_id) - List records in a zone

  • get_record(zone_id, record_id) - Get a specific record

  • create_record(zone_id, data) - Create a DNS record

  • update_record(zone_id, record_id, data) - Update a record

  • delete_record(zone_id, record_id) - Delete a record

EventsResource

class netbird.resources.events.EventsResource(client)[source]

Handler for NetBird events API endpoints.

Provides methods to retrieve audit events and network traffic events.

get_audit_events()[source]

Retrieve all audit events.

Return type:

List[Dict[str, Any]]

Returns:

List of audit event dictionaries

Example

>>> events = client.events.get_audit_events()
>>> for event in events:
...     print(f"{event['timestamp']}: {event['activity']}")
get_network_traffic_events(page=None, page_size=None, user_id=None, reporter_id=None, protocol=None, event_type=None, connection_type=None, direction=None, search=None, start_date=None, end_date=None)[source]

Retrieve network traffic events with optional filtering.

This endpoint is marked as “cloud-only experimental” in the API.

Parameters:
  • page (Optional[int]) – Page number for pagination

  • page_size (Optional[int]) – Number of events per page

  • user_id (Optional[str]) – Filter by user ID

  • reporter_id (Optional[str]) – Filter by reporter peer ID

  • protocol (Optional[str]) – Filter by protocol (tcp, udp, icmp)

  • event_type (Optional[str]) – Filter by event type

  • connection_type (Optional[str]) – Filter by connection type (relay, p2p)

  • direction (Optional[str]) – Filter by traffic direction (sent, received)

  • search (Optional[str]) – Search term

  • start_date (Optional[str]) – Start date filter

  • end_date (Optional[str]) – End date filter

Return type:

List[Dict[str, Any]]

Returns:

List of network traffic event dictionaries

Example

>>> # Get all traffic events
>>> events = client.events.get_network_traffic_events()
>>>
>>> # Filter by protocol and user
>>> events = client.events.get_network_traffic_events(
...     protocol="tcp",
...     user_id="user-123",
...     page_size=50
... )
get_proxy_events(page=None, page_size=None, sort_by=None, sort_order=None, search=None, source_ip=None, host=None, path=None, user_id=None, user_email=None, user_name=None, method=None, status=None, status_code=None, start_date=None, end_date=None)[source]

Retrieve reverse proxy access log events.

Parameters:
Return type:

List[Dict[str, Any]]

Returns:

List of proxy event dictionaries

Methods:

  • get_audit_events() - Get audit log events

  • get_network_traffic_events(**filters) - Get network traffic events with filtering

  • get_proxy_events(**filters) - Get reverse proxy events with filtering

# Audit events
events = client.events.get_audit_events()

# Network traffic with filters
traffic = client.events.get_network_traffic_events(
    protocol="tcp",
    user_id="user-123",
    start_date="2024-01-01",
    end_date="2024-01-31",
    page_size=100,
)

# Proxy events with filters
proxy = client.events.get_proxy_events(
    method="POST",
    host="api.example.com",
    status_code=200,
    sort_by="timestamp",
    sort_order="desc",
)

PostureChecksResource

class netbird.resources.posture_checks.PostureChecksResource(client)[source]

Handler for NetBird posture checks API endpoints.

list()[source]

List all posture checks.

Return type:

List[Dict[str, Any]]

Returns:

List of posture check dictionaries

create(check_data)[source]

Create a new posture check.

Parameters:

check_data (PostureCheckCreate) – Posture check creation data

Return type:

Dict[str, Any]

Returns:

Created posture check dictionary

get(check_id)[source]

Retrieve a specific posture check.

Parameters:

check_id (str) – Unique posture check identifier

Return type:

Dict[str, Any]

Returns:

Posture check dictionary

update(check_id, check_data)[source]

Update a posture check.

Parameters:
  • check_id (str) – Unique posture check identifier

  • check_data (PostureCheckUpdate) – Posture check update data

Return type:

Dict[str, Any]

Returns:

Updated posture check dictionary

delete(check_id)[source]

Delete a posture check.

Parameters:

check_id (str) – Unique posture check identifier

Return type:

None

Methods:

  • list() - List all posture checks

  • get(check_id) - Get posture check by ID

  • create(data) - Create a posture check

  • update(check_id, data) - Update posture check

  • delete(check_id) - Delete posture check

GeoLocationsResource

class netbird.resources.geo_locations.GeoLocationsResource(client)[source]

Handler for NetBird geo locations API endpoints.

list_countries()[source]

List all country codes (ISO 3166-1 alpha-2).

Return type:

List[str]

Returns:

List of 2-letter country code strings

list_cities(country_code)[source]

List cities for a given country code.

Parameters:

country_code (str) – 2-letter ISO country code

Return type:

List[Dict[str, Any]]

Returns:

List of city dictionaries with geoname_id and city_name

Methods:

  • get_countries() - List all countries

  • get_cities(country_code) - List cities in a country

IdentityProvidersResource

class netbird.resources.identity_providers.IdentityProvidersResource(client)[source]

Handler for NetBird identity providers API endpoints.

list()[source]

List all identity providers.

Return type:

List[Dict[str, Any]]

Returns:

List of identity provider dictionaries

create(provider_data)[source]

Create a new identity provider.

Parameters:

provider_data (IdentityProviderCreate) – Identity provider creation data

Return type:

Dict[str, Any]

Returns:

Created identity provider dictionary

get(provider_id)[source]

Retrieve a specific identity provider.

Parameters:

provider_id (str) – Unique identity provider identifier

Return type:

Dict[str, Any]

Returns:

Identity provider dictionary

update(provider_id, provider_data)[source]

Update an identity provider.

Parameters:
  • provider_id (str) – Unique identity provider identifier

  • provider_data (IdentityProviderUpdate) – Identity provider update data

Return type:

Dict[str, Any]

Returns:

Updated identity provider dictionary

delete(provider_id)[source]

Delete an identity provider.

Parameters:

provider_id (str) – Unique identity provider identifier

Return type:

None

Methods:

  • list() - List identity providers

  • get(provider_id) - Get provider by ID

  • create(data) - Create identity provider

  • update(provider_id, data) - Update provider

  • delete(provider_id) - Delete provider

InstanceResource

class netbird.resources.instance.InstanceResource(client)[source]

Handler for NetBird instance API endpoints.

Note: These endpoints do not require authentication. The APIClient will still send auth headers (the server ignores them).

get_status()[source]

Get instance status.

Return type:

Dict[str, Any]

Returns:

Instance status dictionary

get_version()[source]

Get version information.

Return type:

Dict[str, Any]

Returns:

Version information dictionary

setup(email, password, name)[source]

Setup the instance with initial admin user.

Parameters:
  • email (str) – Email address for the admin user

  • password (str) – Password for the admin user (minimum 8 characters)

  • name (str) – Display name for the admin user

Return type:

Dict[str, Any]

Returns:

Setup confirmation dictionary

Methods:

  • get_status() - Get instance status

  • get_version() - Get instance version

  • setup(data) - Initial instance setup

Cloud Resources

Cloud resources are only available on NetBird Cloud (api.netbird.io). Access via client.cloud.<resource>.

ServicesResource

class netbird.resources.cloud.services.ServicesResource(client)[source]

Handler for NetBird reverse proxy services API endpoints.

list()[source]

List all services.

Return type:

List[Dict[str, Any]]

create(service_data)[source]

Create a new service.

Return type:

Dict[str, Any]

get(service_id)[source]

Retrieve a specific service.

Return type:

Dict[str, Any]

update(service_id, service_data)[source]

Update a service.

Return type:

Dict[str, Any]

delete(service_id)[source]

Delete a service.

Return type:

None

list_clusters()[source]

List available proxy clusters.

Return type:

List[Dict[str, Any]]

list_domains()[source]

List service domains.

Return type:

List[Dict[str, Any]]

create_domain(domain_data)[source]

Create a custom domain.

Return type:

Dict[str, Any]

delete_domain(domain_id)[source]

Delete a custom domain.

Return type:

None

validate_domain(domain_id)[source]

Validate a custom domain.

Return type:

Dict[str, Any]

IngressResource

class netbird.resources.cloud.ingress.IngressResource(client)[source]

Handler for NetBird ingress ports API endpoints.

list_ports(peer_id)[source]

List all port allocations for a peer.

Return type:

List[Dict[str, Any]]

create_port(peer_id, port_data)[source]

Create a port allocation for a peer.

Return type:

Dict[str, Any]

get_port(peer_id, allocation_id)[source]

Retrieve a specific port allocation.

Return type:

Dict[str, Any]

update_port(peer_id, allocation_id, port_data)[source]

Update a port allocation.

Return type:

Dict[str, Any]

delete_port(peer_id, allocation_id)[source]

Delete a port allocation.

Return type:

None

list_peers()[source]

List all ingress peers.

Return type:

List[Dict[str, Any]]

create_peer(peer_data)[source]

Create an ingress peer.

Return type:

Dict[str, Any]

get_peer(ingress_peer_id)[source]

Retrieve a specific ingress peer.

Return type:

Dict[str, Any]

update_peer(ingress_peer_id, peer_data)[source]

Update an ingress peer.

Return type:

Dict[str, Any]

delete_peer(ingress_peer_id)[source]

Delete an ingress peer.

Return type:

None

EDR Resources

EDR integrations are accessed via client.cloud.edr:

# CrowdStrike Falcon
falcon = client.cloud.edr.falcon.get()

# Huntress
huntress = client.cloud.edr.huntress.get()

# Microsoft Intune
intune = client.cloud.edr.intune.get()

# SentinelOne
sentinelone = client.cloud.edr.sentinelone.get()

# EDR Peers
edr_peers = client.cloud.edr.peers.list()

MSPResource

class netbird.resources.cloud.msp.MSPResource(client)[source]

Handler for NetBird MSP API endpoints.

list_tenants()[source]

List all MSP tenants.

Return type:

List[Dict[str, Any]]

create_tenant(tenant_data)[source]

Create an MSP tenant.

Return type:

Dict[str, Any]

get_tenant(tenant_id)[source]

Retrieve a specific MSP tenant.

Return type:

Dict[str, Any]

update_tenant(tenant_id, tenant_data)[source]

Update an MSP tenant.

Return type:

Dict[str, Any]

Unlink an MSP tenant.

Return type:

Dict[str, Any]

verify_domain(tenant_id)[source]

Verify domain DNS challenge for a tenant.

Return type:

Dict[str, Any]

create_subscription(tenant_id, price_id)[source]

Create a subscription for a tenant.

Return type:

Dict[str, Any]

invite_tenant(tenant_id)[source]

Invite an existing account as tenant.

Return type:

Dict[str, Any]

respond_to_invite(tenant_id, value)[source]

Respond to a tenant invitation (accept/decline).

Return type:

Dict[str, Any]

InvoiceResource

class netbird.resources.cloud.invoice.InvoiceResource(client)[source]

Handler for NetBird billing invoice API endpoints.

list()[source]

List all paid invoices.

Return type:

List[Dict[str, Any]]

get_pdf_url(invoice_id)[source]

Get PDF URL for an invoice.

Return type:

Dict[str, Any]

get_csv(invoice_id)[source]

Get CSV data for an invoice.

Return type:

Dict[str, Any]

UsageResource

class netbird.resources.cloud.usage.UsageResource(client)[source]

Handler for NetBird billing usage API endpoints.

get()[source]

Get current usage statistics.

Return type:

Dict[str, Any]

EventStreamingResource

class netbird.resources.cloud.event_streaming.EventStreamingResource(client)[source]

Handler for NetBird event streaming integration API endpoints.

list()[source]

List all event streaming integrations.

Return type:

List[Dict[str, Any]]

create(integration_data)[source]

Create an event streaming integration.

Return type:

Dict[str, Any]

get(integration_id)[source]

Retrieve a specific event streaming integration.

Return type:

Dict[str, Any]

update(integration_id, integration_data)[source]

Update an event streaming integration.

Return type:

Dict[str, Any]

delete(integration_id)[source]

Delete an event streaming integration.

Return type:

None

IDPScimResource

class netbird.resources.cloud.idp_scim.IDPScimResource(client)[source]

Handler for NetBird IDP/SCIM integration API endpoints.

list()[source]

List all SCIM IDP integrations.

Return type:

List[Dict[str, Any]]

create(integration_data)[source]

Create a SCIM IDP integration.

Return type:

Dict[str, Any]

get(integration_id)[source]

Retrieve a specific SCIM IDP integration.

Return type:

Dict[str, Any]

update(integration_id, integration_data)[source]

Update a SCIM IDP integration.

Return type:

Dict[str, Any]

delete(integration_id)[source]

Delete a SCIM IDP integration.

Return type:

None

regenerate_token(integration_id)[source]

Regenerate SCIM token.

Return type:

Dict[str, Any]

get_logs(integration_id)[source]

Get SCIM integration sync logs.

Return type:

List[Dict[str, Any]]