state_codestringwymagane
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.
Twój wynik pojawi się tutaj
Uzupełnij dane wejściowe, a następnie kliknij Uruchom.
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.
Zacznij tworzyć
Punkt końcowy API platformy z jednolitym uwierzytelnianiem i śledzeniem użycia.
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"
}'Ustaw klucz API SandBase w środowisku serwera. Żądania używają uwierzytelniania Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Przechowuj klucz na serwerze. Nie ujawniaj go w kodzie przeglądarkowym.
state_codestringwymaganeTwo-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
Zapisany przykładowy response dla tego API; podczas wyświetlania nie jest wykonywane żadne żądanie na żywo.
Nie opublikowano zapisanego response. Uruchom API w Playground, aby sprawdzić jego odpowiedź.
Odkryj więcej
| API | Cena | Odpowiedź |
|---|---|---|
AAA State Price DetailsTo API AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
Pytania
Wyślij żądanie POST do https://api.sandbase.ai/v1/api/aaa/state-price-details z kluczem API SandBase w nagłówku Authorization (Bearer) oraz parametrami w treści JSON. Możesz też wypróbować je w Playground na tej stronie bez pisania kodu.
$0.01 za wywołanie, rozliczane z salda SandBase. Płacisz tylko za wykonane wywołania; nie ma subskrypcji.
Wymagane: state_code (string). Tabela Parameters oraz Playground na tej stronie zawierają wszystkie pola.
Wynik JSON. Ten endpoint działa asynchronicznie, więc odpowiedź informuje, jak pobrać gotowy wynik. README na tej stronie zawiera przykładową odpowiedź.
Nie. AAA State Price Details działa przez SandBase, więc jeden klucz API SandBase obejmuje ten endpoint i każde inne API oraz model w katalogu. Nie musisz osobno ubiegać się o dostęp do API AAA.