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

# Country Validation Rules

> Country-specific requirements for cross-border shipping

Each destination country has specific validation requirements for customs compliance. This guide covers the rules for each supported country.

## 🇪🇨 Ecuador

Ecuador has strict import regulations requiring proper identification.

### Required Fields

| Field                       | Requirement                  |
| --------------------------- | ---------------------------- |
| `receiver.nationalId`       | **Required** (Cédula or RUC) |
| `receiver.idType`           | `cedula` or `ruc`            |
| `receiver.address.province` | **Required**                 |
| `receiver.address.zipCode`  | Must match province          |

### Cédula Validation

Ecuadorian Cédula must be exactly 10 digits and pass the Luhn checksum:

```
Valid format: 1234567890
```

### RUC Validation

For businesses, use RUC (13 digits):

```
Valid format: 1234567890001
```

### Province Codes

| Province  | Postal Code Prefix |
| --------- | ------------------ |
| Guayas    | 09                 |
| Pichincha | 17                 |
| Azuay     | 01                 |
| Manabí    | 13                 |

### Example

```json theme={null}
{
  "receiver": {
    "fullName": "María García",
    "phone": "+593 99 123 4567",
    "nationalId": "1234567890",
    "idType": "cedula",
    "address": {
      "line1": "Av. 9 de Octubre 123",
      "city": "Guayaquil",
      "province": "Guayas",
      "zipCode": "090101",
      "country": "EC"
    }
  }
}
```

***

## 🇲🇽 Mexico

### Required Fields

| Field                      | Requirement                  |
| -------------------------- | ---------------------------- |
| `receiver.address.state`   | **Required** (2-letter code) |
| `receiver.address.zipCode` | **Required** (5 digits)      |
| `receiver.nationalId`      | Optional (RFC)               |

### State Codes

| State            | Code |
| ---------------- | ---- |
| Ciudad de México | DF   |
| Jalisco          | JA   |
| Nuevo León       | NL   |
| Estado de México | EM   |

### RFC Validation (Optional)

If provided, RFC must be 12-13 characters:

```
Personal: XXXX######XXX (13 chars)
Business: XXX######XXX (12 chars)
```

### Example

```json theme={null}
{
  "receiver": {
    "fullName": "Carlos Rodríguez",
    "phone": "+52 55 1234 5678",
    "address": {
      "line1": "Av. Reforma 222",
      "line2": "Col. Juárez",
      "city": "Ciudad de México",
      "state": "DF",
      "zipCode": "06600",
      "country": "MX"
    }
  }
}
```

***

## 🇨🇴 Colombia

### Required Fields

| Field                   | Requirement                  |
| ----------------------- | ---------------------------- |
| `receiver.nationalId`   | **Required** (Cédula)        |
| `receiver.idType`       | `cedula`                     |
| `receiver.address.city` | Must be valid Colombian city |

### Cédula Validation

Colombian Cédula is 6-10 digits:

```
Valid format: 1234567890
```

### Example

```json theme={null}
{
  "receiver": {
    "fullName": "Ana Pérez",
    "phone": "+57 310 123 4567",
    "nationalId": "1234567890",
    "idType": "cedula",
    "address": {
      "line1": "Carrera 7 #32-16",
      "city": "Bogotá",
      "province": "Cundinamarca",
      "zipCode": "110311",
      "country": "CO"
    }
  }
}
```

***

## 🇵🇪 Peru

### Required Fields

| Field                 | Requirement               |
| --------------------- | ------------------------- |
| `receiver.nationalId` | **Required** (DNI or RUC) |
| `receiver.idType`     | `dni` or `ruc`            |

### DNI Validation

Peruvian DNI is exactly 8 digits:

```
Valid format: 12345678
```

### Example

```json theme={null}
{
  "receiver": {
    "fullName": "José López",
    "phone": "+51 999 123 456",
    "nationalId": "12345678",
    "idType": "dni",
    "address": {
      "line1": "Av. Javier Prado 123",
      "city": "Lima",
      "province": "Lima",
      "zipCode": "15036",
      "country": "PE"
    }
  }
}
```

***

## 🇨🇱 Chile

### Required Fields

| Field                 | Requirement        |
| --------------------- | ------------------ |
| `receiver.nationalId` | **Required** (RUT) |
| `receiver.idType`     | `rut`              |

### RUT Validation

Chilean RUT format: `########-X` where X is a check digit (0-9 or K):

```
Valid format: 12345678-9 or 12345678-K
```

### Example

```json theme={null}
{
  "receiver": {
    "fullName": "Pedro Sánchez",
    "phone": "+56 9 1234 5678",
    "nationalId": "12345678-9",
    "idType": "rut",
    "address": {
      "line1": "Av. Providencia 1234",
      "city": "Santiago",
      "province": "Región Metropolitana",
      "zipCode": "7500000",
      "country": "CL"
    }
  }
}
```

***

## Validation Error Examples

### Missing National ID

```json theme={null}
{
  "success": false,
  "error": {
    "code": "VALIDATION_NATIONAL_ID",
    "message": "National ID (Cédula) is required for Ecuador shipments",
    "message_es": "Se requiere documento de identidad (Cédula) para envíos a Ecuador"
  }
}
```

### Invalid Format

```json theme={null}
{
  "success": false,
  "error": {
    "code": "VALIDATION_NATIONAL_ID",
    "message": "Invalid Cédula format. Must be 10 digits.",
    "message_es": "Formato de Cédula inválido. Debe tener 10 dígitos."
  }
}
```

### Province Mismatch

```json theme={null}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ADDRESS",
    "message": "Postal code 090101 does not match province Pichincha",
    "message_es": "El código postal 090101 no corresponde a la provincia Pichincha"
  }
}
```

## Testing Validation

Use sandbox mode to test validation without creating real shipments. The sandbox validates all country rules identically to production.
