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

# Cuentas

> Productos bancarios bajo un link: cuentas vista, ahorro y tarjetas de crédito.

## Qué es una cuenta

Una **cuenta** representa un producto bancario específico bajo un link. Un link típicamente tiene varias cuentas: CuentaRUT + Vista + tarjeta + ahorro, por ejemplo. Su ID es `acc_` + 16 chars hex.

```json theme={null}
{
  "object": "account",
  "id": "acc_3f8a1c5d9e2b6741",
  "link_id": "link_8a2f4c6e1b9d5037",
  "name": "Tarjeta de Crédito Visa",
  "official_name": "TARJETA DE CREDITO VISA",
  "type": "credit_card",
  "currency": "CLP",
  "number": "4111111111111234",
  "last_4": "1234",
  "balance": {
    "available": 850000,
    "current": 150000,
    "limit": 5000000
  },
  "holder_id": null,
  "holder_name": "JANE DOE EXAMPLE",
  "refreshed_at": "2026-06-03T12:00:00Z",
  "last_sync_at": "2026-06-03T12:00:00Z",
  "next_sync_at": "2026-06-03T16:00:00Z",
  "link_status": "active",
  "status": "active"
}
```

## Tipos

| `type`        | Significa                                            |
| ------------- | ---------------------------------------------------- |
| `checking`    | Cuenta corriente o cuenta vista (incluye CuentaRUT). |
| `savings`     | Cuenta de ahorro (plazo, vivienda, etc).             |
| `credit_card` | Tarjeta de crédito. `balance.limit` está poblado.    |
| `other`       | No clasificable. Raro.                               |

## Balance

Para `checking` y `savings`:

* `available`: lo que el user puede gastar ya (puede incluir línea de crédito).
* `current`: saldo contable (sin líneas).
* `limit`: `null`.

Para `credit_card`:

* `available`: cupo disponible (limit − current).
* `current`: lo que debe.
* `limit`: cupo total.

Todos los valores son **bigint en minor units**. Para CLP eso = pesos sin decimal. Para USD/EUR eso = centavos.

## Listar

```bash theme={null}
# Todas las cuentas de un link
curl "https://api.rail.cl/v1/accounts?link_id=link_xxx" \
  -H "Authorization: Bearer rail_sk_live_…"

# Una cuenta específica
curl https://api.rail.cl/v1/accounts/acc_xxx \
  -H "Authorization: Bearer rail_sk_live_…"
```

## status vs link\_status

* `status` = estado de **esta cuenta** específica.
* `link_status` = estado del link padre (replicado por conveniencia).

| `status`  | Significa                                                                                   |
| --------- | ------------------------------------------------------------------------------------------- |
| `active`  | Sigue apareciendo en el banco.                                                              |
| `removed` | La cuenta fue cerrada o ya no aparece en el banco. Por default no la devolvemos (filtrada). |

Para incluir las `removed`: agrega `?include_removed=true`.
