# Validate Barcode (GTIN / EAN / UPC) (`validate.barcode`)

Check the check digit of an EAN-8, UPC-A, EAN-13 or GTIN-14 product barcode and normalise it to GTIN-14.

- **Route:** `POST /v1/run/validate.barcode`
- **Price:** $0.0002 per request ($0.20 per 1,000) · `cost_usd` on every response
- **Source:** GetAllAPIs compute (`compute`) · failover: no
- **Measured latency:** p50 0 ms · p95 0 ms · p99 0 ms (1 calls, 30d)
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `code` | string | yes |  | Barcode digits |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `valid` | True when the check digit is correct. |
| `type` | Barcode type by length. |
| `expected_check_digit` | The check digit the first digits require. |
| `gtin14` | Zero-padded 14-digit form. |
| `reason` | Why it is valid or not. |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/validate.barcode \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code":"3017620422003"}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('validate.barcode', {'code': '3017620422003'})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run validate.barcode '{"code":"3017620422003"}'
```

Quote first (free, validates input): `POST /v1/quote/validate.barcode` with the same body.
