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

# Update a Price

> Atualiza um preço.

Atualiza um `price` com semântica de **merge**. Campos de valor são imutáveis:
`currency`, `unit_amount`, `type`, `recurring` e `product_id`.
Para mudar valor ou cadência, crie outro preço e desative o antigo.

A resposta direta **não** carrega diff; quem precisa de diff lê o webhook
[`price.updated`](/api-reference/webhooks/price.updated).

## Autenticação

A API key da própria organização atua diretamente. A API key de plataforma exige o
header `Organization: <organization_id>` apontando para uma organização
conectada ativa.

## Parâmetros de caminho

<ParamField path="id" type="string" required>
  ID do preço (`price_*`).
</ParamField>

## Attributes

Todos os campos são opcionais.

<ParamField body="is_active" type="boolean">
  `false` tira o preço de novos fluxos de compra. `true` reativa.
</ParamField>

<ParamField body="metadata" type="object">
  Substitui completamente o `metadata` atual quando enviado.
</ParamField>

<ParamField body="name" type="string \| null">
  Rótulo interno. Envie `null` para limpar.
</ParamField>

<ParamField body="tax_behavior" type="string">
  `unspecified`, `inclusive` ou `exclusive`.
</ParamField>

<RequestExample>
  ```bash cURL theme={}
  curl -X POST "https://api.chargefy.io/v1/prices/price_123" \
    -H "Authorization: Bearer {{API_KEY}}" \
    -H "Content-Type: application/json" \
    -d '{
      "is_active": false
    }'
  ```
</RequestExample>

## Resposta

`200 OK` com o objeto `price` completo (mesmo shape de
[`GET /v1/prices/:id`](/api-reference/prices/get#resposta)).

<ResponseExample>
  ```json 200 theme={}
  {
    "id": "price_123",
    "object": "price",
    "created_at": "2026-05-16T14:09:27Z",
    "currency": "brl",
    "is_active": false,
    "livemode": true,
    "metadata": {},
    "name": "Mensal",
    "product": "prod_123",
    "recurring": {
      "interval": "month",
      "interval_count": 1,
      "trial_period_days": null,
      "usage_type": "licensed"
    },
    "tax_behavior": "unspecified",
    "type": "recurring",
    "unit_amount": 9990,
    "updated_at": "2026-05-16T15:02:10Z"
  }
  ```
</ResponseExample>

## Erros comuns

| Status | `code`             | Quando ocorre                                                                                        |
| ------ | ------------------ | ---------------------------------------------------------------------------------------------------- |
| `400`  | `invalid_request`  | Tentativa de atualizar campo imutável (`currency`, `unit_amount`, `type`, `recurring`, `product_id`) |
| `400`  | `invalid_request`  | `is_active` não-boolean; `metadata` não-objeto; `tax_behavior` inválido                              |
| `404`  | `resource_missing` | Preço não existe nesta organização                                                                   |

## Webhook

A atualização dispara [`price.updated`](/api-reference/webhooks/price.updated)
com o `price` completo em `data.object` e o diff em `data.previous_attributes`.
