> For the complete documentation index, see [llms.txt](https://docs.tebex.io/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tebex.io/developers/headless-api/guides/baskets/update-package-quantity.md). Agents can also search and read this documentation through its [MCP server](https://docs.tebex.io/developers/~gitbook/mcp).

# Update Package Quantity

Set the quantity of an item in the basket

You will provide the basket and package ID being modified and a `quantity` value reflecting the user's desired quantity of that package.

{% hint style="info" %}
The user must be authorized before package quantities can be changed, otherwise the request will fail. See [Authorize a Basket](https://docs.tebex.io/developers/headless-api/guides/baskets/authorize-a-basket.md)
{% endhint %}

## Update package quantity

> Sets the quantity of the given item in the basket. The user must be logged in before the quantity can be changed.\
> \
> \- \`{packageId}\` accepts the package's \`ident\` or numeric ID. Using \`ident\` is recommended, since it works for every package type.\
> \- Numeric IDs still work for standard packages.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.1.0"},"tags":[{"description":"Endpoints requiring only a basket ident with no token","name":"Baskets"}],"servers":[{"description":"Main API scoped to public token","url":"https://headless.tebex.io/api/accounts/{token}","variables":{"token":{"default":"YOUR_PUBLIC_TOKEN","description":"The store's public token"}}}],"paths":{"/{basketIdent}/packages/{packageId}":{"put":{"description":"Sets the quantity of the given item in the basket. The user must be logged in before the quantity can be changed.\n\n- `{packageId}` accepts the package's `ident` or numeric ID. Using `ident` is recommended, since it works for every package type.\n- Numeric IDs still work for standard packages.","operationId":"updatePackageQuantity","parameters":[{"$ref":"#/components/parameters/basketIdent"},{"description":"The package's `ident` (recommended) or numeric ID.","explode":false,"in":"path","name":"packageId","required":true,"schema":{"type":"string"},"style":"simple"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/updatePackageQuantity_request"}}}},"responses":{"200":{"description":"Successful response."},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}},"summary":"Update package quantity","tags":["Baskets"]}}},"components":{"parameters":{"basketIdent":{"description":"The basket identifier.","explode":false,"in":"path","name":"basketIdent","required":true,"schema":{"type":"string"},"style":"simple"}},"schemas":{"updatePackageQuantity_request":{"properties":{"quantity":{"type":"integer"}}}}}}
```
