Skip to content

Commit e28c105

Browse files
committed
added nft enpoints
1 parent 7231e9e commit e28c105

File tree

5 files changed

+698
-3
lines changed

5 files changed

+698
-3
lines changed

api/nft/events.md

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
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

api/nft/metadata.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
sidebar_position: 3
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 Metadata
10+
11+
This endpoint allows you to fetch the metadata information of a specific NFT in CHIP-0007 format.
12+
13+
### Endpoint
14+
15+
<Tabs>
16+
<TabItem value="mainnet" label="Mainnet">
17+
18+
```bash
19+
GET https://api.spacescan.io/nfts/{nft_id}/metadata
20+
```
21+
22+
</TabItem>
23+
<TabItem value="testnet" label="Testnet">
24+
25+
```bash
26+
GET https://api-testnet11.spacescan.io/nfts/{nft_id}/metadata
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/{nft_id}/metadata" \
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/nft10lutrplp2mqrp0wg27sjmjeezzluk9a7jgmjpdv6n5qalkpy8kxqrkqag7/metadata" 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/nft10lutrplp2mqrp0wg27sjmjeezzluk9a7jgmjpdv6n5qalkpy8kxqrkqag7/metadata"
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/{nft_id}/metadata"
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/${nftId}/metadata`;
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+
| format | string | The metadata format (e.g., "CHIP-0007") |
105+
| name | string | The name of the NFT |
106+
| description | string | Description of the NFT |
107+
| sensitive_content | boolean | Flag indicating if content is sensitive |
108+
| collection | object | Collection information |
109+
| collection.name | string | Name of the collection |
110+
| collection.id | string | Unique identifier of the collection |
111+
| collection.attributes | array | Array of collection attributes |
112+
| attributes | array | Array of NFT attributes/traits |
113+
114+
### Example Response
115+
116+
```json
117+
{
118+
"format": "CHIP-0007",
119+
"name": "Chia Friends #6707",
120+
"description": "10,000 eco-bit NFTs on Chia, from Chia.",
121+
"sensitive_content": false,
122+
"collection": {
123+
"name": "Chia Friends",
124+
"id": "517B1E97-F1AF-4824-A7B9-8D85E281D7B8",
125+
"attributes": [
126+
{
127+
"type": "description",
128+
"value": "10,000 eco-bit NFTs on Chia, from Chia."
129+
},
130+
{
131+
"type": "twitter",
132+
"value": "@chia_friends"
133+
},
134+
{
135+
"type": "website",
136+
"value": "https://www.chiafriends.xyz/"
137+
}
138+
]
139+
},
140+
"attributes": [
141+
{
142+
"trait_type": "Background",
143+
"value": "Yak"
144+
},
145+
{
146+
"trait_type": "Body",
147+
"value": "Parakeet (Green)"
148+
},
149+
{
150+
"trait_type": "Eyes",
151+
"value": "Cyborg"
152+
},
153+
{
154+
"trait_type": "Mouth",
155+
"value": "Beak (Small)"
156+
}
157+
]
158+
}
159+
```
160+
161+
### Response Headers
162+
163+
| Header | Description |
164+
|--------|-------------|
165+
| Content-Type | application/json |
166+
| Cache-Control | Caching directives for the response |
167+
168+
### Error Responses
169+
170+
| HTTP Status Code | Meaning |
171+
|-----------------|---------|
172+
| 400 | Bad Request -- Your request is invalid |
173+
| 404 | Not Found -- The specified NFT or its metadata could not be found |
174+
| 429 | Too Many Requests -- You're requesting too many times |
175+
| 500 | Internal Server Error -- We had a problem with our server |
176+
| 503 | Service Unavailable -- We're temporarily offline for maintenance |
177+
178+
### Notes
179+
180+
- The response follows the CHIP-0007 metadata standard
181+
- All metadata is returned in JSON format
182+
- Collection attributes may vary depending on the NFT collection
183+
- NFT attributes/traits are specific to each individual NFT

0 commit comments

Comments
 (0)