Introduction
The BillionCore API is a high-performance REST API for BIN (Bank Identification Number) lookup. Given the first 6–8 digits of a payment card, it returns the issuing bank's country, card brand, card type, and transaction routing rules — in under 20 microseconds.
The engine is written in Go and operates entirely in-memory with zero database hops. All responses are JSON. No SDK is required — any HTTP client works.
Quick start
- 1. Register and copy your API key from the dashboard.
- 2. Send a
GETrequest to https://engine.billioncore.tech/api/bin/lookup - 3. Pass your key in the
X-API-Keyheader.
Authentication
All requests require an API key. Keys are prefixed with bc_live_ and are generated instantly when you register.
Pass the key using either the X-API-Key header or as a Bearer token in the Authorization header.
GET /api/bin/lookup?bin=453998&country=US HTTP/1.1 Host: engine.billioncore.tech X-API-Key: bc_live_yourkey
Keep your API key secret — treat it like a password. Never expose it in client-side code or public repositories.
Base URL
All API requests are made over HTTPS to the following base URL. HTTP is not supported.
Endpoints
BillionCore exposes a single lookup endpoint that accepts either a BIN plus country, or a BIN alone. When no country is provided the API returns all configured country rules for that BIN in one response.
BIN + Country lookup
GETReturns a single routing rule for a specific BIN + country combination. This is the fastest path — one atomic load plus two map lookups, returning in under 20µs.
| Parameter | Type | Required | Description |
|---|---|---|---|
| bin | string | required | First 6–8 digits of the card number |
| country | string | optional | ISO 3166-1 alpha-2 code (e.g. US, GB) |
Request
curl "https://engine.billioncore.tech/api/bin/lookup?bin=453998&country=US" \ -H "X-API-Key: bc_live_yourkey"
Response
{
"success": true,
"data": {
"bin": "453998",
"country": "US",
"action": "ENABLE",
"trial_price": 1.00,
"trial_period": 7,
"rebill_price": 39.99,
"rebill_period": 30,
"x_sell_status": "ELIGIBLE",
"bin_performance": {
"gross_profit": 42.50,
"rebill_rate": 0.78,
"chargeback_rate": 0.012
}
}
}BIN-only lookup (all country rules)
GETOmit the country parameter to receive all configured routing rules for a given BIN in a single response. Useful for admin tooling, data exploration, or when you want to see all market configurations at once.
| Parameter | Type | Required | Description |
|---|---|---|---|
| bin | string | required | First 6–8 digits of the card number |
Request
curl "https://engine.billioncore.tech/api/bin/lookup?bin=453998" \ -H "X-API-Key: bc_live_yourkey"
Response
{
"success": true,
"data": {
"bin": "453998",
"rules": {
"US": {
"action": "ENABLE",
"trial_price": 1.00,
"trial_period": 7,
"rebill_price": 39.99,
"rebill_period": 30,
"x_sell_status": "ELIGIBLE"
},
"GB": {
"action": "DISABLE",
"trial_price": 0,
"trial_period": 0,
"rebill_price": 0,
"rebill_period": 0,
"x_sell_status": "INELIGIBLE"
}
},
"bin_performance": {
"gross_profit": 42.50,
"rebill_rate": 0.78,
"chargeback_rate": 0.012
}
}
}Response fields
All successful responses follow the shape { success: true, data: {...} }. The fields inside data are described below.
Common (both endpoints)
| Field | Type | Description |
|---|---|---|
| bin | string | The BIN prefix (6–8 digits) |
| bin_performance | object? | Historical performance data (optional) |
| bin_performance.gross_profit | float | Average gross profit per transaction in USD |
| bin_performance.rebill_rate | float | Rebill success rate (0–1) |
| bin_performance.chargeback_rate | float | Chargeback rate (0–1) |
BIN + Country response
| Field | Type | Description |
|---|---|---|
| country | string | ISO 3166-1 alpha-2 country code |
| action | string | ENABLE | DISABLE | INHERIT — whether to process the card |
| trial_price | float | Trial period charge in USD |
| trial_period | int | Trial length in days |
| rebill_price | float | Recurring charge in USD |
| rebill_period | int | Recurring interval in days |
| x_sell_status | string | Cross-sell eligibility flag |
Action values
| Value | Meaning |
|---|---|
| ENABLE | Process this card in this country — transaction allowed |
| DISABLE | Block this card in this country — do not process |
| INHERIT | No country-specific override — fall back to global rule |
Error codes
Errors always have success: false and a human-readable error string. The HTTP status code mirrors the error type.
| Status | Meaning |
|---|---|
| 401 | Missing or invalid API key |
| 400 | Missing required bin parameter |
| 404 | BIN not found in the database |
| 429 | Rate limit exceeded for your plan |
| 500 | Internal server error — contact support |
Error responses
{
"success": false,
"error": "Unauthorized"
}Code examples
Full working examples for the most common languages and frameworks. All examples use the BIN + Country endpoint — omit &country=US to get all country rules instead.
curl
The fastest way to test your key. Works in any terminal.
# Single country curl "https://engine.billioncore.tech/api/bin/lookup?bin=453998&country=US" \ -H "X-API-Key: bc_live_yourkey" # All country rules curl "https://engine.billioncore.tech/api/bin/lookup?bin=453998" \ -H "X-API-Key: bc_live_yourkey"
PHP (vanilla)
Uses cURL extension, available in every PHP installation.
<?php
function billioncore_lookup(string $bin, string $country = ''): array
{
$url = 'https://engine.billioncore.tech/api/bin/lookup?bin=' . urlencode($bin);
if ($country !== '') {
$url .= '&country=' . urlencode($country);
}
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . $_ENV['BILLIONCORE_API_KEY'],
'Accept: application/json',
],
CURLOPT_TIMEOUT => 5,
]);
$body = curl_exec($ch);
curl_close($ch);
return json_decode($body, true);
}
// Usage
$result = billioncore_lookup('453998', 'US');
if ($result['success']) {
$data = $result['data'];
echo "Action: " . $data['action'] . PHP_EOL;
echo "Trial: $" . $data['trial_price'] . " / " . $data['trial_period'] . " days" . PHP_EOL;
echo "Rebill: $" . $data['rebill_price'] . " / " . $data['rebill_period'] . " days" . PHP_EOL;
}Laravel
Recommended pattern: store the key in config, use the HTTP facade.
<?php
return [
// ...
'billioncore' => [
'key' => env('BILLIONCORE_API_KEY'),
'base_url' => env('BILLIONCORE_BASE_URL', 'https://engine.billioncore.tech'),
],
];JavaScript / Node.js
Works in the browser and Node.js. Uses the native fetch API.
const BILLIONCORE_KEY = process.env.BILLIONCORE_API_KEY;
const BILLIONCORE_BASE = 'https://engine.billioncore.tech';
async function lookupBin(bin, country) {
const url = new URL('/api/bin/lookup', BILLIONCORE_BASE);
url.searchParams.set('bin', bin);
if (country) url.searchParams.set('country', country);
const res = await fetch(url.toString(), {
headers: { 'X-API-Key': BILLIONCORE_KEY },
});
if (!res.ok) {
const err = await res.json();
throw new Error(err.error ?? 'BillionCore error');
}
return res.json().then(r => r.data);
}
// Usage
const data = await lookupBin('453998', 'US');
if (data.action === 'ENABLE') {
console.log('Trial: $' + data.trial_price + ' / ' + data.trial_period + ' days');
}Python
Uses the requests library. Compatible with Django, FastAPI, Flask.
import os
import requests
from typing import Optional
BILLIONCORE_KEY = os.environ["BILLIONCORE_API_KEY"]
BILLIONCORE_BASE = "https://engine.billioncore.tech"
def lookup_bin(bin: str, country: Optional[str] = None) -> dict:
params = {"bin": bin}
if country:
params["country"] = country
resp = requests.get(
f"{BILLIONCORE_BASE}/api/bin/lookup",
params=params,
headers={"X-API-Key": BILLIONCORE_KEY},
timeout=5,
)
resp.raise_for_status()
return resp.json()["data"]
data = lookup_bin("453998", "US")
if data["action"] == "ENABLE":
print(f"Trial: {data['trial_price']{'}'} / {'{'}data['trial_period']{'}'} days")Go
Zero external dependencies — uses the standard library only.
package billioncore
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"os"
"time"
)
type Client struct {
apiKey string
baseURL string
http *http.Client
}
type LookupData struct {
Bin string `json:"bin"`
Country string `json:"country,omitempty"`
Action string `json:"action"`
TrialPrice float64 `json:"trial_price"`
TrialPeriod int `json:"trial_period"`
RebillPrice float64 `json:"rebill_price"`
RebillPeriod int `json:"rebill_period"`
XSellStatus string `json:"x_sell_status"`
Rules map[string]Rule `json:"rules,omitempty"`
}
type Rule struct {
Action string `json:"action"`
TrialPrice float64 `json:"trial_price"`
RebillPrice float64 `json:"rebill_price"`
}
func NewClient() *Client {
return &Client{
apiKey: os.Getenv("BILLIONCORE_API_KEY"),
baseURL: "https://engine.billioncore.tech",
http: &http.Client{Timeout: 5 * time.Second},
}
}
func (c *Client) Lookup(ctx context.Context, bin, country string) (*LookupData, error) {
u, _ := url.Parse(c.baseURL + "/api/bin/lookup")
q := u.Query()
q.Set("bin", bin)
if country != "" {
q.Set("country", country)
}
u.RawQuery = q.Encode()
req, _ := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
req.Header.Set("X-API-Key", c.apiKey)
resp, err := c.http.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
var errResp struct{ Error string `json:"error"` }
json.NewDecoder(resp.Body).Decode(&errResp)
return nil, fmt.Errorf("billioncore: %s", errResp.Error)
}
var result struct {
Data LookupData `json:"data"`
}
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return nil, err
}
return &result.Data, nil
}