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.
Ваш результат появится здесь
Заполните входные данные, затем нажмите «Запустить».
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.
Начните разработку
Конечная точка платформенного 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 в окружении сервера. Запросы используют аутентификацию Bearer.
export SANDBASE_API_KEY="YOUR_API_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 DetailsЭтот 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 |
Вопросы
Отправьте POST-запрос на https://api.sandbase.ai/v1/api/aaa/state-price-details, указав ключ SandBase API в заголовке Authorization (Bearer), а параметры — в теле JSON. Вы также можете попробовать это в Playground на этой странице без написания кода.
$0.01 за вызов, списывается с баланса SandBase. Оплата взимается только за сделанные вызовы; подписка не требуется.
Обязательные: state_code (string). В таблице Parameters и в Playground на этой странице перечислены все поля.
JSON-результат. Этот endpoint работает асинхронно, поэтому ответ подсказывает, как получить готовый результат. В README на этой странице приведен пример ответа.
Нет. AAA State Price Details работает через SandBase, поэтому один API key SandBase покрывает этот endpoint и все остальные API и модели в каталоге. Вам не нужно отдельно запрашивать доступ к API AAA.