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.
1. Obtené tus API keys
- Andá a dashboard.rail.cl y creá una cuenta.
- En Para desarrolladores → API keys, vas a tener 4 keys:
rail_sk_test_… — secret key de test
rail_pk_test_… — publishable key de test
rail_sk_live_… — secret key de live
rail_pk_live_… — publishable key de live
Las sk_* van solo en tu backend. Nunca en frontend ni en git.
2. Listá los links existentes
Un link es la conexión de un usuario tuyo con su banco. Para empezar listamos los que ya existen (al inicio, vacío):
curl https://api.rail.cl/v1/links \
-H "Authorization: Bearer rail_sk_test_…"
Response:
El widget de Rail Connect maneja el flow de credenciales y MFA sin que tu app las vea nunca.
curl https://api.rail.cl/v1/widget_tokens \
-X POST \
-H "Authorization: Bearer rail_sk_test_…" \
-H "Content-Type: application/json" \
-d '{
"bank_id": "banco_estado"
}'
Response:
{
"object": "widget_token",
"id": "wt_a1b2c3d4_sec_…",
"expires_at": "2026-06-03T20:00:00Z"
}
<script src="https://widget.rail.cl/v1/embed.js"></script>
<script>
Rail.openWidget({
token: 'wt_a1b2c3d4_sec_…',
publishableKey: 'rail_pk_test_…',
onSuccess: (et) => {
// Mandá el exchange token a tu backend para canjearlo
fetch('/api/rail-callback', {
method: 'POST',
body: JSON.stringify({ exchange_token: et })
});
},
});
</script>
Backend: canjeá el exchange token por el link
curl https://api.rail.cl/v1/exchange_tokens/et_… \
-X POST \
-H "Authorization: Bearer rail_sk_test_…"
Response:
{
"object": "exchange_token",
"link_id": "link_8a2f4c6e1b9d5037",
"consumed_at": "2026-06-03T20:01:23Z"
}
Guardá link_id asociado al usuario en tu DB — es la referencia para leer sus cuentas.
4. Leé las cuentas
curl "https://api.rail.cl/v1/accounts?link_id=link_8a2f4c6e1b9d5037" \
-H "Authorization: Bearer rail_sk_test_…"
Response:
[
{
"object": "account",
"id": "acc_7d2f3a8c1e9b4502",
"link_id": "link_8a2f4c6e1b9d5037",
"name": "CuentaRUT",
"type": "checking",
"currency": "CLP",
"balance": {
"available": 500000,
"current": 500000
},
"last_4": "5678"
}
]
5. Leé los movimientos
curl "https://api.rail.cl/v1/accounts/acc_7d2f3a8c1e9b4502/movements?per_page=10" \
-H "Authorization: Bearer rail_sk_test_…"
Response (array de movimientos):
[
{
"object": "movement",
"id": "mov_6c8d1f3a9e5b2074",
"amount": -30000,
"currency": "CLP",
"type": "card_payment",
"description": "MERCADOLIBRE CL",
"post_date": "2026-06-01T04:00:00+00:00"
}
]
Los amounts son bigint en minor units. CLP no tiene centavos → el valor entero es directamente pesos. El signo es parte del valor (negativo = egreso).
Próximos pasos
Refresh Intents
Cómo forzar un sync con MFA async.
Webhooks
Recibí eventos en tiempo real (link.refreshed, etc).