# Update an inventory item

Updates the fields supplied and returns the item in the same shape as reading
it.
The companion-switch pairs behave as they do on create, and that matters more
here because turning a switch off **discards the stored value**: clearing
has_quantity resets quantity to 0, clearing has_expiry resets ttl to null,
clearing is_redeemable resets reward_point_cost to 0, and clearing has_serial
resets serial_assignment_mode to null. Sending one of those values while its
switch is off returns a 422 naming the field.
Changing stock settings does not touch items already allocated to people. An
allocation keeps the expiry it was given, so shortening the item's validity
period changes only what future allocations get.
Images work as they do on create - see the create endpoint for how to send a
file rather than a URL.
The account's own attribute configuration also applies, so an update may accept
fields beyond those listed here.

Endpoint: PUT /api/v2/inventory/item/{id}
Version: 2.0.0
Security: default

## Path parameters:

  - `id` (integer, required)
    The ID of the inventory item.

## Header parameters:

  - `Rosterfy-Platform` (string)

## Request fields (application/json):

  - `name` (string)
    The name of the item, as it appears to administrators and to volunteers choosing a reward. Required, and limited to 255 characters.

  - `type` (string)
    What kind of item this is. `distributable` is a physical item handed out and tracked per person, `virtual` is issued without stock, and `certificate` issues a certificate on allocation. Required, and it determines which of the other fields apply.

  - `external_id` (string)
    Your own reference for the item - a SKU or catalogue code. Not used by Rosterfy for anything; it exists so you can match an item back to your own system.

  - `parent_id` (integer)
    The ID of the item this one is a variant of. Set only on variant items.

  - `certificate_id` (integer)
    The ID of the certificate template to issue when the item is allocated. Applies to items of type `certificate`.

  - `category_id` (integer)
    The ID of the category the item is filed under.

  - `icon` (string)
    The icon shown against the item. Either an icon class name, or an image URL when is_image is set. See file_path for uploading an image instead.

  - `is_image` (boolean)
    Whether the item is shown with an uploaded image rather than an icon. When set, supply the image through file_path.

  - `file_path` (string)
    The image to show against the item, used only when is_image is set. Send either a URL to an existing image, or the image itself as a file - see the endpoint description for how to send a file. The value is not stored as sent; it is resolved and the result is stored on icon.

  - `has_quantity` (boolean)
    Whether stock is tracked for this item. When set, quantity must be given and must be greater than 0. When not set, quantity is reset to 0.

  - `quantity` (integer)
    How many of the item are in stock. Only accepted when has_quantity is set, and must be greater than 0.

  - `max_per_user` (integer)
    The most of this item any one person may hold at once. 0 means no limit. Cannot be negative. An allocation that would exceed it is rejected unless the request overrides the limit.

  - `has_serial` (boolean)
    Whether individual units carry serial numbers. When set, serial_assignment_mode must be given. When not set, serial_assignment_mode is reset to null.

  - `serial_assignment_mode` (string)
    How a serial is chosen when the item is allocated: `auto` takes the next free serial, `manual` requires the serial to be named on the allocation. Only accepted when has_serial is set.

  - `is_redeemable` (boolean)
    Whether volunteers can redeem this item with reward points. When set, reward_point_cost must be given. When not set, reward_point_cost is reset to 0.

  - `reward_point_cost` (integer)
    How many reward points redeeming the item costs. Only accepted when is_redeemable is set, and must be greater than 0.

  - `has_expiry` (boolean)
    Whether an allocation of this item expires. When set, ttl must be given. When not set, ttl is reset to null. Not stored on the item itself - it is the switch that decides whether ttl is accepted.

  - `ttl` (integer)
    How long an allocation of this item stays valid, in seconds. Used to work out the expiry date when the item is given to someone. Only accepted when has_expiry is set; when has_expiry is not set it is reset to null.

  - `budget_cost` (number)
    The unit cost of the item, used in budget reporting. Two decimal places.

  - `publish` (boolean)
    Whether the item is live. An unpublished item cannot be collected and is not offered to volunteers.

  - `is_archived` (boolean)
    Whether the item is archived. An archived item is kept for reporting but is no longer offered.

  - `is_inheritable` (boolean)
    Whether subaccounts of this account can use the item.

  - `is_distributable_at_checkin_checkout` (boolean)
    Whether the item can be handed out as part of checking a volunteer in or out of a shift.

  - `has_variants` (boolean)
    Whether this item is a parent that holds variants, such as a garment held in several sizes.

  - `varied_by_attribute_id` (integer)
    The ID of the attribute the variants differ by, such as size. Set on a parent item.

  - `variant_source_id` (integer)
    The ID of the option, within the varying attribute, that this variant represents. Set on a variant item.

  - `variation_config` (object)
    The variant configuration for a parent item.

  - `sort_order` (integer)
    Where the item sits in lists. Lower sorts first.

  - `custom_*` (string)
    A custom attribute, named by its code - custom_shirt_size, for example. The value follows the attribute's own type, so it may be a string, a number, a boolean or a list. See the custom attributes documentation.

## Response 200 fields (application/json):

  - `object` (object)

  - `object.id` (integer)

  - `object.parent_id` (string | null)

  - `object.type` (string)

  - `object.external_id` (string)

  - `object.certificate_id` (string | null)

  - `object.is_image` (integer)

  - `object.icon` (string)

  - `object.variation_config` (string | null)

  - `object.has_quantity` (integer)

  - `object.quantity` (integer)

  - `object.max_per_user` (integer)

  - `object.has_serial` (integer)

  - `object.category_id` (string | null)

  - `object.serial_assignment_mode` (string | null)

  - `object.is_distributable` (integer)

  - `object.is_redeemable` (integer)

  - `object.ttl` (string | null)

  - `object.reward_point_cost` (integer)

  - `object.budget_cost` (string)

  - `object.publish` (integer)

  - `object.sort_order` (integer)

  - `object.has_variants` (integer)

  - `object.varied_by_attribute_id` (string | null)

  - `object.variant_source_id` (string | null)

  - `object.is_archived` (integer)

  - `object.is_distributable_at_checkin_checkout` (string | null)

  - `object.deleted_at` (string | null)

  - `object.is_erased` (integer)

  - `object.created_at` (string)

  - `object.updated_at` (string)

  - `object.deleted_by` (string | null)

  - `object.is_inheritable` (integer)

  - `object.name` (string)

  - `nice` (object)

  - `nice.created_at` (string)

  - `nice.created_at__date` (string)

  - `nice.created_at__time` (string)

  - `nice.created_at__offset` (string)

  - `nice.created_at__offset_minutes` (integer)

  - `nice.created_at__dayofweek` (string)

  - `nice.external_id` (string)

  - `nice.has_quantity` (string)

  - `nice.has_variants` (string)

  - `nice.is_distributable_at_checkin_checkout` (string)

  - `nice.name` (string)

  - `nice.publish` (string)

  - `nice.type` (string)

  - `nice.type:value` (string)

  - `nice.type:array` (string)

  - `nice.updated_at` (string)

  - `nice.updated_at__date` (string)

  - `nice.updated_at__time` (string)

  - `nice.updated_at__offset` (string)

  - `nice.updated_at__offset_minutes` (integer)

  - `nice.updated_at__dayofweek` (string)

  - `nice.distributed` (integer)

  - `nice.allocated` (integer)

  - `nice.available` (integer)

  - `nice.stock_level` (string)

  - `nice.manual_serial_required` (boolean)

  - `nice.account_name_path` (string)

  - `nice.is_foreign_account` (boolean)

  - `relations` (object)

  - `permissions` (object)

  - `permissions.read` (boolean)

  - `permissions.update` (boolean)

  - `permissions.delete` (boolean)

  - `permissions.redeem` (boolean)

  - `attributes` (object)

