> ## 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.

# Adjust Inventory

> Adjust inventory levels by a relative amount

# Adjust Inventory

Adjusts the inventory level for an inventory item at a location by a relative amount. Use positive numbers to increase inventory and negative numbers to decrease.

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.launchmystore.io/api/v1/inventory_levels/adjust.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "inventory_item_id": "inv_abc123",
      "location_id": "loc_main",
      "available_adjustment": -5,
      "reason": "Damaged items removed from stock"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/inventory_levels/adjust.json', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      inventory_item_id: 'inv_abc123',
      location_id: 'loc_main',
      available_adjustment: -5,
      reason: 'Damaged items removed from stock'
    })
  });
  ```
</CodeGroup>

## Body Parameters

<ParamField body="inventory_item_id" type="string" required>
  The inventory item ID to adjust
</ParamField>

<ParamField body="location_id" type="string" required>
  The location ID where the adjustment should be made
</ParamField>

<ParamField body="available_adjustment" type="integer" required>
  The amount to adjust by (positive to increase, negative to decrease)
</ParamField>

<ParamField body="reason" type="string">
  Reason for the adjustment (for audit trail)
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the request succeeded
</ResponseField>

<ResponseField name="data" type="object">
  The updated inventory level

  <Expandable title="Inventory Level Object">
    <ResponseField name="inventory_item_id" type="string">
      Inventory item ID
    </ResponseField>

    <ResponseField name="location_id" type="string">
      Location ID
    </ResponseField>

    <ResponseField name="available" type="integer">
      New available quantity after adjustment
    </ResponseField>

    <ResponseField name="on_hand" type="integer">
      New on-hand quantity after adjustment
    </ResponseField>

    <ResponseField name="updated_at" type="string">
      Update timestamp (ISO 8601)
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Response

```json theme={null}
{
  "success": true,
  "data": {
    "inventory_item_id": "inv_abc123",
    "location_id": "loc_main",
    "variant_id": "var_xyz789",
    "sku": "TSHIRT-S-BLK",
    "available": 40,
    "incoming": 100,
    "committed": 5,
    "on_hand": 45,
    "updated_at": "2024-01-25T10:00:00Z"
  }
}
```

## Batch Adjustments

For adjusting multiple inventory items at once, use the batch endpoint:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.launchmystore.io/api/v1/inventory_levels/adjust_batch.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "adjustments": [
        {
          "inventory_item_id": "inv_abc123",
          "location_id": "loc_main",
          "available_adjustment": -5
        },
        {
          "inventory_item_id": "inv_def456",
          "location_id": "loc_main",
          "available_adjustment": 10
        }
      ],
      "reason": "Inventory reconciliation"
    }'
  ```
</CodeGroup>

## Common Adjustment Reasons

| Reason       | Use Case                             |
| ------------ | ------------------------------------ |
| `received`   | New inventory received from supplier |
| `correction` | Fixing inventory count discrepancy   |
| `damaged`    | Removing damaged items               |
| `returned`   | Processing customer returns          |
| `shrinkage`  | Theft or unexplained loss            |
| `transfer`   | Moving between locations             |
| `recount`    | Physical inventory count adjustment  |

## Error Codes

| Code                     | Description                                   |
| ------------------------ | --------------------------------------------- |
| `UNAUTHORIZED`           | Invalid or missing access token               |
| `FORBIDDEN`              | App doesn't have `write_inventory` scope      |
| `NOT_FOUND`              | Inventory item or location not found          |
| `INSUFFICIENT_INVENTORY` | Adjustment would result in negative inventory |
| `VALIDATION_ERROR`       | Invalid request body                          |
