> For the complete documentation index, see [llms.txt](https://firstoken.gitbook.io/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://firstoken.gitbook.io/api-docs/guides/8-digit-bin-support.md). Agents can also search and read this documentation through its [MCP server](https://firstoken.gitbook.io/api-docs/~gitbook/mcp).

# 8-Digit BIN Support

Firstoken can identify and return the 8-digit BIN of a card. This feature is optional and is enabled by Firstoken in your account configuration.

#### Overview

Card networks are migrating from 6-digit to 8-digit BINs. When the feature is enabled on your account and a card is sent with a registered 8-digit BIN, Firstoken identifies it as an 8-digit BIN and returns it in the response.

If the feature is not enabled on your account, or the card's BIN is not registered as an 8-digit BIN, Firstoken returns the 6-digit BIN, as usual. In the Tokenization API and the Transactions API, the BIN fields are returned in both cases; only the BIN value changes.

{% hint style="info" %}
8-digit BIN support is available in Inbound Routes, the Tokenization API, and the Transactions API.
{% endhint %}

| Service          | How the BIN is returned                                                                    |
| ---------------- | ------------------------------------------------------------------------------------------ |
| Inbound Routes   | In the `card` object of the metadata key defined in **Field name**.                        |
| Tokenization API | In the fields `bin`, `bin_length`, and `pan_length` of each token or card in the response. |
| Transactions API | In the fields `bin`, `bin_length`, and `pan_length` of the response.                       |

#### Requirements

| Requirement           | Description                                                                                                                                                                                     |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Account configuration | Firstoken enables the feature on your account. Contact the Firstoken Support Team to request it.                                                                                                |
| Include Metadata      | **Inbound Routes only**. Enable **Include Metadata** in your Inbound Route configuration. For setup steps, see Create an Inbound Route.                                                         |
| Field name            | **Inbound Routes only**. Set the **Field name** in the same configuration. It defines the key in the payload where the metadata is written.                                                     |
| Registered BIN range  | <p><strong>Production only</strong>. The card's 8-digit BIN must be registered in Firstoken.</p><p>Firstoken registers the ranges. If a range is missing, see Report a Missing 8-Digit BIN.</p> |

{% hint style="info" %}
The Tokenization API and the Transactions API do not require additional configuration.
{% endhint %}

#### Workflow

```mermaid
flowchart TD
    A[Client sends card data to Firstoken] --> B{8-digit BIN feature enabled on the account?}
    B -- No --> C[Standard 6-digit BIN is returned]
    B -- Yes --> D{Card BIN registered as 8 digits?}
    D -- No --> C
    D -- Yes --> E[Firstoken returns the 8-digit BIN in the response]
```

#### Inbound Routes

When **Include Metadata** is enabled, the payload forwarded to your endpoint includes the metadata under the key defined in **Field name**. The name of this key is chosen by the client and is not always `metadata`.

In the following example, **Field name** is set to `metadata`:

```json
{
    "card_number": "16f4d0dd-6674-436f-a215-faabe9d37ef6",
    "card_holder": "John Doe",
    "card_expiration_month": "01",
    "card_expiration_year": "2027",
    "card_security_code": "16f4d0dd-6674-436f-a215-faabe9d37ef6",
    "metadata": {
        "card": {
            "card_truncated": "400000******0021",
            "bin": "40000003",
            "pan_length": 16,
            "bin_length": 8,
            "last_four": "0021",
            "brand": "visa",
            "token": "16f4d0dd-6674-436f-a215-faabe9d37ef6"
        }
    }
}
```

If **Field name** is set to `card_info`, the same data is returned under `card_info.card`.

**Card Metadata Fields**

The following fields are returned inside the `card` object of the metadata key.

<table data-search="false"><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>card_truncated</code></td><td>string</td><td>Card number with the middle digits masked.</td></tr><tr><td><code>bin</code></td><td>string</td><td>BIN of the card. Contains 8 digits when the card is identified with an 8-digit BIN.</td></tr><tr><td><code>pan_length</code></td><td>integer</td><td>Total length of the card number.</td></tr><tr><td><code>bin_length</code></td><td>integer</td><td>Length of the BIN. Returns <code>8</code> when the card is identified with an 8-digit BIN.</td></tr><tr><td><code>last_four</code></td><td>string</td><td>Last four digits of the card number.</td></tr><tr><td><code>brand</code></td><td>string</td><td>Card brand (for example, <code>visa</code>).</td></tr><tr><td><code>token</code></td><td>string</td><td>Firstoken token that represents the card number.</td></tr></tbody></table>

#### Tokenization API

The following fields are added to the responses of the Tokenization API.

| Endpoint                      | Where the fields are returned                                         |
| ----------------------------- | --------------------------------------------------------------------- |
| `POST /tokenization/simple`   | In each item of `data.tokens[]`, for permanent and persistent tokens. |
| `POST /detokenization/simple` | In each item of `data.cards[]`.                                       |
| `GET /tokens/{token}/inspect` | In `data`.                                                            |

Other endpoints, including token deletion, are not affected.

Example, response of `POST /tokenization/simple` for a card with an 8-digit BIN:

```json
{
    "status_code": 200,
    "status": "success",
    "desc": "Success",
    "data": {
        "tokens": [
            {
                "card": "400000******0021",
                "token": "400000AbCdEf0021",
                "tags": [],
                "scheme": 1,
                "created_by": { "name": "API" },
                "status": 1,
                "createdAt": "2026-10-27T15:00:00.000Z",
                "bin": "40000003",
                "bin_length": 8,
                "pan_length": 16
            }
        ]
    }
}
```

#### Transactions API

The following fields are added to the responses of the Transactions API.

| Endpoint                       | Where the fields are returned                                                                 |
| ------------------------------ | --------------------------------------------------------------------------------------------- |
| `POST /requests`               | In `data`. The response also includes `card`, with the first 6 and last 4 digits of the card. |
| `GET /requests/{id}`           | In `data.chd`.                                                                                |
| `POST /requests/{id}/tokenize` | In `data.tokens[0]`.                                                                          |

Other endpoints, including `DELETE /requests/{id}` and `GET /requests/{id}/inspect`, are not affected.

Example, response of `POST /requests` for a card with an 8-digit BIN:

```json
{
    "status_code": 200,
    "status": "success",
    "desc": "Success",
    "data": {
        "id": "dc6e8085-5e73-4078-8fc7-ea34cd3f8ed0",
        "card": "400000******0021",
        "bin": "40000003",
        "bin_length": 8,
        "pan_length": 16
    }
}
```

#### BIN Fields in API Responses

These fields apply to the Tokenization API and the Transactions API.

| Field        | Type    | Description                                                                                                                        |
| ------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `bin`        | string  | First 6 or 8 digits of the card number. Contains 8 digits when the card is identified with an 8-digit BIN, and 6 digits otherwise. |
| `bin_length` | integer | Length of `bin`. Returns `8` or `6`.                                                                                               |
| `pan_length` | integer | Number of digits of the card number.                                                                                               |

The fields are returned on all accounts. If the feature is not enabled on your account, `bin` always contains 6 digits and `bin_length` is `6`.

When an item fails, a token is not found, or the request has no card, the fields return `bin: ""`, `bin_length: 0`, and `pan_length: 0`.

These fields are added to the existing responses. Existing fields do not change, so no changes are required in your integration.

#### Testing in Sandbox

Use the following Visa test cards in the Sandbox environment to validate your integration. Use any expiration date and any CVV.

| Card Number         | BIN Returned | Brand |
| ------------------- | ------------ | ----- |
| 4000 0003 2000 0021 | 40000003     | Visa  |
| 4000 0007 6000 0002 | 40000007     | Visa  |
| 4000 0012 4000 0000 | 40000012     | Visa  |
| 4000 0015 2000 0001 | 40000015     | Visa  |
| 4000 0017 0000 0003 | 40000017     | Visa  |
| 4000 0018 8000 0005 | 40000018     | Visa  |

To validate that your integration also handles cards without an 8-digit BIN, use the following card. Firstoken returns the standard 6-digit BIN.

| Card Number         | BIN Returned | Brand |
| ------------------- | ------------ | ----- |
| 4000 0019 0000 0001 | 400000       | Visa  |

To receive `bin_length: 8` in Sandbox, the feature must be enabled on your Sandbox account. For Inbound Routes, **Include Metadata** and **Field name** must also be configured.

#### Production

In Production, Firstoken returns an 8-digit BIN only when all of the following requirements are met:

* 8-digit BIN support is enabled on your Production account.
* The card's 8-digit BIN is registered in Firstoken.
* For Inbound Routes, **Include Metadata** is enabled and a **Field name** is configured.

For example, a card beginning with `40000003` returns `bin: "40000003"` and `bin_length: 8` when that range is registered. If the feature is not enabled or the range is not registered, Firstoken returns the standard 6-digit BIN for the same card, in the same structure. Example for an Inbound Route:

```json
{
    "metadata": {
        "card": {
            "card_truncated": "400000******0021",
            "bin": "400000",
            "pan_length": 16,
            "bin_length": 6,
            "last_four": "0021",
            "brand": "visa",
            "token": "dce289e1-f67e-44ec-abf2-342a85fc0813"
        }
    }
}
```

To confirm whether a BIN range is registered in Firstoken, contact the Firstoken Support Team.

**Report a Missing 8-Digit BIN**

If a card should return an 8-digit BIN but returns six digits, contact the Firstoken Support Team and include the following information:

| Information     | Description                                                                      |
| --------------- | -------------------------------------------------------------------------------- |
| BIN range       | The affected BIN range.                                                          |
| Service         | The Inbound Route, endpoint, or token request that processed the card.           |
| Example request | A sample request that reproduced the issue. Do not include the full card number. |
| Date and time   | When the issue occurred, in UTC-5.                                               |

With this information, the team can verify your account configuration and register the range if needed.

#### FAQ

<table data-search="false"><thead><tr><th>Question</th><th>Answer</th></tr></thead><tbody><tr><td>How do I enable 8-digit BIN support?</td><td>Contact the Firstoken Support Team. Firstoken enables the feature in your account configuration.</td></tr><tr><td>What happens if the feature is not enabled on my account?</td><td>Firstoken returns the 6-digit BIN, as usual, with <code>bin_length</code> set to <code>6</code>. In the Tokenization API and the Transactions API, the BIN fields are still returned.</td></tr><tr><td>Where is the 8-digit BIN returned?</td><td>In Inbound Routes, in <code>card.bin</code> under the key defined in <strong>Field name</strong>. In the Tokenization API and the Transactions API, in <code>bin</code>.</td></tr><tr><td>Do I need to configure anything for the Tokenization API or the Transactions API?</td><td>No. Only the account feature is required.</td></tr><tr><td>Do I need to change my integration?</td><td>No. The BIN fields are added to existing responses and existing fields do not change.</td></tr><tr><td>What do I need to configure for Inbound Routes?</td><td>Enable <strong>Include Metadata</strong> and set a <strong>Field name</strong> in your Inbound Route configuration. For setup steps, see Create an Inbound Route.</td></tr><tr><td>Is the metadata key always called <code>metadata</code>?</td><td>No. The key name is the value you set in <strong>Field name</strong>.</td></tr><tr><td>How do I know a card was identified with an 8-digit BIN?</td><td><code>bin_length</code> is <code>8</code>.</td></tr><tr><td>What do I do if a card with an 8-digit BIN returns six digits in Production?</td><td>Contact the Firstoken Support Team with the BIN range, the service, an example request, and the date and time of the issue (UTC-5).</td></tr><tr><td>Can I test this in Sandbox?</td><td>Yes. Use the Visa test cards listed in this guide with any expiration date and any CVV.</td></tr></tbody></table>
