> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withgale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Product

> Update an existing product's information

# Update Product

Update product details including price, description, images, and metadata. Changes to UPC code will trigger a new eligibility check.

## Authentication

```bash theme={null}
Authorization: Bearer glm_test_YOUR_API_KEY
```

## Path Parameters

| Parameter | Type    | Required | Description |
| --------- | ------- | -------- | ----------- |
| `id`      | integer | Yes      | Product ID  |

## Request Body

```json theme={null}
{
  "name": "Premium Blood Pressure Monitor",
  "tagline": "Professional-grade automatic BP monitoring",
  "description": "Updated description with new features",
  "price": 5495,
  "images": [
    "https://cdn.example.com/bp-monitor-updated.jpg"
  ],
  "metadata": {
    "category": "medical_devices",
    "brand": "HealthTech Pro",
    "version": "2.0"
  }
}
```

## Parameters

All parameters are optional. Only include fields you want to update.

| Parameter             | Type    | Description                                        |
| --------------------- | ------- | -------------------------------------------------- |
| `name`                | string  | Product name (max 255 chars)                       |
| `tagline`             | string  | Short description (max 255 chars)                  |
| `description`         | string  | Full product description                           |
| `price`               | integer | Price in cents                                     |
| `currency`            | string  | ISO 4217 currency code                             |
| `merchant_product_id` | string  | Your reference ID                                  |
| `upc_code_or_gtin`    | string  | UPC or GTIN (triggers eligibility re-check)        |
| `status`              | enum    | `active`, `inactive`, or `archived`                |
| `images`              | array   | Array of image URLs (replaces all existing images) |
| `metadata`            | object  | Custom key-value pairs (merged with existing)      |

<Info>
  All monetary amounts are integers in cents (e.g., 4995 = \$49.95).
</Info>

## Request

```bash theme={null}
PUT /api/v2/products/{id}
```

## Response

Returns the updated product object:

```json theme={null}
{
  "id": 12345,
  "name": "Premium Blood Pressure Monitor",
  "tagline": "Professional-grade automatic BP monitoring",
  "description": "Updated description with new features",
  "price": 5495,
  "currency": "USD",
  "merchant_product_id": "BP-MONITOR-001",
  "upc_code_or_gtin": "14567890123456",
  "status": "active",
  "eligibility": {
    "hsa_fsa_eligible": true,
    "message": "SIGIS verified - Medical device",
    "checked_at": "2025-10-18T14:30:00Z"
  },
  "images": [
    {
      "id": 569,
      "url": "https://cdn.example.com/bp-monitor-updated.jpg",
      "is_primary": true
    }
  ],
  "metadata": {
    "category": "medical_devices",
    "brand": "HealthTech Pro",
    "version": "2.0"
  },
  "created_at": "2025-10-18T14:30:00Z",
  "updated_at": "2025-10-18T16:00:00Z"
}
```

## Examples

### Update Price

```bash theme={null}
curl -X PUT https://api.withgale.com/api/v2/products/12345 \
  -H "Authorization: Bearer glm_test_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 5495
  }'
```

### Update Description and Status

```bash theme={null}
curl -X PUT https://api.withgale.com/api/v2/products/12345 \
  -H "Authorization: Bearer glm_test_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Enhanced model with improved accuracy and larger display",
    "tagline": "Professional-grade BP monitor",
    "status": "inactive"
  }'
```

## Metadata Merging

Metadata updates are merged with existing values, not replaced:

```javascript theme={null}
// Existing metadata
{
  "metadata": {
    "category": "medical",
    "brand": "HealthTech"
  }
}

// Update request
{
  "metadata": {
    "inventory": 50
  }
}

// Result (merged)
{
  "metadata": {
    "category": "medical",
    "brand": "HealthTech",
    "inventory": 50
  }
}
```

To remove a metadata field, set it to `null`:

```json theme={null}
{
  "metadata": {
    "old_field": null
  }
}
```

## Webhooks

Product updates trigger the following webhook event:

```json theme={null}
{
  "type": "product.updated",
  "data": {
    "id": 12345,
    "name": "Premium Blood Pressure Monitor",
    "price": 5495,
    "updated_at": "2025-10-18T16:00:00Z"
  }
}
```

See [Webhooks Reference](/developer-manual/webhooks) for details.

## Errors

| Status Code | Error Code            | Description                |
| ----------- | --------------------- | -------------------------- |
| 400         | `invalid_request`     | Invalid parameters         |
| 401         | `unauthorized`        | Invalid or missing API key |
| 404         | `not_found`           | Product not found          |
| 422         | `validation_error`    | Field validation failed    |
| 429         | `rate_limit_exceeded` | Too many requests          |

Example error:

```json theme={null}
{
  "error": {
    "code": "validation_error",
    "message": "Invalid price",
    "details": [
      {
        "field": "price",
        "message": "Price must be a positive integer"
      }
    ]
  }
}
```

## Related Endpoints

* [Create Product](/api-reference/endpoint/create-product-v2) - POST /api/v2/products
* [Get Product](/api-reference/endpoint/get-product-v2) - GET /api/v2/products/{id}
* [List Products](/api-reference/endpoint/list-products-v2) - GET /api/v2/products
* [Check Eligibility](/api-reference/endpoint/check-eligibility) - POST /api/v2/products/check-eligibility

## Related Resources

* [Product Object](/api-reference/objects/product)
* [Webhooks Reference](/developer-manual/webhooks)
