apiverve / tradebalance
Trade Balance provides monthly US international trade data - exports, imports, and the resulting goods-and-services trade balance (deficit or surplus) on a Balance of Payments basis. Each month comes with the previous month's balance, and paid plans add month-on-month and year-on-year changes, rolli
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Trade Balance provides monthly US international trade data - exports, imports, and the resulting goods-and-services trade balance (deficit or surplus) on a Balance of Payments basis. Each month comes with the previous month's balance, and paid plans add month-on-month and year-on-year changes, rolling 12-month totals and the last 12 months.
The Trade Balance API provides a simple, reliable way to integrate trade balance functionality into your applications. Built for developers who need production-ready trade balance capabilities without the complexity of building from scratch.
Quick Start
Using JavaScript
async function callTradeBalanceAPI() { try { const params = new URLSearchParams({ date: '2023-06', changes: true }); const response = await fetch(`https://api.apiverve.com/v1/tradebalance?${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); } } callTradeBalanceAPI();
Using cURL
curl -X GET "https://api.apiverve.com/v1/tradebalance?date=2023-06&changes=true" \ -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/tradebalance
View NPM Package → | Package Code →
🔷 NuGet (.NET/C#)
dotnet add package APIVerve.API.TradeBalance
View NuGet Package → | Package Code →
🐍 Python (PyPI)
pip install apiverve-tradebalance
View PyPI Package → | Package Code →
💎 Ruby (RubyGems)
gem install apiverve_tradebalance
View RubyGems Package → | Package Code →
🐘 PHP (Packagist)
composer require apiverve/tradebalance
View Packagist Package → | Package Code →
🎯 Dart (pub.dev)
dart pub add apiverve_tradebalance
View pub.dev Package → | Package Code →
🤖 Android (JitPack)
implementation 'com.github.apiverve:tradebalance-api:1.0.0'
🐹 Go
go get github.com/apiverve/tradebalance-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: Trade Balance API
- 📚 API Reference: docs.apiverve.com/ref/tradebalance
- 📖 OpenAPI Spec: openapi.yaml
- 💡 Examples: examples/
What Can You Build?
The Trade Balance API is commonly used for:
- Web Applications - Add trade balance 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 trade balance 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 Trade Balance API:
{
"status": "ok",
"error": null,
"data": {
"yearMonth": "2026-08",
"year": 2026,
"month": 8,
"exports": 315182,
"imports": 420754,
"balance": -105572,
"unit": "millions_usd",
"exportsFormatted": "$315.18 billion",
"importsFormatted": "$420.75 billion",
"balanceFormatted": "-$105.57 billion",
"tradeStatus": "deficit",
"updatedAt": "2026-10-28T03:39:54.665Z",
"previousYearMonth": "2026-07",
"previousBalance": -92826,
"exportsChange1m": 1.435,
"importsChange1m": 4.2632,
"balanceChange1m": -12746,
"exportsChange12m": 10.6908,
"importsChange12m": 22.1762,
"balanceChange12m": -45930,
"exports12m": 3697470,
"imports12m": 4491225,
"balance12m": -793756,
"history": [
{
"yearMonth": "2025-09",
"exports": 292352,
"imports": 351743,
"balance": -59392
},
{
"yearMonth": "2025-10",
"exports": 301158,
"imports": 338534,
"balance": -37376
},
{
"yearMonth": "2025-11",
"exports": 289504,
"imports": 353372,
"balance": -63868
},
{
"yearMonth": "2025-12",
"exports": 285282,
"imports": 361360,
"balance": -76078
},
{
"yearMonth": "2026-01",
"exports": 301271,
"imports": 353941,
"balance": -52670
},
{
"yearMonth": "2026-02",
"exports": 313628,
"imports": 366127,
"balance": -52500
},
{
"yearMonth": "2026-03",
"exports": 321163,
"imports": 374820,
"balance": -53657
},
{
"yearMonth": "2026-04",
"exports": 329893,
"imports": 382776,
"balance": -52883
},
{
"yearMonth": "2026-05",
"exports": 319979,
"imports": 395731,
"balance": -75752
},
{
"yearMonth": "2026-06",
"exports": 317335,
"imports": 388517,
"balance": -71182
},
{
"yearMonth": "2026-07",
"exports": 310723,
"imports": 403550,
"balance": -92826
},
{
"yearMonth": "2026-08",
"exports": 315182,
"imports": 420754,
"balance": -105572
}
]
}
}
Support & Community
- 🏠 API Home: Trade Balance 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.