Loger Mobile MVP (Expo / React Native) — plan y contrato de API
Estado: backend Phase 0 iniciado y en buena parte hecho. Falta que otro agente arranque la app Expo. Este doc es para que pueda retomarlo sin contexto previo. Branch de trabajo:
chore/laravel-13. Autor del backend: sesión Claude.
Objetivo
Llevar Loger al teléfono con Expo/RN, no a paridad total — solo lo que hace la app usable en el bolsillo. El caso de uso central es capturar y ver rápido: anotar un gasto en dos toques y ver saldos/próximos pagos. Budgets, rollover, conciliación, housing, import se quedan en la web.
Decisión de arquitectura
El backend Laravel es la API. El frontend Vue/Inertia no se reusa en RN (Inertia no existe en RN); se reescribe la UI. Lo que SÍ se reusa: la lógica de negocio (services), la DB, y los JSON de i18n (resources/lang/{es,en}.json, mismas claves).
Decisiones a confirmar con Jesús antes de codear mobile:
- [ ] Repo: ¿repo aparte para el mobile, o carpeta
/mobilejunto al Laravel? (recomendado: repo aparte; el de Laravel es la API) - [ ] UI kit RN (gluestack / Tamagui / RN Paper / NativeBase)
- [ ] Charts: victory-native / react-native-svg, o sin charts en el MVP
- [ ] Base URL por entorno + almacenamiento de token con
expo-secure-store - [ ] Push:
expo-notifications(el backend ya tiene notificaciones; confirmar payloads luego)
Restricciones de entorno (importante para quien continúe)
- La VM puente donde corrió el backend no tiene php/MySQL y no puede hacer push. Jesús hace
git pushy corre migraciones/builds. - El backend se validó con
php -l+ inspección de endpoints en vivo (sesión web logueada), no con la query real contra MySQL. Verificar en deploy. - Mobile: los builds corren en la Mac de Jesús (Expo/EAS, cuentas Apple/ Google). El código se puede generar aquí; el loop de build/device es de él.
Autenticación (token Sanctum — ya existe)
POST /api/sanctum/token
body: { email, password, device_name, code?, recovery_code? }
200 -> "<plainTextToken>" (string JSON plano)
402 -> { status:402, message } (credenciales malas / 2FA requerido)Luego: Authorization: Bearer <token> en todo. GET /api/user -> usuario actual.
Soporta 2FA (TOTP code o recovery_code) igual que el login web.
Quirks de routing (ya verificados en vivo)
routes/api.phpse prefija con/api(RouteServiceProvider). Sus rutas autentican por Bearer token; devuelven 401 a requests con solo cookie — normal, el móvil usa token.- Las rutas
/api/*definidas enroutes/web.phpautentican por cookie o token; para el móvil se usan solo GET. - Las multi-currency viejas quedaron doble-prefijadas (
/api/api/multi-currency/...). No usarlas; usar/api/mobile/*.
Contrato de API para el MVP (URLs y formas reales)
Nuevo en esta sesión (/api/mobile/*, token)
GET /api/mobile/overview — payload de home en una sola llamada:
{
"accounts": [{ "id","name","current_balance" (float),"balance_type",
"currency_code","account_detail_type_id",
"credit_closing_day","type" }],
"netWorth": { "assets": float, "debts": float, "net": float },
"nextPayments": [ /* ver /api/next-payments.data */ ],
"cardsToPay": [ /* subset type=credit_card_payment */ ]
}GET /api/mobile/today — el "Hoy" de la web en una llamada (TodayService::buildPayload):
{
"money": { "today_spent": float, "daily_remaining": float, "month_remaining": float,
"days_in_month_left": int, "currency_code": string|null },
"attention": [{ "id","type","message","cta",... }], // alertas watchlist + metas sub-fondeadas (≤7 días)
"today": [{ "kind": "planner"|"relationship", "id","name","subtitle","status","total"? }],
"upcoming": [{ "kind": "billing_cycle"|"utility"|"planner", "id","name","account_id","total",
"due_at": "YYYY-MM-DD", "days_until": int }], // days_until < 0 = vencido
"meal": [{ "id","meal_id","name","meal_type","is_liked","date","day_label" }], // semana en curso
"pending_review_count": 3 // borradores en bandeja (badge); usa TransactionService::getDraftCount
}money.currency_code puede venir null: usar la moneda de las cuentas de /api/mobile/overview. pending_review_count (int): cantidad de transacciones status=draft del team. Sirve para la insignia de la bandeja sin tener que traer las filas completas.
POST /api/mobile/transactions — quick-add (reusa MultiCurrency@store):
body: {
"account_id": int (req),
"total": number > 0 (req),
"currency_code": "DOP" (req, size 3),
"description": string (req),
"date": "YYYY-MM-DD" (req),
"direction": "WITHDRAW" | "DEPOSIT" (req), // también acepta "credit" | "debit" (legacy, ver nota)
"category_id": int?, "payee_id": int?, "counter_account_id": int?,
"status": "draft" | "verified"? // default verified
}
-> { success:true, data: <MultiCurrencyTransactionResource> }Semántica de
direction: lo que guarda el modelo esDIRECTION_DEBIT='DEPOSIT'(entrada, type 1) yDIRECTION_CREDIT='WITHDRAW'(salida, type -1). EnviarWITHDRAWpara un gasto yDEPOSITpara un ingreso; las lecturas (GET /api/mobile/transactions) devuelven esos mismos valores.credit/debitsiguen siendo válidos solo por compatibilidad: el controlador los guarda tal cual, sin convertirlos, así que no equivalen aWITHDRAW/DEPOSITen los cálculos. No usarlos en clientes nuevos. Transferencias: usarcounter_account_id(fuera del MVP mínimo).
GET /api/mobile/transactions — recientes (MultiCurrency@index).
Ya existían (reusar tal cual)
| Uso | Endpoint | Grupo auth | Forma |
|---|---|---|---|
| Cuentas (completo) | GET /api/accounts | web (cookie+token) | modelos Account completos, incluye current_balance, balance_type, currency_code, credit_closing_day |
| Categorías (picker) | GET /api/categories | web | grupos top-level + subCategories (⚠️ estaba en 500, arreglado) |
| Payees (picker) | GET /api/payees | web | 429 filas {id,name,account_id,...} (pesado → ideal búsqueda server-side) |
| Recientes / lista | GET /api/finance/transactions?filter[account]=ID | web | lista con filtros (QuerifySlim) |
| Próximos pagos | GET /api/next-payments | web | {summary:{total_amount,total_count,by_type}, data:[{id,type,description,title,total,due_date,date,category_id,category_name,status,source,metadata}]} |
| Tarjetas (resumen) | GET /credit-card-summary | token/cookie | {payInFull:[{account_id,account_name,total,due_at,days_until,is_overdue,...}], inactive:[...]} |
| Dashboard rico (opcional) | GET /api/dashboard | token | {netWorth, nextPayments, budgetTotal, transactionTotal, expenses, spendingSummary, meals, checks} |
Pantallas del MVP (5–6) → datos
- Login →
POST /api/sanctum/token - Home (saldos, patrimonio, próximos pagos, tarjetas a pagar) → 1 llamada
GET /api/mobile/overview - Quick-add gasto/ingreso →
POST /api/mobile/transactions; pickers deGET /api/accounts,GET /api/categories,GET /api/payees - Cuentas + saldos →
accountsde/api/mobile/overview(o/api/accounts) - Detalle de cuenta / transacciones recientes →
GET /api/finance/transactions?filter[account]=ID - Tarjetas →
GET /credit-card-summary
Estado del backend
Hecho en esta sesión (en chore/laravel-13, falta push + deploy, sin migración)
- [x] Fix 500
GET /api/categories(faltabaindex()) — commit28c4f49d - [x] Superficie
/api/mobile/*(overview + GET/POST transactions) — commit3b016ddd
Ya estaba
- [x] Login por token (
/api/sanctum/token),/api/user,/api/dashboard - [x]
/api/accounts,/api/next-payments,/credit-card-summary,/api/payees,/api/finance/transactions
Backend opcional / para después
- [ ]
AccountResourceslim (hoy/api/accountsmanda el modelo completo) - [ ] Búsqueda server-side de payees (429 filas; hay payees con
namevacío) - [ ] Soporte de transferencia en quick-add (
counter_account_id) + validación - [ ] i18n de mensajes de la API si hiciera falta
- [ ] Confirmar que
/api/mobile/overviewcorre OK contra MySQL real (no se pudo testear desde la VM)
Tareas Mobile (para el agente que retome)
Phase 1 — Esqueleto Expo
- [ ] Proyecto Expo (TS), navegación (expo-router o react-navigation)
- [ ] Cliente API + base URL por entorno
- [ ] Flujo de auth: login → guardar token en
expo-secure-store→ interceptor Bearer → logout/expiración - [ ] Reusar
resources/lang/{es,en}.jsonpara i18n
Phase 2 — Pantallas core
- [ ] Home desde
/api/mobile/overview(saldos, patrimonio, próximos, tarjetas a pagar) - [ ] Quick-add (gasto/ingreso) con pickers →
POST /api/mobile/transactions - [ ] Lista de cuentas + saldos
- [ ] Transacciones recientes por cuenta
Phase 3 — Tarjetas + patrimonio
- [ ] Pantalla de tarjetas (
/credit-card-summary) - [ ] Glance de patrimonio (de
overview.netWorth)
Phase 4 — Pulido + release
- [ ] Pruebas en device real, estados de error/empty/loading
- [ ] Config EAS build (iOS/Android)
- [ ] Push con
expo-notifications - [ ] Distribución interna (TestFlight / internal track)
Para empezar el mobile (sugerencia de primer paso)
- Confirmar con Jesús las decisiones de arquitectura de arriba.
- Jesús despliega el backend (
git push+php artisan route:clear/ deploy;yarn buildsolo si tocó la web — aquí no). - Verificar en vivo con un token:
GET /api/mobile/overview,POST /api/mobile/transactions. - Scaffoldear Expo (Phase 1).
Esquema de payloads y respuestas (con ejemplos)
Los nombres y tipos de campo son reales (capturados en vivo + del código). Los valores son ilustrativos/sanitizados (no son datos reales). Los endpoints
/api/mobile/*aún no están deployados: sus ejemplos se derivan del controlador, no de una captura en vivo — confirmar formas exactas tras deploy.
Errores comunes (rutas autenticadas)
401 { "message": "Unauthenticated." } // token ausente/inválido/expirado
403 { "message": "This action is unauthorized." } // Gate (p.ej. recurso de otro team)
422 { "message": "The given data was invalid.",
"errors": { "campo": ["mensaje"] } } // validación
404 { "message": "..." } // no encontrado
500 { "message": "Server Error" } // (debug oculto en prod)1. Login — POST /api/sanctum/token (sin auth)
Request:
// headers: Accept: application/json
{ "email": "user@example.com", "password": "••••••",
"device_name": "jesus-iphone-15", // req: nombra el token
"code": "123456", // opc: TOTP 2FA
"recovery_code": "xxxx-xxxx" } // opc: alterno al TOTP200 — string JSON plano con el token (guardar en secure-store):
"3|AbCdEf0123456789plainTextTokenHere"402 — credenciales malas / 2FA requerido:
{ "status": 402, "message": "The provided credentials are incorrect." }2. Usuario — GET /api/user (Bearer)
200 → objeto User (id, name, email, current_team_id, …).
3. Home — GET /api/mobile/overview (Bearer)
{
"accounts": [
{ "id": 101, "name": "BHD Cuenta Corriente", "current_balance": 15230.55,
"balance_type": "DEBIT", "currency_code": "DOP", "detail_type": "bank",
"account_detail_type_id": 2, "credit_closing_day": null, "credit_limit": null,
"type": 1, "reconciliation_last": { "status": "completed", "amount": 15230.55 } },
{ "id": 1735, "name": "Qik Visa Clásica", "current_balance": -20056.92,
"balance_type": "CREDIT", "currency_code": "DOP", "detail_type": "credit_card",
"account_detail_type_id": 6, "credit_closing_day": 25, "credit_limit": 290000.00,
"type": -1, "reconciliation_last": null }
],
"netWorth": { "assets": 1400000.00, "debts": -1034000.00, "net": 366000.00 },
"nextPayments": [ /* items = /api/next-payments.data, ver §9 */ ],
"cardsToPay": [ /* subset de nextPayments con type == "credit_card_payment" */ ]
}balance_type llega en MAYÚSCULAS (DEBIT=activo, CREDIT=pasivo). type: 1=activo, -1=pasivo. detail_type ∈ bank|cash|cash_on_hand|savings|credit_card|property|loan (la app agrupa por él; cae a balance_type si falta). current_balance viene de $account->balance. Las cuentas con closed_at quedan fuera. net = assets + debts (debts negativo). credit_limit (float|null): si > 0, la cuenta es tarjeta de crédito. Crédito disponible = credit_limit + current_balance (el saldo es negativo). reconciliation_last ({status, amount} | null): status ∈ completed|pending. Conciliada = status === 'completed' y |amount − current_balance| < 0.01.
3b. Hoy — GET /api/mobile/today (Bearer)
{
"money": { "today_spent": 1850.0, "daily_remaining": 2410.5, "month_remaining": 62673.0,
"days_in_month_left": 26, "currency_code": null },
"attention": [
{ "id": "9f1c…", "type": "watchlist_threshold", "message": "Comida alcanzó el 90% del presupuesto", "cta": "Ver", "link": "/budgets" },
{ "id": "target-1040", "type": "target_underfunded", "message": "Loan vehicle 27th: faltan 11,956.77 antes del 27 Oct",
"cta": "Asignar", "category_id": 1040, "needed": 11956.77, "due_date": "2026-10-27" }
],
"today": [
{ "kind": "planner", "id": "planner-12", "name": "Pagar internet", "subtitle": null,
"status": "pending", "total": 1500.0 }
],
"upcoming": [
{ "kind": "billing_cycle", "id": "cycle-77", "name": "Qik Visa Clásica", "account_id": 1735,
"total": 20056.92, "due_at": "2026-10-15", "days_until": 5 }
],
"meal": [
{ "id": 301, "meal_id": 18, "name": "Pollo al horno", "meal_type": "dinner",
"is_liked": false, "date": "2026-10-10", "day_label": "Sábado" }
],
"pending_review_count": 3
}Cada lista puede venir vacía. Valores de ejemplo; los nombres y tipos de campo son los reales.
4. Quick-add — POST /api/mobile/transactions (Bearer)
Request:
{
"account_id": 101, // req
"total": 1850.00, // req, > 0
"currency_code": "DOP", // req, 3 letras
"description": "Supermercado Nacional", // req
"date": "2026-10-10", // req, YYYY-MM-DD
"direction": "WITHDRAW", // req: "WITHDRAW"=salida | "DEPOSIT"=entrada ("credit"/"debit" legacy, sin conversión)
"category_id": 153, // opc
"payee_id": 79, // opc
"counter_account_id": null, // opc (transferencias)
"status": "verified" // opc: "verified" (default) | "draft"
}200/201:
{
"success": true,
"data": {
"id": 98231, "description": "Supermercado Nacional", "total": 1850.0,
"currency_code": "DOP", "date": "2026-10-10", "direction": "WITHDRAW",
"status": "verified", "created_at": "…", "updated_at": "…",
"account": { "id": 101, "name": "BHD Cuenta Corriente", "currency_code": "DOP",
"is_multi_currency": false, "primary_currency": "DOP",
"secondary_currencies": [] },
"category": { "id": 153, "name": "Comida" }, // solo si se envió
"payee": { "id": 79, "name": "Supermercado Nacional" }, // solo si se envió
"multi_currency": { "is_converted": false, "secondary_currency_amount": 1850.0,
"is_secondary_currency": false, "display_currencies": { /* … */ } }
}
}Errores: 422 (campos), 403 (cuenta de otro team).
5. Recientes — GET /api/mobile/transactions (Bearer)
Query: account_id, currency_code, start_date, end_date, limit (1–100, default 20), page. 200 →
{
"success": true,
"data": {
"transactions": [ /* igual que data de §4 */ ],
"pagination": { "current_page": 1, "last_page": 4, "per_page": 20 /* … */ }
}
}6. Cuentas (completo) — GET /api/accounts (Bearer o cookie)
200 → array de modelos Account completos. Campos útiles:
[ { "id": 101, "name": "BHD Cuenta Corriente",
"current_balance": "15230.55", "opening_balance": "0.00", // ⚠️ string
"balance_type": "debit", "currency_code": "DOP",
"account_detail_type_id": 2, "credit_closing_day": null, "credit_min_payment": null,
"is_multi_currency": false, "type": 1, "status": "active",
"display_id": "…", "bank_code": "BHD", "index": 0,
"created_at": "…", "updated_at": "…" } ]7. Categorías (picker) — GET /api/categories (Bearer o cookie)
200 → grupos top-level con subCategories (los seleccionables son las hijas):
[ { "id": 10, "name": "Gastos del hogar", "parent_id": null, "index": 0,
"resource_type": "transactions", "color": "#…", "icon": "…",
"subCategories": [
{ "id": 153, "name": "Comida", "parent_id": 10, "index": 0 },
{ "id": 154, "name": "Alquiler", "parent_id": 10, "index": 1 } ] } ]8. Payees (picker) — GET /api/payees (Bearer o cookie)
200 → array grande (~400+). ⚠️ hay payees con name vacío.
[ { "id": 79, "team_id": 2, "user_id": 2, "account_id": 100,
"name": "Supermercado Nacional", "created_at": "…", "updated_at": "…" } ]9. Próximos pagos — GET /api/next-payments (Bearer o cookie)
{
"summary": { "total_amount": 44056.92, "total_count": 10,
"by_type": { "budget_category": 7, "credit_card_payment": 3 } },
"data": [
{ "id": "budget_3", "type": "budget_category", "description": "Alquiler",
"title": "Alquiler", "total": "24000.00", "due_date": "2026-10-07",
"date": "2026-10-07", "category_id": 154, "category_name": "Alquiler",
"status": "pending", "source": "budget_target",
"metadata": { "target_id": 3, "frequency": "MONTHLY" } },
{ "id": "cc_payment_1735_2026-11", "type": "credit_card_payment",
"title": "Credit Card Payment - Qik Visa Clásica", "total": 20056.92,
"due_date": "2026-11-10", "account_id": 1735, "status": "pending",
"source": "dynamic_calculation", "cut_date": "2026-10-25",
"statement_unpaid": true, "metadata": { /* … */ } }
]
}Tipos de item: budget_category, credit_card_payment, planned_transaction. status ∈ { pending, overdue }.
10. Tarjetas — GET /credit-card-summary (Bearer o cookie)
{
"payInFull": [ // tarjetas con estado sin pagar y vencimiento cerca/pasado
{ "account_id": 1735, "account_name": "Qik Visa Clásica", "total": 20056.92,
"due_at": "2026-11-10", "days_until": 30, "is_overdue": false,
"statement_unpaid": true, "cut_date": "2026-10-25", "days_since_cut": 5 } ],
"inactive": [ // candidatas a cancelar: saldo 0 y sin actividad 6+ meses
{ "account_id": 1800, "account_name": "Tarjeta vieja", "total": 0,
"months_inactive": 8 } ]
}(Campos de ciclo como days_since_cut/months_inactive son ilustrativos — confirmar en deploy.)
11. Lista por cuenta — GET /api/finance/transactions?filter[account]=ID (Bearer o cookie)
200 → lista filtrada (QuerifySlim). Soporta filter[...], page, etc. Item ≈ transacción con id, date, description, total/amount, direction, status, category, payee, account_id. (Confirmar forma exacta en deploy.)
12. Presupuesto — GET /api/mobile/budget?month=YYYY-MM (Bearer)
{
"month": "2026-10",
"ready_to_assign": -1000.00,
"groups": [
{ "id": 10, "name": "Gastos del hogar", "kind": "expense",
"budgeted": 35000.0, "activity": -18500.0, "available": 16500.0,
"children": [
{ "id": 153, "name": "Comida", "budgeted": 20000.0, "activity": -12000.0, "available": 8000.0,
"left_from_last_month": 0.0, "funded_spending": 0.0, "payments": 0.0, "has_target": true,
"target": { "amount": 20000.0, "needed": 12000.0, "due_date": "2026-10-15", "frequency": "MONTHLY", "target_type": "spending" } },
{ "id": 154, "name": "Alquiler", "note": "Due on the 5th", "budgeted": 15000.0, "activity": -6500.0, "available": 8500.0,
"left_from_last_month": 0.0, "funded_spending": 0.0, "payments": 0.0, "has_target": false,
"target": null }
] },
{ "id": 99, "name": "Credit Card Payments", "kind": "credit_card_payments",
"budgeted": 110506.59, "activity": -90000.0, "available": 20506.59,
"children": [
{ "id": 500, "name": "Qik Visa Clásica", "budgeted": 110506.59, "activity": -90000.0, "available": 20506.59,
"left_from_last_month": 0.0, "funded_spending": 0.0, "payments": 0.0, "has_target": false, "target": null }
] }
],
"summary": {
"rows": [
{ "currency_code": "DOP", "available": 1509751.30, "to_assign": -1000.00,
"budget_total": 1508751.30, "cash_in_accounts": 1477084.79, "difference": 31666.51 }
],
"uncategorized": [
{ "currency_code": "DOP", "total": 29000.00, "count": 3 }
]
}
}RTA = inflow.activity + inflow.left_from_last_month - totalAssigned (misma fórmula que la web). totalAssigned = sum of budgeted across ALL outflow groups (including Credit Card Payments). Each group has kind: "expense" or "credit_card_payments". Excludes only Ready to Assign and Inflow. summary.rows[]: one row per currency with reconciliation data matching BudgetReconcileBanner.vue. Each category's available is routed to its linked account's currency (or team base currency). to_assign only appears on the base-currency row; others get 0. cash_in_accounts = sum of on-budget account balances for that currency (excludes credit cards, resource-type accounts, and closed accounts). Rows where both budget_total and cash_in_accounts are near zero are omitted. summary.uncategorized[]: verified expense transactions with no category (all dates, same scope as the web's BudgetReconcileBanner). Each entry: {currency_code, total, count}.
13. Asignar presupuesto — POST /api/mobile/budget/assign (Bearer)
{ "category_id": 153, "month": "2026-10", "budgeted": 20000.0 }budgeted es el total del mes (se fija, no se suma). → { "success": true }
14. Mover presupuesto — POST /api/mobile/budget/move (Bearer)
{ "source_category_id": 153, "destination_category_id": 154, "month": "2026-10", "amount": 5000.0 }amount se recorta a lo disponible en origen. → { "success": true }
14b. Copiar del mes anterior — POST /api/mobile/budget/months/{YYYY-MM}/copy-from-previous (Bearer)
{ "overwrite": false } // optional, default falseCopia todas las asignaciones (budgeted > 0) del mes anterior al mes indicado. Excluye categorías reservadas (Ready to Assign, Inflow, Credit Card Payments). Usa registerAssignment() (misma lógica que assign manual, con rollover).
- Sin
overwritey el mes ya tiene asignaciones →409 { "has_assignments": true, "count": 5 }. La app muestra confirmación y reenvía conoverwrite: true. - Con
overwrite: trueo mes vacío →200 { "success": true, "copied": 5, "skipped": 0 }.skipped= categorías con monto idéntico al anterior (sin cambio).
14c. Grupos de presupuesto — CRUD (Bearer)
Crear: POST /api/mobile/budget/groups
{ "name": "Entertainment" }
// → 201 { "id": 42, "name": "Entertainment" }Renombrar: PATCH /api/mobile/budget/groups/{id}
{ "name": "Fun Money" }
// → 200 { "id": 42, "name": "Fun Money" }No se pueden renombrar grupos reservados (Inflow, Ready to Assign, Credit Card Payments) → 422.
Eliminar: DELETE /api/mobile/budget/groups/{id}
// → 200 { "success": true }Las subcategorías se mueven al primer grupo no-reservado. No se pueden eliminar grupos reservados → 422.
14d. Categorías de presupuesto — CRUD (Bearer)
Crear: POST /api/mobile/budget/categories
{ "name": "Groceries", "group_id": 42 }
// → 201 { "id": 200, "name": "Groceries", "group_id": 42 }Editar (nombre, nota, mover a grupo): PATCH /api/mobile/budget/categories/{id}
{ "name": "Food", "note": "Includes restaurants", "group_id": 10 }
// → 200 { "id": 200, "name": "Food", "note": "Includes restaurants", "group_id": 10 }Todos los campos son opcionales; enviar solo los que cambian. note se almacena como categories.description.
Eliminar: DELETE /api/mobile/budget/categories/{id}
// → 200 { "success": true }422 si la categoría tiene transacciones o movimientos de presupuesto asociados.
14e. Metas de presupuesto (Targets) — CRUD (Bearer)
Crear: POST /api/mobile/budget/categories/{id}/targets
{ "target_type": "spending", "amount": 5000, "frequency": "MONTHLY", "frequency_month_date": 15, "notify": true }
// → 201 { "id": 8, "target_type": "spending", "amount": 5000, "frequency": "MONTHLY",
// "frequency_month_date": 15, "frequency_week_day": null, "frequency_date": null,
// "notify": true, "snoozed_month": null, "completed_at": null, "loan": null }target_type: spending | saving_balance | savings_monthly | debt_monthly_payment | loan. frequency: MONTHLY | WEEKLY | DATE. Para loan: enviar principal, interest_rate, term_months, loan_start_date; la app calcula amount (cuota mensual). 422 si la categoría ya tiene una meta.
Editar: PUT /api/mobile/budget/categories/{id}/targets/{targetId}
{ "amount": 7000, "frequency_month_date": 20 }
// → 200 { ...target completo actualizado }Completar: POST /api/mobile/budget/categories/{id}/targets/{targetId}/complete
{ "completed_at": "2026-10" } // opcional; si no, usa el último mes con transacciones
// → 200 { ...target con completed_at }Snooze (toggle): PATCH /api/mobile/budget/categories/{id}/snooze-target
{ "month": "2026-10" }
// → 200 { ...target con snoozed_month: "2026-10" (o null si ya estaba snoozed) }Silencia la alerta de "sub-fondeado" para un solo mes sin tocar la meta.
El target completo en GET /budget ahora incluye: id, target_type, amount, needed, due_date, frequency, frequency_month_date, frequency_week_day, frequency_date, notify, snoozed_month, completed_at, loan: {principal, interest_rate, term_months, loan_start_date} | null.
14f. Transacciones de una categoría — GET /api/mobile/budget/categories/{id}/transactions?month=YYYY-MM (Bearer)
// GET /api/mobile/budget/categories/153/transactions?month=2026-10&page=1&limit=50
{
"data": [
{ "id": 5001, "description": "Supermercado Nacional", "total": 1500.50,
"currency_code": "DOP", "date": "2026-10-18", "direction": "WITHDRAW",
"status": "verified", "account": { "id": 1, "name": "BHD" },
"payee": { "name": "Supermercado Nacional" } }
],
"last_page": 1
}Filtra por category_id y rango del mes. month es obligatorio. Paginado con page y limit (default 50, max 100).
14g. Pagos de tarjeta de crédito — enrichment en GET /api/mobile/budget
Las categorías hijas del grupo credit_card_payments incluyen un campo payment:
{
"id": 42, "name": "Visa Gold Payment", "payment": {
"account_id": 7,
"owed": 15000.00, // max(0, -account.balance)
"set_aside": 10000.00, // = available (budgeted for this category)
"gap": 5000.00, // max(0, owed - set_aside)
"coverage_pct": 66, // min(100, round(set_aside/owed * 100))
"ready_to_pay": false // gap <= 0
}
}Para categorías que NO pertenecen al grupo CC, payment es null.
14h. Movimientos de una categoría — GET /api/mobile/budget/categories/{id}/movements?month=YYYY-MM (Bearer)
// GET /api/mobile/budget/categories/42/movements?month=2026-10
{
"data": [
{ "id": 1, "type": "movement", // "movement" | "assignment"
"amount": 500.00, "date": "2026-10-18",
"from": { "id": 42, "name": "Groceries" },
"to": { "id": 43, "name": "Transport" },
"created_at": "2026-10-18T14:30:00+00:00" }
]
}Devuelve movimientos y asignaciones que involucren la categoría dada en el mes. type=assignment tiene from: null.
14i. Eliminar movimiento — DELETE /api/mobile/budget/movements/{id} (Bearer)
{ "success": true }Revierte el movimiento (devuelve fondos al origen) y elimina el registro. Recalcula rollover.
14j. Ready to Assign info — enrichment en GET /api/mobile/budget
El response incluye ready_to_assign_info:
{
"ready_to_assign_info": {
"status": "available", // "available" | "overspent" | "empty"
"amount": 5000.00,
"scheduled_total": 1200.00, // facturas pendientes del mes
"after_scheduled": 3800.00, // amount - scheduled_total
"default_savings_category_id": 42, // null si no hay
"default_spending_category_id": 55 // null si no hay
}
}14k. Repartir sobrante — POST /api/mobile/budget/ready-to-assign/allocate (Bearer)
// Request
{ "month": "2026-10", "splits": [
{ "destination_category_id": 42, "amount": 3000 },
{ "destination_category_id": 55, "amount": 2000 }
]}
// Response
{ "success": true }Mueve dinero de Ready to Assign a una o más categorías. Equivale al "All to Savings / All to Spending / 50-50" de la web.
14l. Cubrir sobre-asignación — POST /api/mobile/budget/ready-to-assign/cover (Bearer)
// Request
{ "month": "2026-10", "source_category_id": 42, "amount": 1500 }
// Response
{ "success": true }"Fix this": mueve dinero de una categoría hacia Ready to Assign para cubrir un RTA negativo.
14m. Rol por defecto de categoría — PATCH /api/mobile/budget/categories/{id}/default-role (Bearer)
// Request
{ "role": "savings" } // "savings" | "spending" | null (para quitar)
// Response
{ "id": 42, "role": "savings" }Asigna el rol por defecto (ahorro / gasto) para la acción "Todo a Ahorro / Todo a Gasto". Un solo default por rol por equipo.
15. Calendario — GET /api/mobile/calendar?month=YYYY-MM (Bearer)
{
"month": "2026-10",
"events": [
{ "id": 12, "planner_id": 12, "title": "Pagar internet", "start": "2026-10-15",
"end": "2026-10-15", "kind": "billing", "status": "pending", "total": 1500.0,
"source": "billing_cycle", "notes": null, "completed_at": null }
]
}Agrega 3 fuentes: planners, billing cycles, occurrences. kind ∈ planner|billing|occurrence|relationship.
16. Rutina semanal — GET /api/mobile/routine (Bearer)
{
"plan": { "id": 5, "days": ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],
"blocks": [
{ "id": 88, "day": 0, "title": "Ejercicio", "start": "06:00", "end": "07:00",
"color": "#6E9BE6", "member_id": null, "note": "" }
] },
"current": { /* bloque activo ahora o null */ },
"next": { /* próximo bloque hoy o null */ }
}day = 0–6 (lunes–domingo). current/next calculados contra la hora local del team.
16b. Crear bloque — POST /api/mobile/routine/{plan}/blocks (Bearer)
// Request
{ "day": 0, "title": "Morning workout", "start": "09:00", "end": "10:00", "color": "#FF5733", "member_id": null, "note": "Gym session" }
// Response 201
{ "id": 88, "day": 0, "title": "Morning workout", "start": "09:00", "end": "10:00", "color": "#FF5733", "member_id": null, "note": "Gym session", "date": null, "skip": false }day 0–6 (Mon–Sun). color, member_id, note opcionales. Soporta date (excepción puntual) y skip (anular bloque).
16c. Editar bloque — PUT /api/mobile/routine/{plan}/blocks/{item} (Bearer)
// Request (misma forma que 16b, todos requeridos)
{ "day": 1, "title": "Yoga", "start": "07:00", "end": "08:00", "color": "#33FF57" }
// Response 200
{ "id": 88, "day": 1, "title": "Yoga", "start": "07:00", "end": "08:00", ... }16d. Eliminar bloque — DELETE /api/mobile/routine/{plan}/blocks/{item} (Bearer)
// Response 200
{ "deleted": true }16e. Copiar día — POST /api/mobile/routine/{plan}/copy-day (Bearer)
// Request
{ "from": 0, "to": [1, 2], "mode": "replace" }
// Response 201
{ "blocks": [ /* bloques creados */ ], "mode": "replace", "replaced": [1, 2] }mode: replace (borra destino primero, default) o append (agrega sin borrar).
16f. Categorías de rutina — GET /api/mobile/routine/{plan}/categories (Bearer)
// Response 200
{ "categories": [ { "color": "#FF0000", "name": "Work" }, { "color": "#00FF00", "name": "Exercise" } ] }16g. Guardar categorías — PUT /api/mobile/routine/{plan}/categories (Bearer)
// Request
{ "categories": [ { "color": "#FF0000", "name": "Work" }, { "color": "#00FF00", "name": "Exercise" } ] }
// Response 200
{ "categories": [ ... ] }17. Crear evento — POST /api/mobile/events (Bearer)
{ "name": "Cita médico", "date": "2026-10-20", "end_date": null, "notes": null, "total": null, "source": null }→ 201 { "success": true, "data": { "id", "name", "date", "status" } }
17b. Editar evento — PATCH /api/mobile/events/{planner_id} (Bearer)
// Request (todos opcionales)
{ "name": "Cita reprogramada", "date": "2026-10-25", "end_date": null, "notes": "Cambio", "total": 500 }
// Response
{ "success": true, "event": { "id": 12, "planner_id": 12, "title": "Cita reprogramada",
"start": "2026-10-25", "end": "2026-10-25", "status": "pending",
"total": 500, "notes": "Cambio", "completed_at": null } }17c. Eliminar evento — DELETE /api/mobile/events/{planner_id} (Bearer)
→ { "deleted": true }
18. Completar evento — PATCH /api/mobile/events/{planner_id}/complete (Bearer)
{ "notes": "Pagado con tarjeta" } // opcional→ { "success": true }
18b. Cancelar evento — PATCH /api/mobile/events/{planner_id}/cancel (Bearer)
→ { "success": true }
18c. Reabrir evento — PATCH /api/mobile/events/{planner_id}/reopen (Bearer)
→ { "success": true } Devuelve el evento a pending y limpia completed_at.
19. Transferencia — POST /api/mobile/transfers (Bearer)
{ "from_account_id": 101, "to_account_id": 1735, "total": 20000.0, "description": "Pago tarjeta", "date": "2026-10-10" }→ 201 { "success": true, "data": { "id", "description", "total", "date" } }
20. Tareas del hogar — GET /api/mobile/chores?done=today|all (Bearer)
{
"chores": {
"id": 1, "name": "CHORES",
"fields": [ /* board field definitions */ ],
"labels": [ /* board labels */ ],
"stages": [
{ "id": 1, "board_id": 1, "name": "Main",
"items": [
{ "id": 42, "title": "Lavar platos", "resource_type": null, "is_done": false,
"rrule": "DTSTART:20261017\nRRULE:FREQ=DAILY;INTERVAL=1;UNTIL=30991231",
"points": null, "commit_date": null, "color": null, "stage": "Main", "board_id": 1,
"fields": [
{ "id": 10, "name": "Owner", "value": "Jesus", "type": "text", "options": null }
],
"owner": "Jesus" }
] }
]
},
"members": [ { "id": 1, "name": "Jesus" }, { "id": 2, "name": "Karla" } ]
}done=today (default): pendientes + completadas hoy. done=all: todas. Cada item lleva campos dinámicos aplanados (owner, etc.) además del array fields. is_done + commit_date determinan el estado. rrule indica recurrencia (daily/weekly/once). members = perfiles del team, para filtrar por persona.
21. Toggle tarea — PATCH /api/mobile/chores/{item_id}/toggle (Bearer)
→ { "success": true, "is_done": true, "commit_date": "2026-10-17" } Flip is_done. Para tareas recurrentes, el modelo auto-estampa commit_date al completar y la limpia al deshacer. El cron chores:reset-recurring resetea las diarias.
22. Crear tarea — POST /api/mobile/chores (Bearer)
{ "title": "Barrer terraza", "owner": "Karla", "recurrence": "daily" }recurrence ∈ daily|weekdays|weekly|once (default: daily vía boot del modelo). owner se guarda como campo dinámico del plan item. → 201 { "success": true, "data": { "id", "title", "is_done", "rrule" } }
22b. Editar tarea — PATCH /api/mobile/chores/{item_id} (Bearer)
// Request (todos opcionales)
{ "title": "Barrer sala", "owner": "Jesus", "recurrence": "weekly" }
// Response
{ "id": 42, "title": "Barrer sala", "is_done": false, "rrule": "...", "commit_date": null, "owner": "Jesus" }recurrence: "once" quita la recurrencia (rrule = null). owner crea/actualiza el campo dinámico.
22c. Eliminar tarea — DELETE /api/mobile/chores/{item_id} (Bearer)
{ "deleted": true }23. Plan de comidas — GET /api/mobile/meals?start=YYYY-MM-DD&end=YYYY-MM-DD (Bearer)
{
"start": "2026-10-12", "end": "2026-10-18",
"meals": [
{ "id": 301, "mealId": 18, "name": "Pollo al horno", "mealTypeName": "Almuerzo",
"is_liked": false, "is_meal_liked": true, "mealTypeId": 2, "date": "2026-10-15" }
],
"mealTypes": [ { "id": 1, "name": "Desayuno" }, { "id": 2, "name": "Almuerzo" }, { "id": 3, "name": "Cena" } ]
}Defaults: semana en curso (lunes–domingo). meals usa PlannedMealResource. mealTypes para que la app sepa qué tipos de comida hay configurados.
24. Recetas — GET /api/mobile/meals/recipes (Bearer)
{
"recipes": [
{ "id": 18, "name": "Pollo al horno", "meal_type": "Almuerzo", "meal_type_id": 2, "is_liked": true }
]
}Todas las recetas del team. is_liked para filtrar favoritas client-side.
24b. Programar comida — POST /api/mobile/meals/plan (Bearer)
// Request
{ "meal_id": 18, "date": "2026-10-20", "meal_type_id": 2 }
// Response 201
{ "success": true, "plan": { "id": 44, "mealId": 3, "name": "Pollo al horno", "mealTypeName": "Almuerzo", "is_liked": false, "is_meal_liked": true, "mealTypeId": 2, "date": "2026-10-20" } }Usa MealService::scheduleMealOnDate. Crea MealPlan + Planner.
24c. Mover comida — PATCH /api/mobile/meals/plan/{planner} (Bearer)
// Request (todos opcionales)
{ "date": "2026-10-22", "meal_type_id": 3, "meal_id": 19 }
// Response 200
{ "success": true, "plan": { /* PlannedMealResource */ } }Actualiza fecha, tipo de comida o cambia la receta.
24d. Quitar comida del plan — DELETE /api/mobile/meals/plan/{planner} (Bearer)
// Response 200
{ "success": true }Borra el Planner y su MealPlan asociado.
24e. Crear receta — POST /api/mobile/meals/recipes (Bearer)
// Request
{ "name": "Pasta Carbonara", "meal_type_id": 2, "notes": "Receta clásica", "ingredients": [ { "name": "Spaghetti", "quantity": 500, "unit": "g" }, { "name": "Bacon", "quantity": 200, "unit": "g" } ] }
// Response 201
{ "success": true, "recipe": { "id": 25, "name": "Pasta Carbonara", "meal_type": "Almuerzo", "meal_type_id": 2, "notes": "Receta clásica", "is_liked": false, "ingredients": [ { "id": 1, "name": "Spaghetti", "quantity": 500, "unit": "g" } ] } }Solo name es obligatorio. ingredients y notes son opcionales.
24f. Editar receta — PATCH /api/mobile/meals/recipes/{meal} (Bearer)
// Request (todos opcionales)
{ "name": "Nuevo nombre", "meal_type_id": 3, "notes": "Notas actualizadas", "ingredients": [ { "name": "Arroz", "quantity": 2, "unit": "cups" } ] }
// Response 200
{ "success": true, "recipe": { /* misma forma que 24e */ } }Si se envía ingredients, reemplaza todos los ingredientes existentes.
24g. Borrar receta — DELETE /api/mobile/meals/recipes/{meal} (Bearer)
// Response 200
{ "success": true }24h. Favorita (toggle) — POST /api/mobile/meals/recipes/{meal}/favorite (Bearer)
// Response 200
{ "success": true, "is_liked": true }24i. Receta a lista de compras — POST /api/mobile/meals/recipes/{meal}/shopping-list (Bearer)
// Response 200
{ "success": true }Agrega los ingredientes de la receta a la lista de compras activa.
24j. Comida aleatoria — GET /api/mobile/meals/random?meal_type_id= (Bearer)
// Response 200
{ "meal": { "id": 18, "name": "Pollo al horno", "meal_type": "Almuerzo", "meal_type_id": 2, "is_liked": true, "notes": "..." } | null }Favorece recetas marcadas como favoritas. null si no hay recetas. meal_type_id opcional filtra por tipo.
25. Shopping list — GET /api/mobile/shopping?plan=ID (Bearer)
{
"plan": {
"id": 7, "name": "Shopping List", "share_url": "https://loger.app/shared/list/abc-uuid" | null,
"session": { // sesión activa o null
"id": "uuid", "started_at": "ISO8601", "user_id": 1,
"items": [{ "id": 100, "title": "Manzanas", "stage_id": 15, "category": "Frutas", "details": null }],
"purchased_ids": [100]
},
"visits": [ // últimas 20 visitas, más reciente primero
{ "id": "uuid", "started_at": "ISO8601", "completed_at": "ISO8601",
"user_id": 1, "total": "1250.50", "currency": "DOP", "note": "",
"purchased_items": [{ "id": 100, "title": "Manzanas", "category": "Frutas" }],
"remaining_items": [{ "id": 101, "title": "Bananos" }] }
],
"stages": [
{ "id": 15, "name": "Frutas",
"items": [
{ "id": 100, "title": "Manzanas", "state": "pending", "is_done": false, "order": 0 },
{ "id": 101, "title": "Bananos", "state": "buy", "is_done": true, "order": 1 }
] }
]
},
"lists": [
{ "id": 7, "name": "Shopping List", "total": 12, "pending": 8, "shared": false },
{ "id": 9, "name": "Costco trip", "total": 5, "pending": 5, "shared": true }
],
"activeListId": 7
}?plan=ID switches lists (omit for default). state ∈ pending|buy|skip. Items cycle: pending → buy → skip → pending. is_done syncs with state=buy.
26. Add shopping item — POST /api/mobile/shopping/{plan_id}/items (Bearer)
{ "title": "Leche", "stage_id": 15 }stage_id optional (defaults to first stage). → 201 { "id", "title", "state": "pending", "order", "stage_id" }
27. Cycle shopping item — POST /api/mobile/shopping/{plan_id}/items/{item_id}/cycle (Bearer)
{ "state": "buy" } // optional: explicit state; omit to auto-cycle→ { "id", "state": "buy", "is_done": true }
27b. Stages CRUD — shopping list categories
Create stage: POST /api/mobile/shopping/{plan_id}/stages (Bearer)
{ "name": "Lácteos" }→ 201 { "id", "name", "items": [] }
Rename stage: PATCH /api/mobile/shopping/{plan_id}/stages/{stage_id} (Bearer)
{ "name": "Dairy" }→ { "id", "name" }
Delete stage: DELETE /api/mobile/shopping/{plan_id}/stages/{stage_id} (Bearer) → { "deleted": true } (items move to the first remaining stage)
27c. Item update & delete
Update item: PATCH /api/mobile/shopping/{plan_id}/items/{item_id} (Bearer)
{ "title": "Leche deslactosada", "stage_id": 16 }Both fields optional. → { "id", "title", "state", "stage_id" }
Delete item: DELETE /api/mobile/shopping/{plan_id}/items/{item_id} (Bearer) → { "deleted": true }
27d. Bulk operations
Reset list: POST /api/mobile/shopping/{plan_id}/reset (Bearer) All items → pending / is_done=false. → { "reset": true }
Check all: POST /api/mobile/shopping/{plan_id}/check-all (Bearer) All pending items → buy / is_done=true. → { "checked": true }
27e. Compartir lista
Activar sharing: POST /api/mobile/shopping/{plan_id}/share (Bearer) Idempotente — si ya tiene token, devuelve la misma URL. → { "shared": true, "url": "https://loger.app/shared/list/uuid" }
Desactivar sharing: DELETE /api/mobile/shopping/{plan_id}/share (Bearer) → { "shared": false }
GET /shopping incluye share_url en el plan activo (o null si no está compartida).
27f. Iniciar compra — POST /api/mobile/shopping/{plan_id}/sessions/start (Bearer)
Sin body. Inicia una sesión de compra con los ítems pendientes. → 201 { "session": { id, started_at, user_id, items: [{id, title, stage_id, category, details}], purchased_ids: [] } } Si ya hay una sesión activa, devuelve esa (200). 422 si no hay ítems pendientes. El cycle de ítems actualiza purchased_ids automáticamente cuando hay sesión activa.
27g. Terminar compra — POST /api/mobile/shopping/{plan_id}/sessions/finish (Bearer)
{ "session_id": "uuid", "total": 1250.50, "currency": "DOP", "note": "Compra semanal" }→ { "visit": { id, started_at, completed_at, total, currency, note, purchased_items[], remaining_items[] }, "plan": { ... } } Guarda la visita, reinicia todos los ítems a pending, limpia la sesión activa. 409 si session_id no coincide con la sesión activa. 422 si no hay ítems comprados. currency ∈ DOP|USD|EUR. note opcional (max 2000 chars).
28. Aprobar borrador — POST /api/mobile/transactions/{transaction_id}/approve (Bearer)
Sin body. Cambia status de draft a verified. → { "success": true } Errores: 403 (otro team), 404 (no existe).
29. Borrar transacción — DELETE /api/mobile/transactions/{transaction_id} (Bearer)
Elimina una transacción (borra entries de conciliación asociadas). → { "success": true } Errores: 403 (otro team / Gate), 404.
30. Borrar en lote — POST /api/mobile/transactions/bulk-delete (Bearer)
{ "ids": [98231, 98232, 98240] }→ { "success": true, "deleted": 3 } Solo borra las que pertenecen al team del usuario. Las que no existen o son de otro team se ignoran silenciosamente.
30b. Detalle de transacción — GET /api/mobile/transactions/{id} (Bearer)
→ {
"id": 99001,
"description": "Almuerzo Adrian Tropical",
"total": 850.00,
"currency_code": "DOP",
"date": "2026-10-15",
"direction": "WITHDRAW",
"status": "verified",
"notes": null,
"is_transfer": false,
"account": { "id": 101, "name": "BHD Checking" },
"counter_account": null,
"category": { "id": 42, "name": "Food & Dining" },
"payee": { "id": 15, "name": "Adrian Tropical" },
"exchange_rate": null,
"exchange_amount": null,
"created_at": "2026-10-15T12:30:00Z"
}Incluye account, category, payee con {id, name} o null. exchange_rate/exchange_amount presentes si es transacción multi-moneda.
30c. Editar transacción — PATCH /api/mobile/transactions/{id} (Bearer)
{ "description": "Almuerzo corregido", "category_id": 43, "total": 900.0 }→ { "success": true, "transaction": { "id", "description", "total", "currency_code", "date", "direction", "status", "account", "category", "payee" } } Campos opcionales: description, total, date, account_id, category_id (nullable), payee_id (nullable), direction (DEPOSIT|WITHDRAW), notes. Rechaza transferencias con 422.
30d. Payees — GET /api/mobile/payees?search=&limit= (Bearer)
→ [ { "id": 15, "name": "Adrian Tropical" }, { "id": 22, "name": "Supermercado Nacional" } ]search filtra por nombre (LIKE). limit default 50, max 100. Excluye payees sin nombre.
30e. Crear payee — POST /api/mobile/payees (Bearer)
{ "name": "La Sirena" }→ 201 { "id": 87, "name": "La Sirena" } Si ya existe un payee con ese nombre para el equipo, devuelve el existente (idempotente).
30f. Categorías planas — GET /api/mobile/categories (Bearer)
→ [ { "id": 42, "name": "Food & Dining", "group": { "id": 5, "name": "Expenses" } }, ... ]Solo categorías de transacciones (con parent_id), ordenadas por index. Incluye group con {id, name} del padre.
30g. Transacciones sin categorizar — filtro en GET /api/mobile/transactions
GET /api/mobile/transactions?uncategorized=1¤cy_code=DOP&month=2026-10Nuevos parámetros en el endpoint existente (§5): uncategorized=1 (solo gastos verificados sin categoría y sin ser transferencia), month=YYYY-MM (filtro por mes). Misma paginación y forma de respuesta que §5.
30h. Crear cuenta — POST /api/mobile/accounts (Bearer)
{ "name": "BHD Checking", "detail_type": "bank", "currency_code": "DOP", "credit_limit": 0 }
// detail_type: bank | cash | cash_on_hand | savings | credit_card | property | loan
// Para tarjeta: credit_limit, credit_closing_day, credit_payment_days opcionales→ 201 { "success": true, "account": { "id", "name", "current_balance", "currency_code", "balance_type", "type", "detail_type", "credit_limit", "credit_closing_day", "credit_payment_days", "opening_balance", "closed_at", "reconciliation_last" } }
30i. Detalle de cuenta — GET /api/mobile/accounts/{id} (Bearer)
→ misma forma que account en §30h. Incluye reconciliation_last: { status, amount } | null.
30j. Editar cuenta — PATCH /api/mobile/accounts/{id} (Bearer)
{ "name": "Renamed", "credit_limit": 500000 }→ { "success": true, "account": { ... } } Campos opcionales: name, credit_limit, credit_closing_day, credit_payment_days, currency_code.
30k. Cerrar / reabrir cuenta — PUT /api/mobile/accounts/{id}/close (Bearer)
{ "closed": true } // true = cerrar, false = reabrir→ { "success": true, "closed_at": "2026-10-18T..." | null }
30l. Reconciliación — GET /api/mobile/accounts/{id}/reconciliation (Bearer)
→ Estado actual de conciliación para una cuenta.
{
"reconciliation": { // null si nunca se concilió
"id": 1,
"date": "2026-10-15",
"amount": 1000, // saldo del estado de cuenta
"difference": -50, // ledger − statement
"status": "pending", // "pending" | "completed"
"entries": [ // solo si pending; incluye datos de la transacción
{ "id": 1, "transaction_id": 5, "transaction_line_id": 12, "matched": false,
"description": "Supermercado", "date": "2026-10-10", "total": 500.00, "direction": "WITHDRAW" }
]
},
"cleared_balance": 950 // saldo del libro hasta la fecha
}30m. Crear conciliación — POST /api/mobile/accounts/{id}/reconciliation (Bearer)
{ "balance": 5000, "date": "2026-10-18" }→ 201 con { "reconciliation": { id, date, amount, difference, status, entries[] } }
30n. Marcar entrada — PUT /api/mobile/reconciliations/{id}/entries/{entry_id}/check (Bearer)
{ "matched": true }→ { "id": 1, "matched": true }
30o. Ajuste y completar — PUT /api/mobile/reconciliations/{id}/adjustment (Bearer)
{ "balance": 5000 }→ { "id": 1, "status": "completed", "difference": 0 } Crea transacción de ajuste si |ledger − balance| ≥ 0.005, luego completa.
30p. Eliminar conciliación — DELETE /api/mobile/reconciliations/{id} (Bearer)
→ { "deleted": true } — Solo pending; completed retorna 422.
31. Ocurrencias — GET /api/mobile/occurrences (Bearer)
{
"occurrences": [
{ "id": 5, "name": "Lavar carro", "type": "utility",
"last_date": "2026-10-01", "avg_days_passed": 14.0,
"occurrence_count": 8, "days_since_last": 16, "is_overdue": true,
"days_until_next": -2 }
]
}is_overdue = days_since_last >= avg_days_passed + 3 (misma regla que la web). days_until_next: positivo = faltan días, negativo = vencida, null = sin datos. type ∈ utility|relationship|null. Solo activas (is_active=true) con last_date.
32. Registrar ocurrencia — POST /api/mobile/occurrences/{occurrence_id}/instances (Bearer)
Sin body. Registra "pasó ahora" (fecha de hoy). Recalcula avg_days_passed, last_date, etc. → { "success": true, "last_date": "2026-10-17", "occurrence_count": 9 } Errores: 403 (otro team).
33. Deshacer última ocurrencia — DELETE /api/mobile/occurrences/{occurrence_id}/instances (Bearer)
Sin body. Elimina la última entrada del log y recalcula estadísticas. → { "success": true, "last_date": "2026-10-01", "occurrence_count": 8 } Errores: 403 (otro team).
34. Insights (Tendencias) — GET /api/mobile/insights?months=6&end=2026-10&range=6M (Bearer)
{
"period": { "start": "2026-05-01", "end": "2026-10-31", "months": 6,
"anchor": "2026-10", "is_current": true },
"months": [
{ "month": "2026-05-01", "income": 85000.0, "expense": 62000.0,
"assets": 1200000.0, "debts": -950000.0 }
],
"expense_categories": [ { "id": 153, "name": "Comida", "total": 120000.0 } ],
"income_categories": [ { "id": 200, "name": "Salario", "total": 510000.0 } ],
"expense_payees": [ { "id": 79, "name": "Supermercado Nacional", "total": 45000.0 } ],
"income_payees": [ { "id": 90, "name": "Empresa SA", "total": 510000.0 } ],
"expense_accounts": [ { "id": 101, "name": "BHD Cuenta Corriente", "total": 180000.0 } ],
"credit_cards": {
"has_credit_cards": true,
"credit_total": 45000.0, // total del último ciclo (todas las tarjetas)
"credit_total_previous": 38000.0, // ciclo anterior
"credit_total_delta": 7000.0, // diferencia
"credit_capacity": 290000.0, // suma de credit_limit
"credit_line_usage": 15.52, // % utilización
"cards": [
{ "id": 5, "name": "BHD Visa Gold", "credit_limit": 290000.0,
"cycle_total": 45000.0, "cycle_from": "2026-09-15", "cycle_until": "2026-10-15" }
],
"top_categories": [
{ "card_name": "BHD Visa Gold", "category": "Comida", "total": 18000.0 }
],
"top_payees": [
{ "card_name": "BHD Visa Gold", "payee": "Supermercado Nacional", "total": 12000.0 }
]
}
}Query params:
months(1–12, default 6): ventana de meses.end(YYYY-MM, default mes actual): ancla final del periodo. No permite futuro.range∈1M|3M|6M|YTD|1Y: siYTD,monthsse calcula automáticamente (ene..ancla).
months[].income/expense = flujo mensual. assets/debts = patrimonio a cierre de mes (debts negativo). Categorías/payees/cuentas son totales del periodo completo, ordenados de mayor a menor. credit_cards incluye resumen de tarjetas de crédito: total del ciclo actual vs anterior, utilización, y top categorías/payees por tarjeta (misma fuente que la web: CreditCardReportService). Misma fuente de datos que FinanceTrendController::insights (web), reformateado para mobile.
35. Borrar cuenta — DELETE /api/mobile/account (Bearer)
{ "password": "••••••" } // requerido solo si el usuario tiene contraseña (no social-only)Borra al usuario, sus tokens, foto de perfil, y — si es el único miembro — sus equipos y todos los datos (cuentas, transacciones, presupuesto, etc.). Usa la misma acción que la web (DeleteUser + DeleteTeam). → { "success": true } Errores:
422 { password: ["incorrect"] }— contraseña incorrecta.422 { message: "You own a team with other members…" }— debe transferir el equipo primero.
36. Login con Google — POST /api/mobile/auth/google (sin auth)
{ "id_token": "<Google id_token>", "device_name": "jesus-iphone-15", "name": "Jesus" }Verifica el id_token contra oauth2.googleapis.com/tokeninfo. Vincula por email a un usuario existente o crea uno nuevo (con equipo personal). name es opcional (solo para registro nuevo). → "3|AbCdEf0123456789plainTextTokenHere" (string plano, igual que /api/sanctum/token) Errores: 401 (token inválido). Config requerida: GOOGLE_AUTH_WEB_CLIENT_ID, GOOGLE_AUTH_ANDROID_CLIENT_ID, GOOGLE_AUTH_IOS_CLIENT_ID en .env.
37. Login con Apple — POST /api/mobile/auth/apple (sin auth)
{ "id_token": "<Apple id_token>", "device_name": "jesus-iphone-15", "name": "Jesus" }Verifica el JWT contra Apple JWKS (appleid.apple.com/auth/keys). Vincula por apple_id (sub) o email a usuario existente, o crea uno nuevo. Apple solo envía email la primera vez; puede ser relay privado. → "3|AbCdEf0123456789plainTextTokenHere" (string plano) Errores: 401 (token inválido), 422 (email requerido en primer login). Config requerida: APPLE_AUTH_BUNDLE_ID en .env (default: com.neatlancer.neathome). Migración: google_id y apple_id añadidos a tabla users (2026_10_18_001509).
38. Share-to-app (parsear email bancario) — POST /api/mobile/parse-email (Bearer)
{ "from": "alertas@bhd.com.do", "subject": "Alerta de transacción", "body": "<html>...</html>" }El usuario comparte un email bancario desde la bandeja del teléfono a la app. El backend detecta el banco (BHD, APAP, BSC, Qik) y parsea el email con los mismos parsers que usa el sync de Gmail. Si lo reconoce, crea una transacción borrador. → { "parsed": true, "transaction": { "id": 123, "date": "2026-10-17", "payee": "Supermercado Nacional", "amount": 1500.00, "currency_code": "DOP", "description": "Visa Gold BHD", "status": "draft" } } Si el email no es reconocido: { "parsed": false, "message": "Could not recognize the bank email format." }
39. Dirección de reenvío de emails — GET /api/mobile/inbound-email/address (Bearer)
Sin body. Devuelve la dirección única del usuario para configurar reenvío automático de emails bancarios. → { "address": "txns-42-a1b2c3d4@parse.loger.app" } El usuario añade esta dirección como regla de reenvío en Gmail/Outlook. Los emails reenviados llegan al webhook §40. Config requerida: INBOUND_EMAIL_DOMAIN en .env (default: parse.loger.app).
40. Webhook de email reenviado — POST /api/mobile/inbound-email (sin auth — usuario en recipient)
Endpoint público que recibe emails de Mailgun/Postmark inbound routing. El usuario se resuelve del recipient (txns-{userId}-{hmac}@domain). Acepta los campos estándar de Mailgun:
{ "from": "alertas@bhd.com.do", "recipient": "txns-42-a1b2c3d4@parse.loger.app", "subject": "...", "body-html": "<html>..." }Mismo pipeline de parsing que §38. → { "parsed": true, "transaction": {...} } o { "parsed": false, ... }. Errores: 404 (recipient desconocido), 422 (faltan from o body).
41. Notificaciones — GET /api/mobile/notifications?filter=unread|all&page=1 (Bearer)
Lista paginada (20/pág) de notificaciones del usuario. Cada item:
{
"unread_count": 3,
"data": [
{
"id": "uuid",
"type": "EntryGenerated", // class_basename (sin namespace)
"message": "New transactions have been imported",
"cta": "Review now",
"link": "/finance/transactions?filter[status]=draft",
"data": { "billing_cycle_id": 5 }, // campos extra según el tipo
"read_at": null, // null = no leída
"created_at": "2026-10-17T14:30:00+00:00"
}
],
"current_page": 1,
"last_page": 2
}Tipos posibles: EntryGenerated, BillingCycleCutAlert, PlannedAlert, OccurrenceAlert, TransactionsImported, WatchlistThresholdAlert, WatchlistStreakAlert, WatchlistAutoSuggestionAlert, CreditCardRenewalAlert, LoanPaymentAlert, AccountOverdraftAlert.
42. Marcar notificación leída — PUT /api/mobile/notifications/{id}/read (Bearer)
Sin body. → { "success": true }
43. Marcar todas leídas — PATCH /api/mobile/notifications/read-all (Bearer)
Sin body. → { "success": true }
Estado real de /api/mobile/* — qué ya está y qué falta
La lógica de negocio vive en Actions/Services (compartida con el web); los endpoints mobile la reusan — exponer una pantalla es, en esencia, añadir la ruta JSON. La app Expo vive en otro repo (
loger-mobile). El handoff de backend al día (y los pendientes con prioridad) está en.planning/mobile-backend.md(local, no viaja en git).
Ya expuesto en /api/mobile/* (la app ya lo consume)
Auth:
POST /api/sanctum/token— login (2FA)POST /auth/google— login/registro con Google (sin auth, devuelve token)POST /auth/apple— login/registro con Apple (sin auth, devuelve token)DELETE /account— borrar cuenta permanentemente (destructivo, con confirmación de password)
Tab Hoy:
GET /today— payload de la página Today (money, attention, today, upcoming, meal, pending_review_count)GET /overview— cuentas (agrupables pordetail_type),netWorth, próximos pagos, tarjetas a pagarGET /occurrences— lista de ocurrencias condays_since_last,is_overdue,avg_days_passedPOST /occurrences/{id}/instances— registrar "pasó ahora"DELETE /occurrences/{id}/instances— deshacer última ocurrencia
Tab Agenda:
GET /calendar?month=YYYY-MM— agenda (Planner + ciclos + occurrences)GET /routine— rutina semanal (bloques de tiempo, actual + siguiente)POST /events·PATCH /events/{planner}/complete— crear/completar evento
Tab Comida:
GET /meals?start=YYYY-MM-DD&end=YYYY-MM-DD— plan de comidas de la semana + meal typesGET /meals/recipes— todas las recetas del teamGET /shopping?plan=ID— lista de compras activa (stages + items con estado pending/buy/skip)POST /shopping/{plan}/items— agregar item a la listaPOST /shopping/{plan}/items/{item}/cycle— ciclar estado (pending→buy→skip)
Tab Tareas:
GET /chores?done=today|all— tareas del hogar (plan CHORES conPlanItemResource) + membersPATCH /chores/{item}/toggle— marcar hecha/deshacer (respeta recurrencia)POST /chores— crear tarea (title, owner, recurrence)
Tab Dinero:
GET /budget?month=YYYY-MM— grupos + categorías (budgeted/activity/available),ready_to_assignPOST /budget/assign— fijar el asignado del mes de una categoríaPOST /budget/move— mover dinero entre categoríasGET /transactions·POST /transactions— listar (paginado) + quick-addPOST /transfers— transferencia entre cuentasPOST /transactions/{id}/approve— aprobar borrador (draft → verified)DELETE /transactions/{id}— borrar transacciónPOST /transactions/bulk-delete— borrar en loteGET /insights?months=6&end=YYYY-MM— tendencias (gasto/ingreso/patrimonio por mes, desglose por categoría/payee/cuenta)
Notificaciones:
GET /notifications?filter=unread|all— lista paginada conunread_count, tipo, mensaje, link, datos extraPUT /notifications/{id}/read— marcar una como leídaPATCH /notifications/read-all— marcar todas como leídas
Aún NO expuesto (el web sí lo tiene; falta endpoint mobile)
- Transacciones: editar / recategorizar / mark-as-paid (aprobar/borrar ya expuestos).
- Cuentas (escritura) — link-bank, sync-emails, import PDF/CSV.
Conciliación✅ §30l–§30pComida (escritura)✅ §24b–§24j- Integraciones (Gmail full sync), metas / fondo de emergencia / watchlists, ajustes / perfiles.
Parseo de emails bancarios (alternativa a Gmail sync):
POST /parse-email— share-to-app: parsea email bancario compartido desde el teléfonoGET /inbound-email/address— dirección única del usuario para reenvío automáticoPOST /inbound-email— webhook de email reenviado (público, user en recipient)- Búsqueda de payees (
GET /api/payees?search=, backlog).
Sesión & perfil:
GET /me— perfil del usuario (id, name, email, profile_photo_url, has_password, auth_provider, language, current_team_id)DELETE /session— logout (revoca el token actual)- Token expiration: 90 días (configurable via
SANCTUM_TOKEN_EXPIRATIONenv) DELETE /account— ahora requiere re-verificación:passwordpara cuentas con contraseña,{provider, id_token}para social-only