export const title = 'Events' ## List all Audit Events {{ tag: 'GET' , label: '/api/events/audit' }} Returns a list of all audit events ```bash {{ title: 'cURL' }} curl -X GET https://api.netbird.io/api/events/audit \ -H 'Accept: application/json' \ -H 'Authorization: Token ' ``` ```js const axios = require('axios'); let config = { method: 'get', maxBodyLength: Infinity, url: '/api/events/audit', headers: { 'Accept': 'application/json', 'Authorization': 'Token ' } }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/events/audit" headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } response = requests.request("GET", url, headers=headers) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/events/audit" method := "GET" client := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return { req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/events/audit") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); Request request = new Request.Builder() .url("https://api.netbird.io/api/events/audit") .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/events/audit', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Accept: application/json', 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json {{ title: 'Example' }} [ { "id": 10, "timestamp": "2023-05-05T10:04:37.473542Z", "activity": "Route created", "activity_code": "route.add", "initiator_id": "google-oauth2|123456789012345678901", "initiator_name": "John Doe", "initiator_email": "demo@netbird.io", "target_id": "chad9d86lnnc59g18ou0", "meta": { "name": "my route", "network_range": "10.64.0.0/24", "peer_id": "chacbco6lnnbn6cg5s91" } } ] ``` ```json {{ title: 'Schema' }} [ { "id": "string", "timestamp": "string", "activity": "string", "activity_code": "string", "initiator_id": "string", "initiator_name": "string", "initiator_email": "string", "target_id": "string", "meta": { "description": "The metadata of the event", "type": "object", "additionalProperties": "string", "example": { "name": "my route", "network_range": "10.64.0.0/24", "peer_id": "chacbco6lnnbn6cg5s91" } } } ] ``` --- ## List all Traffic Events {{ tag: 'GET' , label: '/api/events/network-traffic' }} Returns a list of all network traffic events ### Query Parameters Page number Number of items per page Filter by user ID Filter by reporter ID Filter by protocol Filter by event type Filter by connection type Filter by direction Case-insensitive partial match on user email, source/destination names, and source/destination addresses Start date for filtering events (ISO 8601 format, e.g., 2024-01-01T00:00:00Z). End date for filtering events (ISO 8601 format, e.g., 2024-01-31T23:59:59Z). ```bash {{ title: 'cURL' }} curl -X GET https://api.netbird.io/api/events/network-traffic \ -H 'Accept: application/json' \ -H 'Authorization: Token ' ``` ```js const axios = require('axios'); let config = { method: 'get', maxBodyLength: Infinity, url: '/api/events/network-traffic', headers: { 'Accept': 'application/json', 'Authorization': 'Token ' } }; axios(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); ``` ```python import requests import json url = "https://api.netbird.io/api/events/network-traffic" headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } response = requests.request("GET", url, headers=headers) print(response.text) ``` ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.netbird.io/api/events/network-traffic" method := "GET" client := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return { req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Token ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` ```ruby require "uri" require "json" require "net/http" url = URI("https://api.netbird.io/api/events/network-traffic") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " response = https.request(request) puts response.read_body ``` ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); Request request = new Request.Builder() .url("https://api.netbird.io/api/events/network-traffic") .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") .build(); Response response = client.newCall(request).execute(); ``` ```php 'https://api.netbird.io/api/events/network-traffic', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Accept: application/json', 'Authorization: Token ' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json {{ title: 'Example' }} { "data": [ { "flow_id": "61092452-b17c-4b14-b7cf-a2158c549826", "reporter_id": "ch8i4ug6lnn4g9hqv7m0", "source": { "id": "ch8i4ug6lnn4g9hqv7m0", "type": "PEER", "name": "My Peer", "geo_location": { "city_name": "Berlin", "country_code": "DE" }, "os": "Linux", "address": "100.64.0.10:51820", "dns_label": "*.mydomain.com" }, "destination": { "id": "ch8i4ug6lnn4g9hqv7m0", "type": "PEER", "name": "My Peer", "geo_location": { "city_name": "Berlin", "country_code": "DE" }, "os": "Linux", "address": "100.64.0.10:51820", "dns_label": "*.mydomain.com" }, "user": { "id": "google-oauth2|123456789012345678901", "email": "alice@netbird.io", "name": "Alice Smith" }, "policy": { "id": "ch8i4ug6lnn4g9hqv7m0", "name": "All to All" }, "icmp": { "type": 8, "code": 0 }, "protocol": 6, "direction": "INGRESS", "rx_bytes": 1234, "rx_packets": 5, "tx_bytes": 1234, "tx_packets": 5, "events": [ { "type": "TYPE_START", "timestamp": {} } ] } ], "page": { "type": "integer", "description": "Current page number" }, "page_size": { "type": "integer", "description": "Number of items per page" }, "total_records": { "type": "integer", "description": "Total number of event records available" }, "total_pages": { "type": "integer", "description": "Total number of pages available" } } ``` ```json {{ title: 'Schema' }} { "data": [ { "flow_id": "string", "reporter_id": "string", "source": { "id": "string", "type": "string", "name": "string", "geo_location": { "city_name": "string", "country_code": "string" }, "os": "string", "address": "string", "dns_label": "string" }, "destination": { "id": "string", "type": "string", "name": "string", "geo_location": { "city_name": "string", "country_code": "string" }, "os": "string", "address": "string", "dns_label": "string" }, "user": { "id": "string", "email": "string", "name": "string" }, "policy": { "id": "string", "name": "string" }, "icmp": { "type": "integer", "code": "integer" }, "protocol": "integer", "direction": "string", "rx_bytes": "integer", "rx_packets": "integer", "tx_bytes": "integer", "tx_packets": "integer", "events": [ { "type": "string", "timestamp": "string" } ] } ], "page": "integer", "page_size": "integer", "total_records": "integer", "total_pages": "integer" } ``` ---