Skip to main content

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": "fdcf2ca8-1871-4aac-bc01-591b3e18578e",
"inserted_at": "2023-01-13T06:30:46.079209Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-01-13T06:30:46.079209Z",
"user_id": null
},
{
"action": "drop",
"destination": "10.3.2.2",
"id": "2e544ab0-0ca5-432e-9a31-b5feb982f50a",
"inserted_at": "2023-01-13T06:30:46.087033Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-01-13T06:30:46.087033Z",
"user_id": null
},
{
"action": "drop",
"destination": "10.3.2.3",
"id": "02df6455-65f1-406b-a3dd-7c223af04f9b",
"inserted_at": "2023-01-13T06:30:46.088443Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-01-13T06:30:46.088443Z",
"user_id": null
},
{
"action": "drop",
"destination": "10.3.2.4",
"id": "e0c4e652-e3a2-4a69-a8f3-265e07515938",
"inserted_at": "2023-01-13T06:30:46.090111Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-01-13T06:30:46.090111Z",
"user_id": null
},
{
"action": "drop",
"destination": "10.3.2.5",
"id": "a7c2bfb2-3e09-48d8-b038-c69c84b777b1",
"inserted_at": "2023-01-13T06:30:46.091623Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-01-13T06:30:46.091623Z",
"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": "9f4d207a-90d8-4cc9-800c-accefe9f90cf"
}
}'
EOF

HTTP/1.1 201
Content-Type: application/json; charset=utf-8
Location: /v0/rules/cc374f84-b003-4858-8772-516ea3f098a1

{
"data": {
"action": "accept",
"destination": "1.1.1.1/24",
"id": "cc374f84-b003-4858-8772-516ea3f098a1",
"inserted_at": "2023-01-13T06:30:47.193190Z",
"port_range": "1 - 2",
"port_type": "udp",
"updated_at": "2023-01-13T06:30:47.193190Z",
"user_id": "9f4d207a-90d8-4cc9-800c-accefe9f90cf"
}
}

GET /v0/rules/{id}

Example

URI Parameters:

  • id: 49a9ae27-74f2-45dd-a324-d47a7581205c
$ 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": "49a9ae27-74f2-45dd-a324-d47a7581205c",
"inserted_at": "2023-01-13T06:30:46.993421Z",
"port_range": null,
"port_type": null,
"updated_at": "2023-01-13T06:30:46.993421Z",
"user_id": null
}
}

PATCH /v0/rules/{id}

Example

URI Parameters:

  • id: b8231fa6-1df2-4b1b-8687-61a72a8031b1
$ 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": "b8231fa6-1df2-4b1b-8687-61a72a8031b1",
"inserted_at": "2023-01-13T06:30:47.244050Z",
"port_range": "1 - 2",
"port_type": "udp",
"updated_at": "2023-01-13T06:30:47.254788Z",
"user_id": null
}
}

DELETE /v0/rules/{id}

Example

URI Parameters:

  • id: 05c0342c-984c-43df-855b-32e88ea8ee08
$ curl -i \
-X DELETE "https://{firezone_host}/v0/rules/{id}" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {api_token}' \

HTTP/1.1 204