Skip to main content
PUT
/
api
/
cotizaciones
/
:id
curl -X PUT 'https://your-domain.com/api/cotizaciones/15' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: session=your-session-token' \
  -d '{
    "cerrada": "SI",
    "fecha_cierre": "2026-02-15",
    "orden_venta": "OV-2026-0042",
    "flete_venta": 700,
    "observaciones": "Cliente confirmó la orden"
  }'
{
  "id": 15,
  "quote_number": "COT-2602-0015",
  "date": "2026-02-10",
  "time": "14:30",
  "impo_expo": "IMPO",
  "tipo": null,
  "load_type": "LCL",
  "sale_condition": null,
  "client_id": 3,
  "origin_id": 2,
  "via_id": 1,
  "end_client": null,
  "kgs": 500,
  "billable_cbm": 2.5,
  "actual_cbm": 2.3,
  "description": "Electronics components",
  "imo": null,
  "stackable": "SI",
  "pickup_address": null,
  "currency": "USD",
  "origin_costs_net": 100,
  "origin_costs_sale": 150,
  "freight_net": 500,
  "freight_sale": 700,
  "freight_net_type": null,
  "freight_sale_type": null,
  "status": "SI",
  "close_date": "2026-02-15",
  "sales_order": "OV-2026-0042",
  "notes": "Cliente confirmó la orden",
  "reference": null,
  "rate_validity": null,
  "profit": 250,
  "month": 2,
  "year": 2026,
  "week": 7,
  "user_id": 5,
  "created_at": "2026-02-10T14:30:00.000Z",
  "updated_at": "2026-02-15T16:45:00.000Z"
}
Updates an existing quotation. Automatically recalculates profit and date-derived fields.

Authorization

Requires active session. Non-admin users can only update quotations they created. Admin users can reassign quotations to other sellers.

Path Parameters

id
number
required
Quotation ID

Request Body

fecha
string
Quotation date (if changed, week/month/year will be recalculated)
hora
string
Quotation time
impo_expo
string
Import/Export. Values: IMPO, EXPO
tipo
string
Quotation type (optional)
fcl_lcl
string
Load type. Values: FCL, LCL
cond_venta
string
Sale condition (optional)
cliente_id
number
Client ID (must exist in clients table)
origen_id
number
Origin location ID (optional)
via_id
number
Via/route location ID (optional)
cliente_final
string
End client name (optional)
kgs
number
Weight in kilograms
cbm_facturables
number
Billable cubic meters
cbm_reales
number
Actual cubic meters
detalle
string
Cargo description
imo
string
IMO classification (for hazardous materials)
apilable
string
Stackable. Values: SI, NO
pickup_address
string
Pickup address (optional)
moneda
string
Currency. Values: USD, EUR, ARS
gastos_origen_neto
number
Origin costs (net) - used to recalculate profit
gastos_origen_venta
number
Origin costs (sale price) - used to recalculate profit
flete_neto
number
Freight cost (net) - used to recalculate profit
flete_venta
number
Freight cost (sale price) - used to recalculate profit
tipo_fn
string
Freight net type (optional)
tipo_fv
string
Freight sale type (optional)
cerrada
string
Status. Values: ENCOTIZACION, SI, NO, PEND, PEND A/C
fecha_cierre
string
Close date (only saved when status is SI, NO, or PEND A/C)
orden_venta
string
Sales order reference (optional)
observaciones
string
Notes (optional)
referencia
string
Reference (optional)
validez_tarifa
string
Rate validity (optional)
vendedor_id
number
Seller/user IDAdmin only: Admins can reassign quotations to other users. Non-admin users cannot change the seller.

Response

data
object
The updated quotation object with recalculated fieldsAll updated fields are returned in the response.
curl -X PUT 'https://your-domain.com/api/cotizaciones/15' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: session=your-session-token' \
  -d '{
    "cerrada": "SI",
    "fecha_cierre": "2026-02-15",
    "orden_venta": "OV-2026-0042",
    "flete_venta": 700,
    "observaciones": "Cliente confirmó la orden"
  }'
{
  "id": 15,
  "quote_number": "COT-2602-0015",
  "date": "2026-02-10",
  "time": "14:30",
  "impo_expo": "IMPO",
  "tipo": null,
  "load_type": "LCL",
  "sale_condition": null,
  "client_id": 3,
  "origin_id": 2,
  "via_id": 1,
  "end_client": null,
  "kgs": 500,
  "billable_cbm": 2.5,
  "actual_cbm": 2.3,
  "description": "Electronics components",
  "imo": null,
  "stackable": "SI",
  "pickup_address": null,
  "currency": "USD",
  "origin_costs_net": 100,
  "origin_costs_sale": 150,
  "freight_net": 500,
  "freight_sale": 700,
  "freight_net_type": null,
  "freight_sale_type": null,
  "status": "SI",
  "close_date": "2026-02-15",
  "sales_order": "OV-2026-0042",
  "notes": "Cliente confirmó la orden",
  "reference": null,
  "rate_validity": null,
  "profit": 250,
  "month": 2,
  "year": 2026,
  "week": 7,
  "user_id": 5,
  "created_at": "2026-02-10T14:30:00.000Z",
  "updated_at": "2026-02-15T16:45:00.000Z"
}

Error Responses

StatusCondition
401No active session
403Non-admin user attempting to update another user’s quotation
404Quotation ID does not exist

Server Logic

Recalculated Fields

  1. profit: Automatically recalculated from cost and sale prices:
    profit = (flete_venta - flete_neto) + (gastos_origen_venta - gastos_origen_neto)
    
    Rounded to 2 decimal places.
  2. week, month, year: Recalculated if fecha is updated
  3. close_date: Only saved when cerrada is SI, NO, or PEND A/C. Set to null for other statuses.
  4. updated_at: Automatically set to current timestamp
  5. user_id:
    • For admin users: Can be changed via vendedor_id in request body
    • For non-admin users: Cannot be changed (preserves existing value)

Notes

  • Role-based access: Non-admin users can only update their own quotations
  • Admin users can reassign quotations to other sellers
  • Profit is automatically recalculated on every update
  • The quotation number (nro_cotizacion) cannot be changed

Build docs developers (and LLMs) love