Contabilidad
Gastos, asientos contables, conciliación bancaria, provisión de fondos y proveedores
curl "https://app.getplea.com/api/accounting/expenses?status=pending" \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const expenses = await fetch('/api/accounting/expenses?status=pending', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
[
{
"id": "exp-uuid-1",
"description": "Material de oficina",
"amount": 85.50,
"taxAmount": 17.96,
"total": 103.46,
"vendorName": "Papelería Central",
"category": "office_supplies",
"status": "pending",
"invoiceNumber": "FC-2026-0234",
"date": "2026-03-05",
"attachmentUrl": "https://storage.googleapis.com/plea-uploads/expense-receipt.pdf",
"createdAt": "2026-03-05T14:00:00Z"
}
]
curl -X POST https://app.getplea.com/api/accounting/expenses \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-H "x-organization-id: ORG_ID" \
-d '{
"description": "Licencia software gestión documental",
"amount": 299.00,
"taxAmount": 62.79,
"category": "software",
"date": "2026-03-01",
"invoiceNumber": "SW-2026-0891"
}'
const expense = await fetch('/api/accounting/expenses', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json',
'x-organization-id': 'ORG_ID'
},
body: JSON.stringify({
description: 'Licencia software gestión documental',
amount: 299.00,
taxAmount: 62.79,
category: 'software',
date: '2026-03-01',
invoiceNumber: 'SW-2026-0891'
})
}).then(r => r.json());
{
"id": "exp-uuid-new",
"description": "Licencia software gestión documental",
"amount": 299.00,
"taxAmount": 62.79,
"total": 361.79,
"category": "software",
"status": "pending",
"date": "2026-03-01",
"createdAt": "2026-03-07T12:00:00Z"
}
curl -X POST https://app.getplea.com/api/accounting/expenses/upload \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID" \
-F "file=@factura_proveedor.pdf"
{
"id": "exp-uuid-ocr",
"description": "Factura detectada: Servicios de consultoría IT",
"amount": 1500.00,
"taxAmount": 315.00,
"total": 1815.00,
"vendorName": "Tech Solutions S.L.",
"invoiceNumber": "TS-2026-0045",
"date": "2026-02-28",
"status": "pending",
"ocrConfidence": 0.95,
"attachmentUrl": "https://storage.googleapis.com/plea-uploads/factura_proveedor.pdf"
}
curl -X POST https://app.getplea.com/api/accounting/expenses/exp-uuid-1/approve \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
await fetch('/api/accounting/expenses/exp-uuid-1/approve', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
});
{
"id": "exp-uuid-1",
"status": "approved",
"approvedBy": "user-uuid-1",
"approvedAt": "2026-03-07T12:30:00Z"
}
curl "https://app.getplea.com/api/accounting/journal-entries?dateFrom=2026-01-01&dateTo=2026-03-31" \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const entries = await fetch('/api/accounting/journal-entries?dateFrom=2026-01-01&dateTo=2026-03-31', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
[
{
"id": "je-uuid-1",
"date": "2026-03-01",
"description": "Factura F-2026/0001 - Elena Martínez",
"entries": [
{ "account": "430", "accountName": "Clientes", "debit": 3025.00, "credit": 0 },
{ "account": "705", "accountName": "Prestaciones de servicios", "debit": 0, "credit": 2500.00 },
{ "account": "477", "accountName": "IVA repercutido", "debit": 0, "credit": 525.00 }
]
}
]
curl "https://app.getplea.com/api/accounting/journal-entries/export?dateFrom=2026-01-01&dateTo=2026-03-31" \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID" \
-o libro_diario.csv
Content-Type: text/csv
Content-Disposition: attachment; filename="libro-diario-2026-Q1.csv"
curl https://app.getplea.com/api/accounting/bank-transactions \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const transactions = await fetch('/api/accounting/bank-transactions', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
[
{
"id": "bt-uuid-1",
"date": "2026-03-05",
"description": "TRANSFERENCIA MARTINEZ RUIZ ELENA",
"amount": 3025.00,
"reconciled": false,
"suggestedMatch": {
"type": "invoice",
"id": "inv-uuid-1",
"number": "F-2026/0001",
"confidence": 0.92
}
}
]
curl -X POST https://app.getplea.com/api/accounting/bank-transactions/bt-uuid-1/reconcile \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-H "x-organization-id: ORG_ID" \
-d '{"matchType": "invoice", "matchId": "inv-uuid-1"}'
await fetch('/api/accounting/bank-transactions/bt-uuid-1/reconcile', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json',
'x-organization-id': 'ORG_ID'
},
body: JSON.stringify({
matchType: 'invoice',
matchId: 'inv-uuid-1'
})
});
{
"id": "bt-uuid-1",
"reconciled": true,
"matchType": "invoice",
"matchId": "inv-uuid-1",
"reconciledAt": "2026-03-07T12:00:00Z"
}
curl https://app.getplea.com/api/accounting/trust-accounts \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const accounts = await fetch('/api/accounting/trust-accounts', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
[
{
"id": "trust-uuid-1",
"clientId": "client-uuid-1",
"clientName": "Elena Martínez Ruiz",
"balance": 5000.00,
"caseId": "case-uuid-1",
"caseNumber": "2026/0042",
"createdAt": "2026-01-20T10:00:00Z"
}
]
curl -X POST https://app.getplea.com/api/accounting/trust-accounts/trust-uuid-1/deposit \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-H "x-organization-id: ORG_ID" \
-d '{"amount": 2000.00, "description": "Provisión para tasas judiciales"}'
await fetch('/api/accounting/trust-accounts/trust-uuid-1/deposit', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json',
'x-organization-id': 'ORG_ID'
},
body: JSON.stringify({
amount: 2000.00,
description: 'Provisión para tasas judiciales'
})
});
{
"id": "trust-uuid-1",
"balance": 7000.00,
"lastTransaction": {
"type": "deposit",
"amount": 2000.00,
"description": "Provisión para tasas judiciales",
"date": "2026-03-07T12:00:00Z"
}
}
curl -X POST https://app.getplea.com/api/accounting/trust-accounts/trust-uuid-1/withdraw \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-H "x-organization-id: ORG_ID" \
-d '{"amount": 350.00, "description": "Pago de tasas judiciales"}'
await fetch('/api/accounting/trust-accounts/trust-uuid-1/withdraw', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json',
'x-organization-id': 'ORG_ID'
},
body: JSON.stringify({
amount: 350.00,
description: 'Pago de tasas judiciales'
})
});
{
"id": "trust-uuid-1",
"balance": 6650.00,
"lastTransaction": {
"type": "withdrawal",
"amount": 350.00,
"description": "Pago de tasas judiciales",
"date": "2026-03-07T12:30:00Z"
}
}
curl https://app.getplea.com/api/accounting/vendors \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const vendors = await fetch('/api/accounting/vendors', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
[
{
"id": "vendor-uuid-1",
"name": "Papelería Central",
"taxId": "B55667788",
"email": "facturas@papeleriacentral.com",
"totalExpenses": 1250.00
},
{
"id": "vendor-uuid-2",
"name": "Tech Solutions S.L.",
"taxId": "B99001122",
"email": "billing@techsolutions.es",
"totalExpenses": 3600.00
}
]
Endpoints del módulo contable: gastos con OCR automático, libro diario, conciliación bancaria, cuentas de provisión de fondos y gestión de proveedores.
Gastos
GET /api/accounting/expenses
Lista los gastos de la organización.
Filtrar: pending, approved, rejected.
Desde fecha (ISO 8601).
Hasta fecha (ISO 8601).
POST /api/accounting/expenses
Crea un nuevo gasto manualmente.
Descripción del gasto.
Importe base (sin IVA).
Importe del IVA.
UUID del proveedor.
Categoría: office_supplies, travel, software, professional_services, other.
Fecha del gasto (ISO 8601).
Número de factura del proveedor.
POST /api/accounting/expenses/upload
Sube una factura de proveedor y extrae los datos automáticamente mediante OCR.
Archivo de la factura (PDF, JPG, PNG).
POST /api/accounting/expenses/:id/approve
Aprueba un gasto pendiente.
UUID del gasto.
Libro Diario
GET /api/accounting/journal-entries
Lista los asientos contables.
Desde fecha (ISO 8601).
Hasta fecha (ISO 8601).
GET /api/accounting/journal-entries/export
Exporta el libro diario en formato CSV.
Desde fecha.
Hasta fecha.
Conciliación bancaria
GET /api/accounting/bank-transactions
Lista las transacciones bancarias importadas.
POST /api/accounting/bank-transactions/:id/reconcile
Concilia una transacción bancaria con una factura o gasto.
UUID de la transacción bancaria.
Tipo de coincidencia: invoice o expense.
UUID de la factura o gasto a conciliar.
Provisión de fondos
GET /api/accounting/trust-accounts
Lista las cuentas de provisión de fondos de clientes.
POST /api/accounting/trust-accounts/:id/deposit
Registra un depósito en la cuenta de provisión.
UUID de la cuenta de provisión.
Importe del depósito.
Descripción del depósito.
POST /api/accounting/trust-accounts/:id/withdraw
Registra una retirada de la cuenta de provisión.
UUID de la cuenta de provisión.
Importe a retirar.
Concepto de la retirada.
Proveedores
GET /api/accounting/vendors
Lista los proveedores de la organización.
Last updated today