idstringจำเป็น
Asset platform's ID. *refers to [`/asset_platforms`](/reference/asset-platforms-list)
ค่าเริ่มต้น: "ethereum"
https://api.sandbase.ai/v1/api/coingecko/simple-token-priceGet one or more token prices using their token contract addresses
เอาต์พุตของคุณจะแสดงที่นี่
กรอกอินพุตให้ครบ แล้วคลิก Run
Get one or more token prices using their token contract addresses
The response is the official CoinGecko API response, unchanged.
curl -X POST "https://api.sandbase.ai/v1/api/coingecko/simple-token-price" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "ethereum", "contract_addresses": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "vs_currencies": "usd"}'
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Asset platform's ID. *refers to /asset_platforms |
contract_addresses | string | Yes | Token contract addresses, comma-separated if querying more than 1 token |
include_24hr_change | boolean | No | Include 24-hour change percentage. Default: false |
include_24hr_vol | boolean | No | Include 24-hour trading volume. Default: false |
include_last_updated_at | boolean | No | Include last updated price time as a UNIX timestamp. Default: false |
include_market_cap | boolean | No | Include market capitalization. Default: false |
precision | string | No | Decimal places for currency price value |
vs_currencies | string | Yes | Target currency of coins, comma-separated if querying more than 1 currency. *refers to [/simple/supported_vs_currencies](/reference/simple-supported-currencie |
Flat price per call. Failed calls are not charged.
เริ่มสร้าง
เอ็นด์พอยต์ของ Platform API ที่มีการยืนยันตัวตนและการติดตามการใช้งานแบบรวมศูนย์
curl -X POST "https://api.sandbase.ai/v1/api/coingecko/simple-token-price" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "ethereum",
"vs_currencies": "usd",
"contract_addresses": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}'ตั้งค่า SandBase API key ของคุณในสภาพแวดล้อมฝั่งเซิร์ฟเวอร์ คำขอจะใช้การยืนยันตัวตนแบบ Bearer
export SANDBASE_API_KEY="YOUR_API_KEY"เก็บ key ไว้บนเซิร์ฟเวอร์ อย่าเปิดเผยในโค้ดฝั่งเบราว์เซอร์
idstringจำเป็นAsset platform's ID. *refers to [`/asset_platforms`](/reference/asset-platforms-list)
ค่าเริ่มต้น: "ethereum"
contract_addressesstringจำเป็นToken contract addresses, comma-separated if querying more than 1 token
ค่าเริ่มต้น: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
vs_currenciesstringจำเป็นTarget currency of coins, comma-separated if querying more than 1 currency. *refers to [`/simple/supported_vs_currencies`](/reference/simple-supported-currencies)
ค่าเริ่มต้น: "usd"
include_24hr_changebooleanInclude 24-hour change percentage. Default: false
include_24hr_volbooleanInclude 24-hour trading volume. Default: false
include_last_updated_atbooleanInclude last updated price time as a UNIX timestamp. Default: false
include_market_capbooleanInclude market capitalization. Default: false
precisionstringDecimal places for currency price value
ค่าที่เป็นไปได้: full, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
บันทึกตัวอย่างการตอบกลับสำหรับ API นี้; จะไม่มีการส่งคำขอจริงเมื่อเปิดดู
ยังไม่มีการเผยแพร่การตอบกลับที่บันทึกไว้ ให้รัน API ใน Playground เพื่อดูการตอบกลับ
สำรวจเพิ่มเติม
| API | ราคา | การตอบกลับ |
|---|---|---|
CoinGecko | $0.008 ต่อการเรียก | JSON |
CoinGecko | $0.008 ต่อการเรียก | JSON |
CoinGecko | $0.008 ต่อการเรียก | JSON |
CoinGecko | $0.008 ต่อการเรียก | JSON |
CoinGecko | $0.008 ต่อการเรียก | JSON |
CoinGecko | $0.008 ต่อการเรียก | JSON |
คำถาม
ส่งคำขอ POST ไปที่ https://api.sandbase.ai/v1/api/coingecko/simple-token-price โดยใส่ SandBase API key ของคุณใน Authorization header (Bearer) และส่งพารามิเตอร์เป็น JSON body คุณยังสามารถลองใช้ได้ใน Playground บนหน้านี้โดยไม่ต้องเขียนโค้ด
$0.008 ต่อครั้ง คิดจากยอดคงเหลือ SandBase ของคุณ คุณจะถูกเรียกเก็บเฉพาะคำขอที่คุณส่งเท่านั้น ไม่มีค่าสมาชิกรายเดือน
ที่ต้องระบุ: id (string), contract_addresses (string) และ vs_currencies (string). ตัวเลือก: include_24hr_change (boolean), include_24hr_vol (boolean), include_last_updated_at (boolean), include_market_cap (boolean) และ precision (หนึ่งใน full, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18). ตาราง Parameters และ Playground ในหน้านี้แสดงทุกฟิลด์
การตอบกลับ JSON ที่ส่งกลับในคำขอ HTTP เดียวกัน (แบบซิงโครนัส)
ไม่จำเป็น CoinGecko Coin Price by Token Addresses ทำงานผ่าน SandBase ดังนั้น SandBase API key เดียวครอบคลุม endpoint นี้และทุก API กับโมเดลอื่นในแค็ตตาล็อก คุณไม่ต้องสมัครขอสิทธิ์เข้าถึง CoinGecko API แยกต่างหาก