---
title: "Update Hubspot Deal"
method: PATCH
path: "/api/budget/hubspot/deal"
tags: ["copilot_frontend", "copilot_budget"]
---

# Update Hubspot Deal

`PATCH /api/budget/hubspot/deal`

Actualiza un deal en HubSpot asociado a un cliente.

Este endpoint:
1. Busca el contacto en HubSpot por email
2. Obtiene el deal asociado al contacto
3. Actualiza solo las propiedades especificadas en el payload
4. Solo actualiza si hay cambios (compara valores actuales)

**Protected Endpoint:** Requires JWT authentication and 'ui_comercial' or 'admin' role

Args:
    data: Email del cliente y propiedades del deal a actualizar
    current_user: Current authenticated user

Returns:
    UpdateDealResponse con el ID del deal actualizado

Raises:
    Exception: Si no se encuentra el contacto o deal, o hay errores de HubSpot

## Request body

- UpdateDealRequest — Request to update a deal in HubSpot.
  - `email` string, required — Client email to find the contact and associated deal
  - `properties` object, required — Deal properties to update (key-value pairs)

## Response `200`

Successful Response

- UpdateDealResponse — Response after updating a deal.
  - `deal_id` string, required — HubSpot deal ID that was updated
  - `message` string, required — Success message

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/hogarsolar/apis/hogarsolar-backend-api.md) · [All operations](https://skmtc.dev/hogarsolar/apis/hogarsolar-backend-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hogarsolar/hogarsolar-backend-api/revisions/d9861e46bef8/schema)
