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

# Set on-hand stock for many SKUs

> Absolute SET of the on-hand quantity per (sku, location). Requires the `stock:write` scope. Reservations (committed) are system-owned and never written here. The request is 200 when structurally valid; each row carries its own status in the results array.



## OpenAPI

````yaml /new-api/openapi.json post /stock/levels/set
openapi: 3.1.0
info:
  title: Riqra Public API
  version: 1.0.0
  description: Programmatic access to a merchant's commerce data.
servers:
  - url: https://api-v2.riqra.com/public/v1
security: []
paths:
  /stock/levels/set:
    post:
      tags:
        - Stock
      summary: Set on-hand stock for many SKUs
      description: >-
        Absolute SET of the on-hand quantity per (sku, location). Requires the
        `stock:write` scope. Reservations (committed) are system-owned and never
        written here. The request is 200 when structurally valid; each row
        carries its own status in the results array.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                items:
                  type: array
                  items:
                    type: object
                    properties:
                      sku:
                        type: string
                        minLength: 1
                        maxLength: 64
                        example: SKU-001
                        description: SKU of the product variant to update.
                      locationId:
                        type: string
                        format: uuid
                        example: 0b2e9f5a-1c3d-4e6f-8a9b-0c1d2e3f4a5b
                        description: >-
                          Location to set stock at (UUID). List them via `GET
                          /stock/locations`.
                      onHand:
                        type: integer
                        minimum: 0
                        example: 42
                        description: >-
                          Absolute on-hand quantity to set — a replacement
                          value, not a delta.
                    required:
                      - sku
                      - locationId
                      - onHand
                  minItems: 1
                  maxItems: 100
              required:
                - items
      responses:
        '200':
          description: Per-row results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StockSetResponse'
        '400':
          description: Invalid request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Missing required scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    StockSetResponse:
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/StockSetResult'
          description: One result per requested item, in request order.
      required:
        - results
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            requestId:
              type: string
          required:
            - code
            - message
            - requestId
      required:
        - error
    StockSetResult:
      type: object
      properties:
        sku:
          type: string
          description: Echoes the requested SKU.
        locationId:
          type: string
          description: Echoes the requested location.
        status:
          type: integer
          description: >-
            Per-row HTTP-style status: `200` on success, otherwise `404`, `409`,
            or `422`.
          example: 200
        onHand:
          type: integer
          description: Resulting on-hand quantity (success only).
        committed:
          type: integer
          description: Units reserved by open orders, system-owned (success only).
        available:
          type: integer
          description: '`onHand` − `committed` (success only).'
        code:
          type: string
          description: >-
            Error code (error rows only): `SKU_NOT_FOUND`, `SKU_DISCONTINUED`,
            `LOCATION_NOT_FOUND`, `LOCATION_INACTIVE`, or
            `STOCK_BELOW_COMMITTED`.
        message:
          type: string
          description: Human-readable error detail (error rows only).
      required:
        - sku
        - locationId
        - status
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'Public API key presented as `Authorization: Bearer rq_live_…`.'

````