You're viewing documentation for the legacy version of Firezone, now End-of-Life. View the latest docs here.
REST API: Rules
This endpoint allows an adminisrator to manage Rules.
API Documentation
GET /v0/rules
Example
$ curl -i \
-X GET "https://{firezone_host}/v0/rules" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {api_token}' \
HTTP/1.1 200
Content-Type: application/json; charset=utf-8
{
"data": [
{
"action": "drop",
"destination": "10.3.2.1",
"id": "2a136a17-4d29-4d8b-a6d4-f35ee3051105",
"inserted_at": "2023-03-29T15:11:47.482818Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-03-29T15:11:47.482818Z",
"user_id": null
},
{
"action": "drop",
"destination": "10.3.2.2",
"id": "7a4961bf-6b2b-4217-b87b-ffd1deb448ac",
"inserted_at": "2023-03-29T15:11:47.483506Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-03-29T15:11:47.483506Z",
"user_id": null
},
{
"action": "drop",
"destination": "10.3.2.3",
"id": "6dffbc74-ec58-43ca-8700-d0c572baa198",
"inserted_at": "2023-03-29T15:11:47.484107Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-03-29T15:11:47.484107Z",
"user_id": null
},
{
"action": "drop",
"destination": "10.3.2.4",
"id": "9bba129d-cdad-4efe-8296-b78ba50f3ef4",
"inserted_at": "2023-03-29T15:11:47.484759Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-03-29T15:11:47.484759Z",
"user_id": null
},
{
"action": "drop",
"destination": "10.3.2.5",
"id": "df142fde-922c-4a6d-a8e4-0b145a875624",
"inserted_at": "2023-03-29T15:11:47.485540Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-03-29T15:11:47.485540Z",
"user_id": null
}
]
}
POST /v0/rules
Example
$ curl -i \
-X POST "https://{firezone_host}/v0/rules" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {api_token}' \
--data-binary @- << EOF
{
"rule": {
"action": "accept",
"destination": "1.1.1.1/24",
"port_range": "1 - 2",
"port_type": "udp",
"user_id": "def4dacc-6367-4320-a0fb-4675b9b571cf"
}
}
EOF
HTTP/1.1 201
Content-Type: application/json; charset=utf-8
Location: /v0/rules/c52efbe6-5ed0-4514-97df-93f6013dd52b
{
"data": {
"action": "accept",
"destination": "1.1.1.1/24",
"id": "c52efbe6-5ed0-4514-97df-93f6013dd52b",
"inserted_at": "2023-03-29T15:11:47.185000Z",
"port_range": "1 - 2",
"port_type": "udp",
"updated_at": "2023-03-29T15:11:47.185000Z",
"user_id": "def4dacc-6367-4320-a0fb-4675b9b571cf"
}
}
GET /v0/rules/{id}
Example
URI Parameters:
id
:dd39b339-2ac4-4c83-96e5-9b29516dd85e
$ curl -i \
-X GET "https://{firezone_host}/v0/rules/{id}" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {api_token}' \
HTTP/1.1 200
Content-Type: application/json; charset=utf-8
{
"data": {
"action": "drop",
"destination": "10.10.10.0/24",
"id": "dd39b339-2ac4-4c83-96e5-9b29516dd85e",
"inserted_at": "2023-03-29T15:11:47.447659Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-03-29T15:11:47.447659Z",
"user_id": null
}
}
PATCH /v0/rules/{id}
Example
URI Parameters:
id
:720fdab6-32af-4487-bce5-e72fa76be829
$ curl -i \
-X PUT "https://{firezone_host}/v0/rules/{id}" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {api_token}' \
--data-binary @- << EOF
{
"rule": {
"action": "accept",
"destination": "1.1.1.1/24",
"port_range": "1 - 2",
"port_type": "udp"
}
}
EOF
HTTP/1.1 200
Content-Type: application/json; charset=utf-8
{
"data": {
"action": "accept",
"destination": "1.1.1.1/24",
"id": "720fdab6-32af-4487-bce5-e72fa76be829",
"inserted_at": "2023-03-29T15:11:47.243306Z",
"port_range": "1 - 2",
"port_type": "udp",
"updated_at": "2023-03-29T15:11:47.251589Z",
"user_id": null
}
}
DELETE /v0/rules/{id}
Example
URI Parameters:
id
:f5f10a6e-cfdd-47ea-ae23-264195b3503c
$ curl -i \
-X DELETE "https://{firezone_host}/v0/rules/{id}" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {api_token}' \
HTTP/1.1 204