# Correspondents

## [addCorrespondent](https://github.com/BIoTws/biot-core/blob/master/core.js#L365)

Adding a correspondent

**Params:**

&#x20;     code - **{string}** - Pairing code

{% tabs %}
{% tab title="JS module" %}

```javascript
await core.addCorrespondent('ApM6ZzpMhnK87Qqz4LhkIHTxGA79VVTVqb1PmtrAzOzo@byteball.org/bb-test#O3IZDFeH4SR0');
```

{% endtab %}

{% tab title="CLI" %}

```bash
biot-core addCorrespondent ApM6ZzpMhnK87Qqz4LhkIHTxGA79VVTVqb1PmtrAzOzo@byteball.org/bb-test#O3IZDFeH4SR0
```

{% endtab %}

{% tab title="RPC" %}

```javascript
client.request('addCorrespondent', ['ApM6ZzpMhnK87Qqz4LhkIHTxGA79VVTVqb1PmtrAzOzo@byteball.org/bb-test#O3IZDFeH4SR0'], (err, data) => {
    if(err)
        throw err;

    console.log(data);
});
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
			id: id++,
			name: 'addCorrespondent',
			args: ['ApM6ZzpMhnK87Qqz4LhkIHTxGA79VVTVqb1PmtrAzOzo@byteball.org/bb-test#O3IZDFeH4SR0']
		}));
```

{% endtab %}
{% endtabs %}

## [removeCorrespondent](https://github.com/BIoTws/biot-core/blob/master/core.js#L375)

Removing a correspondent

**Params:**

&#x20;     device\_address - **{string}** - Device address

{% tabs %}
{% tab title="JS module" %}

```javascript
await core.removeCorrespondent('0WI73XY6WPR46D4ZKEQEFFQSSPBZMUOVD');
```

{% endtab %}

{% tab title="CLI" %}

```bash
biot-core removeCorrespondent 0WI73XY6WPR46D4ZKEQEFFQSSPBZMUOVD
```

{% endtab %}

{% tab title="RPC" %}

```javascript
client.request('removeCorrespondent', ['0WI73XY6WPR46D4ZKEQEFFQSSPBZMUOVD'], (err, data) => {
    if(err)
        throw err;

    console.log(data);
});
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
			id: id++,
			name: 'removeCorrespondent',
			args: ['0WI73XY6WPR46D4ZKEQEFFQSSPBZMUOVD']
		}));
```

{% endtab %}
{% endtabs %}

## [listCorrespondents](https://github.com/BIoTws/biot-core/blob/master/core.js#L385)

List of correspondents

{% tabs %}
{% tab title="JS module" %}

```javascript
await core.listCorrespondents()
```

{% endtab %}

{% tab title="CLI" %}

```bash
biot-core listCorrespondents
```

{% endtab %}

{% tab title="RPC" %}

```javascript
client.request('listCorrespondents', [], (err, data) => {
    if(err)
        throw err;

    console.log(data);
});
```

{% endtab %}

{% tab title="WS" %}

```javascript
socket.send(JSON.stringify({
			id: id++,
			name: 'listCorrespondents',
			args: []
		}));
```

{% endtab %}

{% tab title="Result" %}

```javascript
[{ device_address: '0TFZHX7UTVQUWEPGLQDWEV5A4KLHFA5WB',
    hub: 'byteball.org/bb-test',
    name: 'Testnet Faucet',
    my_record_pref: 1,
    peer_record_pref: 1 }]
```

{% endtab %}
{% endtabs %}
