JavaScript Example
Fetch and display current Bitcoin fee estimates directly in the browser. No dependencies required.
examples/javascript/current-fees.htmlSimple, copy-paste public examples for using the free BTCBench Bitcoin fee API in dashboards, crypto blogs, WordPress sites, newsletters, and developer experiments. JavaScript, Python, PHP, and WordPress shortcode — all in one place. This repository contains example files only, not BTCBench production source code.
Each file is standalone and designed to be opened, read, and copied without a build process. Preview the live version on BTCBench.com, view the file on GitHub, or download directly from GitHub.
Fetch and display current Bitcoin fee estimates directly in the browser. No dependencies required.
examples/javascript/current-fees.htmlCommand-line script using the Python standard library only. No third-party packages needed.
examples/python/current-fees.pyServer-side PHP page that fetches and renders current Bitcoin fee estimates with USD cost estimates.
examples/php/current-fees.phpDrop a fee widget into any post, page, or sidebar using a simple shortcode. Includes PHP, JS, and CSS.
examples/wordpress/shortcode-example.phpA compact, self-contained Bitcoin fee card widget. Drop it into any HTML page or iframe it into a blog.
widgets/simple-fee-card.htmlField-by-field notes on the BTCBench fee JSON response, CSV endpoint, and status endpoint.
docs/endpoints.mdThese short snippets are enough to pull live Bitcoin fee data into your project. Each full example file includes error handling, USD cost estimates, and a styled display.
// Fetch current Bitcoin fee estimates from BTCBench
fetch("https://www.btcbench.com/api/v1/fees.json")
.then(response => response.json())
.then(data => {
const fees = data.fees;
console.log("Fastest: ", fees.fastest, "sat/vB");
console.log("Normal: ", fees.halfHour, "sat/vB");
console.log("Economy: ", fees.economy, "sat/vB");
console.log("BTC/USD: $", data.btc_price_usd);
})
.catch(err => console.error("BTCBench error:", err));
// Full example → examples/javascript/current-fees.html
All endpoints below are free and public. No authentication or API key is required.
| Resource | Endpoint / URL |
|---|---|
| Current fee data (JSON) | https://www.btcbench.com/api/v1/fees.json |
| Current fee data (CSV) | https://www.btcbench.com/api/v1/fees.csv |
| API status | https://www.btcbench.com/api/v1/status.json |
| AI data manifest | https://www.btcbench.com/data/ai-data-manifest.json |
| API documentation | btcbench.com/api-docs.html |
| Embed widget page | btcbench.com/embed.html |
| Daily fee reports | btcbench.com/reports/daily-v2/ |
| Weekly fee reports | btcbench.com/reports/weekly-v2/ |
| Monthly fee reports | btcbench.com/reports/monthly-v2/ |
| Methodology notes | btcbench.com/methodology.html |
All tools are free, public, and require no account or login.
BTCBench fee data and examples are suitable for a wide range of projects.
This GitHub repository is intentionally limited to public example files, endpoint notes, and lightweight widget references. It does not include BTCBench production code, private scripts, deployment files, or internal monitoring logic. Never commit any of the following to a public repository: