state_codestringจำเป็น
Two-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
https://api.sandbase.ai/v1/api/aaa/state-price-detailsReturns detailed gas price data for a specific state including current prices for all fuel grades, historical averages (yesterday, week ago, month ago, year ago), and all-time highest recorded prices with their dates.
เอาต์พุตของคุณจะแสดงที่นี่
กรอกอินพุตให้ครบ แล้วคลิก Run
Returns AAA gas prices for one US state. Each fuel grade has a current price and past prices from yesterday, a week ago, a month ago and a year ago, plus the highest recorded price with its date. Send a two-letter state_code.
curl -X POST "https://api.sandbase.ai/v1/api/aaa/state-price-details" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"state_code": "WA"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
state_code | string | Yes | Two-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported. |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"highest_recorded": {
"Diesel": {
"date": "9/23/26",
"price": "7.4697"
},
"Regular Unleaded": {
"date": "5/20/26",
"price": "5.7887"
}
},
"prices": {
"Diesel": {
"current": 7.2512,
"month_ago": 7.3739,
"week_ago": 7.2642,
"year_ago": 4.9787,
"yesterday": 7.2685
},
"Mid-Grade": {
"current": 5.4442,
"month_ago": 5.7645,
"week_ago": 5.5587,
"year_ago": 4.5651,
"yesterday": 5.4577
},
"Premium": {
"current": 5.7146,
"month_ago": 6.0237,
"week_ago": 5.8074,
"year_ago": 4.8184,
"yesterday": 5.7243
},
"Regular": {
"current": 5.1925,
"month_ago": 5.4891,
"week_ago": 5.3047,
"year_ago": 4.2855,
"yesterday": 5.203
}
},
"state_code": "WA",
"state_name": "Washington"
},
"status": "success"
}
| Field | Meaning |
|---|---|
data.state_code / data.state_name | The two-letter code and full name of the state the prices describe. |
data.prices.Regular.current | Current price for Regular fuel in the state. Mid-Grade, Premium and Diesel use the same structure under data.prices. |
data.prices.Diesel.current | Current price for Diesel in the state. |
data.prices.Regular.yesterday / data.prices.Regular.week_ago / data.prices.Regular.month_ago / data.prices.Regular.year_ago | Regular price at each earlier point in time. The other grades have the same keys, so you can compare change over time. |
data.highest_recorded | Highest recorded price for each fuel grade, with the date it was recorded. Each entry holds a price string and a date string in M/D/YY format. |
data.highest_recorded.Diesel.price / date | Highest recorded Diesel price and the date it was recorded. |
status | Shows success when the call worked. |
state_code, such as WA. The description says all 50 states and DC are supported.data.prices are numbers. Prices under data.highest_recorded are strings.data.prices uses Regular, while data.highest_recorded labels the regular grade Regular Unleaded. Mid-Grade and Premium appear only under data.prices.$0.01 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
เริ่มสร้าง
เอ็นด์พอยต์ของ Platform API ที่มีการยืนยันตัวตนและการติดตามการใช้งานแบบรวมศูนย์
curl -X POST "https://api.sandbase.ai/v1/api/aaa/state-price-details" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"state_code": "WA"
}'ตั้งค่า SandBase API key ของคุณในสภาพแวดล้อมฝั่งเซิร์ฟเวอร์ คำขอจะใช้การยืนยันตัวตนแบบ Bearer
export SANDBASE_API_KEY="YOUR_API_KEY"เก็บ key ไว้บนเซิร์ฟเวอร์ อย่าเปิดเผยในโค้ดฝั่งเบราว์เซอร์
state_codestringจำเป็นTwo-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
บันทึกตัวอย่างการตอบกลับสำหรับ API นี้; จะไม่มีการส่งคำขอจริงเมื่อเปิดดู
ยังไม่มีการเผยแพร่การตอบกลับที่บันทึกไว้ ให้รัน API ใน Playground เพื่อดูการตอบกลับ
สำรวจเพิ่มเติม
| API | ราคา | การตอบกลับ |
|---|---|---|
AAA State Price DetailsAPI นี้ AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
คำถาม
ส่งคำขอ POST ไปที่ https://api.sandbase.ai/v1/api/aaa/state-price-details โดยใส่ SandBase API key ของคุณใน Authorization header (Bearer) และส่งพารามิเตอร์เป็น JSON body คุณยังสามารถลองใช้ได้ใน Playground บนหน้านี้โดยไม่ต้องเขียนโค้ด
$0.01 ต่อครั้ง คิดจากยอดคงเหลือ SandBase ของคุณ คุณจะถูกเรียกเก็บเฉพาะคำขอที่คุณส่งเท่านั้น ไม่มีค่าสมาชิกรายเดือน
ที่ต้องระบุ: state_code (string). ตาราง Parameters และ Playground ในหน้านี้แสดงทุกฟิลด์
ผลลัพธ์ JSON จุดเชื่อมต่อนี้ทำงานแบบอะซิงโครนัส ดังนั้นการตอบกลับจะบอกวิธีดึงผลลัพธ์ที่เสร็จแล้ว README บนหน้านี้มีตัวอย่างการตอบกลับ
ไม่จำเป็น AAA State Price Details ทำงานผ่าน SandBase ดังนั้น SandBase API key เดียวครอบคลุม endpoint นี้และทุก API กับโมเดลอื่นในแค็ตตาล็อก คุณไม่ต้องสมัครขอสิทธิ์เข้าถึง AAA API แยกต่างหาก