Skip to main content
PATCH
/
api
/
transactions
/
:id
Update Transaction
curl --request PATCH \
  --url https://api.example.com/api/transactions/:id \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": {},
  "amount": 123,
  "accountId": "<string>",
  "currency": "<string>",
  "description": "<string>",
  "date": "<string>",
  "categoryId": "<string>"
}
'
{
  "400": {},
  "401": {},
  "404": {},
  "id": "<string>",
  "type": "<string>",
  "amount": 123,
  "currency": "<string>",
  "description": "<string>",
  "date": "<string>",
  "account": {},
  "category": {},
  "updatedAt": "<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 update

Request Body

All fields are optional. Only include the fields you want to update.
type
enum
Type of transaction
amount
number
Transaction amount (must be greater than 0.01, max 2 decimal places)
accountId
string
UUID of the account where the transaction impacts
currency
string
Currency code (3 characters max)
description
string
Description of the transaction (max 500 characters)
date
string
ISO 8601 date string for when the transaction occurred
categoryId
string
UUID of the category to associate with this transaction

Update Logic

When you update a transaction, the system:
  1. Reverts the old transaction’s impact on the account balance
  2. Validates the new data (category coherence, account ownership, etc.)
  3. Applies the new transaction data and updates the account balance accordingly
  4. Returns the updated transaction with related data

Account Changes

If you change the accountId, the system will:
  • Remove the transaction impact from the old account
  • Apply the transaction impact to the new account
  • Validate that the new account belongs to the authenticated user

Category Coherence

The category type must match the transaction type (or be “BOTH”):
  • INCOME transaction → INCOME or BOTH category
  • EXPENSE transaction → EXPENSE or BOTH category
  • TRANSFER transaction → Any category type

Response

Returns the updated transaction object with full details.
id
string
Transaction UUID
type
string
Updated transaction type
amount
number
Updated transaction amount
currency
string
Currency code
description
string
Updated description
date
string
Updated transaction date
account
object
Updated account object with new balance
category
object
Updated category object (if applicable)
updatedAt
string
Timestamp of this update

Error Responses

400
error
Bad Request - Validation failed
  • Invalid UUID format
  • Category type doesn’t match transaction type
  • Invalid amount format
401
error
Unauthorized - Missing or invalid authentication token
404
error
Not Found - Transaction, account, or category not found or doesn’t belong to user

Example Requests

curl -X PATCH https://api.yourfinanceapp.com/api/transactions/a3c4e8f2-9d7b-4a1c-8e3f-2b5d9a7c1e4f \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1650.50,
    "description": "Compra de comestibles (actualizado)"
  }'

Example Response

{
  "id": "a3c4e8f2-9d7b-4a1c-8e3f-2b5d9a7c1e4f",
  "type": "EXPENSE",
  "amount": 1650.50,
  "currency": "ARS",
  "description": "Compra de comestibles (actualizado)",
  "date": "2026-03-04T14:30:00.000Z",
  "userId": "user-uuid-123",
  "accountId": "uuid-de-la-cuenta",
  "categoryId": "92b77be3-a14a-462c-a291-7eff27cbcf47",
  "account": {
    "id": "uuid-de-la-cuenta",
    "name": "Cuenta Principal",
    "type": "WALLET",
    "balance": 8349.50,
    "currency": "ARS"
  },
  "category": {
    "id": "92b77be3-a14a-462c-a291-7eff27cbcf47",
    "name": "Alimentos",
    "type": "EXPENSE",
    "icon": "🛒"
  },
  "createdAt": "2026-03-04T14:30:15.123Z",
  "updatedAt": "2026-03-04T15:45:30.789Z",
  "deletedAt": null
}

Notes

  • This is a partial update endpoint (PATCH), so you only need to send the fields you want to change
  • The account balance is automatically recalculated based on the changes
  • If you change the account, both the old and new account balances are updated
  • All validation rules from the create endpoint still apply

Build docs developers (and LLMs) love