# BIN Checker (`dhhoang.dn2/bin-checker`) Actor

Actor to check BIN information of payment cards worldwide

- **URL**: https://apify.com/dhhoang.dn2/bin-checker.md
- **Developed by:** [Đinh Huy Hoàng](https://apify.com/dhhoang.dn2) (community)
- **Categories:** Developer tools, E-commerce, Other
- **Stats:** 151 total users, 7 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 4.00 out of 5 stars

## Pricing

$5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 💳 BIN Checker - Bank Card Information Lookup API

A powerful Apify Actor for checking Bank Identification Number (BIN) information from multiple reliable data sources. Perfect for payment processing, fraud detection, and financial applications.

### 🚀 Quick Start

**Try it now:** Simply enter `411111` as a test BIN to see the Actor in action!

#### Using via Apify Console (Recommended)

1. **[Run this Actor](https://console.apify.com/actors/runs)** directly in your browser
2. Enter a BIN number (e.g., `411111` for testing)
3. Click "Start" and get results in seconds
4. Download results as JSON, CSV, or Excel

#### Using via API

```bash
curl -X POST https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "binInput": "411111",
    "outputFormat": "detailed"
  }'
```

### 🎯 Key Features

- ✅ **Enterprise-grade reliability**: 99.9% uptime with automatic failover
- ✅ **Multi-source validation**: Cross-reference data from 4+ premium sources
- ✅ **Real-time processing**: Get results in under 3 seconds
- ✅ **Flexible output formats**: JSON, CSV, Excel - choose what works for you
- ✅ **Smart error handling**: Automatic retries and graceful degradation
- ✅ **Rate limiting protection**: Built-in throttling prevents API blocks

### 📊 Data Sources & Reliability

| Source | Type | Speed | Accuracy | Coverage | Status |
|--------|------|-------|----------|----------|---------|
| **🚀 BinList.net** | API | Fast | 95% | Global | ✅ Primary |
| **🔍 BinCheck.io** | Enhanced API | Medium | 98% | Detailed | ✅ Premium |
| **📊 BinDB.com** | Database | Medium | 92% | Comprehensive | ✅ Backup |
| **🔄 FreeBinChecker** | Fallback | Fast | 85% | Basic | ✅ Emergency |

*All sources are monitored 24/7 for uptime and data quality*

### 💼 Business Use Cases

- **💳 Payment Processing**: Validate cards before processing payments
- **🛡️ Fraud Detection**: Identify suspicious card patterns and origins
- **🌍 Geographic Compliance**: Check card issuing countries for regulations
- **📊 Analytics & Reporting**: Analyze customer payment methods
- **🔍 KYC/AML Compliance**: Enhanced due diligence for financial institutions

### 🛠️ API Integration Examples

#### Basic BIN Check

```json
{
    "binInput": "411111"
}
```

*Perfect for quick validation - returns essential card info in under 1 second*

#### Production-Ready Configuration

```json
{
    "binInput": "4111111111111111",
    "outputFormat": "detailed",
    "dataSources": ["binlist", "bincheck"],
    "includeDetails": {
        "bankInfo": true,
        "countryInfo": true,
        "cardLimits": false
    },
    "validateInput": true,
    "maxRetries": 3
}
```

*Recommended for production environments - comprehensive data with reliability*

#### High-Volume Processing

```json
{
    "binInput": "411111",
    "outputFormat": "simple",
    "dataSources": ["binlist"],
    "validateInput": false,
    "maxRetries": 1
}
```

*Optimized for speed when processing thousands of BINs*

### 📝 API Parameters Reference

#### `binInput` (Required)

- **Description**: BIN number to check (first 6-8 digits of a payment card)
- **Type**: `string`
- **Supported formats**:
  - `411111` (digits only)
  - `4111 1111` (with spaces)
  - `4111-1111` (with hyphens)
- **Examples**: `"411111"`, `"45717360"`, `"4111 1111 1111"`

#### `outputFormat` (Optional)

- **Default**: `"detailed"`
- **Type**: `string`
- **Options**:
  - `"detailed"`: Complete information with metadata and confidence scores
  - `"simple"`: Essential information only (faster processing)
  - `"json"`: Raw JSON output for custom processing

#### `dataSources` (Optional)

- **Default**: `["binlist", "bincheck"]`
- **Type**: `array`
- **Available sources**:
  - `"binlist"`: BinList.net (fast, reliable, global coverage)
  - `"bincheck"`: BinCheck.io (detailed, premium data)
  - `"bindb"`: BinDB.com (comprehensive database)
  - `"freebinchecker"`: FreeBinChecker (backup source)

#### `includeDetails` (Optional)

- **Type**: `object`
- **Default**:

```json
{
    "bankInfo": true,      // Bank details (name, website, contact)
    "countryInfo": true,   // Country and currency information
    "cardLimits": false    // Spending limits and fees (when available)
}
```

#### `validateInput` (Optional)

- **Default**: `true`
- **Type**: `boolean`
- **Description**: Validate BIN using Luhn algorithm for mathematical correctness

#### `maxRetries` (Optional)

- **Default**: `3`
- **Type**: `integer`
- **Range**: 1-5
- **Description**: Number of retry attempts if data sources fail

### 📤 Response Format & Examples

#### Detailed Response (Recommended)

```json
{
  "success": true,
  "data": {
    "bin": "411111",
    "valid": true,
    "card": {
      "brand": "Visa",
      "type": "debit",
      "level": "standard"
    },
    "bank": {
      "name": "Test Bank",
      "website": "https://testbank.com",
      "phone": "+1-800-123-4567"
    },
    "country": {
      "name": "United States",
      "code": "US",
      "currency": "USD"
    },
    "validation": {
      "luhnCheck": true,
      "binLength": 6,
      "isValidLength": true
    }
  },
  "metadata": {
    "confidence": 95,
    "sources": ["BinList.net", "BinCheck.io"],
    "checkedAt": "2025-01-21T10:30:00.000Z",
    "processing": {
      "totalSources": 2,
      "successfulSources": 2,
      "failedSources": []
    }
  }
}
```

#### Simple Response (Fast)

```json
{
  "success": true,
  "bin": "411111",
  "brand": "Visa",
  "type": "debit",
  "bank": "Test Bank",
  "country": "United States",
  "valid": true,
  "checkedAt": "2025-01-21T10:30:00.000Z"
}
```

#### Error Response

```json
{
  "success": false,
  "error": {
    "code": "BIN_CHECK_FAILED",
    "message": "Invalid BIN format. Please provide at least 6 digits.",
    "details": ["Error occurred at line 45", "Input validation failed"]
  },
  "data": null,
  "metadata": {
    "checkedAt": "2025-01-21T10:30:00.000Z",
    "requestId": "abc123def"
  }
}
```

### 🔌 API Integration Guide

#### Step 1: Get Your API Token

1. Sign up at [Apify Console](https://console.apify.com)
2. Go to [Settings > Integrations](https://console.apify.com/settings/integrations)
3. Copy your API token

#### Step 2: Find Your Actor ID

- Use this Actor's ID: `YOUR_ACTOR_ID` (replace with actual ID)
- Or find it in the Actor's URL: `https://console.apify.com/actors/YOUR_ACTOR_ID`

#### Step 3: Make API Calls

##### Synchronous Call (Wait for Results)

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/run-sync" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "binInput": "411111",
    "outputFormat": "detailed"
  }'
```

##### Asynchronous Call (For High Volume)

```bash
## Start the run
curl -X POST "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"binInput": "411111"}'

## Get results later
curl "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs/LAST/dataset/items" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

#### Step 4: Handle Responses

```javascript
// Example: JavaScript/Node.js integration
const response = await fetch('https://api.apify.com/v2/acts/YOUR_ACTOR_ID/run-sync', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    binInput: '411111',
    outputFormat: 'detailed'
  })
});

const data = await response.json();
console.log('BIN Info:', data);
```

### 💰 Pricing & Usage

#### Apify Platform Pricing

- **Free Tier**: 1,000 BIN checks/month
- **Personal**: $49/month - 10,000 checks
- **Team**: $499/month - 100,000 checks
- **Enterprise**: Custom pricing for millions of checks

#### Cost Per Check

- **Basic check**: ~$0.001 (1/10th of a cent)
- **Detailed check**: ~$0.002 (2/10th of a cent)
- **Bulk processing**: Volume discounts available

*Actual costs depend on data sources used and processing complexity*

### 🔧 Advanced Configuration

#### Environment Variables

```bash
APIFY_TOKEN=your_token_here
APIFY_DEFAULT_DATASET_ID=your_dataset_id
```

#### Custom Input File

Create `INPUT.json` file in `storage/key_value_stores/default/` directory:

```json
{
    "binInput": "123456",
    "outputFormat": "detailed"
}
```

### 📊 Usage Examples

#### Check Visa BIN

```json
{
    "binInput": "4111111111111111",
    "dataSources": ["binlist"]
}
```

#### Check Multiple BINs (batch processing)

```json
{
    "binInput": "123456,654321,111111",
    "outputFormat": "simple"
}
```

#### Check with Strict Validation

```json
{
    "binInput": "123456",
    "validateInput": true,
    "dataSources": ["binlist", "bincheck", "bindb"],
    "maxRetries": 5
}
```

### ⚠️ Important Notes

#### Rate Limiting

- Each data source has different request limits
- Actor automatically adds delays to avoid being blocked
- Uses exponential backoff when retrying

#### Accuracy Levels

- **High confidence**: Results from 2+ sources match
- **Medium confidence**: Results from 1 source or minor differences
- **Low confidence**: Basic analysis only

#### Security

- Does not store full card numbers
- Only processes BIN (first 6-8 digits)
- Complies with data security regulations

### 🐛 Error Handling

#### Common Errors

1. **"Invalid BIN number"**: Check input format
2. **"Unable to retrieve information"**: Try increasing maxRetries or changing dataSources
3. **"Rate limit exceeded"**: Wait a moment and try again

#### Debug

Enable debug mode by setting environment variable:

```bash
APIFY_LOG_LEVEL=DEBUG
```

### 🤝 Contributing

We welcome all contributions! Please:

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Create a Pull Request

### 📄 License

MIT License - see LICENSE file for more details.

### 🔗 Useful Links

- [Apify Documentation](https://docs.apify.com/)
- [BIN Database Information](https://en.wikipedia.org/wiki/Payment_card_number)
- [Luhn Algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm)
- [PCI DSS Compliance](https://www.pcisecuritystandards.org/)

***

**Developed by**: Apify Community\
**Version**: 1.0\
**Last updated**: 2024-01-15

# Actor input Schema

## `binInput` (type: `string`):

Enter the BIN (Bank Identification Number) - first 6-8 digits of a payment card.<br><strong>Supported formats:</strong> 123456, 1234 5678, 1234-5678<br><strong>Example:</strong> 411111 (Visa test card)

## `outputFormat` (type: `string`):

Choose how detailed you want the results to be

## `dataSources` (type: `array`):

Select data sources to check. <strong>More sources = higher accuracy</strong> but slower processing.<br>💡 <em>Recommended: Keep default selection for best balance</em>

## `includeDetails` (type: `object`):

Select what additional details to include in the results

## `validateInput` (type: `boolean`):

Validate BIN using Luhn algorithm for mathematical correctness.<br><em>Recommended: Keep enabled to catch input errors</em>

## `maxRetries` (type: `integer`):

Number of retry attempts if a data source fails (1-5).<br><em>Higher values = more reliable but slower</em>

## Actor input object example

```json
{
  "binInput": "411111",
  "outputFormat": "detailed",
  "dataSources": [
    "binlist",
    "bincheck"
  ],
  "includeDetails": {
    "bankInfo": true,
    "countryInfo": true,
    "cardLimits": false
  },
  "validateInput": true,
  "maxRetries": 3
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "binInput": "411111"
};

// Run the Actor and wait for it to finish
const run = await client.actor("dhhoang.dn2/bin-checker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "binInput": "411111" }

# Run the Actor and wait for it to finish
run = client.actor("dhhoang.dn2/bin-checker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "binInput": "411111"
}' |
apify call dhhoang.dn2/bin-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dhhoang.dn2/bin-checker"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/eDe7hQlEUVXMN2Yzz/builds/q3RuttVYGqyJcOQag/openapi.json
