Authentication
This endpoint requires authentication using a Bearer token.
Bearer token for authentication
Path Parameters
UUID of the transaction to delete
Soft Delete Behavior
This endpoint performs a soft delete, which means:
- The transaction is not permanently removed from the database
- The
deletedAt field is set to the current timestamp
- The transaction’s impact on the account balance is reversed
- The transaction will no longer appear in list or get endpoints
- The transaction can potentially be restored by setting
deletedAt to null (though no restore endpoint currently exists)
Balance Restoration
When a transaction is deleted:
- INCOME transactions: The amount is subtracted from the account balance
- EXPENSE transactions: The amount is added back to the account balance
- TRANSFER transactions: The amount is added back to the source account
This ensures the account balance reflects the state as if the transaction never occurred.
Response
Returns a success message confirming the deletion.
Confirmation message: “Transacción eliminada y saldo restaurado.”
Error Responses
Bad Request
- Invalid UUID format
- Transaction has no associated account
Unauthorized - Missing or invalid authentication token
Not Found - Transaction doesn’t exist, doesn’t belong to user, or is already deleted
Example Request
curl -X DELETE https://api.yourfinanceapp.com/api/transactions/a3c4e8f2-9d7b-4a1c-8e3f-2b5d9a7c1e4f \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Example Response
{
"message": "Transacción eliminada y saldo restaurado."
}
Example Scenario
Before Deletion
Account Balance: $10,000 ARS
Transaction to Delete:
- Type: EXPENSE
- Amount: $1,500.75 ARS
- Description: “Compra de comestibles”
After Deletion
Account Balance: $11,500.75 ARS (restored)
Transaction:
deletedAt: “2026-03-04T16:00:00.000Z”
- No longer visible in list/get endpoints
Notes
- Only transactions belonging to the authenticated user can be deleted
- The deletion is atomic - both the soft delete and balance restoration happen in a database transaction
- If the balance restoration fails, the deletion is rolled back
- Already deleted transactions (where
deletedAt is not null) cannot be deleted again and will return a 404 error
- There is currently no API endpoint to permanently delete or restore soft-deleted transactions