# Relationship Graph

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

* Through this API, you will be able to query the list of 1-degree relationship graph data (users) authorized by users. A 1-degree relationship refers to other users directly associated with the said user. This data needs to be [decrypted using the Lit Protocol](https://relationlabs.gitbook.io/graph-zh/guide/use-litprotocol-to-decrypt).
* Header

| Field  | Type   | Required | Remarks                                                                                               |
| ------ | ------ | -------- | ----------------------------------------------------------------------------------------------------- |
| ApiKey | String | true     | [ApiKey](https://relationlabs.gitbook.io/relation-graph/api/user-tag) obtained from the administrator |

* Request Parameters

| Field           | Type    | Required | Remarks                                                                                                                                                                                                                       |
| --------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| address         | String  | fasle    | EOA Address                                                                                                                                                                                                                   |
| twitterUsername | String  | fasle    | twitter username                                                                                                                                                                                                              |
| steamId         | String  | fasle    | steamId                                                                                                                                                                                                                       |
| sig             | String  | true     | User authorization information (when provided with authorization details, developers can[use Lit Protocol to decrypt](https://relationlabs.gitbook.io/relation-graph/guide/use-litprotocol-to-decrypt) the returned results). |
| message         | String  | true     | Original text of user authorization information signature （Please refer to the original signature splicing[SIWE](https://docs.login.xyz/).The statement field needs to be: **Access to Relationship Graph.**)）                |
| limit           | Integer | true     | Query limit (up to 100)                                                                                                                                                                                                       |
| cursor          | String  | true     | Cursor data returned by last page. If it is empty, it means the caller is querying the first page.                                                                                                                            |

* Request Example

```shell
curl  GET 'https://api.relationlabs.ai/api/v1/relationshipGraph?address=0x9bd286ef4e3d9ec1af6c6ae9da2f0b3617deab13&sig=0x00111&message=example.com%20wants%20you%20to%20sign%20in%20with...&limit=10&cursor=a1228c5910a04c94b70e18694d72cbb0' \
--header 'ApiKey: <ApiKey>'
```

* Response Parameters

| Field | Type          | Remarks                         |
| ----- | ------------- | ------------------------------- |
| code  | String        | Return code                     |
| desc  | String        | Return message                  |
| data  | EncryptedData | Data(Encrypted by Lit Protocol) |

The decrypted fields of `EncryptedData` are as follows:

| Field       | Type     | Remarks                         |
| ----------- | -------- | ------------------------------- |
| relation    | Relation | Relation information            |
| address     | List     | Address list                    |
| twitter     | Twitter  | Twitter information             |
| steam       | Steam    | Steam information               |
| description | String   | The description of relationship |

The decrypted data structure of `EncryptedData` is as follows:

```json
[
  {
    "relation": {
      "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",
      "address": []
    },
    "twitter": {
      "username": "VitalikButerin",
      "name": "vitalik.eth",
      "avatar": "https://pbs.twimg.com/profile_images/977496875887558661/L86xyLF4_400x400.jpg"
    },
    "steam": {
      "steamId": "178691028912",
      "name": "vitalik",
      "avatar": "https://pbs.twimg.com/profile_images/977496875887558661/L86xyLF4_400x400.jpg"
    },
    "description": ""
  }
]
```

* Response Body

```json

{
  "code": "0",
  "desc": "success",
  "data": {
    "encryptedString": "xxx",
    "encryptedSymmetricKey": "xxx"
  }
}
```

* Return Code

| code | desc    | Remarks                           |
| ---- | ------- | --------------------------------- |
| 0    | success | the flag for a successful request |
