# Security

Manage your security options.

## List allowed region or country codes

> List allowed region or country codes.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/allowed_country_codes":{"get":{"tags":["Security"],"operationId":"listAllowedCodes","summary":"List allowed region or country codes","description":"List allowed region or country codes.\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"description":"Country calling codes or country dial-in codes.\n"},"description":"A collection of allowed region or country codes.       \n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Update allowed region or country codes.

> Update allowed region or country codes.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/allowed_country_codes":{"post":{"tags":["Security"],"operationId":"updateAllowedCode","summary":"Update allowed region or country codes.","description":"Update allowed region or country codes.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"description":"Country calling codes or country dial-in codes.\n"},"description":"A collection of allowed region or country codes.\n"}}}}},"required":true},"responses":{"200":{"description":"OK"},"4XX":{"description":"Error"}}}}}}
```

## List block codes

> List block codes.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/disallowed_codes":{"get":{"tags":["Security"],"operationId":"listBlockCodes","summary":"List block codes","description":"List block codes.\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 blocked code.\n"},"number_prefix":{"type":"string","minLength":1,"maxLength":16,"description":"The number prefix of blocked code.  \nAn alphanumeric sequence beginning with an optional plus sign.\n"},"description":{"type":"string","maxLength":1024,"description":"The description of blocked code.\n"}}}}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Create a block code

> Create a block code.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/disallowed_codes":{"post":{"tags":["Security"],"operationId":"createBlockCode","summary":"Create a block code","description":"Create a block code.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"number_prefix":{"type":"string","minLength":1,"maxLength":16,"description":"The number prefix of blocked code.  \nAn alphanumeric sequence beginning with an optional plus sign.\n"},"description":{"type":"string","maxLength":1024,"description":"The description of blocked code.\n"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The unique ID of the resource.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Retrieve blocked code

> Retrieve details of blocked code by it's unique ID.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/disallowed_codes/{id}":{"get":{"tags":["Security"],"operationId":"showBlockCode","summary":"Retrieve blocked code","description":"Retrieve details of blocked code by it's unique ID.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The unique ID of the resource.\n"},"description":"The unique ID of the blocked code."}],"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 blocked code.\n"},"number_prefix":{"type":"string","minLength":1,"maxLength":16,"description":"The number prefix of blocked code.  \nAn alphanumeric sequence beginning with an optional plus sign.\n"},"description":{"type":"string","maxLength":1024,"description":"The description of blocked code.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Update a blocked code

> Update a blocked code by it's ID.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/disallowed_codes/{id}":{"post":{"tags":["Security"],"operationId":"updateBlockCode","summary":"Update a blocked code","description":"Update a blocked code by it's ID.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The unique ID of the resource.\n"},"description":"The unique ID of the code."}],"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 blocked code.\n"},"number_prefix":{"type":"string","minLength":1,"maxLength":16,"description":"The number prefix of blocked code.  \nAn alphanumeric sequence beginning with an optional plus sign.\n"},"description":{"type":"string","maxLength":1024,"description":"The description of blocked code.\n"}}}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Error"}}}}}}
```

## Destroy disallowed codes

> Destroy disallowed codes

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/disallowed_codes/{id}/destroy":{"post":{"tags":["Security"],"operationId":"deleteBlockCode","summary":"Destroy disallowed codes","description":"Destroy disallowed codes","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The unique ID of the resource.\n"},"description":"The unique ID of the code."}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid entry ID supplied"},"404":{"description":"User not found"}}}}}}
```

## Export disallowed codes

> Export a collection of disallowed codes to file.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/disallowed_codes/export":{"get":{"tags":["Security"],"operationId":"exportBlockedCodes","summary":"Export disallowed codes","description":"Export a collection of disallowed codes to file.\n","responses":{"200":{"description":"OK","headers":{"Content-Disposition":{"schema":{"type":"string"},"description":"The format is `attachment; filename=\"example\"`\n"}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"4XX":{"description":"Error"}}}}}}
```

## GET /blacklisted\_numbers

> List blacklisted numbers

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/blacklisted_numbers":{"get":{"tags":["Security"],"operationId":"listBlacklistedNumbers","summary":"List blacklisted numbers","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 this blacklisted number.\n"},"number":{"type":"string","minLength":1,"maxLength":64,"description":"An alphanumeric sequence beginning with an optional plus sign.\n"},"expire_at":{"allOf":[{"type":"string","format":"date_time","description":"The RFC 3339 format is defined by\nThe date_time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), \nfor example, 2017-07-21T17:32:28Z\n"}],"description":"Blacklisted number's expire time.\n"},"created_at":{"allOf":[{"type":"string","format":"date_time","description":"The RFC 3339 format is defined by\nThe date_time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), \nfor example, 2017-07-21T17:32:28Z\n"}],"description":"Blacklisted number's creation time.\n"},"updated_at":{"allOf":[{"type":"string","format":"date_time","description":"The RFC 3339 format is defined by\nThe date_time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), \nfor example, 2017-07-21T17:32:28Z\n"}],"description":"Blacklisted number's last updated time.\n"},"description":{"type":"string","maxLength":255,"description":"Remarks for the blacklisted number.\n"}}}}}}}}},"4XX":{"description":"Error"}}}}}}
```

## POST /blacklisted\_numbers

> Create new blacklisted number

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/blacklisted_numbers":{"post":{"tags":["Security"],"operationId":"createBlacklistedNumber","summary":"Create new blacklisted number","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string","minLength":1,"maxLength":64,"description":"An alphanumeric sequence beginning with an optional plus sign.\n"},"expire_at":{"allOf":[{"type":"string","format":"date_time","description":"The RFC 3339 format is defined by\nThe date_time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), \nfor example, 2017-07-21T17:32:28Z\n"}],"description":"Blacklisted number's expire time.\n"},"description":{"type":"string","maxLength":255,"description":"Remarks for the blacklisted number.\n"}},"required":["number"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of this blacklisted number.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## GET /blacklisted\_numbers/{id}

> Show blacklisted number

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/blacklisted_numbers/{id}":{"get":{"tags":["Security"],"operationId":"showBlacklistedNumber","summary":"Show blacklisted number","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of this blacklisted number.\n"},"description":"The unique ID of the blacklisted number."}],"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 this blacklisted number.\n"},"number":{"type":"string","minLength":1,"maxLength":64,"description":"An alphanumeric sequence beginning with an optional plus sign.\n"},"expire_at":{"allOf":[{"type":"string","format":"date_time","description":"The RFC 3339 format is defined by\nThe date_time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), \nfor example, 2017-07-21T17:32:28Z\n"}],"description":"Blacklisted number's expire time.\n"},"created_at":{"allOf":[{"type":"string","format":"date_time","description":"The RFC 3339 format is defined by\nThe date_time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), \nfor example, 2017-07-21T17:32:28Z\n"}],"description":"Blacklisted number's creation time.\n"},"updated_at":{"allOf":[{"type":"string","format":"date_time","description":"The RFC 3339 format is defined by\nThe date_time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), \nfor example, 2017-07-21T17:32:28Z\n"}],"description":"Blacklisted number's last updated time.\n"},"description":{"type":"string","maxLength":255,"description":"Remarks for the blacklisted number.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## POST /blacklisted\_numbers/{id}

> Update blacklisted number

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/blacklisted_numbers/{id}":{"post":{"tags":["Security"],"operationId":"updateBlacklistedNumber","summary":"Update blacklisted number","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of this blacklisted number.\n"},"description":"The unique ID of the blacklisted number."}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"number":{"type":"string","minLength":1,"maxLength":64,"description":"An alphanumeric sequence beginning with an optional plus sign.\n"},"expire_at":{"allOf":[{"type":"string","format":"date_time","description":"The RFC 3339 format is defined by\nThe date_time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), \nfor example, 2017-07-21T17:32:28Z\n"}],"description":"Blacklisted number's expire time.\n"},"description":{"type":"string","maxLength":255,"description":"Remarks for the blacklisted number.\n"}}}}},"required":true},"responses":{"200":{"description":"OK"},"4XX":{"description":"Error"}}}}}}
```

## Destroy blacklisted number

> Destroy blacklisted number<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/blacklisted_numbers/{id}/destroy":{"post":{"tags":["Security"],"operationId":"deleteBlacklistedNumber","summary":"Destroy blacklisted number","description":"Destroy blacklisted number\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 this blacklisted number.\n"},"description":"The unique ID of the blacklisted number."}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid entry ID supplied"}}}}}}
```

## Export number blacklists

> Export a collection of number blacklists to file.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.0"},"tags":[{"name":"Security","description":"Manage your security options.\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":{"/blacklisted_numbers/export":{"get":{"tags":["Security"],"operationId":"exportBlacklistedNumbers","summary":"Export number blacklists","description":"Export a collection of number blacklists 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"}}}}}}
```
