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

# Atualizar item do link

> Troca o preço ou a quantidade de um item

Permissão: `payment_link.write` (chave secreta).

## Endpoint

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://api.upag.dev/v1/payment-links/d4e5f6a7-b8c9-4d0e-9f1a-2b3c4d5e6f70/items/e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a81 \
    -H "Authorization: Bearer sk_test_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{ "quantity": 2 }'
  ```

  ```javascript Node.js SDK theme={null}
  import { Upag } from 'upag';

  const upag = new Upag('sk_test_your_api_key');

  // upag.paymentLinks.updateItem(paymentLinkId, itemId, params)
  const item = await upag.paymentLinks.updateItem(
    'd4e5f6a7-b8c9-4d0e-9f1a-2b3c4d5e6f70',
    'e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a81',
    { quantity: 2 },
  );
  ```
</CodeGroup>

<Note>
  Em produção use `https://api.upag.io/v1` com `sk_live_...`.
</Note>

## Parâmetros

<ParamField path="paymentLinkId" type="string (uuid)" required>
  ID do link de pagamento.
</ParamField>

<ParamField path="itemId" type="string (uuid)" required>
  ID do item.
</ParamField>

<ParamField body="price" type="string (uuid)">
  Novo preço do item.
</ParamField>

<ParamField body="quantity" type="integer">
  Nova quantidade (≥ 1).
</ParamField>

## Resposta

`200 OK`

```json Response theme={null}
{
  "id": "e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a81",
  "product": "0b9c1f3e-6a4d-4c1e-9d55-3f1f6a7c2e10",
  "price": "5f2d7a90-3b1c-4e8a-8f6d-1c9e4b7a2d33",
  "quantity": 2,
  "amount": 9980
}
```

* `404` — `PAYMENT_LINK_NOT_FOUND`, `PAYMENT_LINK_ITEM_NOT_FOUND`, `PRICE_NOT_FOUND` ou `PRODUCT_NOT_FOUND`.
* `400` — violação das regras de consistência (veja a [referência](./reference)).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.