---
title: "GasBuddy API: gas stations as JSON | Perceptlayer"
description: "GasBuddy API for gas stations by ZIP code or coordinates, with cash and credit prices, ratings, amenities and trends as JSON. 1 credit per successful call."
url: https://perceptlayer.com/apis/gasbuddy
---

[APIs](https://perceptlayer.com/apis) / [Cars](https://perceptlayer.com/verticals/cars) / GasBuddy

1 credit per call 2 endpoints 7 datapoints 

# GasBuddy API

GasBuddy API for gas stations by ZIP code or coordinates, with cash and credit prices, ratings, amenities and trends as JSON. 1 credit per successful call.

[Get a free API key](https://perceptlayer.com/signup) Run it below

GasBuddy

GET /v1/gasbuddy/stations?search=85396&fuel=1 

```
{
  "success": true,
  "data": {
    "countryCode": "US",
    "country_code": "US",
    "displayName": "85396",
    "display_name": "85396",
    "latitude": 33.526973087714,
    "longitude": -112.650762301472,
    "regionCode": "AZ",
    "region_code": "AZ",
    "stations": {
      "count": 2,
      "cursor": {
        "next": "1"
      },
      "results": [
        {
          "id": "187725",
          "name": "Shell",
          "fuels": [
            "regular_gas",
            "midgrade_gas",
            "premium_gas"
          ],
          "priceUnit": "dollars_per_gallon",
          "price_unit": "dollars_per_gallon",
          "currency": "USD",
          "latitude": 33.465405037595,
          "longitude": -112.505053281784,
          "starRating": 4.5,
          "star_rating": 4.5,
          "ratingsCount": 235,
          "ratings_count": 235,
          "address": {
            "line1": "1520 N Verrado Way",
            "locality": "Buckeye",
            "region": "AZ",
            "postalCode": "85396",
            "postal_code": "85396",
            "country": "US"
          },
          "brands": [
            "…"
          ],
          "prices": [
            "…"
          ]
        },
        {
          "id": "95678",
          "name": "Shell",
          "fuels": [
            "regular_gas",
            "midgrade_gas",
            "premium_gas"
          ],
          "priceUnit": "dollars_per_gallon",
          "price_unit": "dollars_per_gallon",
          "currency": "USD",
          "latitude": 33.661230491569,
          "longitude": -112.615829184651,
          "starRating": 4.6,
          "star_rating": 4.6,
          "ratingsCount": 243,
          "ratings_count": 243,
          "address": {
            "line1": "19491 N Canyon Springs Blvd",
            "locality": "Buckeye",
            "region": "AZ",
            "postalCode": "85396-2212",
            "postal_code": "85396-2212",
            "country": "US"
          },
          "brands": [
            "…"
          ],
          "prices": [
            "…"
          ]
        }
      ]
    },
    "trends": [
      {
        "areaName": "Arizona",
        "area_name": "Arizona",
        "country": "US",
        "today": 3.97,
        "todayLow": 3.11,
        "today_low": 3.11,
        "trend": 0
      },
      {
        "areaName": "United States",
        "area_name": "United States",
        "country": "US",
        "today": 3.75,
        "todayLow": 0,
        "today_low": 0,
        "trend": 0
      }
    ],
    "currency": "USD"
  },
  "meta": {
    "endpoint_family": "stations",
    "duration_ms": 1963,
    "request_id": "req_5acf55335dad4498958310d1642fbac9",
    "credits_charged": 1,
    "credits_remaining": 992
  }
}
```

200 OK JSON X-Credits-Used: 1

Recorded from our API and shortened.

Sample data

## What one call returns

A recorded run of `stations`: the fields and shapes you will get, shortened to 2 items.

| # | areaName string | area\_name string | country string | today number | todayLow number | today\_low number | trend integer |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | Arizona | Arizona | US | 3.97 | 3.11 | 3.11 | 0 |
| 2 | United States | United States | US | 3.75 | 0 | 0 | 0 |

Recorded from our API · 2 items shown · 7 datapoints per item GET /v1/gasbuddy/stations?search=85396&fuel=1

7 datapoints

### Location

-   areaName string
-   area\_name string
-   country string

### Other

-   today number
-   todayLow number
-   today\_low number
-   trend integer

Playground

## Run this API

cURL shell 

```
curl "https://api.perceptlayer.com/v1/gasbuddy/stations?search=85396&fuel=1" \
  -H "X-API-Key: $API_KEY"
```

GasBuddy · 2 endpoints

## Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

| Endpoint | Required parameters | Returns | Cost |
| --- | --- | --- | --- |
| [GET `/v1/gasbuddy/station`](https://perceptlayer.com/apis/gasbuddy/station) | `id` | `id` `name` `phone` `openStatus` `open_status` `enterprise` +17 more | 1 credit |
| [GET `/v1/gasbuddy/stations`](https://perceptlayer.com/apis/gasbuddy/stations) | none +7 optional | `countryCode` `country_code` `displayName` `display_name` `latitude` `longitude` +5 more | 1 credit |

Overview

## About the GasBuddy API

## What you can get

The GasBuddy API returns GasBuddy gas stations and fuel prices as JSON through 2 endpoints.

-   **Stations near a place:** `stations` takes a `search` (such as a ZIP code) or `lat` and `lng`, with `fuel` ( `1`, `2`, `3`, `4`, `5` or `12`), `brand_id`, `maxAge` and `cursor`.
-   **One station:** `station` takes a station `id`.

The recorded `stations` search for ZIP code 85396 with `fuel` `1` returns the place's `display_name`, `region_code` `AZ`, `latitude` and `longitude`, and `stations` with a `count` of 2. Each station has `id`, `name`, `fuels`, `address`, `star_rating`, `ratings_count`, `price_unit`, `brands` and `prices`. `trends` gives today's average and low price for the area: `today` was `3.97` in Arizona and `3.75` across the United States.

## How a call works

Search an area, then read a station: `GET /v1/gasbuddy/stations?search=85396&fuel=1`, with your key in the `X-API-Key` header, returns each station's `id`. Pass that to `station`, for example `GET /v1/gasbuddy/station?id=205033`, which returned a Sunoco with `open_status` `open`, a `star_rating` of 4.4 from 99 ratings, `amenities` such as `Pay At Pump`, and `prices` per fuel, each with a `cash` and `credit` price and its `posted_time`. Regular was `3.93` cash and `4.03` credit. Pass `cursor` to get the next set of stations. Every successful call costs 1 credit; failed calls cost nothing.

Cars JSON REST MCP

### More cars APIs

[Agriaffaires](https://perceptlayer.com/apis/agriaffaires) [Aramisauto](https://perceptlayer.com/apis/aramisauto) [Autohero](https://perceptlayer.com/apis/autohero) [Autoline](https://perceptlayer.com/apis/autoline) [AutoScout24](https://perceptlayer.com/apis/autoscout24) [AutoTempest](https://perceptlayer.com/apis/autotempest) [AutoTrack.nl](https://perceptlayer.com/apis/autotrack-nl) [Autotrader](https://perceptlayer.com/apis/autotrader) [AutoTrader UK](https://perceptlayer.com/apis/autotrader-uk) [AutoTrader.ca](https://perceptlayer.com/apis/autotrader-ca) [AutoUncle](https://perceptlayer.com/apis/autouncle) [Autovit](https://perceptlayer.com/apis/autovit)

Use cases

### Find the cheapest station near a ZIP code or a fleet vehicle's position

`Use the GasBuddy API to find the cheapest station near a ZIP code or a fleet vehicle's position` 

### Compare cash and credit prices at a station

`Use the GasBuddy API to compare cash and credit prices at a station` 

### Track the state and national average with \`trends\`

`` Use the GasBuddy API to track the state and national average with `trends` `` 

### Filter stations by brand with \`brand\_id\`

`` Use the GasBuddy API to filter stations by brand with `brand_id` `` 

FAQ

## Questions

**How much does the GasBuddy API cost?**

Each successful call costs one credit, whichever endpoint you call, and each set of stations is one call. New accounts get free credits to start, and credit packs bring the price down as you scale.

**How fresh are the prices?**

Each price carries its \`posted\_time\`, so you can see when it was last reported. \`stations\` also takes a \`maxAge\`.

**Can I search by coordinates instead of a ZIP code?**

Yes. Pass \`lat\` and \`lng\` in place of \`search\`.

**What format are responses in?**

Every endpoint returns JSON, with no HTML parsing on your side.

**Is this the official GasBuddy API?**

No. Perceptlayer is an independent service and is not affiliated with GasBuddy. It returns GasBuddy data as JSON with a Perceptlayer key, so there is no GasBuddy developer account, app review or partner approval to get first. It only reads data: if GasBuddy has an official API and you need to act on your own GasBuddy account, such as posting, managing orders or reading private data, use that one.

**Should I build a GasBuddy scraper instead?**

You can, but a GasBuddy scraper is code you maintain: page changes break it, requests get blocked, and GasBuddy's terms govern how you collect data. The GasBuddy API gives you 2 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.

## Try the GasBuddy API with 100 free credits

No credit card. Failed calls are never billed.

[Get a free API key](https://perceptlayer.com/signup) [Read the docs](https://docs.perceptlayer.com)
