# NFT API

### Get NFT token metadata <a href="#huo-qu-yu-suan-ke-mu-v2" id="huo-qu-yu-suan-ke-mu-v2"></a>

```
## Request
curl -X "POST" "https://oracle-api.banksea.finance/moonbeam/v1/token/metadata" \
     -H 'x-api-key: test-api-key' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
    "collection":"beanies",
    "token_id":"1"
}'
```

* Interface: /moonbeam/v1/token/metadata
* Method: POST
* Data Format: JSON
* Request Parameter:

| Parameter  | Type   | Required | Description         |
| ---------- | ------ | -------- | ------------------- |
| collection | String | Y        | The NFT collection. |
| token\_id  | String | Y        | The token id.       |

*   Request Example:

    ```
    {
        "collection":"beanies",
        "token_id":"1"
    }
    ```
* Response Data

| Field                  | Type   | Description                                                       |
| ---------------------- | ------ | ----------------------------------------------------------------- |
| token\_name            | String | The name of the NFT token.                                        |
| image\_url             | String | The image url of the NFT token.                                   |
| attributes             | List   | The attributes of the NFT token.                                  |
| attributes.trait\_type | String | Attribute type.                                                   |
| attributes.value       | String | Attribute value.                                                  |
| attributes.amount      | Number | Attribute amount.                                                 |
| attributes.rarity      | Number | Attribute rarity.                                                 |
| rarity\_score          | Number | The Rarity Score is an indicator of the rarity of NFT attributes. |
| rank                   | Number | Rank within the NFT collection for rarity scores.                 |

*   Response Example:

    ```json
    {
        "success": true,
        "code": "200",
        "message": "success",
        "data": {
            "attributes": [
                {
                    "amount": 40,
                    "rarity": 8.66,
                    "value": "GradientGreen",
                    "trait_type": "Background"
                },
                {
                    "amount": 56,
                    "rarity": 12.12,
                    "value": "Green",
                    "trait_type": "Bodies"
                },
                {
                    "amount": 48,
                    "rarity": 10.39,
                    "value": "Caffeinated",
                    "trait_type": "Eyes"
                },
                {
                    "amount": 15,
                    "rarity": 3.25,
                    "value": "Galactic",
                    "trait_type": "Mouths"
                },
                {
                    "amount": 43,
                    "rarity": 9.31,
                    "value": "Casual",
                    "trait_type": "Tops"
                },
                {
                    "amount": 45,
                    "rarity": 9.74,
                    "value": "Warrior",
                    "trait_type": "Bottoms"
                }
            ],
            "rank": 53,
            "token_name": "Beanies#1",
            "image_url": "https://gateway.pinata.cloud/ipfs/QmUJLruvoTP2AmQy2KkC5tA2gfXif2hvUvehVmcAPjdhSH/1.png",
            "rarity_score": 78.0
        }
    }
    ```

### Get NFT token transactions <a href="#huo-qu-yu-suan-ke-mu-v2" id="huo-qu-yu-suan-ke-mu-v2"></a>

```
## Request
curl -X "POST" "https://oracle-api.banksea.finance/moonbeam/v1/token/transactions" \
     -H 'x-api-key: test-api-key' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
    "collection":"damnedpirates",
    "token_id":"2913"
}'
```

* Interface: /moonbeam/v1/token/transactions
* Method: POST
* Data Format: JSON
* Request Parameter:

| Parameter  | Type   | Required | Description         |
| ---------- | ------ | -------- | ------------------- |
| collection | String | Y        | The NFT collection. |
| token\_id  | String | Y        | The token id.       |

*   Request Example:

    ```
    {
        "collection":"damnedpirates",
        "token_id":"2913"
    }
    ```
* Response Data:

| Field                    | Type   | Description                                   |
| ------------------------ | ------ | --------------------------------------------- |
| max\_price               | Number | The highest transaction price in history.     |
| min\_price               | Number | The lowest transaction price in history.      |
| price\_history           | List   | The list of transaction prices in history.    |
| price\_history.price     | Number | historical price.                             |
| price\_history.timestamp | Number | The transaction time of the historical price. |
| holder\_history          | List   | The list of former holders in history.        |
| activities               | List   | The list of activities.                       |
| activities.event\_type   | String | Type of activity.                             |
| activities.price         | Number | Price of activity.                            |
| activities.from\_address | String | The source address of the NFT transfer .      |
| activities.to\_address   | String | The destination address of the NFT transfer.  |
| activities.timestamp     | Number | Time of activity.                             |

*   Response Example:

    ```json
    {
        "success": true,
        "code": "200",
        "message": "success",
        "data": {
            "activities": [
                {
                    "seller": null,
                    "buyer": null,
                    "transaction_type": "Listing",
                    "total_amount": 1.790000,
                    "transaction_time": 1635837336000
                },
                {
                    "seller": "0xc97d64c2395e1cf29bbfdeb8e79236b6f8b8bc0e",
                    "buyer": "0x4103a69d709b9a9b4d2c50306f513fe9fc4a8995",
                    "transaction_type": "Sale",
                    "total_amount": 1.790000,
                    "transaction_time": 1635862608000
                },
                {
                    "seller": null,
                    "buyer": null,
                    "transaction_type": "CancelListing",
                    "total_amount": null,
                    "transaction_time": 1635862608000
                },
                {
                    "seller": null,
                    "buyer": null,
                    "transaction_type": "Listing",
                    "total_amount": 2.000000,
                    "transaction_time": 1637074350000
                },
                {
                    "seller": null,
                    "buyer": null,
                    "transaction_type": "Listing",
                    "total_amount": 1.790000,
                    "transaction_time": 1637348862000
                },
                {
                    "seller": null,
                    "buyer": null,
                    "transaction_type": "CancelListing",
                    "total_amount": null,
                    "transaction_time": 1637931805000
                },
                {
                    "seller": null,
                    "buyer": null,
                    "transaction_type": "Listing",
                    "total_amount": 1.400000,
                    "transaction_time": 1637952930000
                },
                {
                    "seller": null,
                    "buyer": null,
                    "transaction_type": "Listing",
                    "total_amount": 1.250000,
                    "transaction_time": 1638304416000
                },
                {
                    "seller": "0x4103a69d709b9a9b4d2c50306f513fe9fc4a8995",
                    "buyer": "0x97abc3231f4a60f77631db352d4e6a8214cc268d",
                    "transaction_type": "Sale",
                    "total_amount": 1.250000,
                    "transaction_time": 1638371010000
                },
                {
                    "seller": null,
                    "buyer": null,
                    "transaction_type": "CancelListing",
                    "total_amount": null,
                    "transaction_time": 1638371010000
                }
            ],
            "max_price": 1.790000,
            "min_price": 1.250000,
            "price_history": [
                {
                    "price": 1.790000,
                    "timestamp": 1635862608000
                },
                {
                    "price": 1.250000,
                    "timestamp": 1638371010000
                }
            ],
            "holder_history": [
                "0x4103a69d709b9a9b4d2c50306f513fe9fc4a8995",
                "0x97abc3231f4a60f77631db352d4e6a8214cc268d"
            ]
        }
    }
    ```

### Get NFT token valuation <a href="#huo-qu-yu-suan-ke-mu-v2" id="huo-qu-yu-suan-ke-mu-v2"></a>

```
## Request
curl -X "POST" "https://oracle-api.banksea.finance/moonbeam/v1/token/valuation" \
     -H 'x-api-key: test-api-key' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
    "collection":"beanies",
    "token_id":"1"
}'
```

* Interface: /moonbeam/v1/token/valuation
* Method: POST
* Data Format: JSON
* Request Parameter:

| Parameter  | Type   | Required | Description         |
| ---------- | ------ | -------- | ------------------- |
| collection | String | Y        | The NFT collection. |
| token\_id  | String | Y        | The token id.       |

*   Request Example:

    ```
    {
        "collection":"beanies",
        "token_id":"1"
    }
    ```
* Response Data:

| Field                        | Type   | Description                                  |
| ---------------------------- | ------ | -------------------------------------------- |
| valuation                    | Number | The valuation of the NFT token.              |
| valuation\_history           | List   | The list of valuation over the past 30 days. |
| valuation\_history.valuation | Number | valuation.                                   |
| valuation\_history.timestamp | Number | valuation time.                              |

*   Response Example:

    ```json
    {
        "success": true,
        "code": "200",
        "message": "success",
        "data": {
            "valuation": 31.534898,
            "valuation_history": [
                {
                    "valuation": 31.534898,
                    "timestamp": 1656898709000
                }
            ]
        }
    }
    ```
