# products.hub_update

Alterar produto. Altera os campos informados; o tipo não muda depois de criado. `null` limpa suporte, descritor e prazo de reembolso. `stockQuantity` é o estoque do produto físico.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/products.hub_update` (corpo JSON)
- Quem pode chamar: administrador da conta
- Escopo da chave: `crm:write`
- Grava dados: sim
- Pela chave de API: sim
- Ferramenta MCP: `products_hub_update`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `products.hub_update`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `id` | string (uuid) | sim |  |
| `name` | string | não |  |
| `description` | string | não |  |
| `category` | string \| null | não |  |
| `supportEmail` | string (email) \| null | não |  |
| `supportPhone` | string \| null | não |  |
| `softDescriptor` | string \| null | não |  |
| `refundDays` | integer \| null | não |  |
| `stockQuantity` | integer \| null | não |  |
| `checkoutType` | "internal" \| "external" | não |  |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "description": {
      "type": "string",
      "minLength": 50,
      "maxLength": 1000
    },
    "category": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 80
        },
        {
          "type": "null"
        }
      ]
    },
    "supportEmail": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 200,
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "supportPhone": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 30
        },
        {
          "type": "null"
        }
      ]
    },
    "softDescriptor": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 22
        },
        {
          "type": "null"
        }
      ]
    },
    "refundDays": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 90
        },
        {
          "type": "null"
        }
      ]
    },
    "stockQuantity": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "checkoutType": {
      "type": "string",
      "enum": [
        "internal",
        "external"
      ]
    }
  },
  "required": [
    "id"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/products.hub_update \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"00000000-0000-0000-0000-000000000000","softDescriptor":"MINHA MARCA"}'
```

CLI:

```bash
node cli/atomiks.mjs products.hub_update --json '{"id":"00000000-0000-0000-0000-000000000000","softDescriptor":"MINHA MARCA"}'
```

MCP: ferramenta `products_hub_update` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "type": {
      "type": "string",
      "enum": [
        "course",
        "community",
        "ebook",
        "mentorship",
        "event",
        "software",
        "physical",
        "other"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "physical",
        "digital",
        "service"
      ]
    },
    "category": {
      "type": [
        "string",
        "null"
      ]
    },
    "checkoutType": {
      "type": "string",
      "enum": [
        "internal",
        "external"
      ]
    },
    "priceCents": {
      "type": "number"
    },
    "imageUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "archived": {
      "type": "boolean"
    },
    "createdAt": {
      "type": "string"
    },
    "supportEmail": {
      "type": [
        "string",
        "null"
      ]
    },
    "supportPhone": {
      "type": [
        "string",
        "null"
      ]
    },
    "softDescriptor": {
      "type": [
        "string",
        "null"
      ]
    },
    "refundDays": {
      "type": [
        "number",
        "null"
      ]
    },
    "stockQuantity": {
      "type": [
        "number",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "incomplete",
        "ready_to_submit",
        "approved",
        "archived"
      ]
    },
    "offers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "productId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "isMain": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "incomplete",
              "ready_to_submit",
              "approved",
              "archived"
            ]
          },
          "priceCents": {
            "type": "number"
          },
          "newPriceCents": {
            "type": [
              "number",
              "null"
            ]
          },
          "recurrence": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "frequency": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "quarterly",
                      "semi-annually",
                      "yearly"
                    ]
                  },
                  "intervalMonths": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "trialDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 180
                  }
                },
                "required": [
                  "frequency",
                  "intervalMonths",
                  "trialDays"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "incompleteReason": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "hasCoupon": {
            "type": "boolean"
          },
          "archived": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "productId",
          "name",
          "isMain",
          "status",
          "priceCents",
          "newPriceCents",
          "recurrence",
          "incompleteReason",
          "hasCoupon",
          "archived"
        ],
        "additionalProperties": false
      }
    },
    "salesCount": {
      "type": "number"
    },
    "revenueCents": {
      "type": "number"
    },
    "series": {
      "type": "array",
      "items": {
        "type": "number"
      }
    }
  },
  "required": [
    "id",
    "name",
    "description",
    "type",
    "kind",
    "category",
    "checkoutType",
    "priceCents",
    "imageUrl",
    "archived",
    "createdAt",
    "supportEmail",
    "supportPhone",
    "softDescriptor",
    "refundDays",
    "stockQuantity",
    "status",
    "offers",
    "salesCount",
    "revenueCents",
    "series"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
