# Metadata Service Guide

Cronos ID has a Metadata Service, which allows third party NFT platforms and wallets to integrate and display the information of Cronos IDs.

## Service Endpoints

Production Environment `https://metadata.cronosid.xyz/`

## Contracts

* Testnet, CRORegistrar: `0x8101623b9F430C5A3fa808619456B8d98ba5A894`
* Mainnet, CRORegistrar: `0xf884647Dfa84696d9373F36eE413CCc48093F924`

## NFT Metadata API

### Request path:

```
/{networkName}/{contractAddress}/{tokenId}
```

### Parameters:

* **Network**: Name of the chain to query for (mainnet | testnet)
* **contractAddress**: Accepts contractAddress of the NFT which is represented by the tokenId
* **tokenId**: Accepts labelhash of Cronos ID domain in both hex and int format

```
// how to get tokenId for the name 'abcde5.cro' (javascript)
const label = "abcde5".toLowerCase()
ethers.utils.keccak256(ethers.utils.toUtf8Bytes(label))
// or, same
ethers.utils.id(label)
```

### Response Body:

```
{
  "is_normalized": true,
  "name": "to-the-moon.cro",
  "description": "to-the-moon.cro, an Cronos ID name.",
  "attributes": [
    {
      "trait_type": "Created Date",
      "display_type": "date",
      "value": 1661226007000
    },
    { "trait_type": "Length", "display_type": "number", "value": 11 },
    { "trait_type": "Segment Length", "display_type": "number", "value": 11 },
    {
      "trait_type": "Character Set",
      "display_type": "string",
      "value": "mixed"
    },
    {
      "trait_type": "Registration Date",
      "display_type": "date",
      "value": 1661226007000
    },
    {
      "trait_type": "Expiration Date",
      "display_type": "date",
      "value": 1976795527000
    }
  ],
  "name_length": 11,
  "segment_length": 11,
  "url": "https://cronosid.xyz/name/register/?label=to-the-moon.cro",
  "version": 0,
  "background_image": "https://metadata.cronosid.xyz/testnet/avatar/to-the-moon.cro",
  "image": "https://metadata.cronosid.xyz/testnet/0x8101623b9F430C5A3fa808619456B8d98ba5A894/0x486a8f914586140c471814a37061a30c5fc9585adca7fa5ed0636305c46d73fc/image",
  "image_url": "https://metadata.cronosid.xyz/testnet/0x8101623b9F430C5A3fa808619456B8d98ba5A894/0x486a8f914586140c471814a37061a30c5fc9585adca7fa5ed0636305c46d73fc/image"
}
```

### Response Fields:

| Field             | Description                                                                                                                                              |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name              | name of the domain                                                                                                                                       |
| description       | Short description about the name. It contains a warning message if the domain is not comprised of numbers and letters.                                   |
| is\_normalized    | Whether the domain is normalized. It must follow [UTS46](http://unicode.org/reports/tr46/) for normaliztion and validation.                              |
| attributes        | <p>A list of attributes, including:<br>- Created Date<br>- Length<br>- Segment Length<br>- Character Set<br>- Registration Date<br>- Expiration Date</p> |
| name\_length      | Character length of the domain                                                                                                                           |
| segment\_length   | Segment length of the domain. Local-sensitive text segmentation obtained by Intl.Segmenter.                                                              |
| url               | A URL to the domain's profile page on Cronos ID website                                                                                                  |
| version           | Cronos ID NFT version                                                                                                                                    |
| background\_image | Origin URL of the avatar image                                                                                                                           |
| image             | URL of the domain image to display (recommended)                                                                                                         |
| image\_url        | URL of the NFT image                                                                                                                                     |

## NFT Metadata Image API

### Request Path:

```
/{networkName}/{contractAddress}/{tokenId}/image
```

### Parameters:

* **network**: Name of the chain to query for (mainnet | testnet)
* **contactAddress**: Accepts contractAddress of the NFT which is represented by the tokenId
* **tokenId**: Accepts labelhash of Cronos ID domain in both hex and int format

### Response Body:

A SVG image file

* the content-type is ‘image/svg+xml’.
