Skip to main content
POST
/
api
/
budgets
curl -X POST https://api.yourfinanceapp.com/api/budgets \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 50000.0,
    "month": 1,
    "year": 2026,
    "categoryId": "660e8400-e29b-41d4-a716-446655440001"
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount": 50000.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.

Request Body

amount
number
required
Budget limit amount. Must be a positive number.Validation: Must be greater than 0
month
integer
required
Month for the budget (1-12)Validation: Min: 1, Max: 12
year
integer
required
Year for the budgetValidation: Min: 2024
categoryId
string
required
UUID of the category to controlValidation: Must be a valid UUID

Validation Rules

Parent Category Constraint

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

Child Categories Constraint

If the category has child categories with budgets, the new budget 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.”

Uniqueness

Only one budget per category per month/year combination is allowed. Error: 409 Conflict - “Ya existe un presupuesto para esta categoría este mes.”

Response

id
string
Unique identifier for the created budget
amount
number
Budget limit amount
month
integer
Month of the budget (1-12)
year
integer
Year of the budget
categoryId
string
UUID of the associated category
userId
string
UUID of the user who owns this budget
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount": 50000.0,
  "month": 1,
  "year": 2026,
  "categoryId": "660e8400-e29b-41d4-a716-446655440001",
  "userId": "770e8400-e29b-41d4-a716-446655440002"
}
curl -X POST https://api.yourfinanceapp.com/api/budgets \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 50000.0,
    "month": 1,
    "year": 2026,
    "categoryId": "660e8400-e29b-41d4-a716-446655440001"
  }'

Build docs developers (and LLMs) love