# Static Method

**RelationIM.getRelationToken (acquire a unifiedAuthToken)**

```javascript
RelationIM.getRelationToken(addressAuthToken, APIKEY)
```

|     **Config options**     |                      **Description**                      | **Default** |
| :------------------------: | :-------------------------------------------------------: | :---------: |
| addressAuthToken: _string_ | Required field. The token is acquired via authByMetamask. |             |
|      apiKey: _string_      |       Required field. It is acquired from the Admin.      |             |

Note: In the return message, `token` refers to the account's `unifiedAuthToken` in `relation`. If there is no such account, one will be registered by default.

**RelationIM.init(You need to initialize an API before calling it.)**

```javascript
RelationIM.init({configOptions})
```

| **Config options** |                             **Description**                            | **Default** |
| :----------------: | :--------------------------------------------------------------------: | :---------: |
|   token: _string_  |                Required. The unifiedAuthToken of a user                |             |
|  apiKey: _string_  |                   Required. Acquired from the Admin.                   |             |
| connect: _boolean_ | Optional. Whether to establish a socket connection to receive message. |    false    |
| refresh: _boolean_ |    Optional. Whether to initialize the interface again(refresh it).    |    false    |

Note: When using `init` to initialize the interface, you can use `connect` to specify whether to connect to `socket`. The parameter `refresh` means whether to refresh the `RelationIM` instance.

**RelationIM.getInstance(to acquire the `RelationIM` instance already initialized.)**

```javascript
RelationIM.getInstance()
```

Note: Normally you only need one `RelationIM` instance. However, you may frequently call common APIs. To avoid redunant initiations of `RelationIM` and `socket , we suggest you manually specify a static method` RelationIM.getInstance`where needed so that you can acquire the`RelationIM\` instance already initialized.
