# Safety stock and backorder for a variant at a location

`PUT /shop/stock-rules` · Rivier · shop

Safety stock and backorder for a variant at a location.

- Scope: shop:admin
- Sdk: shop.stockRule.set
- Cli: shop stock rule set

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "variantId": {
      "type": "string",
      "format": "uuid"
    },
    "locationId": {
      "type": "string",
      "format": "uuid"
    },
    "safetyStock": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1000000
    },
    "backorder": {
      "type": "boolean"
    }
  },
  "required": [
    "variantId",
    "locationId"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X PUT 'https://api.rivier.ai/shop/stock-rules' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "variantId": "string",
  "locationId": "string"
}'
```
