> ## Documentation Index
> Fetch the complete documentation index at: https://docs.greip.io/llms.txt
> Use this file to discover all available pages before exploring further.

# BIN / IIN Lookup

> Utilize this module to effortlessly retrieve comprehensive information associated with a debit or credit card.

The API provides details such as card type (debit or credit), scheme (Visa, Mastercard, etc.), brand (gold, platinum, etc.), and bank information.

This data is invaluable for various applications, including verifying customer payment details, detecting fraudulent transactions, and delivering personalized services to enhance user experiences.

export const MCPCallout = () => {
  return <div class="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-[rgba(192, 132, 252, 0.2)] bg-[rgba(192, 132, 252, 0.1)] dark:border-[#c084fc4d] dark:bg-[#c084fc1a] text-[#6005BB] dark:text-[#FFFFFF]" data-callout-type="callout">
      <div class="mt-0.5 w-4" data-component-part="callout-icon">
        <svg class="h-4 w-4 !m-0 shrink-0 bg-[#c084fc] [mask-image:url('https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/duotone/fire.svg')] [-webkit-mask-image:url('https://d3gk2c5xim1je2.cloudfront.net/v7.1.0/duotone/fire.svg')] [mask-repeat:no-repeat] [-webkit-mask-repeat:no-repeat] [mask-position:center] [-webkit-mask-position:center]"></svg>
      </div>
      <div class="text-sm prose dark:prose-invert min-w-0 w-full [&_kbd]:bg-background-light dark:[&_kbd]:bg-background-dark text-[#6005BB] dark:text-[#FFFFFF]" data-component-part="callout-content">
        <span data-as="p">
          Want to skip the docs? Use the{" "}
          <a class="link mint-text-xs border-[#C792FC]" href="/docs-mcp-server">
            <b>MCP Server</b>
          </a>
        </span>
      </div>
    </div>;
};

export const Availability = ({plan, color}) => {
  const colorMap = {
    green: "text-green-700 dark:text-green-400",
    blue: "text-blue-700 dark:text-blue-400",
    purple: "text-purple-700 dark:text-purple-400"
  };
  return <div dir="ltr" data-orientation="horizontal" class="p-4 px-5 mt-0 md:mt-4 flex flex-col sm:flex-row flex-wrap gap-2 relative overflow-hidden rounded-2xl border border-gray-950/10 dark:border-white/10 my-0 bg-gray-50 dark:bg-white/5 dark:codeblock-dark text-gray-950 dark:text-gray-50 codeblock-light text-sm prose prose-gray dark:prose-invert font-semibold no-wrap-words">
      Endpoint availability:{" "}
      <span class={` ${colorMap[color]} flex-1`}>{plan}</span>
      <a class="custom-link text-xs" href="https://greip.io/detailed-pricing">
        Learn more
      </a>
    </div>;
};

## Authentication

Include your API key in the `Authorization` header:

```http theme={null}
Authorization: Bearer <api_key>
```

API v2 accepts the key only in this header, not in query parameters or request bodies. See [Authentication](/authentication).

### Path parameters

<ParamField path="bin" type="string" required placeholder="The BIN">
  The BIN/IIN of the card (min: 6 digits).

  Sample value: `456789`, `456789XXXXXX1234`, or `4567891234567890`.
</ParamField>

### Query parameters

<ParamField query="format" type="string" default="JSON" placeholder="Response format">
  The format command is used to get a response in a specific format.

  Expected values: `JSON`, `XML`, `CSV`, or `Newline`

  For more information please refer to [Response format](/options/response-format).
</ParamField>

<ParamField query="mode" type="string" default="live" placeholder="Environment">
  The mode command is used in the development stage to simulate the integration process before releasing it to the production environment.

  Expected values: `live`, or `test`.

  For more information please refer to [Development environment](/options/development-environment).
</ParamField>

<ParamField query="source" type="string" placeholder="Integration label">
  Optional label for your own analytics or support correlation (for example a product or channel name).
</ParamField>

<ParamField query="user_id" type="string" placeholder="User identifier">
  The user\_id command can be used to identify requests sent by specific users to monitor in the [Events page](/knowledge-base/events-and-alerts/overview).

  Expected values: email address, phone number, user id, name, etc.

  For more information please refer to [User identifier](/options/user-identifier).
</ParamField>

<Panel>
  <MCPCallout />

  <Availability plan="Standard and above" color="green" />

  <ResponseExample>
    ```json Success theme={null}
    {
      "success": true,
      "data": {
        "bin": "456789",
        "is_valid": true,
        "reason": null,
        "is_blacklisted": false,
        "scheme": {
          "name": "Visa",
          "is_luhn": true,
          "is_prepaid": false,
          "is_commercial": false,
          "type": "debit",
          "brand": "Traditional",
          "currency": "SAR"
        },
        "detected_digits": "4",
        "syntax": {
          "gaps": [4, 8, 12],
          "lengths": [16, 18, 19],
          "code": { "name": "CVV", "size": 3 }
        },
        "bank": {
          "id": "588847",
          "name": "AL RAJHI BANKING AND INVESTMENT CORP.",
          "city": "Riyadh",
          "url": "https://www.alrajhibank.com.sa",
          "phone": "+96611211600",
          "latitude": "25",
          "longitude": "45"
        },
        "country": {
          "alpha2": "SA",
          "name": "Saudi Arabia",
          "code": "966",
          "numeric": "682",
          "emoji": "🇸🇦",
          "continent": "Asia",
          "language_code": "ar",
          "language_native": "العربية"
        }
      },
      "execution_ms": 2
    }
    ```

    ```json Error theme={null}
    {
      "success": false,
      "code": 101,
      "type": "invalid_key",
      "description": "The API Key is missing or invalid."
    }
    ```
  </ResponseExample>
</Panel>

### Response properties

<ResponseField name="success" type="boolean" required>
  `true` when the request succeeded; `false` on error.
</ResponseField>

<ResponseField name="data" type="object" required>
  <Expandable title="properties" defaultOpen={true}>
    <ResponseField name="bin" type="string" required>
      The BIN/IIN digits from the request (up to 8 digits).
    </ResponseField>

    <ResponseField name="is_valid" type="boolean" required>
      Whether the card number prefix passes structural validation. Use `is_blacklisted` for blocklist outcomes.
    </ResponseField>

    <ResponseField name="reason" type="string">
      Human-readable validation message when `is_valid` is `false`, or `null` on success.
    </ResponseField>

    <ResponseField name="is_blacklisted" type="boolean" required>
      Indicates if the BIN is on your blocklists or matched custom rules (Premium plans and above).
    </ResponseField>

    <ResponseField name="scheme" type="object">
      Card scheme details when a known issuer is detected; `null` when the scheme is unknown.

      <Expandable title="properties" defaultOpen={true}>
        <ResponseField name="name" type="string" required>
          Card scheme name (for example `Visa`, `Mastercard`).
        </ResponseField>

        <ResponseField name="is_luhn" type="boolean" required>
          Whether Luhn checksum validation applies to this scheme.
        </ResponseField>

        <ResponseField name="is_prepaid" type="boolean">
          Whether the card is prepaid when known; otherwise `null`.
        </ResponseField>

        <ResponseField name="is_commercial" type="boolean">
          Whether the card is commercial when known; otherwise `null`.
        </ResponseField>

        <ResponseField name="type" type="string">
          Card type (`debit`, `credit`, etc.) when known.
        </ResponseField>

        <ResponseField name="brand" type="string">
          Card brand when known.
        </ResponseField>

        <ResponseField name="currency" type="string">
          Card currency when known.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="detected_digits" type="string">
      Issuer prefix digits used to detect the scheme.
    </ResponseField>

    <ResponseField name="syntax" type="object">
      Card number formatting rules for the detected scheme.

      <Expandable title="properties" defaultOpen={true}>
        <ResponseField name="gaps" type="array" required>
          Gap positions when grouping the card number.
        </ResponseField>

        <ResponseField name="lengths" type="array" required>
          Allowed card number lengths.
        </ResponseField>

        <ResponseField name="code" type="object" required>
          Security code metadata (for example CVV).

          <Expandable title="properties" defaultOpen={true}>
            <ResponseField name="name" type="string" required>
              Code name (for example `CVC`, `CVV`).
            </ResponseField>

            <ResponseField name="size" type="integer" required>
              Number of digits in the code.
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="bank" type="object" required>
      Issuing bank details when available.

      <Expandable title="properties" defaultOpen={true}>
        <ResponseField name="id" type="string">
          Internal bank ID.
        </ResponseField>

        <ResponseField name="identifier" type="string">
          Bank identifier code when available.
        </ResponseField>

        <ResponseField name="name" type="string">
          Official bank name.
        </ResponseField>

        <ResponseField name="city" type="string">
          Bank city.
        </ResponseField>

        <ResponseField name="url" type="string">
          Bank website URL.
        </ResponseField>

        <ResponseField name="phone" type="string">
          Bank contact phone.
        </ResponseField>

        <ResponseField name="logo" type="string">
          Bank logo URL when available.
        </ResponseField>

        <ResponseField name="latitude" type="string">
          Bank latitude when available.
        </ResponseField>

        <ResponseField name="longitude" type="string">
          Bank longitude when available.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="country" type="object" required>
      Country associated with the issuing bank.

      <Expandable title="properties" defaultOpen={true}>
        <ResponseField name="alpha2" type="string">
          ISO 3166-1 alpha-2 country code.
        </ResponseField>

        <ResponseField name="name" type="string">
          Country name.
        </ResponseField>

        <ResponseField name="code" type="string">
          Country dialing code.
        </ResponseField>

        <ResponseField name="numeric" type="string">
          Country numeric code.
        </ResponseField>

        <ResponseField name="emoji" type="string">
          Country flag emoji.
        </ResponseField>

        <ResponseField name="continent" type="string">
          Continent name.
        </ResponseField>

        <ResponseField name="language_code" type="string">
          Primary language code (ISO 639-1).
        </ResponseField>

        <ResponseField name="language_native" type="string">
          Native language name.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="execution_ms" type="integer" required>
  Time taken to process the request (milliseconds).
</ResponseField>


## OpenAPI

````yaml openapi/v2.json GET /lookup/bin/{bin}
openapi: 3.0.3
info:
  title: Greip API v2 (docs playground)
  version: 2.0.0
servers:
  - url: https://v2.greipapi.com
security: []
paths:
  /lookup/bin/{bin}:
    get:
      summary: BIN lookup
      operationId: lookupBin
      parameters:
        - name: bin
          in: path
          required: true
          schema:
            type: string
        - name: format
          in: query
          schema:
            type: string
            default: JSON
        - name: mode
          in: query
          schema:
            type: string
            default: live
        - name: source
          in: query
          schema:
            type: string
        - name: user_id
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.