# Bic validate

`bic-validate` · version 1.0.0 · Identifiers & check digits · free, no key needed

Validate a Business Identifier Code's ISO 9362:2022 structure and parse its party prefix, country, location and branch.

**Use when you need to: validate a bic swift code · is this swift code valid · parse bank code and branch from a bic.**

## Decide before calling

Read the [versioned contract](/v1/tools/bic-validate/versions/1.0.0) and the supported scope below. Reuse `bic-validate@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `bic-validate@1.0.0` for validate a bic swift code. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- validate a bic swift code
- is this swift code valid
- parse bank code and branch from a bic
- is this a test or passive bic
- check if a bic is the bank's primary office
- בדיקת קוד סוויפט

## Not supported

- checksum or check-digit validation (BIC carries none)
- looking up the bank name, address or branch list for a BIC
- case-folding a lowercase input (a lowercase BIC fails structurally)

## Behavior

- bic is taken exactly as given; this tool does not case-fold. A lowercase or mixed-case bic fails structurally, it is never upper-cased.
- If bic.length is not 8 and not 11, valid:false, reason:'wrong_length' with every parsed field null.
- Otherwise the shape ^[A-Z0-9]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$ must match (4-char party prefix, 2-letter country, 2-char location, optional 3-char branch); else valid:false, reason:'invalid_character'.
- party_prefix = bic[0:4], country = bic[4:6], location = bic[6:8], branch = bic[8:11] when length is 11 else null. is_primary_office = branch is null or branch === 'XXX'. location_type: location[1] '0' -> 'test', '1' -> 'passive', else 'normal'. Both are computed regardless of country validity.
- If country is neither one of the pinned officially-assigned ISO 3166-1 alpha-2 codes (isIso3166Alpha2) nor 'XK' (Kosovo: a user-assigned code that SWIFT uses in live BICs), valid:false, reason:'invalid_country' with the parsed fields still populated. Otherwise valid:true, reason:null. No checksum exists for a BIC; validation is purely structural.

## Input

- `bic` (string, required): min length 1; max length 20

## Output

- `valid` (boolean, required)
- `reason` (one of null, "wrong_length", "invalid_character", "invalid_country", required)
- `party_prefix` (string or null, required): pattern `^[A-Z0-9]{4}$`
- `country` (string or null, required): pattern `^[A-Z]{2}$`
- `location` (string or null, required): pattern `^[A-Z0-9]{2}$`
- `branch` (string or null, required): pattern `^[A-Z0-9]{3}$`
- `is_primary_office` (boolean or null, required)
- `location_type` (one of null, "normal", "test", "passive", required)
- `data_version` (string, required)

## Limits

- max bic bytes: 20

## Example

Request input:

```json
{
  "bic": "DEUTDEFF"
}
```

Response:

```json
{
  "result": {
    "data_version": "iso3166-1-2026-09-28",
    "valid": true,
    "reason": null,
    "party_prefix": "DEUT",
    "country": "DE",
    "location": "FF",
    "branch": null,
    "is_primary_office": true,
    "location_type": "normal"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "bic-validate",
  "version": "1.0.0",
  "input": {
    "bic": "DEUTDEFF"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/bic-validate/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"bic":"DEUTDEFF"}'
```

The machine-readable contract is at [/v1/tools/bic-validate/versions/1.0.0](/v1/tools/bic-validate/versions/1.0.0).

### CLI

```sh
node cli.mjs run bic-validate 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Iban validate](/tools/iban-validate): Validate an IBAN's country, registry length, BBAN structure and MOD 97-10 check digits, and parse its bank/branch code.
- [Isin validate](/tools/isin-validate): Validate a 12-character ISIN's ISO 6166 Luhn check digit and parse its country prefix, NSIN and NSIN scheme.
- [Cusip validate](/tools/cusip-validate): Validate a 9-character CUSIP's Modulus 10 Double Add Double check digit and parse its issuer, issue and PPN marker.
- [Iban compute from bban](/tools/iban-compute-from-bban): Compute the MOD 97-10 check digits and full IBAN for a country code and BBAN, using the pinned IBAN registry.
- [Mx clabe validate](/tools/mx-clabe-validate): Validate an 18-digit Mexican CLABE's weighted check digit and split it into bank, plaza and account fields.
- [Payment card validate](/tools/payment-card-validate): Validate a payment card's Luhn check digit and detect its brand from its IIN, without returning the full number.
