# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://relationlabs.gitbook.io/relation-one-api/js-sdk/im-js-sdk/static-method.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
