Validate an address

Validate an address for a chain and get its type and normalized form.

# Validate an address

`GET https://api.rarebl.com/open/address/validate`

Checks that an address is well formed for a chain and returns its type and normalized form. For ETH it also tells whether the address is a contract.

**Rate class:** compute (2 requests per second, burst 10, per IP). **Available since:** Open API v2.

## Request

Send the parameters as query parameters (GET) or as a JSON object (POST with `Content-Type: application/json`). They are identical either way. No API key is needed: `X-API-KEY` is reserved and ignored.

Example: `curl "https://api.rarebl.com/open/address/validate?chain=btc&address=bc1q7dszvzdj8lk8dd4ssad94m0t2acunaf48j455q"`

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | string | Yes | The chain. One of: btc, ltc, bch, dash, eth, tron. |
| `address` | string | Yes | The address to check. |

## Responses

### API200 (HTTP 200): OK

A valid Bitcoin address.

```json
{
  "status": 1,
  "code": "API200",
  "message": "success",
  "data": {
    "valid": true,
    "type": "p2wpkh",
    "normalized": "bc1q7dszvzdj8lk8dd4ssad94m0t2acunaf48j455q"
  },
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `data.valid` | boolean | Whether the address is valid for the chain. |
| `data.type` | string | p2pkh, p2sh, p2wpkh, p2tr, cashaddr, eoa, contract, tron-account, ... |
| `data.normalized` | string | The canonical form (BCH: CashAddr without prefix; ETH: checksummed). |
| `data.isContract` | boolean | ETH only, from `eth_getCode`. |

### API200 (HTTP 200): OK (ETH)

An ETH contract address.

```json
{
  "status": 1,
  "code": "API200",
  "message": "success",
  "data": {
    "valid": true,
    "type": "contract",
    "normalized": "0xdac17f958d2ee523a2206206994597c13d831ec7",
    "isContract": true
  },
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

### API400 (HTTP 400): Bad Request

A parameter is missing or malformed. `data.param` names it (here `chain`).

```json
{
  "status": 0,
  "code": "API400",
  "message": "Unknown or missing chain.",
  "data": {
    "param": "chain"
  },
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

### API429 (HTTP 429): Too Many Requests

Rate limited (compute class: 2 requests per second, burst 10, per IP). A `Retry-After` header says how long to wait, in seconds.

```json
{
  "status": 0,
  "code": "API429",
  "message": "Too many requests. Please retry shortly.",
  "data": null,
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

## Notes

- Mostly pure code (checksums and prefixes); ETH adds an `eth_getCode` call.
- Use it before saving a withdrawal address.

Back to the Rarebl AI documentation index