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

# Set per-variant inventory tracking flags and stock counts



## OpenAPI

````yaml /api-reference/openapi.json patch /products/{productId}/inventory
openapi: 3.1.0
info:
  title: Replo Public API
  version: '2026-09-08'
servers:
  - url: https://api.replo.app/v1
security: []
paths:
  /products/{productId}/inventory:
    patch:
      tags:
        - Products
      summary: Set per-variant inventory tracking flags and stock counts
      operationId: products.setInventory
      parameters:
        - name: Replo-Api-Version
          in: header
          required: true
          schema:
            type: string
            enum:
              - '2026-09-08'
          description: The public API version to use for this request.
        - schema:
            type: string
            format: uuid
          required: true
          name: productId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                variants:
                  type: array
                  items:
                    type: object
                    properties:
                      trackInventory:
                        type: boolean
                      available:
                        type: integer
                        minimum: 0
                        maximum: 2147483647
                      continueSellingWhenOutOfStock:
                        type: boolean
                      optionValues:
                        type: array
                        items:
                          type: object
                          properties:
                            optionName:
                              type: string
                              minLength: 1
                              maxLength: 255
                              description: Option name, e.g. "Color".
                            value:
                              type: string
                              minLength: 1
                              maxLength: 512
                              description: Value within that option, e.g. "Navy".
                          required:
                            - optionName
                            - value
                    required:
                      - optionValues
                    additionalProperties: false
                  minItems: 1
                  maxItems: 250
              required:
                - variants
              additionalProperties: false
      responses:
        '200':
          description: Set per-variant inventory tracking flags and stock counts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductInventory'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '401':
          description: Missing or invalid Replo Public API token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '403':
          description: You are not authorized to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '409':
          description: The resource is in a conflicting state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '413':
          description: File content exceeds the 10 MiB limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '429':
          description: >-
            Too many requests. Please retry after the time indicated by the
            Retry-After header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '500':
          description: An internal error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
        '503':
          description: Service temporarily unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
      security:
        - bearerAuth: []
components:
  schemas:
    ProductInventory:
      type: object
      properties:
        object:
          type: string
          enum:
            - product_inventory
        productId:
          type: string
          format: uuid
        variants:
          type: array
          items:
            type: object
            properties:
              optionValues:
                type: array
                items:
                  type: object
                  properties:
                    optionName:
                      type: string
                      minLength: 1
                      maxLength: 255
                      description: Option name, e.g. "Color".
                    value:
                      type: string
                      minLength: 1
                      maxLength: 512
                      description: Value within that option, e.g. "Navy".
                  required:
                    - optionName
                    - value
              trackInventory:
                type: boolean
              available:
                type:
                  - integer
                  - 'null'
              continueSellingWhenOutOfStock:
                type: boolean
            required:
              - optionValues
              - trackInventory
              - available
              - continueSellingWhenOutOfStock
      required:
        - object
        - productId
        - variants
    PublicApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            doc_url:
              type: string
          required:
            - code
            - message
            - doc_url
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````