BankCoin Platform

API · Packages · Subscriptions · Explorer · Search · Docs ● HD Wallet Mode

Packages My API Docs Explorer Live Network Search

Interactive API Tester

Paste your API key below to validate it and test the live /rate endpoint directly in your browser.

Getting Started

The BankCoin API gives you programmatic access to our cryptocurrency exchange rate data, blockchain explorer, and account management. Our API is REST-based, returns JSON, and works over HTTPS only.

Base URL

https://bankcoin.site/platform.php?action={action}

Quick Start (3 steps)

1
Create an account

Register via the Packages tab and choose your tier.

2
Generate an API key

Go to My API and click "Generate New Key".

3
Make your first request

Send your key in the X-API-Key header. See example below.

cURL
PHP
Python
JavaScript
Node.js
# Test the /rate endpoint curl -H "X-API-Key: bk_live_xxxxxxxx" \ "https://bankcoin.site/platform.php?action=api_v1_rate"
Pro tip: Always use environment variables to store your API key. Never commit keys to Git or paste them in public forums.

Authentication

Every API request must include your API key in the X-API-Key HTTP header. Requests without a valid key return 401 Unauthorized.

Header Format

X-API-Key: bk_live_your_56_char_hex_key

Key Format

  • Prefix: bk_live_ (production) — will be bk_test_ for sandbox
  • Body: 40 hexadecimal characters
  • Total length: 48 characters
  • Secret: stored server-side, never sent over the wire

Rotating Keys

Generate a new key anytime from My API. Old keys can be deactivated individually without affecting other keys. For production systems, rotate keys every 90 days.

Warning: Your API key grants full access to your account tier. If a key is leaked, delete it immediately from the dashboard.

Rate Limits

Rate limits are applied per API key. Every response includes a rate_limit object showing current usage and remaining quota.

Tier Requests / Minute Requests / Day Burst
Free 5 100 7 / min
Basic 30 5,000 45 / min
Pro 120 50,000 180 / min
Enterprise 1,000 500,000 1500 / min

Rate Limit Response

{ "status": "ok", "tier": "pro", "rate_limit": { "used_minute": 42, "used_day": 1876, "limits": { "per_minute": 120, "per_day": 50000 } }, "data": { ... } }

Exceeding the Limit

HTTP/1.1 429 Too Many Requests { "error": "rate_limit_exceeded", "used_minute": 120, "used_day": 120, "limits": { "per_minute": 120, "per_day": 50000 } }

Endpoints

All endpoints are accessed via the single entry point using the action query parameter.

GET ?action=api_v1_rate Current BTC/USD price + 24h change Free+
GET ?action=blocks Latest 15 blocks Free+
GET ?action=mempool Recent mempool transactions Free+
GET ?action=stats Network statistics (height, fees, mempool size) Free+
GET ?action=search&q={query} Search by TX / Address / Block Free+
GET ?action=tx-detail&txid={hash} Full transaction details Free+
GET ?action=address-detail&address={addr} Full address details with balance Free+
GET ?action=block-detail&block={height|hash} Full block details Free+
GET ?action=key_status Get rate-limit status for all your keys Free+

GET /rate

Returns the current Bitcoin price in USD along with 24-hour change, sourced from CoinGecko.

GET https://bankcoin.site/platform.php?action=api_v1_rate

Headers

HeaderTypeRequiredDescription
X-API-KeystringREQUIREDYour API key (bk_live_...)
AcceptstringOPTIONALapplication/json (default)

Query Parameters

This endpoint takes no query parameters beyond action.

Success Response — 200 OK

{ "status": "ok", "tier": "pro", "rate_limit": { "used_minute": 1, "used_day": 1, "limits": { "per_minute": 120, "per_day": 50000 } }, "data": { "pair": "BTC/USD", "price": 67432.10, "change_24h": 1.23, "timestamp": 1718000000 } }

Error Responses

// 401 Unauthorized — missing or invalid key { "error": "invalid_api_key" } // 429 Too Many Requests — rate limit exceeded { "error": "rate_limit_exceeded", "used_minute": 120, "used_day": 120, "limits": { "per_minute": 120, "per_day": 50000 } }

Live Example

Try it now using the Interactive Tester above, or via cURL:

curl -H "X-API-Key: bk_live_xxxxxxxx" \ "https://bankcoin.site/platform.php?action=api_v1_rate"

Error Codes

All errors return JSON with an error field describing the problem.

CodeMeaningSolution
400Bad RequestMissing or invalid parameters. Check query/form fields.
401UnauthorizedAPI key missing, malformed, or inactive. Generate a new one.
403ForbiddenTier doesn't grant access to this endpoint. Upgrade your plan.
404Not FoundRequested resource (TX / block / address) doesn't exist.
429Too Many RequestsRate limit hit. Wait until the quota resets or upgrade tier.
500Server ErrorUnexpected condition. Retry with exponential backoff.
503Service UnavailableUpstream blockchain API is down. Retry in 30s.
Retry Strategy: Use exponential backoff (1s → 2s → 4s → 8s), stop after 4 attempts, and honor any Retry-After header if present.

Code Examples

Ready-to-use snippets in every major language.

PHP (Production-ready with retry)

<?php function bankcoin_api(string $action, array $params = [], int $maxRetries = 4): ?array { $apiKey = getenv('BANKCOIN_API_KEY'); $baseUrl = 'https://bankcoin.site/platform.php'; $url = $baseUrl . '?' . http_build_query(array_merge(['action' => $action], $params)); $delay = 1; for ($attempt = 0; $attempt < $maxRetries; $attempt++) { $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10, CURLOPT_HTTPHEADER => ['X-API-Key: ' . $apiKey], CURLOPT_SSL_VERIFYPEER => true, ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200) { return json_decode($response, true); } if ($httpCode === 429 || $httpCode >= 500) { sleep($delay); $delay *= 2; continue; } throw new Exception("API error: HTTP $httpCode"); } throw new Exception('Max retries exceeded'); } $data = bankcoin_api('api_v1_rate'); echo 'BTC price: $' . $data['data']['price'];

Python

import os, time, requests API_KEY = os.environ['BANKCOIN_API_KEY'] BASE_URL = 'https://bankcoin.site/platform.php' def bankcoin_api(action, params=None, max_retries=4): headers = {'X-API-Key': API_KEY} query = {'action': action, **(params or {})} delay = 1 for attempt in range(max_retries): r = requests.get(BASE_URL, headers=headers, params=query, timeout=10) if r.status_code == 200: return r.json() if r.status_code == 429 or r.status_code >= 500: time.sleep(delay) delay *= 2 continue r.raise_for_status() raise Exception('Max retries exceeded') data = bankcoin_api('api_v1_rate') print(f"BTC: ${data['data']['price']}")

JavaScript / TypeScript

async function bankcoinApi(action, params = {}, maxRetries = 4) { const apiKey = process.env.BANKCOIN_API_KEY; const baseUrl = 'https://bankcoin.site/platform.php'; const query = new URLSearchParams({ action, ...params }); let delay = 1000; for (let i = 0; i < maxRetries; i++) { const res = await fetch(`${baseUrl}?${query}`, { headers: { 'X-API-Key': apiKey }, }); if (res.ok) return res.json(); if (res.status === 429 || res.status >= 500) { await new Promise(r => setTimeout(r, delay)); delay *= 2; continue; } throw new Error(`HTTP ${res.status}`); } throw new Error('Max retries exceeded'); } bankcoinApi('api_v1_rate').then(d => console.log(d.data.price));

cURL

# Get price curl -s -H "X-API-Key: bk_live_xxxxxxxx" \ "https://bankcoin.site/platform.php?action=api_v1_rate" | jq # Get latest blocks curl -s -H "X-API-Key: bk_live_xxxxxxxx" \ "https://bankcoin.site/platform.php?action=blocks" | jq # Check rate limit status curl -s -H "X-API-Key: bk_live_xxxxxxxx" \ "https://bankcoin.site/platform.php?action=key_status" | jq

Integration Patterns

1. Caching Pattern

Reduce your API calls by caching responses locally. Price data changes slowly — 30s cache saves 95% of your quota.

// Simple in-memory cache (Node.js) const cache = new Map(); const TTL = 30000; // 30 seconds async function cachedRate() { const key = 'rate'; const hit = cache.get(key); if (hit && Date.now() - hit.ts < TTL) return hit.data; const data = await bankcoinApi('api_v1_rate'); cache.set(key, { data, ts: Date.now() }); return data; }

2. Webhook Pattern (Pro+)

For real-time updates, Pro and Enterprise tiers can register webhook URLs that receive push notifications.

// Webhook payload (POST to your server) { "event": "payment.confirmed", "order_id": "SUB_a1b2c3d4e5f6g7h8", "tier": "pro", "amount_btc": "0.00290912", "tx_hash": "a1b2c3d4...", "timestamp": 1718000000 }

3. Batch Requests

Combine multiple data fetches in parallel using Promise.all:

const [rate, blocks, stats] = await Promise.all([ bankcoinApi('api_v1_rate'), bankcoinApi('blocks'), bankcoinApi('stats'), ]);

Webhooks

Pro & Enterprise only. Available on Pro tier and above.

Register a webhook URL to receive real-time events:

  • payment.confirmed — Subscription paid & activated
  • payment.expired — Order expired without payment
  • subscription.expiring — 3 days before expiry
  • rate.alert — BTC price crossed your threshold

Verification

Every webhook includes an X-BankCoin-Signature header. Verify using HMAC-SHA256:

<?php $signature = $_SERVER['HTTP_X_BANKCOIN_SIGNATURE']; $body = file_get_contents('php://input'); $secret = getenv('WEBHOOK_SECRET'); $expected = hash_hmac('sha256', $body, $secret); if (!hash_equals($expected, $signature)) { http_response_code(401); exit('Invalid signature'); } // Process the event...

Best Practices

DO store keys in environment variables

Use process.env, getenv(), or a secrets manager. Never hardcode.

DO implement exponential backoff

For 429 and 5xx responses, wait 1s → 2s → 4s → 8s before retrying.

DO cache aggressively

Price data changes slowly. A 30s cache saves 95% of your quota.

DO monitor your rate limit

Read rate_limit.used_day from every response. Warn at 80%.

DON'T expose keys client-side

Never put API keys in browser JavaScript. Route through your own backend.

DON'T ignore rate limit errors

Repeated 429s may trigger temporary IP blocking.

DON'T poll faster than needed

Use webhooks (Pro+) for real-time updates instead of tight polling loops.

Changelog

v1.4 2026-10-16
  • Added ?action=key_status endpoint for rate-limit visibility
  • Added ?action=validate_key for interactive testing
  • New fields in rate_limit: used_minute, used_day
v1.3 2026-09-22
  • Introduced ?action=all combined endpoint (blocks + mempool + stats)
  • Response caching reduces latency by up to 90%
v1.0 2026-08-01
  • Initial public release
  • Endpoints: /rate, /blocks, /mempool, /stats, /search, /tx-detail, /address-detail, /block-detail