> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt # GetRules POST https://api.voximplant.com/platform_api/GetRules Gets the rules. Allowed roles: `Owner`, `Admin`, `Developer`, `Supervisor`, `Call list manager`, `Support`. **Example request:** Get the first rule for the template 74951234567. Reference: https://docs.voximplant.ai/api-reference/management-api/reference/rules/get-rules ## Authentication - `Authorization` header (bearer token, required) — Voximplant Management API uses signed JWT tokens generated from your service-account private key. Pass the token in the `Authorization` header as a Bearer value: ``` Authorization: Bearer $VOXIMPLANT_TOKEN ``` See [Authorization](/api-reference/management-api/authorization) for ready-to-copy snippets in bash, Python, Node.js and Go that turn your `credentials.json` into a token. ## Request ### Query parameters - `application_id` (integer, optional) — The application ID. **Required** unless **application_name** is provided. - `application_name` (string, optional) — The application name. **Required** unless **application_id** is provided. - `rule_id` (integer, optional) — The rule ID to filter - `rule_name` (string, optional) — The rule name part to filter - `video_conference` (boolean, optional) — Whether it is a video conference to filter - `attached_key_id` (string, optional) — The service account ID bound to the rule. Read more in the [guide](/platform/voxengine/management-api-usage) - `template` (string, optional) — Search for template matching - `with_scenarios` (boolean, optional) — Whether to get bound scenarios info - `count` (integer, optional, default: 20) — The max returning record count - `offset` (integer, optional, default: 0) — The first **N** records are skipped in the output ## Response ### 200 Successful response - `result` (list of RuleInfoType, optional) - `total_count` (integer, optional) — The total found rule count - `count` (integer, optional) — The returned rule count ## Types ### RuleInfoType The [GetRules] function result item. - `rule_id` (integer, optional) — The rule ID - `application_id` (integer, optional) — The application ID - `rule_name` (string, optional) — The rule name - `rule_pattern` (string, optional) — The rule pattern regex - `rule_pattern_exclude` (string, optional) — The rule pattern excluding regex - `video_conference` (boolean, optional) — Whether video conference is required - `scenarios` (list of ScenarioInfoType, optional) — The bound scenarios - `modified` (string, optional) — Timestamp in YYYY-MM-DD HH:mm:ss format. The rule editing UTC date in 24-h format: YYYY-MM-DD HH:mm:ss ### ScenarioInfoType The [GetScenarios] function result. - `scenario_id` (integer, optional) — The scenario ID - `scenario_name` (string, optional) — The scenario name - `scenario_script` (string, optional) — The scenario text - `modified` (string, optional) — Timestamp in YYYY-MM-DD HH:mm:ss format. The scenario editing UTC date in 24-h format: YYYY-MM-DD HH:mm:ss - `parent` (boolean, optional) — Whether the scenario belongs to the parent account, 'false' if the scenario belongs to the current account ## Examples **Response** ```json { "result": [ { "rule_id": 10, "application_id": 1, "rule_name": "Moscow", "rule_pattern": "749[59].+", "video_conference": false, "scenarios": [ { "scenario_id": 3, "scenario_name": "scen3", "modified": "2013-09-09 16:36:50" }, { "scenario_id": 2, "scenario_name": "scen2", "modified": "2013-09-09 16:35:55" } ], "modified": "2013-09-09 17:07:29" } ], "total_count": 1, "count": 1 } ``` **SDK Code** ```python Example 1 import requests url = "https://api.voximplant.com/platform_api/GetRules" headers = {"Authorization": "Bearer "} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript Example 1 const url = 'https://api.voximplant.com/platform_api/GetRules'; const options = {method: 'POST', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Example 1 package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voximplant.com/platform_api/GetRules" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Example 1 require 'uri' require 'net/http' url = URI("https://api.voximplant.com/platform_api/GetRules") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java Example 1 import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.voximplant.com/platform_api/GetRules") .header("Authorization", "Bearer ") .asString(); ``` ```php Example 1 request('POST', 'https://api.voximplant.com/platform_api/GetRules', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp Example 1 using RestSharp; var client = new RestClient("https://api.voximplant.com/platform_api/GetRules"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift Example 1 import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.voximplant.com/platform_api/GetRules")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```