Skip to main content
PATCH
/
api
/
budgets
/
:id
curl -X PATCH https://api.yourfinanceapp.com/api/budgets/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 55000.0
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount": 55000.0,
  "month": 1,
  "year": 2026,
  "categoryId": "660e8400-e29b-41d4-a716-446655440001",
  "userId": "770e8400-e29b-41d4-a716-446655440002"
}

Authentication

This endpoint requires JWT authentication via Bearer token.

Path Parameters

id
string
required
UUID of the budget to update

Request Body

All fields are optional. Only provide the fields you want to update.
amount
number
New budget limit amount. Must be a positive number.Validation: Must be greater than 0
month
integer
New month for the budget (1-12)Validation: Min: 1, Max: 12
year
integer
New year for the budgetValidation: Min: 2024
categoryId
string
New category UUID to associate with this budgetValidation: Must be a valid UUID

Validation Rules

Ownership

You can only update budgets you own. Error: 403 Forbidden - “No tienes permiso”

Parent Category Constraint

If updating the amount and the category has a parent with a budget, the sum of all sibling budgets cannot exceed the parent’s limit. Error: 400 Bad Request - “El presupuesto supera el límite de la categoría padre. Disponible: $X.”

Child Categories Constraint

If updating the amount and the category has child categories with budgets, the new amount must be greater than or equal to the sum of all child budgets. Error: 400 Bad Request - “El monto es menor a la suma de las subcategorías ($X). Ajusta las subcategorías primero.”

Not Found

Budget must exist. Error: 404 Not Found - “Presupuesto no encontrado”

Response

id
string
Budget UUID
amount
number
Updated budget limit amount
month
integer
Updated month (1-12)
year
integer
Updated year
categoryId
string
Updated category UUID
userId
string
User UUID (unchanged)
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount": 55000.0,
  "month": 1,
  "year": 2026,
  "categoryId": "660e8400-e29b-41d4-a716-446655440001",
  "userId": "770e8400-e29b-41d4-a716-446655440002"
}
curl -X PATCH https://api.yourfinanceapp.com/api/budgets/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 55000.0
  }'

Important Notes

  • When updating the amount, both parent and child constraints are validated
  • If you need to reduce a parent budget below child budgets total, adjust child budgets first
  • Partial updates are supported - only send the fields you want to change

Build docs developers (and LLMs) love