Language guides

Each guide calls the current API. The host is https://api.binlookupapi.com. The method is POST. Send the key as a bearer token.

LanguageGuide
curlcurl
JavaScript (Node.js)JavaScript
PythonPython
PHPPHP
JavaJava
C#C#
GoGo

Rules for every language

  • Create an API key first. See the quickstart.
  • Store the key in an environment variable named BINLOOKUP_API_KEY.
  • Do not put the key in browser code or in a mobile application.
  • Send 6 to 11 digits. A JSON number or a string of digits is accepted.
  • Do not send a full card number.
  • Read response.status (or the HTTP status) before you read data.
  • Read X-Quota-Remaining and stop before it reaches zero.
  • Batch lookup is POST /v1/bins with a numbers array of 1 to 2,000 values. It requires BLAPI-500KPM, or a test-mode organisation.

The field list, error codes, and quota headers are in the API reference.

Ruby

require "net/http"
require "json"

uri = URI("https://api.binlookupapi.com/v1/bin")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("BINLOOKUP_API_KEY")}"
request["Content-Type"] = "application/json"
request.body = { number: 42467101 }.to_json

response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
  http.request(request)
end

payload = JSON.parse(response.body)
if response.code == "200"
  puts payload["data"]["scheme"]
else
  warn payload["error"]
end

For a batch, send numbers to POST /v1/bins. See Batch lookups.