|
| 1 | +--- |
| 2 | +sidebar_position: 4 |
| 3 | +--- |
| 4 | +import Tabs from '@theme/Tabs'; |
| 5 | +import TabItem from '@theme/TabItem'; |
| 6 | +import CodeBlock from '@theme/CodeBlock'; |
| 7 | +import ApiCallExample from '@site/src/components/ApiCallExample'; |
| 8 | + |
| 9 | +# Get NFT Events History |
| 10 | + |
| 11 | +This endpoint allows you to fetch the complete event history of a specific NFT, including transfers, listings, and other on-chain activities. |
| 12 | + |
| 13 | +### Endpoint |
| 14 | + |
| 15 | +<Tabs> |
| 16 | + <TabItem value="mainnet" label="Mainnet"> |
| 17 | + |
| 18 | +```bash |
| 19 | +GET https://api.spacescan.io/nfts/events/{nft_id} |
| 20 | +``` |
| 21 | + |
| 22 | + </TabItem> |
| 23 | + <TabItem value="testnet" label="Testnet"> |
| 24 | + |
| 25 | +```bash |
| 26 | +GET https://api-testnet11.spacescan.io/nfts/events/{nft_id} |
| 27 | +``` |
| 28 | + |
| 29 | + </TabItem> |
| 30 | +</Tabs> |
| 31 | + |
| 32 | +### Parameters |
| 33 | + |
| 34 | +| Parameter | Type | Required | Default | Description | |
| 35 | +|-----------|------|----------|---------|-------------| |
| 36 | +| nft_id | string | Yes | - | The unique identifier of the NFT | |
| 37 | + |
| 38 | +:::info Free API |
| 39 | +Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacescan.io/apis#plans) for rate limits and features. |
| 40 | +::: |
| 41 | + |
| 42 | +:::tip Pro API |
| 43 | +Use `pro-api.spacescan.io` with your API key in the `x-api-key` header. See our [API Plans](https://spacescan.io/apis#plans) for details. |
| 44 | + |
| 45 | +```bash |
| 46 | +curl -X GET "https://pro-api.spacescan.io/nfts/events/{nft_id}" \ |
| 47 | + -H "x-api-key: YOUR_API_KEY" |
| 48 | +``` |
| 49 | +::: |
| 50 | + |
| 51 | +### Live API Test |
| 52 | + |
| 53 | +<Tabs> |
| 54 | + <TabItem value="mainnet" label="Mainnet"> |
| 55 | + <a href="https://api.spacescan.io/nfts/events/nft10lutrplp2mqrp0wg27sjmjeezzluk9a7jgmjpdv6n5qalkpy8kxqrkqag7" target="_blank" rel="noopener noreferrer" className="api-test-button"> |
| 56 | + 🚀 Test API in Browser |
| 57 | + </a> |
| 58 | + </TabItem> |
| 59 | +</Tabs> |
| 60 | + |
| 61 | +### Request Examples |
| 62 | + |
| 63 | +<Tabs> |
| 64 | + <TabItem value="curl" label="cURL"> |
| 65 | + |
| 66 | +```bash |
| 67 | +curl -X GET "https://api.spacescan.io/nfts/events/nft10lutrplp2mqrp0wg27sjmjeezzluk9a7jgmjpdv6n5qalkpy8kxqrkqag7" |
| 68 | +``` |
| 69 | + |
| 70 | + </TabItem> |
| 71 | + <TabItem value="python" label="Python"> |
| 72 | + |
| 73 | +```python |
| 74 | +import requests |
| 75 | + |
| 76 | +nft_id = "nft10lutrplp2mqrp0wg27sjmjeezzluk9a7jgmjpdv6n5qalkpy8kxqrkqag7" |
| 77 | +url = f"https://api.spacescan.io/nfts/events/{nft_id}" |
| 78 | + |
| 79 | +response = requests.get(url) |
| 80 | +data = response.json() |
| 81 | +print(data) |
| 82 | +``` |
| 83 | + |
| 84 | + </TabItem> |
| 85 | + <TabItem value="javascript" label="JavaScript"> |
| 86 | + |
| 87 | +```javascript |
| 88 | +const nftId = "nft10lutrplp2mqrp0wg27sjmjeezzluk9a7jgmjpdv6n5qalkpy8kxqrkqag7"; |
| 89 | +const url = `https://api.spacescan.io/nfts/events/${nftId}`; |
| 90 | + |
| 91 | +fetch(url) |
| 92 | + .then(response => response.json()) |
| 93 | + .then(data => console.log(data)) |
| 94 | + .catch(error => console.error('Error:', error)); |
| 95 | +``` |
| 96 | + |
| 97 | + </TabItem> |
| 98 | +</Tabs> |
| 99 | + |
| 100 | +### Response Schema |
| 101 | + |
| 102 | +| Field | Type | Description | |
| 103 | +|-------|------|-------------| |
| 104 | +| coin_name | string | Unique identifier for the coin | |
| 105 | +| nft_id | string | The NFT identifier | |
| 106 | +| version_number | number | Version number of the event | |
| 107 | +| confirmed_block | string | Block height where event was confirmed | |
| 108 | +| confirmed_time | string | Timestamp of confirmation | |
| 109 | +| spend_block | string | Block height where coin was spent | |
| 110 | +| spend_time | string | Timestamp when coin was spent | |
| 111 | +| owner_address | string | Address of the owner | |
| 112 | +| owner_did | string | DID of the owner (if applicable) | |
| 113 | +| parent_coin | string | Parent coin identifier | |
| 114 | +| from_address | string | Source address of the transaction | |
| 115 | +| is_ephemeral | boolean | Whether the coin is ephemeral | |
| 116 | +| memo | string | Optional memo attached to the transaction | |
| 117 | +| spend_tags | array | Array of spend tags | |
| 118 | +| confirmed_txn_id | string | Transaction ID of confirmation | |
| 119 | +| spend_txn_id | string | Transaction ID of spend | |
| 120 | +| is_spend | boolean | Whether the coin has been spent | |
| 121 | + |
| 122 | +### Example Response |
| 123 | + |
| 124 | +```json |
| 125 | +[ |
| 126 | + { |
| 127 | + "coin_name": "d68dfe7118627cab63768f505285bdb86be78f5e5514b6218a1f0cdf6a4a4e01", |
| 128 | + "nft_id": "nft10lutrplp2mqrp0wg27sjmjeezzluk9a7jgmjpdv6n5qalkpy8kxqrkqag7", |
| 129 | + "version_number": 0, |
| 130 | + "confirmed_block": "6200809", |
| 131 | + "confirmed_time": "2024-11-12T19:00:50.000Z", |
| 132 | + "spend_block": "0", |
| 133 | + "spend_time": null, |
| 134 | + "owner_address": "xch1u7jecspyllxzsz4srfvf0pzv489vr3n3tnd3kx2da3avftaq854s4ndhny", |
| 135 | + "owner_did": "did:chia:1gw3wdgx2rs98x86vj3z9888kfu6jtgv5u39224m42crjk0t2rx2q4v06hh", |
| 136 | + "parent_coin": "a71ce702f29eb59ab716b1f395490c856bb2bacaaafdf78134662cf2ec638598", |
| 137 | + "from_address": "xch1u7jecspyllxzsz4srfvf0pzv489vr3n3tnd3kx2da3avftaq854s4ndhny", |
| 138 | + "is_ephemeral": false, |
| 139 | + "memo": null, |
| 140 | + "spend_tags": null, |
| 141 | + "confirmed_txn_id": "txn1nn8zvkmp0j8g5rqdajc9ps9acuympp9vekp2e3t29pguqw6shqnq2hpcgg", |
| 142 | + "confirmed_txn_type": 3, |
| 143 | + "is_spend": false |
| 144 | + } |
| 145 | +] |
| 146 | +``` |
| 147 | + |
| 148 | +### Response Headers |
| 149 | + |
| 150 | +| Header | Description | |
| 151 | +|--------|-------------| |
| 152 | +| Content-Type | application/json | |
| 153 | +| Cache-Control | Caching directives for the response | |
| 154 | + |
| 155 | +### Error Responses |
| 156 | + |
| 157 | +| HTTP Status Code | Meaning | |
| 158 | +|-----------------|---------| |
| 159 | +| 400 | Bad Request -- Your request is invalid | |
| 160 | +| 404 | Not Found -- The specified NFT could not be found | |
| 161 | +| 429 | Too Many Requests -- You're requesting too many times | |
| 162 | +| 500 | Internal Server Error -- We had a problem with our server | |
| 163 | +| 503 | Service Unavailable -- We're temporarily offline for maintenance | |
| 164 | + |
| 165 | +### Notes |
| 166 | + |
| 167 | +- Events are returned in chronological order, with the most recent events first |
| 168 | +- Each event represents a state change of the NFT on the blockchain |
| 169 | +- The `spend_tags` field can help identify the type of event (transfer, listing, etc.) |
| 170 | +- `owner_did` may be null if the owner doesn't have an associated DID |
0 commit comments