Services API
Service management endpoints
Services API
Manage services for network routing.
GET /v1/services
List services.
Authentication
Required. Scope: services.read
Query Parameters
| Parameter | Type | Description |
|---|---|---|
source_peer_id | string | Filter by source peer |
target_peer_id | string | Filter by target peer |
requires_interface | boolean | Filter by interface requirement |
Response
[
{
"id": "01HSVC...",
"source_peer_id": "01HXYZ...",
"target_peer_id": "01HABC...",
"transport_type": "tcp",
"requires_interface": true,
"interface_ipv4_cidr": "192.168.100.10/24",
"interface_ipv6_cidr": null,
"fully_transparent": false,
"bandwidth_limit_mbps": 1000,
"route_count": 2,
"created_at": "2024-01-15T10:30:00Z"
}
]Example
curl -X GET http://agent:8080/v1/services \
-H "Authorization: Bearer $TOKEN"
# Filter by target peer
curl -X GET "http://agent:8080/v1/services?target_peer_id=01HABC..." \
-H "Authorization: Bearer $TOKEN"GET /v1/services/{id}
Get a specific service.
Authentication
Required. Scope: services.read
Path Parameters
| Parameter | Description |
|---|---|
id | Service ID |
Response
{
"id": "01HSVC...",
"source_peer_id": "01HXYZ...",
"target_peer_id": "01HABC...",
"transport_type": "tcp",
"requires_interface": true,
"interface_ipv4_cidr": "192.168.100.10/24",
"interface_ipv6_cidr": null,
"fully_transparent": false,
"bandwidth_limit_mbps": 1000,
"routes": [
{
"id": 1,
"priority": 100,
"source_cidr": "10.0.0.0/8",
"dest_cidr": "192.168.100.0/24"
}
],
"created_at": "2024-01-15T10:30:00Z"
}Errors
| Status | Code | Description |
|---|---|---|
| 404 | NOT_FOUND | Service not found |
POST /v1/services
Create a new service.
Authentication
Required. Scope: services.write
Request Body
{
"target_peer_id": "01HABC...",
"source_peer_id": "01HXYZ...",
"transport_type": "tcp",
"requires_interface": true,
"desired_ipv4_cidr": "192.168.100.10/24",
"desired_ipv6_cidr": "fd00::10/64",
"fully_transparent": false,
"bandwidth_limit_mbps": 1000
}| Field | Type | Required | Default | Description |
|---|---|---|---|---|
target_peer_id | string | Yes | Target peer ID | |
source_peer_id | string | No | local | Source peer ID |
transport_type | string | No | tcp | tcp or kcp |
requires_interface | boolean | No | false | Create MACVLAN |
desired_ipv4_cidr | string | No | IPv4 for interface | |
desired_ipv6_cidr | string | No | IPv6 for interface | |
fully_transparent | boolean | No | false | Transparent mode |
bandwidth_limit_mbps | integer | No | 0 | Bandwidth limit |
Response
{
"id": "01HSVC...",
"source_peer_id": "01HXYZ...",
"target_peer_id": "01HABC...",
"transport_type": "tcp",
"requires_interface": true,
"created_at": "2024-01-15T10:30:00Z"
}Errors
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_REQUEST | Missing target_peer_id |
| 400 | INVALID_TRANSPORT | Invalid transport type |
| 404 | NOT_FOUND | Target peer not found |
| 409 | ALREADY_EXISTS | Service already exists |
| 422 | SERVICE_LIMIT_EXCEEDED | License limit reached |
PUT /v1/services/{id}
Update service settings.
Authentication
Required. Scope: services.write
Path Parameters
| Parameter | Description |
|---|---|
id | Service ID |
Request Body
{
"requires_interface": true,
"desired_ipv4_cidr": "192.168.100.10/24",
"bandwidth_limit_mbps": 500
}All fields are optional. Only provided fields are updated.
Response
Returns the updated service.
Errors
| Status | Code | Description |
|---|---|---|
| 404 | NOT_FOUND | Service not found |
DELETE /v1/services/{id}
Delete a service.
Authentication
Required. Scope: services.write
Path Parameters
| Parameter | Description |
|---|---|
id | Service ID |
Response
{
"deleted": true
}Errors
| Status | Code | Description |
|---|---|---|
| 404 | NOT_FOUND | Service not found |
Notes
Deleting a service also deletes all associated routes.
See Also
- Transparent Mode - Source IP preservation details
- Routing - Traffic routing concepts
- Create Service Guide - How-to guide