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.
- 料金
- $0.01USD / 回
- メソッド
- POST
- レスポンス
- 非同期 JSON
- パラメータ
- 必須 0 件 · 任意 0 件
プレイグラウンド
出力はここに表示されます
入力を完了してから[実行]をクリックしてください。
API README
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.
開発を始める
最初のリクエストを送信
統一認証と使用状況の追跡を備えたプラットフォームAPIエンドポイントです。
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. 認証
SandBaseのAPIキーをサーバー環境に設定してください。リクエストはBearer認証を使用します。
export SANDBASE_API_KEY="YOUR_API_KEY"キーはサーバー側で管理してください。ブラウザコードに公開しないでください。
3. パラメータ
このAPIのパラメータスキーマは公開されていません。
4. レスポンス
このAPIの保存済みサンプルレスポンスです。表示時にライブリクエストは行われません。
保存済みレスポンスはまだ公開されていません。PlaygroundでAPIを実行し、レスポンスを確認してください。
さらに探索
関連 APIs
| API | 価格 | レスポンス |
|---|---|---|
AAA State Gas Pricesこの API AAA | $0.01 / 回 | 非同期 JSON |
AAA | $0.01 / 回 | 非同期 JSON |
AAA | $0.01 / 回 | 非同期 JSON |
AAA | $0.01 / 回 | 非同期 JSON |
AAA | $0.01 / 回 | 非同期 JSON |
AAA | $0.01 / 回 | 非同期 JSON |
質問
FAQ
AAA State Gas Prices API はどのように使いますか?
Authorization ヘッダー(Bearer)に SandBase API key を指定し、パラメータを JSON ボディで送信して https://api.sandbase.ai/v1/api/aaa/state-gas-prices に POST リクエストを送ります。このページの Playground で、コードを書かずに試すこともできます。
AAA State Gas Prices API の料金はいくらですか?
1回あたり $0.01、SandBase 残高から課金されます。課金対象はご利用分のみで、サブスクリプションはありません。
AAA State Gas Prices API はどのパラメータを受け付けますか?
AAA State Gas Prices は入力パラメータを取りません。空の JSON ボディを送信してください。
AAA State Gas Prices API は何を返しますか?
JSON 結果です。このエンドポイントは非同期で実行されるため、レスポンスには完了した結果の取得方法が含まれます。 このページの README にサンプルレスポンスがあります。
AAA の開発者アカウントまたは API key は必要ですか?
いいえ。AAA State Gas Prices は SandBase 経由で動作するため、SandBase の API key 1つでこのエンドポイントと、カタログ内の他のすべての API とモデルを利用できます。AAA の API アクセスを別途申請する必要はありません。
