> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/6.15/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/6.15/api-reference/whitelist_api.md).

# Whitelist API

TPOSS Whitelist API allows you to provision, deprovision, and look for IMEI(s) in the TPOSS [whitelist](https://docs.cennso.com/components/tposs/6.15/configuration/imeisv.md) database using these RPC methods:

- [Imei.Whitelist.Add](#imeiwhitelistadd) - to add a list of IMEISV to the TPOSS whitelist database
- [Imei.Whitelist.Delete](#imeiwhitelistdelete) - to delete a list of IMEISV from the TPOSS whitelist database
- [Imei.Whitelist.Get](#imeiwhitelistget) - to fetch IMEISV from the TPOSS whitelist database

## API methods

### Imei.Whitelist.Add

This method allows you to add a list of IMEI(s) to the TPOSS whitelist database.

You can pass the following parameters in the request:

| Name | Type | Required / Optional | Description |
|---|---|---|---|
| AuthKey | string | required | Pre-shared authentication key. |
| FeId | String | required | Static frontend identifier which must be unique to the system. |
| FeSId | String | optional | Dynamic frontend session identifier which must be reset upon system startup. |
| IMEIs | list | required | List of IMEIs that should be added. |

Example of the request:

```bash
curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://127.0.0.1:12000 --data-binary @- <<EOF
{
  "id": "1",
  "jsonrpc": "2.0",
  "method":"Imei.Whitelist.Add",
  "params": {
    "AuthKey": "secret",
    "FeId":"TPUIBrowser",
    "FeSId": "TPUIBrowser",
    "IMEIs": ["012345678901207", "012345678901217"]
  }
}
EOF
```

The API returns the total number of IMEIs that arrived in the request and the number of IMEIs successfully added to the whitelist.

Example of the successful response:

```json
{
  "id": "101",
  "jsonrpc": "2.0",
  "result": {
    "Added": 2,
    "Total": 2
   }
}
```

In the case of an error, the response contains the `error` object with an error code and message:

```json
{
  "id": "1",
  "jsonrpc": "2.0",
  "error": {
    "code": "-33333",
    "message": "Not authenticated"
  }
}
```

The following error codes may be returned:

- `-30000` - Required field is missing.
- `-32700` - Can't decode JSON request body.
- `-33333` - Not authenticated.

### Imei.Whitelist.Delete

The method allows you to delete IMEI(s) from the TPOSS whitelist database.

You can pass the following parameters in the request:

| Name | Type | Required / Optional | Description |
|---|---|---|---|
| AuthKey | string | required | Pre-shared authentication key. |
| FeId | string | required | Static frontend identifier which must be unique to the system. |
| FeSId | string | optional | Dynamic frontend session identifier which must be reset upon system startup. |
| IMEIs | list | required | List of IMEIs that should be deleted. |

Example of the request:

```
curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://127.0.0.1:12000 --data-binary @- <<EOF
{
  "id": "1",
  "jsonrpc": "2.0",
  "method":"Imei.Whitelist.Delete",
  "params": {
    "AuthKey": "secret",
    "FeId":"TPUIBrowser",
    "FeSId": "TPUIBrowser",
    "IMEIs": ["012345678901207", "012345678901217"]
  }
}
EOF
```

The API returns the total number of IMEIs that arrived in the request and the number of IMEIs successfully deleted from the whitelist.

Example of the successful response:

```json
{
  "id": "101",
  "jsonrpc": "2.0",
  "result": {
    "Deleted": 2,
    "Total": 2
   }
}
```

In the case of an error, the response contains the `error` object with an error code and message:

```json
{
  "id": "1",
  "jsonrpc": "2.0",
  "error": {
    "code": "-33333",
    "message": "Not authenticated"
  }
}
```

The following error codes may be returned:

- `-30000` - Required field is missing.
- `-32700` - Can't decode JSON request body.
- `-33333` - Not authenticated.

### Imei.Whitelist.Get

This method allows you to fetch IMEI(s) from the TPOSS whitelist database by the given `Limit` and `Offset`.

You can pass the following parameters in the request:

| Name | Type | Required / Optional | Description |
|---|---|---|---|
| AuthKey | string | required | Pre-shared authentication key. |
| FeId | string | required | Static frontend identifier which must be unique to the system. |
| FeSId | string | optional | Dynamic frontend session identifier which must be reset upon system startup. |
| Limit | string | required | Limit for the result size. |
| Offset | string | required | Number of results skipped in the response. |

Example of the request:

```bash
curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d http://127.0.0.1:12000 --data-binary @- <<EOF
{
  "id": "1",
  "jsonrpc": "2.0",
  "method":"Imei.Whitelist.Get",
  "params": {
    "AuthKey": "secret",
    "FeId":"TPUIBrowser",
    "FeSId": "TPUIBrowser",
    "Limit": 10,
    "Offset": 20
  }
}
EOF
```

Example of the successful response:

```json
{
  "id": "101",
  "jsonrpc": "2.0",
  "result": {
    "Limit": 2,
    "Offset": 5,
    "IMEIs": ["012345678901207", "012345678901217"]}
}
```

In the case of an error, the response contains the `error` object with an error code and message:

```json
{
  "id": "1",
  "jsonrpc": "2.0",
  "error": {
    "code": "-33333",
    "message": "Not authenticated"
  }
}
```

The following error codes may be returned:

- `-30000` - Required field is missing.
- `-32700` - Can't decode JSON request body.
- `-33333` - Not authenticated.
