4.2 KiB
4.2 KiB
NetBird API Reference
Base URL: https://net.dcglab.co.uk/api
Authentication
Header: Authorization: Bearer <token>
Endpoints
Peers
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/peers |
List all peers |
| GET | /api/peers/{peerId} |
Get peer details |
| PUT | /api/peers/{peerId} |
Update peer |
| DELETE | /api/peers/{peerId} |
Delete peer |
Peer Object Fields:
id- Unique identifiername- Peer nameip- NetBird IP addressconnection_ip- Public connection IPconnected- Boolean connection statuslast_seen- ISO timestampos- Operating systemhostname- System hostnamegroups- Array of group objectsssh_enabled- Boolean SSH accessuser_id- Owner user IDdns_label- DNS nameapproval_required- Boolean pending approval
Groups
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/groups |
List all groups |
| POST | /api/groups |
Create group |
| GET | /api/groups/{groupId} |
Get group details |
| PUT | /api/groups/{groupId} |
Update group |
| DELETE | /api/groups/{groupId} |
Delete group |
Group Object Fields:
id- Unique identifiername- Group namepeers_count- Number of peersresources_count- Number of resourcesissued- Creation source (api, etc.)
Setup Keys
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/setup-keys |
List all setup keys |
| POST | /api/setup-keys |
Create setup key |
| GET | /api/setup-keys/{keyId} |
Get key details |
| PUT | /api/setup-keys/{keyId} |
Update key |
| DELETE | /api/setup-keys/{keyId} |
Delete key |
Create Setup Key Body:
{
"name": "string",
"type": "one-off" | "reusable",
"expires_in": 86400,
"auto_groups": ["group-id-1", "group-id-2"]
}
Policies
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/policies |
List all policies |
| POST | /api/policies |
Create policy |
| GET | /api/policies/{policyId} |
Get policy details |
| PUT | /api/policies/{policyId} |
Update policy |
| DELETE | /api/policies/{policyId} |
Delete policy |
Policy Rule Fields:
name- Rule namedescription- Rule descriptionenabled- Boolean statusaction- "accept" or "drop"protocol- "tcp", "udp", "icmp", "all"ports- Array of port strings (e.g., ["80", "443"])sources- Array of source group IDsdestinations- Array of destination group IDsbidirectional- Boolean
Routes
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/routes |
List all routes |
| POST | /api/routes |
Create route |
| GET | /api/routes/{routeId} |
Get route details |
| PUT | /api/routes/{routeId} |
Update route |
| DELETE | /api/routes/{routeId} |
Delete route |
DNS
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/dns/nameservers |
List nameserver groups |
| POST | /api/dns/nameservers |
Create nameserver group |
| GET | /api/dns/nameservers/{nsgroupId} |
Get nameserver group |
| PUT | /api/dns/nameservers/{nsgroupId} |
Update nameserver group |
| DELETE | /api/dns/nameservers/{nsgroupId} |
Delete nameserver group |
| GET | /api/dns/settings |
Get DNS settings |
| PUT | /api/dns/settings |
Update DNS settings |
Users
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/users |
List all users |
| POST | /api/users |
Create service user or invite |
| GET | /api/users/{userId} |
Get user details |
| PUT | /api/users/{userId} |
Update user |
| DELETE | /api/users/{userId} |
Delete user |
| POST | /api/users/{userId}/invite |
Resend invitation |
| POST | /api/users/{userId}/approve |
Approve pending user |
| DELETE | /api/users/{userId}/reject |
Reject pending user |
Common Patterns
Filter by Name
Many list endpoints support ?name= query parameter for exact match filtering.
Service Users
Set is_service_user: true when creating users for automation/API access.
Auto Groups
When creating setup keys or users, specify auto_groups to automatically assign peers to groups.