# Secure Cross-Platform Identity Linking

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

* Through this API, under the premise of obtaining user authorization, you can query the Web3 address associated with a user's Web2 account or the Web2 account associated with a Web3 address and verify whether these accounts belong to the same individual. 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](/relation-graph/api/cross-platform-identity-linking.md) 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](/relation-graph/guide/use-litprotocol-to-decrypt.md) 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 Secure Cross-Platform Identity Linking.**)） |

* Request Example

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

* Response Parameters

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

The Account field consists of the following subfields:

| Field    | Type     | Remarks              |
| -------- | -------- | -------------------- |
| relation | Relation | Relation information |
| address  | List     | Address list         |
| twitter  | Twitter  | Twitter information  |
| steam    | Steam    | Steam information    |

Data structure of the decrypted Twitter object

```json
{
  "code": "0",
  "desc": "success",
  "data": {
    "address": [],
    "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"
    },
    "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"
    }
  }
}
```

* 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 |


---

# 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-graph/api/cross-platform-identity-linking.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.
