apiverve / gasprices
Gas Prices returns average retail gasoline, diesel and LPG prices from official weekly government surveys for the US, the UK, all 27 EU countries and the EU average. Pass a country, or a US state, region or city, to get the latest week with week-over-week and year-over-year changes, in any currency,
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Gas Prices returns average retail gasoline, diesel and LPG prices from official weekly government surveys for the US, the UK, all 27 EU countries and the EU average. Pass a country, or a US state, region or city, to get the latest week with week-over-week and year-over-year changes, in any currency, per liter or per gallon.
The Gas Prices API provides a simple, reliable way to integrate gas prices functionality into your applications. Built for developers who need production-ready gas prices capabilities without the complexity of building from scratch.
Quick Start
Using JavaScript
async function callGasPricesAPI() { try { const params = new URLSearchParams({ country: 'US', area: 'CA', unit: 'liter' }); const response = await fetch(`https://api.apiverve.com/v1/gasprices?${params}`, { method: 'GET', headers: { 'x-api-key': 'YOUR_API_KEY_HERE' } }); const data = await response.json(); console.log(data); } catch (error) { console.error('Error:', error); } } callGasPricesAPI();
Using cURL
curl -X GET "https://api.apiverve.com/v1/gasprices?country=US&area=CA&unit=liter" \ -H "x-api-key: YOUR_API_KEY_HERE"
Get your API key: https://apiverve.com
📁 For more examples, see the examples folder
Installation
Choose your preferred programming language:
📦 NPM (JavaScript/Node.js)
npm install @apiverve/gasprices
View NPM Package → | Package Code →
🔷 NuGet (.NET/C#)
dotnet add package APIVerve.API.GasPrices
View NuGet Package → | Package Code →
🐍 Python (PyPI)
pip install apiverve-gasprices
View PyPI Package → | Package Code →
💎 Ruby (RubyGems)
gem install apiverve_gasprices
View RubyGems Package → | Package Code →
🐘 PHP (Packagist)
composer require apiverve/gasprices
View Packagist Package → | Package Code →
🎯 Dart (pub.dev)
dart pub add apiverve_gasprices
View pub.dev Package → | Package Code →
🤖 Android (JitPack)
implementation 'com.github.apiverve:gasprices-api:1.0.0'
🐹 Go
go get github.com/apiverve/gasprices-api/go
Why Use This API?
| Feature | Benefit |
|---|---|
| Multi-language SDKs | Native packages for JavaScript, Python, C#, Go, and Android |
| Simple Integration | Single API key authentication, consistent response format |
| Production Ready | 99.9% uptime SLA, served from 24 global regions |
| Comprehensive Docs | Full examples, OpenAPI spec, and dedicated support |
Documentation
- 🏠 API Home: Gas Prices API
- 📚 API Reference: docs.apiverve.com/ref/gasprices
- 📖 OpenAPI Spec: openapi.yaml
- 💡 Examples: examples/
What Can You Build?
The Gas Prices API is commonly used for:
- Web Applications - Add gas prices features to your frontend or backend
- Mobile Apps - Native SDKs for Android development
- Automation - Integrate with n8n, Zapier, or custom workflows
- SaaS Products - Enhance your product with gas prices capabilities
- Data Pipelines - Process and analyze data at scale
API Reference
Authentication
All requests require an API key in the header:
x-api-key: YOUR_API_KEY_HERE
Get your API key: https://apiverve.com
Response Format
Every APIVerve endpoint returns the same envelope — check status, then read data:
{
"status": "ok",
"error": null,
"data": { ... }
}
Example Response
A real response from the Gas Prices API:
{
"status": "ok",
"error": null,
"data": {
"country": "US",
"countryName": "United States",
"area": "US",
"areaName": "United States",
"areaType": "national",
"week": "2026-09-28",
"currency": "USD",
"unit": "gallon",
"prices": {
"regular": 4.465,
"midgrade": 5.073,
"premium": 5.482,
"diesel": 6.382,
"allGrades": 4.603,
"lpg": null
},
"changeDirection": "down",
"previousWeek": "2026-09-21",
"weeklyChange": {
"regular": -0.013,
"midgrade": 0.012,
"premium": 0.022,
"diesel": -0.147,
"allGrades": -0.007,
"lpg": null
},
"yearAgoWeek": "2025-09-29",
"yearlyChange": {
"regular": 1.347,
"midgrade": 1.366,
"premium": 1.415,
"diesel": 2.628,
"allGrades": 1.355,
"lpg": null
},
"nativeCurrency": "USD",
"nativeUnit": "gallon",
"exchangeRate": 1
}
}
Support & Community
- 🏠 API Home: Gas Prices API
- 💬 Support: https://apiverve.com/contact
- 🐛 Issues: GitHub Issues
- 📖 Documentation: https://docs.apiverve.com
- 🌐 Website: https://apiverve.com
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Security
For security concerns, please review our Security Policy.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Built with ❤️ by APIVerve
Copyright © 2026 APIVerve. All rights reserved.