# Legacy - v0

MYTY Avatar Registry is an all-in-one solution for retrieve the resources of the Web3 avatars. We provide various types of avatars in the registry such as

* NFT-based Camera Filters
* PFP Collections
* NFT Gaming Characters

You can check out the full avatar lists -- here.

An application builder does not need to think about avatars, filters anymore.

## Getting started

1. First of all, you need to request an API key. Please contact our team via email, DM, etc.
2. We provide a playground, you can easily play with our APIs.

## Basics

{% hint style="info" %}
<https://api.myty.space/v0> \
is the right path for now, but we are going to release v1 soon! Stay tuned!
{% endhint %}

### Supported NFT Collections

As we mentioned, we provide a various types of avatars. In order to get the catalog of supported avatar, you need to request following API. (Don't forget you need to add your

Request :

```
/v0/supportedNFTCollections
```

Response :

```json
[
    {
        "id": 1,
        "address": "0x1A92f7381B9F03921564a437210bB9396471050C",
        "name": "Cool Cats",
        "symbol": "COOL",
        "imageUri": null,
        "createdAt": "2022-09-16T02:24:04Z"
    },
    {
        "id": 2,
        "address": "0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e",
        "name": "goblintown",
        "symbol": "GOBLIN",
        "imageUri": null,
        "createdAt": "2022-09-16T02:24:04Z"
    },
    {
        "id": 3,
        "address": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
        "name": "BoredApeYachtClub",
        "symbol": "BAYC",
        "imageUri": null,
        "createdAt": "2022-09-16T02:24:04Z"
    },
    ...
```

Then, you know that

* What kind of NFT Collections are supported by MYTY
* The `collectionAddress` (address).

### Get the avatars from specific collection

Now, you can request the supported avatars(tokenIds) from the specific collections

Request :

```
/v0/avatarVerified?collectionAddress={collectionAddress}
```

Response :

```json
[
  {
    "id": 80,
    "name": "Goblintown_Public_20221202",
    "creator": {
      "id": 2,
      "address": "0x82EAcBd9f498701029477e35054155861cbd3b04"
    },
    "nftCollection": {
      "id": 2,
      "address": "0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e",
      "name": "goblintown",
      "symbol": "GOBLIN",
      "imageUri": null,
      "createdAt": "2022-09-16T02:24:04Z"
    },
    "nftCollectionAddress": "0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e",
    "nftCollectionName": "goblintown",
    "tokenIdsStr": "0-898,900-1352,1354-1473,1475-2624,2626-3240,3242-3661,3663-4071,4073-4586,4588-4892,4894-5464,5466-5741,5743-5947,5949-6484,6486-6748,6750-7943,7945-8040,8042-8994,8996-9998",
    "tokenIds": [
      0,
      1,
      2,
      ...
    ],
    "tokenIdsBig": [
      0
    ],
    "chain": "Ethereum",
    "avatarStyle": {
      "id": 1,
      "name": "v0.1"
    },
    "kitVersion": {
      "id": 6,
      "major": 1,
      "minor": 0,
      "patch": 1
    },
    "assetUri": "https://assets-avatar.myty.space/000080_Goblintown_Public_20221202_Standalone",
    "createdAt": "2022-12-01T17:16:39.562210Z",
    "updatedAt": "2022-12-01T17:16:39.562221Z",
    "expiredAt": null,
    "allUriValid": true,
    "uriValid": true,
    "verified": true,
    "rejected": false,
    "deprecated": false,
    "createdBy": null,
    "updatedBy": null
  },
  {
    "id": 81,
    "name": "Goblintown_Public_20221202",
    "creator": {
      "id": 2,
      "address": "0x82EAcBd9f498701029477e35054155861cbd3b04"
    },
    "nftCollection": {
      "id": 2,
      "address": "0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e",
      "name": "goblintown",
      "symbol": "GOBLIN",
      "imageUri": null,
      "createdAt": "2022-09-16T02:24:04Z"
    },
    "nftCollectionAddress": "0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e",
    "nftCollectionName": "goblintown",
    "tokenIdsStr": "0-898,900-1352,1354-1473,1475-2624,2626-3240,3242-3661,3663-4071,4073-4586,4588-4892,4894-5464,5466-5741,5743-5947,5949-6484,6486-6748,6750-7943,7945-8040,8042-8994,8996-9998",
    "tokenIds": [
      0,
      1,
      ...
    ],
    "chain": "Ethereum",
    "avatarStyle": {
      "id": 1,
      "name": "v0.1"
    },
    "kitVersion": {
      "id": 3,
      "major": 0,
      "minor": 3,
      "patch": 0
    },
    "assetUri": "https://assets-avatar.myty.space/000081_Goblintown_Public_20221202_Standalone",
    "createdAt": "2022-12-01T17:17:19.066643Z",
    "updatedAt": "2022-12-01T17:17:19.066650Z",
    "expiredAt": null,
    "allUriValid": true,
    "uriValid": true,
    "verified": true,
    "rejected": false,
    "deprecated": false,
    "createdBy": null,
    "updatedBy": null
  },
  {
    "id": 92,
    "name": "GoblinTown",
    "creator": {
      "id": 2,
      "address": "0x82EAcBd9f498701029477e35054155861cbd3b04"
    },
    "nftCollection": {
      "id": 2,
      "address": "0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e",
      "name": "goblintown",
      "symbol": "GOBLIN",
      "imageUri": null,
      "createdAt": "2022-09-16T02:24:04Z"
    },
    "nftCollectionAddress": "0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e",
    "nftCollectionName": "goblintown",
    "tokenIdsStr": "0-898,900-1352,1354-1473,1475-2624,2626-3240,3242-3661,3663-4071,4073-4586,4588-4892,4894-5464,5466-5741,5743-5947,5949-6484,6486-6748,6750-7943,7945-8040,8042-8994,8996-9998",
    "tokenIds": [
     ...
    ],
    "tokenIdsBig": [
      ...
    ],
    "chain": "Ethereum",
    "avatarStyle": {
      "id": 1,
      "name": "v0.1"
    },
    "kitVersion": {
      "id": 8,
      "major": 1,
      "minor": 1,
      "patch": 0
    },
    "assetUri": "",
    "createdAt": "2023-02-14T01:38:33.697814Z",
    "updatedAt": "2023-02-14T01:38:33.697820Z",
    "expiredAt": null,
    "allUriValid": true,
    "uriValid": false,
    "verified": true,
    "rejected": false,
    "deprecated": false,
    "createdBy": null,
    "updatedBy": null
  }
]
```

Almost done, you probably notice that there are multiple response of `GoblinTown` Assets. That's not a weird thing. As our SDK/Kit has been upgraded, we have many types of `GoblinTown` in our registry. Please be aware that which version of `MYTY SDK you are using, and pick the right one. (Usually you will pick the latest version of assets) Here our logic  shown below :`

1. List of AvatarAssetInfo received
2. Filter out using `avatar > deprecated` && `avatar > kitVersion`
3. Match with `tokenIds` and merge it with ownership info received before (e.g., for Doodles, we should fetch two assets)
4. Get the latest one using `avatar > updatedAt.`

Then, please find `assetUri` from the response. It will guide to the `UnityAssetBundle` you need.

Yes you're done, you can play with the AssetBundle!
