> For the complete documentation index, see [llms.txt](https://relationlabs.gitbook.io/relation-one-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://relationlabs.gitbook.io/relation-one-api/api-zh/api/profile/user-info.md).

# 用户信息

## <mark style="color:blue;">GET</mark> /api/v1/userInfo

* 说明： 返回用户个人信息，参数为空即查询当前访问的用户
* Header

| Field         | Type   | Required | Remarks                                                            |
| ------------- | ------ | -------- | ------------------------------------------------------------------ |
| ApiKey        | String | true     | 从管理员获取的[ApiKey](/relation-one-api/api-zh/guide/glossary.md#apikey) |
| Authorization | String | false    | Bearer ${unifiedAuthToken} ,其中unifiedAuthToken来自/api/v1/auth接口的返回  |

* Request Parameters

| Field   | Type          | Required | Remarks                                                             |
| ------- | ------------- | -------- | ------------------------------------------------------------------- |
| address | String        | false    | relationId or address。此参数与Authorization二选一                          |
| fields  | List\[String] | false    | 可选，填写需要返回的用户字段，value: CREATE\_AT、FOLLOW\_COUNT、ADDRESS\_WITH\_CHAIN |

* Request Example

```shell
curl  GET 'https://api.relationlabs.ai/api/v1/userInfo?address=0x9bd286ef4e3d9ec1af6c6ae9da2f0b3617deab13' \
--header 'ApiKey: <ApiKey>'
```

* Response Parameters

| Field | Type     | Remarks |
| ----- | -------- | ------- |
| code  | String   | 返回码     |
| desc  | String   | 返回信息    |
| data  | UserInfo | 数据      |

The UserInfo field consists of the following subfields:

| Field            | Type             | Remarks                                                             |
| ---------------- | ---------------- | ------------------------------------------------------------------- |
| name             | String           | 用户姓名                                                                |
| avatar           | String           | 用户头像                                                                |
| relationId       | String           | 用户的relationId                                                       |
| createdAt        | String           | 用户的注册时间                                                             |
| followCount      | FollowCount      | 用户的following、follower统计数据                                           |
| └─followingCount | Integer          | 用户following的总数                                                      |
| └─followerCount  | Integer          | 用户follower的总数                                                       |
| addressWithChain | AddressWithChain | 用户的地址信息列表，其中包含所属的链                                                  |
| └─address        | String           |                                                                     |
| └─chainName      | String           | 所属的链名称。当前支持的链：eth、polygon、bsc、op、moonbeam、solana、flow、substrate、ic、 |

The FollowCount field consists of the following subfields:

| Field          | Type    | Remarks        |
| -------------- | ------- | -------------- |
| name           | String  | 用户姓名           |
| followingCount | Integer | 用户following的总数 |
| followerCount  | Integer | 用户follower的总数  |

The AddressWithChain field consists of the following subfields:

| Field     | Type   | Remarks                                                             |
| --------- | ------ | ------------------------------------------------------------------- |
| name      | String | 用户姓名                                                                |
| address   | String | 用户地址                                                                |
| chainName | String | 所属的链名称。当前支持的链：eth、polygon、bsc、op、moonbeam、solana、flow、substrate、ic、 |

* Response Body

```json
{
    "code": "0",
    "desc": "success",
    "data": {
        "relationId": "d4swz-zaaaa-aaaaj-at5fa-cai",
        "name": "test_user",
        "avatar": "https://3fypb-gqaaa-aaaag-aaedq-cai.ic1.io/nft/eth/relation-test-club/16.png",
        "createdAt": "2022-08-18 16:54:15",
        "followCount": {
            "followingCount": 10,
            "followerCount": 30
        },
        "addressWithChain": [
            {
                "address": "0x1152e0eebd5d2b98da5d1ed7d1ce066c20a4e430",
                "chainName": "eth"
            }
        ]
    }
}
```

* Return Code

| code  | desc    | Remarks                                   |
| ----- | ------- | ----------------------------------------- |
| 0     | success | the flag for a successful request         |
| 11601 | failed  | this field not support in current version |
| 11602 | failed  | user not found                            |
