Skip to main content
DELETE
/
api
/
transactions
/
:id
Delete Transaction
curl --request DELETE \
  --url https://api.example.com/api/transactions/:id \
  --header 'Authorization: <authorization>'
{
  "400": {},
  "401": {},
  "404": {},
  "message": "<string>"
}

Authentication

This endpoint requires authentication using a Bearer token.
Authorization
string
required
Bearer token for authentication

Path Parameters

id
string
required
UUID of the transaction to delete

Soft Delete Behavior

This endpoint performs a soft delete, which means:
  1. The transaction is not permanently removed from the database
  2. The deletedAt field is set to the current timestamp
  3. The transaction’s impact on the account balance is reversed
  4. The transaction will no longer appear in list or get endpoints
  5. 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.
message
string
Confirmation message: “Transacción eliminada y saldo restaurado.”

Error Responses

400
error
Bad Request
  • Invalid UUID format
  • Transaction has no associated account
401
error
Unauthorized - Missing or invalid authentication token
404
error
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

Build docs developers (and LLMs) love