Skip to content

Commit 5e7943d

Browse files
authored
Merge pull request #166 from spacescan-io/sabari
Added new token info route
2 parents 716eb30 + 54ad768 commit 5e7943d

File tree

1 file changed

+100
-86
lines changed

1 file changed

+100
-86
lines changed

api/cat/info.md

Lines changed: 100 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import TabItem from '@theme/TabItem';
66
import CodeBlock from '@theme/CodeBlock';
77
import ApiCallExample from '@site/src/components/ApiCallExample';
88

9-
# Get CAT Information
9+
# Get Token Information
1010

1111
This endpoint allows you to fetch detailed information about a specific CAT (Chia Asset Token).
1212

@@ -15,25 +15,28 @@ This endpoint allows you to fetch detailed information about a specific CAT (Chi
1515
<Tabs>
1616
<TabItem value="mainnet" label="Mainnet">
1717

18-
```
19-
GET https://api.spacescan.io/cat/info/{asset_id}
18+
```bash
19+
GET https://api.spacescan.io/token/info/{token_id}
2020
```
2121

2222
</TabItem>
2323
<TabItem value="testnet" label="Testnet">
2424

25-
```
26-
GET https://api-testnet11.spacescan.io/cat/info/{asset_id}
25+
```bash
26+
GET https://api-testnet11.spacescan.io/token/info/{token_id}
2727
```
2828

2929
</TabItem>
3030
</Tabs>
3131

3232
### Parameters
3333

34-
| Parameter | Type | Description |
35-
|-----------|--------|-------------------------------------------------|
36-
| asset_id | string | The unique identifier of the CAT |
34+
| Parameter | Type | Required | Default | Description |
35+
|-----------|------|----------|---------|-------------|
36+
| token_id | string | Yes | - | The unique identifier of the CAT |
37+
| include_price | boolean | No | false | Include price information |
38+
| include_supply | boolean | No | false | Include supply information |
39+
| currency | string | No | USD | Currency for price conversion |
3740

3841
:::info Free API
3942
Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacescan.io/apis#plans) for rate limits and features.
@@ -43,7 +46,7 @@ Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacesc
4346
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.
4447

4548
```bash
46-
curl -X GET "https://pro-api.spacescan.io/cat/info/{asset_id}" \
49+
curl -X GET "https://pro-api.spacescan.io/token/info/{token_id}?include_price=true&include_supply=true" \
4750
-H "x-api-key: YOUR_API_KEY"
4851
```
4952
:::
@@ -52,111 +55,122 @@ curl -X GET "https://pro-api.spacescan.io/cat/info/{asset_id}" \
5255

5356
<Tabs>
5457
<TabItem value="mainnet" label="Mainnet">
55-
<a href="https://api.spacescan.io/cat/info/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589" target="_blank" rel="noopener noreferrer" className="api-test-button">
58+
<a href="https://api.spacescan.io/token/info/14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495" target="_blank" rel="noopener noreferrer" className="api-test-button">
5659
🚀 Test API in Browser
5760
</a>
5861
</TabItem>
5962
<TabItem value="testnet" label="Testnet">
60-
<a href="https://api-testnet11.spacescan.io/cat/info/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589" target="_blank" rel="noopener noreferrer" className="api-test-button">
63+
<a href="https://api-testnet11.spacescan.io/token/info/14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495" target="_blank" rel="noopener noreferrer" className="api-test-button">
6164
🚀 Test API in Browser
6265
</a>
6366
</TabItem>
6467
</Tabs>
6568

66-
### Request Example
69+
### Request Examples
6770

6871
<Tabs>
6972
<TabItem value="curl" label="cURL">
7073
<Tabs>
7174
<TabItem value="mainnet" label="Mainnet">
72-
<CodeBlock language="bash">
73-
curl -X GET "https://api.spacescan.io/cat/info/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589"
74-
</CodeBlock>
75-
</TabItem>
76-
<TabItem value="testnet" label="Testnet">
77-
<CodeBlock language="bash">
78-
curl -X GET "https://api-testnet11.spacescan.io/cat/info/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589"
79-
</CodeBlock>
75+
76+
```bash
77+
# Basic info
78+
curl -X GET "https://api.spacescan.io/token/info/14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495"
79+
80+
# With price and supply info
81+
curl -X GET "https://api.spacescan.io/token/info/14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495?include_price=true&include_supply=true&currency=USD"
82+
```
83+
8084
</TabItem>
8185
</Tabs>
8286
</TabItem>
8387
<TabItem value="python" label="Python">
84-
<Tabs>
85-
<TabItem value="mainnet" label="Mainnet">
86-
<CodeBlock language="python">
87-
import requests
8888

89-
asset_id = "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589"
90-
url = f"https://api.spacescan.io/cat/info/{asset_id}"
89+
```python
90+
import requests
9191

92-
response = requests.get(url)
93-
data = response.json()
94-
print(data)
95-
</CodeBlock>
96-
</TabItem>
97-
<TabItem value="testnet" label="Testnet">
98-
<CodeBlock language="python">
99-
import requests
92+
token_id = "14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495"
93+
params = {
94+
"include_price": "true",
95+
"include_supply": "true",
96+
"currency": "USD"
97+
}
10098

101-
asset_id = "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589"
102-
url = f"https://api-testnet11.spacescan.io/cat/info/{asset_id}"
99+
url = f"https://api.spacescan.io/token/info/{token_id}"
100+
response = requests.get(url, params=params)
101+
data = response.json()
102+
print(data)
103+
```
103104

104-
response = requests.get(url)
105-
data = response.json()
106-
print(data)
107-
</CodeBlock>
108-
</TabItem>
109-
</Tabs>
110105
</TabItem>
111106
<TabItem value="javascript" label="JavaScript">
112-
<Tabs>
113-
<TabItem value="mainnet" label="Mainnet">
114-
<CodeBlock language="javascript">
115-
const assetId = "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589";
116-
const url = `https://api.spacescan.io/cat/info/${assetId}`;
117-
118-
fetch(url)
119-
.then(response => response.json())
120-
.then(data => console.log(data))
121-
.catch(error => console.error('Error:', error));
122-
</CodeBlock>
123-
</TabItem>
124-
<TabItem value="testnet" label="Testnet">
125-
<CodeBlock language="javascript">
126-
const assetId = "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589";
127-
const url = `https://api-testnet11.spacescan.io/cat/info/${assetId}`;
128-
129-
fetch(url)
130-
.then(response => response.json())
131-
.then(data => console.log(data))
132-
.catch(error => console.error('Error:', error));
133-
</CodeBlock>
134-
</TabItem>
135-
</Tabs>
136-
</TabItem>
137-
</Tabs>
138107

139-
### Response
108+
```javascript
109+
const tokenId = "14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495";
110+
const url = `https://api.spacescan.io/token/info/${tokenId}?include_price=true&include_supply=true&currency=USD`;
111+
112+
fetch(url)
113+
.then(response => response.json())
114+
.then(data => console.log(data))
115+
.catch(error => console.error('Error:', error));
116+
```
140117

141-
<Tabs>
142-
<TabItem value="mainnet" label="Mainnet">
143-
<ApiCallExample endpoint="https://api.spacescan.io/cat/info/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589" />
144-
</TabItem>
145-
<TabItem value="testnet" label="Testnet">
146-
<ApiCallExample endpoint="https://api-testnet11.spacescan.io/cat/info/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589" />
147118
</TabItem>
148119
</Tabs>
149120

150121
### Response Schema
151122

152-
| Field | Type | Description |
153-
|------------------|---------|-------------------------------------------------------|
154-
| status | string | The status of the API request |
155-
| cat | object | Detailed information about the CAT |
156-
| cat.asset_id | string | The unique identifier of the CAT |
157-
| cat.name | string | The name of the CAT |
158-
| cat.symbol | string | The symbol/ticker of the CAT |
159-
| cat.total_supply | string | The total supply of the CAT |
160-
| cat.description | string | Description of the CAT |
161-
| cat.website_url | string | Official website URL |
162-
| cat.logo_url | string | URL of the CAT's logo |
123+
| Field | Type | Description |
124+
|-------|------|-------------|
125+
| status | string | Success or failure status |
126+
| info | object | Basic token information |
127+
| info.asset_id | string | The unique identifier of the CAT |
128+
| info.token_id | string | Token ID in tkn format |
129+
| info.name | string | The name of the CAT |
130+
| info.description | string | Description of the CAT |
131+
| info.symbol | string | Trading symbol of the CAT |
132+
| info.preview_url | string | URL to the CAT's logo image |
133+
| info.tags | string | Category tags |
134+
| info.twitter | string | Twitter profile URL (null if not set) |
135+
| info.discord | string | Discord server URL (null if not set) |
136+
| info.website | string | Official website URL (null if not set) |
137+
| info.type | string | Token type (e.g., "CAT2") |
138+
| price | object | Price information (if requested) |
139+
| price.price_[currency] | number | Price in specified currency |
140+
| price.price_xch | number | Price in XCH |
141+
| supply | object | Supply information (if requested) |
142+
| supply.total_supply | number | Total token supply |
143+
| supply.burned | number | Number of tokens burned |
144+
| supply.melted | number | Number of tokens melted |
145+
| supply.circulating_supply | number | Current circulating supply |
146+
147+
### Example Response
148+
149+
```json
150+
{
151+
"status": "success",
152+
"info": {
153+
"asset_id": "14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495",
154+
"token_id": "tkn1zj6qjckla7qaj49vpkft28kzrnn6ekxx9hvla7fs82j3cc2ukj2ssa84km",
155+
"name": "LLC Burn Token",
156+
"description": "LLC Burn Token can only be acquired by burning a Little Lambo Coin...",
157+
"symbol": "LLBT",
158+
"preview_url": "https://assets.spacescan.io/cat/f5cd9dccc98c1fd4f32b599324b6dd938c793c0e50af7581195aee603277bad8.webp",
159+
"tags": "meme",
160+
"twitter": "https://twitter.com/LittleLamboCoin",
161+
"discord": "https://discord.gg/Ew96DzCxc7",
162+
"website": "https://littlelambocoin.com/llc-burn-token",
163+
"type": "CAT2"
164+
},
165+
"price": {
166+
"price_usd": 0.02624364935709997,
167+
"price_xch": 0.001225206519248
168+
},
169+
"supply": {
170+
"total_supply": 1000000000,
171+
"burned": 1,
172+
"melted": 0,
173+
"circulating_supply": 999999999
174+
}
175+
}
176+
```

0 commit comments

Comments
 (0)