PUT /api/accrued-expenses/:id
Updates an existing manual expense. Only expenses with tipo_origen: MANUAL can be updated. XML-imported expenses cannot be modified.
Authentication
This endpoint requires authentication. Include your access token in the request cookies.
Path Parameters
Unique identifier of the expense to update
Request Body
All fields are optional. Only include fields you want to update.
Updated description or concept of the expense
Updated subtotal amount before taxes
Payment status of the expense
Payment date in ISO 8601 format. Set to null to clear the payment date
Updated category. Set to null to clear the category
Response
The updated expense object
Unique identifier for the expense
Profile ID associated with this expense
Origin type. Will be MANUAL
Date of the expense (ISO 8601 format)
Total amount (subtotal + iva_amount)
Payment date (ISO 8601 format)
Description/concept of the expense
Last update timestamp (ISO 8601)
Example Request
curl -X PUT "https://api.contafy.com/api/accrued-expenses/expense-789" \
-H "Content-Type: application/json" \
-H "Cookie: access_token=your_access_token" \
-d '{
"concept": "Compra de papelería y suministros",
"subtotal": 1200,
"iva_amount": 192,
"is_paid": true,
"payment_date": "2024-03-20",
"categoria": "Gastos de oficina"
}'
Example Response
{
"message": "Expense updated successfully",
"data": {
"id": "expense-789",
"profile_id": "profile-123",
"tipo_origen": "MANUAL",
"fecha": "2024-03-15T00:00:00Z",
"mes": 3,
"año": 2024,
"total": 1392,
"subtotal": 1200,
"iva": 16,
"iva_amount": 192,
"is_paid": true,
"payment_date": "2024-03-20T00:00:00Z",
"concepto": "Compra de papelería y suministros",
"categoria": "Gastos de oficina",
"created_at": "2024-03-15T10:30:00Z",
"updated_at": "2024-03-20T14:25:00Z"
}
}
Error Responses
Authentication required or token expired{
"error": "Unauthorized",
"message": "Authentication required"
}
Invalid request body or attempting to update an XML expense{
"error": "Bad Request",
"message": "Cannot update XML-imported expenses"
}
User does not have permission to update this expense{
"error": "Forbidden",
"message": "You do not have permission to update this expense"
}
Expense not found{
"error": "Not Found",
"message": "Expense not found"
}
500 Internal Server Error
Server error occurred{
"error": "Internal Server Error",
"message": "An unexpected error occurred"
}