# Update an item

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Idempotency Supported](/docs/api/idempotency)

Updates an item with the changes specified. Unspecified item parameters are not modified.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/items/basic \
     -u {site_api_key}:\
     -d description="basic plan" \
     -d enabled_for_checkout="false" \
     -d enabled_in_portal="false"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Item.Update("basic")
		.Description("basic plan")
		.EnabledForCheckout(false)
		.EnabledInPortal(false)
		.Request();

Item item = result.Item;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    itemAction "github.com/chargebee/chargebee-go/v3/actions/item"
    "github.com/chargebee/chargebee-go/v3/models/item"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := itemAction.Update("basic", &item.UpdateRequestParams{
        Description : "basic plan",
        EnabledForCheckout : chargebee.Bool(false),
        EnabledInPortal : chargebee.Bool(false),
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Item := res.Item
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.ItemUpdateRequest{
    Description : "basic plan",
    EnabledForCheckout : chargebee.Bool(false),
    EnabledInPortal : chargebee.Bool(false),
}
  res, err := client.Item.Update("basic", req)
      if err != nil {
        fmt.Println(err)
    } else {
        Item := res.Item
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Item.update("basic")
            .description("basic plan")
            .enabledForCheckout(false)
            .enabledInPortal(false)
            .request();

        Item item = result.item();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.item.Item;
import com.chargebee.v4.models.item.params.ItemUpdateParams;
import com.chargebee.v4.models.item.responses.ItemUpdateResponse;

public class ItemUpdate {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        ItemUpdateParams params = ItemUpdateParams.builder()
            .description("basic plan")
            .enabledForCheckout(false)
            .enabledInPortal(false)
            .build();

        ItemUpdateResponse response = client
            .items()
            .update("basic", params);

        Item item = response.getItem();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.item.update("basic", {
        description: "basic plan",
        enabled_for_checkout: false,
        enabled_in_portal: false
    });

    console.log(result);
    const item = result.item;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->item()->update("basic", [
    "description" => "basic plan",
    "enabled_for_checkout" => false,
    "enabled_in_portal" => false
]);
$item = $result->item;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Item.update("basic",
    cb_client.Item.UpdateParams(
        description="basic plan",
        enabled_for_checkout=False,
        enabled_in_portal=False
    )
)
item = response.item
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Item.update("basic",{
  :description => "basic plan",
  :enabled_for_checkout => "false",
  :enabled_in_portal => "false"
})

item = result.item
```

## Sample Response

```json
{
  "item": {
    "description": "basic plan",
    "enabled_for_checkout": false,
    "enabled_in_portal": false,
    "id": "basic",
    "is_giftable": false,
    "is_shippable": false,
    "item_applicability": "all",
    "name": "Basic",
    "object": "item",
    "resource_version": 1599817250886,
    "status": "active",
    "type": "plan",
    "updated_at": 1599817250
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/items/{item-id}

## Input Parameters

- `name` (optional, string, max chars=100)
  The display name for the item. Must be unique. This is visible only in Chargebee and not to customers.

- `description` (optional, string, max chars=2000)
  Description of the item. This is visible only in Chargebee and not to customers.
  
  **Note**:
  
  -   The description field supports up to 2000 characters, including HTML tags. The inner text (excluding HTML tags) must not exceed 500 characters.  
      For example:  
      `- testing - desc` .  
      Total with tags: 38 characters,  
      inner text: 'testing desc' (12 characters).
  -   If your input includes characters requiring sanitization, such as incomplete HTML tags, the sanitization process may alter the input and increase its length. If the sanitized content exceeds the allowed limit, the request will be rejected.

- `is_shippable` (optional, boolean, default=false)
  Indicates that the item is a physical product. If Orders are enabled in Chargebee, subscriptions created for this item will have orders associated with them.

- `external_name` (optional, string, max chars=100)
  A unique display name for the item.

- `item_family_id` (optional, string, max chars=100)
  The `id` of the [Item family](/docs/api/item_families) that the item belongs to. Is mandatory when [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) have been enabled.

- `enabled_in_portal` (optional, boolean, default=true)
  Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription) .

- `redirect_url` (optional, string, max chars=500)
  If `enabled_for_checkout` , then the URL to be redirected to once the checkout is complete. This parameter is only meant for plan-items.

- `enabled_for_checkout` (optional, boolean, default=true)
  Allow the plan to subscribed to via Checkout. Applies only for plan-items. **Note:** Only the in-app layout of Checkout is supported.

- `item_applicability` (optional, enumerated string, default=all)
  Indicates which addon-items and charge-items can be applied to the item. Only possible for plan-items. Other details of attaching items such as whether to attach as a mandatory item or to attach on a certain event, can be specified using the [Create](/docs/api/attached_items/create-an-attached-item) or [Update an attached item](/docs/api/attached_items/update-an-attached-item) API.
  Possible enum values:
    - `all`
      all addon-items and charge-items are applicable to this plan-item.
    - `restricted`
      only the addon-items or charge-items provided in `applicable_items` can be applied to this plan-item.

- `applicable_items` (optional, string, max chars=100)
  The list of ids of addon-items and charge-items that can be applied to the plan-item. This parameter can be provided only for plan-items and that too when item\_applicability is restricted. Other details of attaching items can be specified using the [Create](/docs/api/attached_items/create-an-attached-item) or [Update an attached item](/docs/api/attached_items/update-an-attached-item) API.

- `unit` (optional, string, max chars=30)
  The unit of measure for a quantity-based item. This is displayed on the Chargebee UI and on customer facing documents/pages. The latter includes [hosted pages](/docs/api/hosted_pages) , [invoices](/docs/api/invoices) and [quotes](/docs/api/quotes). Examples follow:
  
  -   "user" for a cloud-collaboration platform.
  -   "GB" for a data service.
  -   "issue" for a magazine.

- `gift_claim_redirect_url` (optional, string, max chars=500)
  The URL to redirect to once the gift has been claimed by the receiver.

- `metadata` (optional, jsonobject)
  A collection of key-value pairs that provides extra information about the item. [Learn more](/docs/api/advanced-features#metadata) .

- `included_in_mrr` (optional, boolean)
  The item is included in MRR calculations for your site. This attribute is only applicable for items of `type = charge` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude charge-items from MRR calculations, this value is always returned `false` .

- `status` (optional, enumerated string)
  The status of the item.
  Possible enum values:
    - `active`
      The item can be used to create new item prices.
    - `archived`
      The item is no longer active and no new item prices can be created

- `is_percentage_pricing` (optional, boolean, default=false)
  Indicates whether the pricing is percentage-based.

- `bundle_configuration` (optional, enumerated string)
  Parameters of `bundle_configuration`
  - `type` (optional, enumerated string)
    Type of the bundle
    Possible enum values:
      - `fixed`
        Fixed `bundle_configuration.type` should be provided when you create a bundle plan that cannot be updated during checkout or subscription creation.

- `bundle_items_to_add` (optional, array)
  Parameters for `bundle_items_to_add`
  - `item_id` (optional, string, max chars=100)
    [`item_id`](/docs/api/items/item-object#id) that needs to be added to the bundle. **Note:** This parameter is only applicable when the [`item_type`](/docs/api/items/item-object#type) is `plan` .
  - `item_type` (optional, enumerated string)
    [`item_type`](/docs/api/items/item-object#type) that can be added to the bundle.
    Possible enum values:
      - `plan`
        An essential component of the bundle plan. **Note:** At least one plan item must be associated with the bundle.
      - `addon`
        A recurring component that can be added to a bundle plan.
      - `charge`
        A non-recurring component that can be added to a bundle plan.
  - `quantity` (optional, integer)
    Quantity of the item(plan, addon, and charge) associated with the bundle.
  - `price_allocation` (optional, bigdecimal)
    Price allocation of the item(plan, addon, and charge) associated with the bundle.

- `bundle_items_to_update` (optional, array)
  Parameters for bundle\_items\_to\_update
  - `item_id` (optional, string, max chars=100)
    [`item_id`](/docs/api/items/item-object#id) that needs to be updated from the bundle plan. This attribute is only applicable when the [`item_type`](/docs/api/items/item-object#type) is `plan` .
  - `item_type` (optional, enumerated string)
    [`item_type`](/docs/api/items/item-object#type) that you want to update from the bundle.
    Possible enum values:
      - `plan`
        An essential component of the bundle plan. **Note:** At least one plan item must be associated with the bundle.
      - `addon`
        A recurring component that can be added to a bundle plan.
      - `charge`
        A non-recurring component that can be added to a bundle plan.
  - `quantity` (optional, integer)
    Quantity of the item(plan, addon, and charge) associated with the bundle.
  - `price_allocation` (optional, bigdecimal)
    Price allocation of the item(plan, addon, and charge) associated with the bundle.

- `bundle_items_to_remove` (optional, array)
  Parameters for bundle\_items\_to\_remove
  - `item_id` (optional, string, max chars=100)
    [`item_id`](/docs/api/items/item-object#id) that needs to be removed from the bundle plan. **Note:** This attribute is only applicable when the [`item_type`](/docs/api/items/item-object#type) is `plan` .
  - `item_type` (optional, enumerated string)
    [`item_type`](/docs/api/items/item-object#type) that you want to remove from the bundle.
    Possible enum values:
      - `plan`
        An essential component of the bundle plan. **Note:** At least one plan item must be associated with the bundle.
      - `addon`
        A recurring component that can be added to a bundle plan.
      - `charge`
        A non-recurring component that can be added to a bundle plan.

## Returns

- `item` (Item object)
  Resource object representing item
