AAA State Gas Prices
https://api.sandbase.ai/v1/api/aaa/state-gas-pricesReturns current average gas prices for all 50 US states plus DC across all four fuel grades (Regular, Mid-Grade, Premium, Diesel). States are listed in alphabetical order by full state name.
- Giá
- $0.01USD / lượt gọi
- Phương thức
- POST
- Phản hồi
- JSON bất đồng bộ
- Tham số
- 0 bắt buộc · 0 tùy chọn
Phòng thử nghiệm
Đầu ra của bạn sẽ xuất hiện ở đây
Hoàn tất đầu vào, rồi nhấp Run.
README API
AAA State Gas Prices
Returns the current average cost of gas for each US state and DC, based on AAA data. Each row covers Regular, Mid-Grade, Premium and Diesel. The request takes no input.
Use cases
- Compare Regular gas costs between states to find the cheapest and most expensive places to fill up.
- Estimate fuel costs for a road trip that crosses several states.
- Build a state-by-state fuel cost table or map for a dashboard.
- Track the gap between
dieselandregularin each state for fleet planning.
Request
curl -X POST "https://api.sandbase.ai/v1/api/aaa/state-gas-prices" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
The result is returned in outputs[0].data.
Example response
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"states": [
{
"diesel": 5.8537,
"mid_grade": 4.1781,
"premium": 4.5882,
"regular": 3.73,
"state": "Alabama"
}
]
},
"status": "success"
}
Response fields
| Field | Meaning |
|---|---|
data.states[] | One entry per state. The list is in alphabetical order by full state name. |
data.states[].state | Full name of the state, for example Alabama. |
data.states[].regular | Average cost of Regular gas in that state. |
data.states[].mid_grade | Average cost of Mid-Grade gas in that state. |
data.states[].premium | Average cost of Premium gas in that state. |
data.states[].diesel | Average cost of diesel in that state. |
status | Shows success when the call worked. |
Notes
- Send an empty JSON object
{}as the request body. There are no parameters. - Fuel values are plain numbers, such as
3.73or5.8537. - For the US-wide average, call AAA National Average.
Pricing
$0.01 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Bắt đầu xây dựng
Gửi request đầu tiên của bạn
Endpoint API của nền tảng với xác thực và theo dõi mức sử dụng thống nhất.
curl -X POST "https://api.sandbase.ai/v1/api/aaa/state-gas-prices" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'2. Xác thực
Đặt SandBase API key của bạn trong môi trường máy chủ. Các request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key của bạn trên máy chủ. Không hiển thị trong mã chạy trên trình duyệt.
3. Tham số
Chưa có schema tham số nào được công bố cho API này.
4. Phản hồi
Đây là phản hồi ví dụ đã lưu cho API này; không có request thực nào được gửi khi xem mục này.
Chưa có phản hồi đã lưu nào được công bố. Chạy API trong Playground để xem phản hồi.
Khám phá thêm
APIs liên quan
| API | Giá | Phản hồi |
|---|---|---|
AAA State Gas PricesAPI này AAA | $0.01 mỗi lần gọi | JSON bất đồng bộ |
AAA | $0.01 mỗi lần gọi | JSON bất đồng bộ |
AAA | $0.01 mỗi lần gọi | JSON bất đồng bộ |
AAA | $0.01 mỗi lần gọi | JSON bất đồng bộ |
AAA | $0.01 mỗi lần gọi | JSON bất đồng bộ |
AAA | $0.01 mỗi lần gọi | JSON bất đồng bộ |
Câu hỏi
FAQ
Làm thế nào để dùng API AAA State Gas Prices?
Gửi yêu cầu POST đến https://api.sandbase.ai/v1/api/aaa/state-gas-prices với khóa API SandBase của bạn trong tiêu đề Authorization (Bearer) và các tham số trong phần thân JSON. Bạn cũng có thể thử trực tiếp trong Playground trên trang này mà không cần viết code.
API AAA State Gas Prices có giá bao nhiêu?
$0.01 mỗi lần gọi, được tính từ số dư SandBase của bạn. Bạn chỉ bị tính phí cho các lần gọi bạn thực hiện; không có gói đăng ký.
API AAA State Gas Prices chấp nhận những tham số nào?
AAA State Gas Prices không nhận tham số đầu vào; hãy gửi một phần thân JSON rỗng.
API AAA State Gas Prices trả về gì?
Kết quả JSON. Endpoint này chạy bất đồng bộ, nên phản hồi sẽ cho bạn biết cách lấy kết quả hoàn tất. README trên trang này có ví dụ phản hồi.
Tôi có cần tài khoản nhà phát triển hoặc API key của AAA không?
Không. AAA State Gas Prices chạy thông qua SandBase, nên chỉ cần một API key SandBase là đủ cho endpoint này và mọi API cùng model khác trong danh mục. Bạn không cần đăng ký riêng để có quyền truy cập API của AAA.
