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

# Set Inventory Level

> Set inventory to an absolute value

# Set Inventory Level

Sets the stock for an inventory item to an absolute value. Unlike `adjust`, this sets the exact quantity rather than adding or subtracting.

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.launchmystore.io/api/v1/inventory_levels/set.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "inventory_item_id": "inv_abc123",
      "available": 100
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/inventory_levels/set.json', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      inventory_item_id: 'inv_abc123',
      available: 100
    })
  });
  ```
</CodeGroup>

## Body Parameters

<ParamField body="inventory_item_id" type="string" required>
  The inventory item ID to update — a variant UUID (`varientId`) or a product ID. The variant's stock is updated first; if no variant matches, the product-level stock is set as a fallback.
</ParamField>

<ParamField body="available" type="integer" required>
  The absolute available quantity to set (must be >= 0)
</ParamField>

## Response

Responses use the standard platform envelope: `status`, `type`, and a `data` object containing the updated `inventory_level`.

<ResponseField name="status" type="integer">
  HTTP status code (`200` on success)
</ResponseField>

<ResponseField name="type" type="string">
  `"success"` or `"error"`
</ResponseField>

<ResponseField name="data" type="object">
  Wrapper for the updated inventory level

  <Expandable title="inventory_level">
    <ResponseField name="inventory_item_id" type="string">
      The inventory item ID that was updated (the variant or product ID you passed)
    </ResponseField>

    <ResponseField name="available" type="integer">
      The absolute available quantity that was set
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Response

```json theme={null}
{
  "status": 200,
  "state": "success",
  "message": null,
  "data": {
    "inventory_level": {
      "inventory_item_id": "inv_abc123",
      "available": 100
    }
  }
}
```

## Use Cases

| Scenario                      | Endpoint to Use                      |
| ----------------------------- | ------------------------------------ |
| Physical count reconciliation | `set` - Set to exact counted value   |
| Receiving shipment            | `adjust` - Add received quantity     |
| Damaged goods                 | `adjust` - Subtract damaged quantity |

<Note>
  LaunchMyStore tracks a single stock value per variant (with a product-level fallback) — there is no per-location inventory model. Inventory is set or adjusted on the item directly, so there are no location connect/disconnect operations.
</Note>

## Error Responses

| Status | `type`  | When                                                             |
| ------ | ------- | ---------------------------------------------------------------- |
| `400`  | `error` | Missing `inventory_item_id` or `available`, or `available` \< 0  |
| `401`  | `error` | Invalid or missing access token                                  |
| `403`  | `error` | App doesn't have the `write_inventory` scope                     |
| `404`  | `error` | No variant or product matched `inventory_item_id` for this store |
