---
title: "Actualizar inventario"
description: "Establece o repone la existencia de un producto."
language: es-MX
canonical_url: "https://exac.mx/docs/mcp/tools/update_inventory"
md_url: "https://exac.mx/docs/mcp/tools/update_inventory.md"
---

# Actualizar inventario

Establece o repone la existencia de un producto.

Herramienta: `update_inventory`

## Propósito

Establece o repone la existencia de un producto.

### Úsala cuando

Debe registrarse un conteo o reabastecimiento.

### No la uses cuando

Estás recibiendo una entrega con varios productos.

| Detalle | Valor |
| --- | --- |
| Permisos | products:manage |
| Efectos secundarios | Destructivo |
| Idempotencia | Idempotente |

## Esquema de entrada

```json
{
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request."
    },
    "input": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "mode": {
              "type": "string",
              "const": "set"
            },
            "productId": {
              "type": "string"
            },
            "locationId": {
              "type": "string"
            },
            "stock": {
              "anyOf": [
                {
                  "type": "number",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "note": {
              "type": "string"
            }
          },
          "required": [
            "mode",
            "productId",
            "stock"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "mode": {
              "type": "string",
              "const": "restock"
            },
            "productId": {
              "type": "string"
            },
            "locationId": {
              "type": "string"
            },
            "quantity": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "note": {
              "type": "string"
            }
          },
          "required": [
            "mode",
            "productId",
            "quantity"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "idempotencyKey",
    "input"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false
}
```

## Esquema de salida

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "locationId": {
          "type": "string"
        },
        "locationStock": {
          "type": "number"
        },
        "product": {
          "type": "object",
          "properties": {
            "productId": {
              "type": "string",
              "minLength": 1
            },
            "description": {
              "type": "string"
            },
            "sku": {
              "type": "string"
            },
            "code": {
              "type": "string"
            },
            "active": {
              "type": "boolean"
            },
            "price": {
              "type": "number"
            },
            "quantityDiscounts": {
              "maxItems": 10,
              "type": "array",
              "items": {
                "$ref": "#/definitions/__schema0"
              }
            },
            "taxIncluded": {
              "type": "boolean"
            },
            "taxRate": {
              "type": "number"
            },
            "taxability": {
              "type": "string"
            },
            "taxExemptReason": {
              "type": "string"
            },
            "stock": {
              "type": "number"
            },
            "stockStatus": {
              "type": "string",
              "enum": [
                "available",
                "out_of_stock"
              ]
            },
            "satProductCode": {
              "type": "string"
            },
            "satUnitCode": {
              "type": "string"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "productId",
            "description",
            "active",
            "price",
            "updatedAt"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "product"
      ],
      "additionalProperties": false
    },
    "error": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "validation_error",
            "unauthenticated",
            "forbidden",
            "not_found",
            "method_not_allowed",
            "conflict",
            "idempotency_conflict",
            "operation_in_progress",
            "recovery_required",
            "rate_limited",
            "provider_unavailable",
            "internal"
          ]
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "properties": {
            "issues": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "message": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "path",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "retryable": {
              "type": "boolean"
            },
            "retryAfterSeconds": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": false
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "definitions": {
    "__schema0": {
      "type": "object",
      "properties": {
        "minQuantity": {
          "type": "number"
        },
        "percentage": {
          "type": "number"
        }
      },
      "required": [
        "minQuantity",
        "percentage"
      ],
      "additionalProperties": false
    }
  },
  "oneOf": [
    {
      "required": [
        "data"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
```

## Herramientas relacionadas

- [`get_inventory`](/docs/mcp/tools/get_inventory.md) — **Leer inventario**: Consulta existencias, movimientos u operaciones agrupadas de inventario.

- [`receive_inventory`](/docs/mcp/tools/receive_inventory.md) — **Recibir inventario**: Registra una entrega de inventario de proveedor con varios productos.

## Flujo relacionado

[Consulta los flujos canónicos en la introducción](/docs.md)

## Operaciones REST equivalentes

- [`POST /v1/products/{productId}/inventory`](/docs/api/catalog/products/update-product-inventory.md)

Documentación completa: https://exac.mx/docs.md
Índice para agentes: https://exac.mx/docs/llms.txt
