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

# BIC 验证

> `bic` 端点验证业务标识码，提供银行代码、国家信息和机构类型的详细解析，适用于国际银行业务。

## 快速开始

### 基础 URL

```
https://bankvalidation.cleariflow.com/v1/bic/
```

### 验证端点

`bic` 端点需要您的 API 密钥和 BIC 参数，以对业务标识码进行全面验证。

```
https://bankvalidation.cleariflow.com/v1/bic/
? api_key = YOUR_UNIQUE_API_KEY
& bic = DEUTDEFF500
```

此成功请求验证德国 BIC 并返回详细信息：

<ResponseExample>
  ```json theme={"system"}
  {
    "bic": "DEUTDEFF500",
    "is_valid": true,
    "country_code": "DE",
    "country_name": "Germany",
    "bank_code": "DEUT",
    "bank_name": "Bank information not available",
    "location_code": "F",
    "branch_code": "500",
    "details": {
      "type": "BIC",
      "active": true,
      "institution_type": "Bank"
    }
  }
  ```
</ResponseExample>

### 请求参数

<ParamField query="api_key" type="String" required>
  您的唯一 API 密钥。请注意，每个用户为每个 Cleariflow API 拥有
  独立的 API 密钥，因此您的银行验证 API 密钥无法用于汇率
  API，例如。
</ParamField>

<ParamField query="bic" type="String" required>
  要验证的业务标识码。允许空格，处理过程中将自动移除。BIC 应遵循 ISO 9362 标准格式。
</ParamField>

### 响应参数

API 响应以通用、轻量的 [JSON 格式](https://www.json.org/json-en.html) 返回。

<ResponseField name="bic" type="String">
  规范化后的 BIC，无空格，以大写格式返回。
</ResponseField>

<ResponseField name="is_valid" type="Boolean">
  总体验证结果，表示 BIC 是否符合所有验证规则。
</ResponseField>

<ResponseField name="country_code" type="String">
  两字母 ISO 国家代码（例如 DE 表示德国，US 表示美国）。
</ResponseField>

<ResponseField name="country_name" type="String">
  与 BIC 关联国家的全称。
</ResponseField>

<ResponseField name="bank_code" type="String">
  4 字符银行标识码（例如 DEUT 表示德意志银行）。
</ResponseField>

<ResponseField name="bank_name" type="String">
  银行名称（当前显示 "Bank information not available"）。
</ResponseField>

<ResponseField name="location_code" type="String">
  2 字符位置代码，表示城市或地区（例如 FF 表示法兰克福）。
</ResponseField>

<ResponseField name="branch_code" type="String">
  3 字符分行代码（可选，8 字符 BIC 可能为空）。
</ResponseField>

<ResponseField name="details" type="Object">
  关于 BIC 类型和状态的附加详细信息。
</ResponseField>

<ResponseField name="details.type" type="String">
  标识符类型（通常为 "BIC"）。
</ResponseField>

<ResponseField name="details.active" type="Boolean">
  BIC 当前是否处于活跃使用状态。
</ResponseField>

<ResponseField name="details.institution_type" type="String">
  金融机构类型（例如 "Bank"、"Credit Union"）。
</ResponseField>

## 示例

### 有效的德国 BIC（8 个字符）

**请求：**

```
GET https://bankvalidation.cleariflow.com/v1/bic/?api_key=YOUR_API_KEY&bic=DEUTDEFF
```

**响应：**

```json theme={"system"}
{
  "bic": "DEUTDEFF",
  "is_valid": true,
  "country_code": "DE",
  "country_name": "Germany",
  "bank_code": "DEUT",
  "bank_name": "Bank information not available",
  "location_code": "FF",
  "branch_code": "",
  "details": {
    "type": "BIC",
    "active": true,
    "institution_type": "Bank"
  }
}
```

### 有效的德国 BIC（11 个字符，含分行）

**请求：**

```
GET https://bankvalidation.cleariflow.com/v1/bic/?api_key=YOUR_API_KEY&bic=DEUTDEFF500
```

**响应：**

```json theme={"system"}
{
  "bic": "DEUTDEFF500",
  "is_valid": true,
  "country_code": "DE",
  "country_name": "Germany",
  "bank_code": "DEUT",
  "bank_name": "Bank information not available",
  "location_code": "FF",
  "branch_code": "500",
  "details": {
    "type": "BIC",
    "active": true,
    "institution_type": "Bank"
  }
}
```

### 有效的美国 BIC

**请求：**

```
GET https://bankvalidation.cleariflow.com/v1/bic/?api_key=YOUR_API_KEY&bic=CHASUS33
```

**响应：**

```json theme={"system"}
{
  "bic": "CHASUS33",
  "is_valid": true,
  "country_code": "US",
  "country_name": "United States",
  "bank_code": "CHAS",
  "bank_name": "Bank information not available",
  "location_code": "33",
  "branch_code": "",
  "details": {
    "type": "BIC",
    "active": true,
    "institution_type": "Bank"
  }
}
```

### 有效的英国 BIC

**请求：**

```
GET https://bankvalidation.cleariflow.com/v1/bic/?api_key=YOUR_API_KEY&bic=NWBKGB2L
```

**响应：**

```json theme={"system"}
{
  "bic": "NWBKGB2L",
  "is_valid": true,
  "country_code": "GB",
  "country_name": "United Kingdom",
  "bank_code": "NWBK",
  "bank_name": "Bank information not available",
  "location_code": "2L",
  "branch_code": "",
  "details": {
    "type": "BIC",
    "active": true,
    "institution_type": "Bank"
  }
}
```

### 无效的 BIC

**请求：**

```
GET https://bankvalidation.cleariflow.com/v1/bic/?api_key=YOUR_API_KEY&bic=INVALID
```

**响应：**

```json theme={"system"}
{
  "bic": "INVALID",
  "is_valid": false,
  "country_code": "",
  "country_name": "",
  "bank_code": "",
  "bank_name": "Bank information not available",
  "location_code": "",
  "branch_code": "",
  "details": {
    "type": "BIC",
    "active": true
  }
}
```

## 错误处理

### 缺少 BIC 参数

**请求：**

```
GET https://bankvalidation.cleariflow.com/v1/bic/?api_key=YOUR_API_KEY
```

**响应：**

```json theme={"system"}
{
  "error": {
    "message": "Missing bic",
    "code": "missing_bic"
  }
}
```

### 缺少 API 密钥

**请求：**

```
GET https://bankvalidation.cleariflow.com/v1/bic/?bic=DEUTDEFF500
```

**响应：**

```json theme={"system"}
{
  "error": {
    "message": "API key is required",
    "code": "missing_api_key"
  }
}
```

## BIC 结构

BIC 由多个部分组成：

1. **银行代码（4 个字符）**：金融机构的唯一标识符
2. **国家代码（2 个字符）**：ISO 3166-1 alpha-2 国家代码
3. **位置代码（2 个字符）**：城市或地区标识符
4. **分行代码（3 个字符）**：可选分行标识符（主办公室为 XXX）

### 格式示例

* **8 字符 BIC**：`DEUTDEFF`（德意志银行，德国，法兰克福）
* **11 字符 BIC**：`DEUTDEFF500`（德意志银行，德国，法兰克福，分行 500）

### 常用位置代码

* **FF**：德国法兰克福
* **33**：美国纽约
* **2L**：英国伦敦
* **PP**：法国巴黎
* **MM**：意大利米兰

## 验证规则

API 执行全面验证，包括：

1. **长度验证**：检查 BIC 是否为 8 或 11 个字符
2. **格式验证**：验证 BIC 是否符合 ISO 9362 标准
3. **字符验证**：确保仅使用字母数字字符
4. **国家代码验证**：验证国家代码格式
5. **银行代码验证**：检查银行标识符格式

### BIC 格式要求

* **银行代码**：4 个字母数字字符
* **国家代码**：2 个字母字符 (ISO 3166-1)
* **位置代码**：2 个字母数字字符
* **分行代码**：3 个字母数字字符（可选）

## BIC 与 SWIFT

BIC（业务标识码）和 SWIFT 经常互换使用：

* **BIC**：官方 ISO 9362 标准名称
* **SWIFT**：推广该代码的报文网络
* **SWIFT Code**：BIC 的替代名称

所有 BIC 均可用于 SWIFT 报文，但并非所有 SWIFT 代码都是有效的 BIC。

## 支持的国家

API 支持 50 多个国家的 BIC 验证，包括：

* **欧洲**：德国、法国、意大利、西班牙、荷兰、比利时、奥地利、瑞士、英国、波兰
* **美洲**：美国、加拿大、巴西、墨西哥
* **亚洲**：日本、新加坡、香港、澳大利亚
* **非洲**：南非、埃及、尼日利亚

完整支持国家列表，请参阅[支持的国家](/bank-validation/countries)页面。

## 使用场景

BIC 验证对于以下场景至关重要：

1. **国际电汇**：确保准确的路由信息
2. **SEPA 支付**：欧洲支付系统要求
3. **银行应用**：客户账户验证
4. **金融合规**：监管报告要求
5. **支付处理**：电商和金融科技应用
