# REST API reference

### User data methods

<div class="pointer-container" id="bkmrk-%C2%A0-6"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>##### Initialize user data database (batch data creation)

- Type: POST
- URL: `<domain>/init/`
- Data: ```
    {
        'profiles': [
            {
                'cat_ids': [<cat_id>,],
                'app_ids': [<app_id>,],
                'profile': {
                    'page_id': <page_id>,
                    'id': <id>
                }
            }, ...
        ],
        'nets': [{'ip': <ipv4>, 'profile_id': <profile_id>, 'prefix_len': <prefix_len4>}, ...],
        'nets6': [{'ip': <ipv6>, 'profile_id': <profile_id>, 'prefix_len': <prefix_len6>}, ...],
        'blockpages': [{'id': <page_id>, 'type': <blockpage_type>}, ...],
        'napts': [
            {
                'ip': <ipv4>,
                "profile_id": <profile_id>,
                "lower_port_bound": <lower_port_bound>,
                "upper_port_bound": <upper_port_bound>
            },
        ]
    }
    ```
- Result: 204 No body

### Profile methods

<div class="pointer-container" id="bkmrk-%C2%A0-7"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>##### Fetch all profiles

- Type: GET
- URL: `<domain>/profiles`
- Result: 200 OK

##### Add a profile

- Type: POST
- URL: `<domain>/profiles`
- Data: ```
    {
        "profile": {
            "id": int,
            "page_id": int
        },
        "cat_ids": [int, ],
        "app_ids": [int, ],
    }
    ```
- Result: 201 Created

##### Fetch a specific profile  


- Type: GET
- URL: `<domain>/profiles/<id>`
- Result: 200 OK

##### Update a specific profile

- Type: PATCH
- URL: `<domain>/profiles`
- Data: ```
    {
      "app_ids": [int, ],
      "cat_ids": [int, ],
      "profile": {
        "plan_id": int,
        "provider_id": int,
        "white_list_only": bool,
        "hide_block_reason": bool,
        "empty_dns_answer": bool,
        "page_id": int,
        "tls": bool
      }
    }
    ```
- Result: 200 OK

### Blockpage methods

<div class="pointer-container" id="bkmrk-%C2%A0-8"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>##### Get all blockpages  


- Type: GET
- URL: `<domain>/blockpage`
- Result: 200 OK

##### Create a blockpage  


- Type: POST
- URL: `<domain>/blockpage`
- Data: ```
    {
      "type": int,
      "id": int
    }
    ```
- Result: 200 OK

##### Get a specific blockpage  


- Type: GET
- URL: `<domain>/blockpage/<page_id>`
- Result: 200 OK

##### Update a blockpage  


- Type: PATCH
- URL: `<domain>/blockpage/<page_id>`
- Data: ```
    {
      "type": int
    }
    ```
- Result: 200 OK

##### Delete a blockpage  


- Type: DELETE
- URL: `<domain>/blockpage/<page_id>`
- Result: 204 No Content, no body

### Lists methods

<div class="pointer-container" id="bkmrk-%C2%A0-9"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>##### Create an allow- or denylist  


- Type: POST
- URL: `<domain>/profile/<profile_id>/bw_list`
- Data: ```
    {
      "type": "string", //"allow" or "deny" only
      "domains": ["string", "string", ]
    }
    ```
- Result: 201 Created

##### Create an allow- or denylist with multiple entries  


- Type: POST
- URL: `<domain>/profile/<profile_id>/bw_list/batch`
- Data: ```
    {
      "type": "string", //"allow" or "deny" only
      "domains": ["string", "string", ]
    }
    ```
- Result: 201 Created

##### Update a domain in an allow- or denylist  


- Type: PATCH
- URL: `<domain>/profile/<profile_id>/bw_list/<domain>`
- Data: ```
    {
      "type": "string", //"allow" or "deny" only
      "domain": "string",
      "profile_id": int
    }
    ```
- Result: 200 OK

Delete a domain from an allow- or denylist:

- Type: DELETE
- URL: `<domain>/profile/<profile_id>/bw_list/<domain>`
- Result: 204 No Content, no body

### IPv4 network methods

<div class="pointer-container" id="bkmrk-%C2%A0-10"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>##### Create an IPv4 address entry  


- Type: POST
- URL: `<domain>/net`
- Data: ```
    {
      "ip": "string", //IPv4 address in canonical form
      "profile_id": int,
      "prefix_len": int
    }
    ```
- Result: 201 Created

##### Get an IPv4 address entry  


- Type: GET
- URL: `<domain>/net/<int_ip>`
- Result: 200 OK

##### Update an IPv4 address entry  


- Type: PATCH
- URL: `<domain>/net/<int_ip>`
- Data: ```
    {
      "ip": "string", //IPv4 address in canonical form
      "profile_id": int,
      "prefix_len": int
    }
    ```
- Result: 200 OK

##### Delete an IPv4 address  


- Type: DELETE
- URL: `<domain>/net/<int_ip>`
- Result: 204 No Content, no body

### IPv6 network methods

<div class="pointer-container" id="bkmrk-%C2%A0-11"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>##### Create an IPv6 address entry  


- Type: POST
- URL: `<domain>/net6`
- Data: ```
    {
      "ip": "string", //IPv6 address in canonical form
      "prefix_len": int,
      "profile_id": int
    }
    ```
- Result: 201 Created

##### Get an IPv6 address entry  


- Type: GET
- URL: `<domain>/net6/<ipv6>`
- Result: Dictionary with IPv6 and profile\_id data

##### Update an IPv6 address entry  


- Type: PATCH
- URL: `<domain>/net6/<ipv6>`
- Data: ```
    {
      "ip": "string", //IPv6 address in canonical form
      "prefix_len": int,
      "profile_id": int
    }
    ```
- Result: 200 OK

##### Delete an IPv6 address  


- Type: DELETE
- URL: `<domain>/net6/<ipv6>`
- Result: 204 No Content, no body

### IPv4 NAT methods

<div class="pointer-container" id="bkmrk-%C2%A0-12"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>##### Create an IPv4 NAT entry  


- Type: POST
- URL: `<domain>/napt/`
- Data: ```
    {
      "ip": "string", //IPv4 address in canonical form
      "lower_port_bound": int,
      "upper_port_bound": int,
      "profile_id": int
    }
    ```
- Result: 201 Created

##### Create multiple IPv4 NAT entries  


- Type: POST
- URL: `<domain>/napt/batch`
- Data: ```
    [
      {
      	"ip": "string", //IPv4 address in canonical form
      	"lower_port_bound": int,
      	"upper_port_bound": int,
      	"profile_id": int
      },
      
    ]
    ```
- Result: 201 Created

##### Get all IPv4 NAT entries by IP  


- Type: GET
- URL: `<domain>/napt/<int_ip>`
- Result: 200 OK

##### Get a specific IPv4 NAT entry  


- Type: GET
- URL: `<domain>/napt/<int_ip>/<lower_port_bound>/<upper_port_bound>`
- Result: 200 OK

##### Update an IPv4 NAT entry  


- Type: PATCH
- URL: `<domain>/napt/<int_ip>/<lower_port_bound>/<upper_port_bound>`
- Data: ```
    {
      "ip": "string", //IPv4 address in canonical form
      "lower_port_bound": int,
      "upper_port_bound": int,
      "profile_id": int
    }
    ```
- Result: 200 OK

##### Delete an IPv4 NAT entry  


- Type: DELETE
- URL: `<domain>/napt/<int_ip>/<lower_port_bound>/<upper_port_bound>`
- Result: 204 No Content, no body

##### Delete multiple IPv4 NAT entries  


- Type: DELETE
- URL: `<domain>/napt/batch`
- Data: ```
    [
      {
      	"ip": "string", //IPv4 address in canonical form
      	"lower_port_bound": int,
      	"upper_port_bound": int,
      	"profile_id": int
      },
      
    ]
    ```
- Result: 204 No Content, no body

### AppBlocker methods

##### Get a list of all available AppBlocker categories  


- Type: GET
- URL: `<domain>/app_aware/application/`
- Result: 200 OK