Code examples

Last updated: September 20, 2026

This article gives example requests in common languages. Each example sends one BIN to POST /v1/bin. Replace YOUR_API_KEY with your key.

curl

curl -X POST "https://api.binlookupapi.com/v1/bin" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"number": 42467101}'

Node.js

const response = await fetch("https://api.binlookupapi.com/v1/bin", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ number: 42467101 }),
});
const result = await response.json();
console.log(result.data);

Python

import requests

response = requests.post(
    "https://api.binlookupapi.com/v1/bin",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"number": 42467101},
)
print(response.json()["data"])

PHP

<?php
$ch = curl_init("https://api.binlookupapi.com/v1/bin");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer YOUR_API_KEY",
    "Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(["number" => 42467101]));
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($result["data"]);

Go

package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

func main() {
	body := bytes.NewBufferString(`{"number": 42467101}`)
	req, _ := http.NewRequest("POST", "https://api.binlookupapi.com/v1/bin", body)
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	data, _ := io.ReadAll(resp.Body)
	fmt.Println(string(data))
}

Ruby

require "net/http"
require "json"

uri = URI("https://api.binlookupapi.com/v1/bin")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = { number: 42467101 }.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
puts JSON.parse(response.body)["data"]

Batch requests

For a batch request, send the array numbers to POST /v1/bins. See Batch lookup: POST /v1/bins.