---
title: Aggiornare un prodotto
description: "Aggiorna i campi inviando solo ciò che cambia. imageUrls SOSTITUISCE l'array esistente (il vostro CMS resta canonico). Idempotency-Key supportato."
canonical: "https://www.tracepass.eu/it/docs/update-product"
locale: it
source: "https://www.tracepass.eu/it/docs/update-product"
---

# Aggiornare un prodotto

> Aggiorna i campi inviando solo ciò che cambia. imageUrls SOSTITUISCE l'array esistente (il vostro CMS resta canonico). Idempotency-Key supportato.

```http
PATCH /api/v1/products/{id}
```

Applica una patch a uno o più campi del prodotto. Inviate solo le chiavi che volete modificare — i campi omessi restano invariati. La semantica dell'intero array su `imageUrls` è intenzionale: il vostro CMS è l'insieme canonico delle immagini, quindi un PATCH con `imageUrls: ["a","b"]` sostituisce ciò che era presente. Per aggiungere una singola immagine senza riscrivere l'elenco, usate invece l'endpoint di caricamento multipart.

Conta come una scrittura v1. Rispetta `Idempotency-Key`. L'unicità di `model` viene riverificata quando viene modificato; `description: null` cancella la descrizione (diverso dall'omettere la chiave).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Authorization` | header | string | yes | `Bearer <token>` — una chiave API `tp_` (Developer → API Keys; più semplice, per server-to-server) oppure un access token OAuth 2.0 (Developer → OAuth Apps; per app autorizzate dall'utente, scoped e revocabili). La pagina Authentication contiene il flusso OAuth completo e l'elenco degli scopes. |
| `Idempotency-Key` | header | string | no | UUID v4. |
| `id` | path | ObjectId | yes | ID del prodotto. |
| `name` | body | string (1-200) | no | Nome visualizzato. |
| `model` | body | string (1-100) | no | Identificatore del modello. L'unicità viene riverificata quando viene modificato. |
| `description` | body | string \| null (≤ 2000) | no | Passate `null` per cancellare. |
| `defaultFieldValues` | body | object | no | Sostituisce i valori iniziali per i passaporti futuri. |
| `imageUrls` | body | string\[\] (max 20) | no | Sostituisce l'intero array di immagini. |
| `status` | body | enum | no | `active` o `archived`. |
| `sourceLocale` | body | string (ISO 639-1) | no | Aggiorna il locale di `name` / `description`. |

## Examples

```bash
curl -sS -X PATCH \
  https://app.tracepass.eu/api/v1/products/6650a1b2c3d4e5f6a7b8c9d0 \
  -H "Authorization: Bearer tp_REDACTED_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Li-Ion 48V Battery Pack (revised)",
    "imageUrls": ["https://cdn.example.com/new-hero.jpg"]
  }'
```

```typescript
await fetch(`https://app.tracepass.eu/api/v1/products/${id}`, {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.TRACEPASS_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Li-Ion 48V Battery Pack (revised)",
    imageUrls: ["https://cdn.example.com/new-hero.jpg"],
  }),
});
```

```python
import os, requests
res = requests.patch(
    f"https://app.tracepass.eu/api/v1/products/{product_id}",
    headers={"Authorization": f"Bearer {os.environ['TRACEPASS_API_KEY']}"},
    json={
        "name": "Li-Ion 48V Battery Pack (revised)",
        "imageUrls": ["https://cdn.example.com/new-hero.jpg"],
    },
)
res.raise_for_status()
```

## Responses

### 200 — Aggiornato

```json
{
  "_id": "6650a1b2c3d4e5f6a7b8c9d0",
  "name": "Li-Ion 48V Battery Pack (revised)",
  "imageUrls": ["https://cdn.example.com/new-hero.jpg"],
  "updatedAt": "2026-05-09T15:30:00.000Z"
}
```

### 404 — Non trovato

```json
{ "error": "Product not found" }
```

### 409 — Model duplicato

```json
{ "error": "A product with this model already exists for your company" }
```

## Related

- [Creare un prodotto](https://www.tracepass.eu/it/docs/create-product.md)
- [Caricare l'immagine del prodotto](https://www.tracepass.eu/it/docs/upload-product-image.md)
