# Outbound rules

Manage your outbound rules.

## List outbound rules

> Retrieve a collection of outbound rules.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules":{"get":{"tags":["Outbound Rule"],"operationId":"listOutboundRules","summary":"List outbound rules","description":"Retrieve a collection of outbound rules.\n","parameters":[{"name":"filter","in":"query","schema":{"type":"string"},"description":"Use the `filter` query parameter to retrieve just a subset of a collection.\n"},{"name":"search","in":"query","schema":{"type":"string"},"description":"Use the `search` query parameter to restrict the results of a request to match a search criterion.\n"},{"name":"orderby","in":"query","schema":{"type":"string"},"description":"Use the `orderby` query parameter to specify the sort order of the items returned from server.  \nThe default order is ascending order.\n"},{"name":"skip","in":"query","schema":{"type":"integer","format":"int32","minimum":0,"default":0},"description":"Use the `skip` query parameter to set the number of items to skip at the start of a collection.\n"},{"name":"top","in":"query","schema":{"type":"integer","format":"int32","minimum":1,"maximum":100,"default":100},"description":"Use the `top` query parameter to specify the page size of the result set.\n"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","format":"int64","minimum":0,"description":"Total number of resource.\n"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of outbound rule.\n"},"number_prefix":{"type":"string","maxLength":64,"description":"Prefix of callee ID. Calls started with this prefix will be applied this outbound rule.\n"},"number_length":{"type":"string","maxLength":64,"description":"The length of number prefix.  \nA semicolon-separated list of integer.  \nFor example by specifying \"1;2\", calls with a caller ID of 1 or 2 digits will be applied this rule.\n"},"number_mask":{"type":"string","description":"Extension who starts the call. A semicolon-separated list of extensions allowed.\nFor example by specifying \"101-110;199\", extensions from 101 to 110 and 199 will be applied this rule.\n"},"enabled":{"type":"boolean","default":true,"description":"Whether to enable outbound rule.\n"},"priority":{"type":"integer","format":"int32","minimum":0,"default":1000,"description":"The priority of outbound rule.\n"},"office_hours":{"allOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["GLOBAL","CUSTOM"],"description":"The office hours mode can be either:  \n- `GLOBAL`: Use global office hours.\n- `CUSTOM`: Use specific office hours.\n"}}},{"type":"object","properties":{"monday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"tuesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"wednesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"thursday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"friday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"saturday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"sunday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}}}}]},"holidays":{"type":"array","items":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"readOnly":true,"description":"The unique ID of holiday.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of the holiday.\n"},"every_year":{"type":"boolean","description":"Does the holiday take effect every year.\n"},"consecutive":{"type":"boolean","description":"Whether the holiday consists of consecutive days.\n"},"year_start":{"type":"integer","description":"The start year of holiday.\n"},"year_end":{"type":"integer","description":"The end year of holiday.\n"},"month_start":{"type":"integer","description":"The start month of holiday.\n"},"month_end":{"type":"integer","description":"The end month of holiday.\n"},"day_start":{"type":"integer","description":"The start day of holiday.\n"},"day_end":{"type":"integer","description":"The end day of holiday.\n"},"hour_start":{"type":"integer","description":"The start hour of holiday.\n"},"hour_end":{"type":"integer","description":"The end hour of holiday.\n"},"minute_start":{"type":"integer","description":"The start minute of holiday.\n"},"minute_end":{"type":"integer","description":"The end minute of holiday.\n"}}},"description":"A collection of tenant's holidays.\n"},"routing_strategy":{"type":"string","enum":["PRIORITIZED","RANDOMLY"],"default":"PRIORITIZED","description":"Routing strategy:   \nCan be either:  \n- `PRIORITIZED`: Selected according to the priority order of the route list.\n- `RANDOMLY`: Randomly select one of the route list.\n"}}}}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Create a outbound rule

> Add a new outbound rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules":{"post":{"tags":["Outbound Rule"],"operationId":"createOutboundRule","summary":"Create a outbound rule","description":"Add a new outbound rule.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of outbound rule.\n"},"number_prefix":{"type":"string","maxLength":64,"description":"Prefix of callee ID. Calls started with this prefix will be applied this outbound rule.\n"},"number_length":{"type":"string","maxLength":64,"description":"The length of number prefix.  \nA semicolon-separated list of integer.  \nFor example by specifying \"1;2\", calls with a caller ID of 1 or 2 digits will be applied this rule.\n"},"number_mask":{"type":"string","description":"Extension who starts the call. A semicolon-separated list of extensions allowed.\nFor example by specifying \"101-110;199\", extensions from 101 to 110 and 199 will be applied this rule.\n"},"enabled":{"type":"boolean","default":true,"description":"Whether to enable outbound rule.\n"},"priority":{"type":"integer","format":"int32","minimum":0,"default":1000,"description":"The priority of outbound rule.\n"},"office_hours":{"allOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["GLOBAL","CUSTOM"],"description":"The office hours mode can be either:  \n- `GLOBAL`: Use global office hours.\n- `CUSTOM`: Use specific office hours.\n"}}},{"type":"object","properties":{"monday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"tuesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"wednesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"thursday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"friday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"saturday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"sunday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}}}}]},"holidays":{"type":"array","items":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"readOnly":true,"description":"The unique ID of holiday.\n"},"description":"A collection ID of tenant's holidays.\n"},"routing_strategy":{"type":"string","enum":["PRIORITIZED","RANDOMLY"],"default":"PRIORITIZED","description":"Routing strategy:   \nCan be either:  \n- `PRIORITIZED`: Selected according to the priority order of the route list.\n- `RANDOMLY`: Randomly select one of the route list.\n"},"routes":{"type":"array","items":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Enable this route or not.\n"},"provider_id":{"allOf":[{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of trunk.\n"}],"description":"The unique ID of provider.\n"},"strip_digits":{"type":"integer","format":"int32","minimum":0,"default":0,"description":"Digits for striping number. Values: 0-9. \nFor example if it is set to 2, the first two digits for caller ID of calling from route_provider_1 will be removed.\n"},"prepend":{"type":"string","description":"Prefix number. If it is set to \"0086\", call ID for calling from\nroute_provider_1 will be prefixed with \"0086\".\n"},"outbound_caller_id":{"allOf":[{"type":"string","minLength":1,"maxLength":64,"description":"Outbound caller id.\n"}],"description":"The outbound caller ID within the trunk's DID/DDI pool scope.\n"}}}}},"required":["name"]}}}},"responses":{"201":{"description":"Created outbound rule","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## GET /outbound\_rules/{id}

> Retrieve a outbound rule

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules/{id}":{"get":{"tags":["Outbound Rule"],"operationId":"retrieveOutboundRule","summary":"Retrieve a outbound rule","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"description":"The unique ID of the outbound rule."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of outbound rule.\n"},"number_prefix":{"type":"string","maxLength":64,"description":"Prefix of callee ID. Calls started with this prefix will be applied this outbound rule.\n"},"number_length":{"type":"string","maxLength":64,"description":"The length of number prefix.  \nA semicolon-separated list of integer.  \nFor example by specifying \"1;2\", calls with a caller ID of 1 or 2 digits will be applied this rule.\n"},"number_mask":{"type":"string","description":"Extension who starts the call. A semicolon-separated list of extensions allowed.\nFor example by specifying \"101-110;199\", extensions from 101 to 110 and 199 will be applied this rule.\n"},"enabled":{"type":"boolean","default":true,"description":"Whether to enable outbound rule.\n"},"priority":{"type":"integer","format":"int32","minimum":0,"default":1000,"description":"The priority of outbound rule.\n"},"office_hours":{"allOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["GLOBAL","CUSTOM"],"description":"The office hours mode can be either:  \n- `GLOBAL`: Use global office hours.\n- `CUSTOM`: Use specific office hours.\n"}}},{"type":"object","properties":{"monday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"tuesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"wednesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"thursday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"friday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"saturday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"sunday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}}}}]},"holidays":{"type":"array","items":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"readOnly":true,"description":"The unique ID of holiday.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of the holiday.\n"},"every_year":{"type":"boolean","description":"Does the holiday take effect every year.\n"},"consecutive":{"type":"boolean","description":"Whether the holiday consists of consecutive days.\n"},"year_start":{"type":"integer","description":"The start year of holiday.\n"},"year_end":{"type":"integer","description":"The end year of holiday.\n"},"month_start":{"type":"integer","description":"The start month of holiday.\n"},"month_end":{"type":"integer","description":"The end month of holiday.\n"},"day_start":{"type":"integer","description":"The start day of holiday.\n"},"day_end":{"type":"integer","description":"The end day of holiday.\n"},"hour_start":{"type":"integer","description":"The start hour of holiday.\n"},"hour_end":{"type":"integer","description":"The end hour of holiday.\n"},"minute_start":{"type":"integer","description":"The start minute of holiday.\n"},"minute_end":{"type":"integer","description":"The end minute of holiday.\n"}}},"description":"A collection of tenant's holidays.\n"},"routing_strategy":{"type":"string","enum":["PRIORITIZED","RANDOMLY"],"default":"PRIORITIZED","description":"Routing strategy:   \nCan be either:  \n- `PRIORITIZED`: Selected according to the priority order of the route list.\n- `RANDOMLY`: Randomly select one of the route list.\n"},"routes":{"type":"array","items":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Enable this route or not.\n"},"provider_id":{"allOf":[{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of trunk.\n"}],"description":"The unique ID of provider.\n"},"strip_digits":{"type":"integer","format":"int32","minimum":0,"default":0,"description":"Digits for striping number. Values: 0-9. \nFor example if it is set to 2, the first two digits for caller ID of calling from route_provider_1 will be removed.\n"},"prepend":{"type":"string","description":"Prefix number. If it is set to \"0086\", call ID for calling from\nroute_provider_1 will be prefixed with \"0086\".\n"},"outbound_caller_id":{"allOf":[{"type":"string","minLength":1,"maxLength":64,"description":"Outbound caller id.\n"}],"description":"The outbound caller ID within the trunk's DID/DDI pool scope.\n"}}}}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Update a outbound rule

> Update properties of outbound rule by it's unique ID.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules/{id}":{"post":{"tags":["Outbound Rule"],"operationId":"updateOutboundRule","summary":"Update a outbound rule","description":"Update properties of outbound rule by it's unique ID.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"description":"The unique ID of the outbound rule."}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of outbound rule.\n"},"number_prefix":{"type":"string","maxLength":64,"description":"Prefix of callee ID. Calls started with this prefix will be applied this outbound rule.\n"},"number_length":{"type":"string","maxLength":64,"description":"The length of number prefix.  \nA semicolon-separated list of integer.  \nFor example by specifying \"1;2\", calls with a caller ID of 1 or 2 digits will be applied this rule.\n"},"number_mask":{"type":"string","description":"Extension who starts the call. A semicolon-separated list of extensions allowed.\nFor example by specifying \"101-110;199\", extensions from 101 to 110 and 199 will be applied this rule.\n"},"enabled":{"type":"boolean","default":true,"description":"Whether to enable outbound rule.\n"},"priority":{"type":"integer","format":"int32","minimum":0,"default":1000,"description":"The priority of outbound rule.\n"},"office_hours":{"allOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["GLOBAL","CUSTOM"],"description":"The office hours mode can be either:  \n- `GLOBAL`: Use global office hours.\n- `CUSTOM`: Use specific office hours.\n"}}},{"type":"object","properties":{"monday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"tuesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"wednesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"thursday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"friday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"saturday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"sunday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}}}}]},"holidays":{"type":"array","items":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"readOnly":true,"description":"The unique ID of holiday.\n"},"description":"A collection ID of tenant's holidays.\n"},"routing_strategy":{"type":"string","enum":["PRIORITIZED","RANDOMLY"],"default":"PRIORITIZED","description":"Routing strategy:   \nCan be either:  \n- `PRIORITIZED`: Selected according to the priority order of the route list.\n- `RANDOMLY`: Randomly select one of the route list.\n"},"routes":{"type":"array","items":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Enable this route or not.\n"},"provider_id":{"allOf":[{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of trunk.\n"}],"description":"The unique ID of provider.\n"},"strip_digits":{"type":"integer","format":"int32","minimum":0,"default":0,"description":"Digits for striping number. Values: 0-9. \nFor example if it is set to 2, the first two digits for caller ID of calling from route_provider_1 will be removed.\n"},"prepend":{"type":"string","description":"Prefix number. If it is set to \"0086\", call ID for calling from\nroute_provider_1 will be prefixed with \"0086\".\n"},"outbound_caller_id":{"allOf":[{"type":"string","minLength":1,"maxLength":64,"description":"Outbound caller id.\n"}],"description":"The outbound caller ID within the trunk's DID/DDI pool scope.\n"}}}}}}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Error"}}}}}}
```

## POST /outbound\_rules/{id}/destroy

> Delete a outbound rule

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules/{id}/destroy":{"post":{"tags":["Outbound Rule"],"operationId":"deleteOutboundRule","summary":"Delete a outbound rule","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"description":"The unique ID of the outbound rule."}],"responses":{"204":{"description":"No Content"},"4XX":{"description":"Error"}}}}}}
```

## Export outbound rules

> Export a collection of outbound rules to file.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules/export":{"get":{"tags":["Outbound Rule"],"operationId":"exportOutboundRules","summary":"Export outbound rules","description":"Export a collection of outbound rules to file.\n","responses":{"200":{"description":"OK","headers":{"Content-Disposition":{"schema":{"type":"string"},"description":"the format is `attachment; filename=\"example\"`"}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"4XX":{"description":"Error"}}}}}}
```

## List applied groups of outbound rule

> Retrieve a collection of user groups applied to outbound rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules/{id}/applied_groups":{"get":{"tags":["Outbound Rule"],"operationId":"listOutboundRuleAppliedGroups","summary":"List applied groups of outbound rule","description":"Retrieve a collection of user groups applied to outbound rule.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"description":"The unique ID of the outbound rule."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of user group.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of user group.\n"},"description":{"type":"string","maxLength":1024,"description":"The description of user group.\n"}}}}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Check if a group has outbound rule applied

> Check if a group has outbound rule applied.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules/{id}/applied_groups/{group_id}":{"get":{"tags":["Outbound Rule"],"operationId":"checkIfGroupAppliedOutboundRule","summary":"Check if a group has outbound rule applied","description":"Check if a group has outbound rule applied.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"description":"The unique ID of the outbound rule."},{"name":"group_id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of user group.\n"},"description":"The unique ID of the group."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of user group.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of user group.\n"},"description":{"type":"string","maxLength":1024,"description":"The description of user group.\n"}}}}}},"404":{"description":"Not Found"}}}}}}
```

## Apply group to outbound rule

> Apply a group to outbound rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules/{id}/applied_groups/{group_id}":{"post":{"tags":["Outbound Rule"],"operationId":"applyGroupToOutboundRule","summary":"Apply group to outbound rule","description":"Apply a group to outbound rule.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"description":"The unique ID of the outbound rule."},{"name":"group_id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of user group.\n"},"description":"The unique ID of the group."}],"responses":{"200":{"description":"OK"},"4XX":{"description":"Error"}}}}}}
```

## Cancel group applied outbound rule

> Cancel group applied outbound rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Outbound Rule","description":"Manage your outbound rules.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/outbound_rules/{id}/applied_groups/{group_id}/destroy":{"post":{"tags":["Outbound Rule"],"operationId":"cancelUserGroupAppliedOutboundRule","summary":"Cancel group applied outbound rule","description":"Cancel group applied outbound rule.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of outbound rule.\n"},"description":"The unique ID of the outbound rule."},{"name":"group_id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of user group.\n"},"description":"The unique ID of the group."}],"responses":{"204":{"description":"No Content"},"4XX":{"description":"Error"}}}}}}
```
