> For the complete documentation index, see [llms.txt](https://docs.space.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.space.id/developer-guide/web3-name-api-and-sdk/web3-name-api.md).

# Web3 Name API

SPACE ID provides a free HTTP API to help dApps integrate domain resolutions with ease. All data is  queried on-chain securely in real time.

The primary capabilities of the SPACE ID Web3 Name API include:

1. Domain Name -> Address resolution: Retrieve the crypto address uniquely bound to the domain name by entering the domain name.
2. Address -> Domain Name resolution: Retrieve the domain name associated with the address via inputs: 1) the crypto address, and 2) the chain id.
   * Given one crypto address could own multiple domain names, users can set a primary name such that their address can be 1-to-1 mapped to this primary name&#x20;

## 1. Resolve Domain Name -> Address

<mark style="color:blue;">`GET`</mark> `https://nameapi.space.id/getAddress?domain=`&#x20;

**Request URL Example:**&#x20;

* Domain to be resolved: spaceid.bnb
* <https://nameapi.space.id/getAddress?domain=spaceid.bnb>&#x20;

```json
Status Code: 200 OK
{
"address":"0xb5932a6B7d50A966AEC6C74C97385412Fb497540"
"code":0
"msg":"success"
}
```

**Return Field Description**

<table><thead><tr><th width="148">Name</th><th>Description</th></tr></thead><tbody><tr><td>address </td><td>Returns the resolved address. If no domain records are found, the address field will not be returned</td></tr><tr><td>code</td><td>0: address found, 1: no address found, -1: error</td></tr><tr><td>msg</td><td>result status and error message</td></tr></tbody></table>

\*Get Address API now supports .four token CA resolving, sample query is provided for testing and integration.

[https://nameapi.space.id/getAddress?domain=tst.four ](https://nameapi.space.id/getAddress?domain=tst.four)

```
Status Code: 200 OK
{
"address":"0x86Bb94DdD16Efc8bc58e6b056e8df71D9e666429"
"code":0
"msg":"success"
}
```

## 2. Resolve Address -> Domain Name

<mark style="color:blue;">`GET`</mark> `https://nameapi.space.id/getName?chainid=&address=`

#### Query Parameters

<table><thead><tr><th width="195">Name</th><th>Description</th></tr></thead><tbody><tr><td>chainid</td><td>The Chain ID that tells which chain the app is on (e.g. Ethereum: 1, BNB Chain: 56, Solana: 900)</td></tr><tr><td>address</td><td>The crypto address that can be resolved to a primary domain name</td></tr></tbody></table>

**Request URL Example (single chain query):**&#x20;

* BNB Chain (Chain ID: 56) Address to be resolved: 0xb5932a6B7d50A966AEC6C74C97385412Fb497540
* <https://nameapi.space.id/getName?chainid=56&address=0xb5932a6B7d50A966AEC6C74C97385412Fb497540>
* Return:&#x20;

```json
Status Code: 200 OK
{
  "code": 0,
  "data": {
    "name": "spaceid.bnb",
    "chainID": 56,
    "errMsg": ""
  },
  "msg": "success"
}
```

\*GetName API now support four meme token domain retrieval

<https://nameapi.space.id/getName?chainid=56&address=0x86Bb94DdD16Efc8bc58e6b056e8df71D9e666429>

```
Status Code: 200 OK
{
  "code": 0,
  "data": {
    "name": "tst.four",
    "chainID": 56,
    "errMsg": ""
  },
  "msg": "success"
}
```

**Request URL Example (multi-chain query):**

* Address 0xb5932a6B7d50A966AEC6C74C97385412Fb497540, to be resolved for names on Arbitrum, BNB Chain, and Mint.&#x20;
* <https://nameapi.space.id/getDomainNamesByChainIdList?chainlist=42161,56,101,185&address=0x2e552E3aD9f7446e9caB378c008315E0C26c0398>
* Return:&#x20;

<pre class="language-json"><code class="lang-json"><strong>Status Code: 200 OK
</strong>{
   "code": 0,
   "data": [
       {
           "name": "0x5206.arb",
           "chainID": 42161,
           "errMsg": ""
       },
       {
           "name": "allen.bnb",
           "chainID": 56,
           "errMsg": ""
       },
       {
           "name": "",
           "chainID": 0,
           "errMsg": "unsupported chain id: 101"
       },
       {
           "name": "",
           "chainID": 185,
           "errMsg": "corresponding domain not found"
       }
   ],
   "msg": "success"
}

</code></pre>

**Return Field Description**

<table><thead><tr><th width="134">Name</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>Returns the resolved domain name. If no record is found, the name field will not be returned</td></tr><tr><td>code</td><td>0: name found, 1: name not found, -1: error </td></tr><tr><td>msg</td><td>result status and error message</td></tr></tbody></table>

## 3. Resolve Payment ID -> Address

<mark style="color:blue;">`GET`</mark> `https://nameapi.space.id/getPaymentIdName/”paymentID”/”chaintype”`&#x20;

#### Query Parameters

<table><thead><tr><th width="195">Name</th><th>Description</th></tr></thead><tbody><tr><td>paymentID</td><td>The payment ID name that needs to be resolved (e.g. jerry@binance)</td></tr><tr><td>chaintype</td><td>The chain address to be resolved, from btc, evm, sol, tron, aptos, sui</td></tr></tbody></table>

**Request URL Example:**&#x20;

* Payment ID to be resolved: jerry\@binance, chaintype: evm
* <https://nameapi.space.id/getPaymentIdName/jerry@binance/evm>
* Return:

<pre class="language-json"><code class="lang-json"><strong>Status Code: 200 OK
</strong>{
  "address": "0x5bcb636853ab70b873adaf2d9759ca1489669cce",
  "code": 0,
  "msg": "success"
}
</code></pre>

## Appendix for Supported Domains & Chains

| Chain                     | Chain ID | Domain  |
| ------------------------- | -------- | ------- |
| Ethereum Mainnet          | 1        | .eth    |
| BNB Chain                 | 56       | .bnb    |
| BNB Chain                 | 56       | .four   |
| Solana                    | 900      | .sol    |
| Arbitrum One              | 42161    | .arb    |
| Manta Pacific Mainnet     | 169      | .manta  |
| Mode                      | 34443    | .mode   |
| ZKFair Mainnet            | 42766    | .zfk    |
| Lightlink Phoenix Mainnet | 1890     | .ll     |
| ZetaChain Mainnet         | 7000     | .zeta   |
| Merlin Mainnet            | 4200     | .merlin |
| Gnosis                    | 100      | .gno    |
| Taiko Alethia             | 167000   | .taiko  |
| AlienX Mainnet            | 10241024 | .alien  |
| Mint Mainnet              | 185      | .mint   |
| AILayer Mainnet           | 2649     | .ail    |
| Morph                     | 2818     | .mph    |
| DuckChain Mainnet         | 5545     | .duck   |
| Gravity Alpha Mainnet     | 1625     | .g      |
| Story                     | 1514     | .ip     |
| Injective                 | 901      | .inj    |
| Sei                       | 902      | .sei    |
| .lens on Polygon          | 903      | .lens   |
| .crypto on Polygon        | 904      | .crypto |
