BINtools / API documentation / BIN lookup examples
Server-side integration guide

BIN lookup API examples that keep the key private

Use the versioned BINtools API from a trusted backend, pass the key in a request header and treat each result as reference metadata—not payment authorization. The examples below are ready to adapt without exposing a live credential.

Contract reviewed 2026-07-28 · 375,518 six-digit reference records

Quick start

1

Create an account

Register, open the dashboard and create a named API key for one application or environment.

2

Store it server-side

Use an environment secret. Never commit it, place it in a query string or ship it to a browser bundle.

3

Call the v1 endpoint

Send at least six digits and handle status codes before reading response fields.

GEThttps://bintools.io/api/v1/lookup?bin=498542
cURLX-API-Key header
curl --request GET \
  'https://bintools.io/api/v1/lookup?bin=498542' \
  --header 'X-API-Key: bt_YOUR_API_KEY'

The placeholder is intentional. Replace it only in your local secret store or deployment environment. The service also accepts Authorization: Bearer ….

Never use ?api_key=…. Query strings can appear in access logs, analytics, browser history, screenshots and referrer data. BINtools v1 deliberately accepts credentials only from headers.

Node.js server example

This example is suitable for a server route, worker or background job. It validates the input, reads the key from the environment and distinguishes rate limiting from other failures.

Node.js 18+server only
const digits = String(input).replace(/\D/g, "");
if (digits.length < 6) throw new Error("BIN needs at least 6 digits");

const response = await fetch(
  `https://bintools.io/api/v1/lookup?bin=${digits.slice(0, 8)}`,
  { headers: { "X-API-Key": process.env.BINTOOLS_API_KEY } }
);

if (response.status === 429) {
  throw new Error("BINtools limit reached; retry later");
}
if (!response.ok) {
  const problem = await response.json();
  throw new Error(problem.error ?? `HTTP ${response.status}`);
}

const binData = await response.json();
Frontend rule: if your application runs in a browser or mobile client, call your own narrow backend endpoint. Embedding a private key in JavaScript, a mobile package or a public repository makes it recoverable.

Python example

Python + requestsenvironment secret
import os
import re
import requests

digits = re.sub(r"\D", "", user_input)
if len(digits) < 6:
    raise ValueError("BIN needs at least 6 digits")

response = requests.get(
    "https://bintools.io/api/v1/lookup",
    params={"bin": digits[:8]},
    headers={"X-API-Key": os.environ["BINTOOLS_API_KEY"]},
    timeout=10,
)
response.raise_for_status()
bin_data = response.json()

In this example only the BIN value is a query parameter. The API key remains in a header. Set a short timeout and catch requests.HTTPError so a metadata lookup cannot stall your main transaction flow.

Response fields

FieldMeaningImportant limitation
binThe prefix represented by the response.Current classification is based on the first six digits.
schemePayment-network label in the reference record.A label can change when ranges are reassigned.
typeCredit, debit, prepaid or another recorded product type.Not every source record has the same completeness.
levelProduct or card-level label where available.Do not use it as the sole eligibility decision.
bankIssuer label associated with the matched prefix.Names may differ from current legal branding.
countryRecorded issuing country name.It is not the cardholder’s current location.
country_codeTwo-letter country code where present.Missing or legacy records can return an empty value.
isoAdditional ISO-related value stored with the record.Clients should tolerate null or empty optional fields.
phone / urlIssuer contact metadata when exposed by the active plan.Verify contact details before operational use.

Six-digit lookup granularity

The public BINtools reference currently contains 375,518 distinct six-digit records. The v1 lookup normalizes the input and matches the first six digits against that source. A client can preserve up to eight input digits for its own workflow, but it must not present the result as verified eight-digit IIN classification.

Two cards can share the same first six digits while belonging to different eight-digit sub-ranges. That matters for routing, product classification, fraud analytics and reporting. Use a network-authorized or processor source when eight-digit precision is required.

Error handling

StatusMeaningClient behavior
400The BIN is missing or shorter than six digits.Validate the input; do not retry unchanged.
401The key is missing, invalid or inactive.Check the secret and key status; never log the full value.
403The endpoint or feature is unavailable on the active plan.Use an available feature or change the plan intentionally.
404No matching reference record was found.Return “unknown”; do not invent issuer metadata.
429A daily or monthly account limit was reached.Stop immediate retries, inspect status and apply backoff.
5xxTemporary service or upstream failure.Retry a small number of times with exponential backoff and jitter.
GEThttps://bintools.io/api/v1/status

The authenticated status endpoint returns the active plan, daily and monthly usage limits, usage counts and the configured BIN digit setting. Use it for operational monitoring—not on every lookup.

Caching and logging

  • Cache successful reference results by the matched six-digit prefix, not by the full PAN.
  • Keep a source timestamp and refresh on a controlled schedule because issuer assignments change.
  • Do not cache 401, 403 or 429 responses as permanent lookup results.
  • Never log the API key or a full card number. A BIN metadata lookup does not need the PAN.
  • Use request timeouts and circuit breaking so a reference lookup cannot block payment processing.
  • Record the response status, latency and match granularity for diagnostics without storing sensitive input.

Versioned API vs legacy browser endpoints

The website still uses several anonymous /api/*.php endpoints for interactive tools. They have per-IP controls and anti-abuse checks and are not the stable integration surface for a backend product.

New integrations should use /api/v1/lookup with a named key. This gives account-level limits, usage tracking, key activation controls and a separate status endpoint.

Frequently asked questions

Where should I put the BINtools API key?

Send it in the X-API-Key header or as an Authorization Bearer token. Do not put a key in the URL because query strings can be stored in access logs, browser history and referrer data.

Can I call the authenticated API directly from browser JavaScript?

A private API key should not be embedded in public frontend code. Call BINtools from your server, serverless function or another trusted backend and return only the fields your frontend needs.

Does a BIN lookup validate a payment card?

No. A lookup returns reference metadata for a number prefix. It cannot confirm ownership, account status, available balance, authorization outcome or the cardholder location.

Does the current lookup provide eight-digit IIN precision?

The current reference match is based on the first six digits. Longer input may be accepted by a client or plan, but the returned issuer classification must be treated as six-digit legacy-prefix metadata.

Start with one controlled integration

Create a separate key for each environment, keep production credentials out of developer laptops where possible and begin with a single server-side lookup path. Measure errors and latency before adding BIN metadata to a wider workflow.