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

# Update Inventory

> Updates the available inventory for a listing. Supports two actions: setting inventory to an exact value (`SET_INVENTORY`) or adjusting it by a delta (`ADJUST_INVENTORY`). If inventory reaches 0, the listing is automatically closed.



## OpenAPI

````yaml PUT /v1/listings/{id}/inventory
openapi: 3.0.1
info:
  title: OpenAPI Treet Listings
  description: Treet API to manage brand store listings
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.treet-test.co
security:
  - ClientIdAuth: []
    ApiKeyAuth: []
paths:
  /v1/listings/{id}/inventory:
    put:
      summary: Update Listing Inventory
      description: >-
        Updates the available inventory for a listing. Supports two actions:
        setting inventory to an exact value (`SET_INVENTORY`) or adjusting it by
        a delta (`ADJUST_INVENTORY`). If inventory reaches 0, the listing is
        automatically closed.
      parameters:
        - name: id
          in: path
          required: true
          description: The listing ID.
          schema:
            type: string
            format: uuid
      requestBody:
        description: Inventory update action
        required: true
        content:
          application/json:
            schema:
              required:
                - action
              type: object
              example:
                action: SET_INVENTORY
                oldInventory: 5
                newInventory: 3
              properties:
                action:
                  description: |-
                    The inventory update operation to perform.
                     * `SET_INVENTORY` — sets inventory to an exact value. Requires `oldInventory` and `newInventory`.
                     * `ADJUST_INVENTORY` — adjusts inventory by a delta. Requires `inventoryAdjustment`.
                  type: string
                  enum:
                    - SET_INVENTORY
                    - ADJUST_INVENTORY
                oldInventory:
                  description: >-
                    The expected current inventory count. The update will only
                    proceed if the listing's current inventory matches this
                    value.

                     *Required if `action` is `SET_INVENTORY`
                  type: integer
                  minimum: 0
                newInventory:
                  description: |-
                    The inventory value to set.

                     *Required if `action` is `SET_INVENTORY`
                  type: integer
                  minimum: 0
                inventoryAdjustment:
                  description: >-
                    The amount to add (positive) or subtract (negative) from the
                    current inventory.

                     *Required if `action` is `ADJUST_INVENTORY`
                  type: integer
      responses:
        '200':
          description: Inventory updated successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - availableInventory
                properties:
                  id:
                    type: string
                    description: The Treet listing ID.
                    example: 550e8400-e29b-41d4-a716-446655440000
                  availableInventory:
                    description: The updated available inventory count.
                    type: integer
                    minimum: 0
                    example: 3
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    ClientIdAuth:
      type: apiKey
      in: header
      name: X-Treet-Client-Id
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Treet-Authentication-Key

````