# Sync rules

> What happens to your listings when a seller changes a price or runs out.

Source: https://www.ninjabuy.com/business/docs/api/sync-rules

What happens to your listing when a supplier changes a price or runs out.

> Coming soon
>
> This is the plan for these routes, and they answer 404 until they are built. The [orders](https://www.ninjabuy.com/business/docs/api/orders.md), [balance](https://www.ninjabuy.com/business/docs/api/balance.md) and [inventory level](https://www.ninjabuy.com/business/docs/api/inventory-levels.md) routes work today.

- We read a listing again when an order for it comes in and on a regular schedule; each product's last\_checked\_at says when we last did. Keeping products in sync is free.
- The changes your code acts on are also events: [product.cost\_changed](https://www.ninjabuy.com/business/docs/webhooks.md#product-cost-changed), [product.repriced](https://www.ninjabuy.com/business/docs/webhooks.md#product-repriced), [product.paused](https://www.ninjabuy.com/business/docs/webhooks.md#product-paused) and [product.out\_of\_stock](https://www.ninjabuy.com/business/docs/webhooks.md#product-out-of-stock).

Endpoints

- GET /v1/sync\_rules Coming soon List sync rules
- GET /v1/sync\_rules/{id} Coming soon Retrieve a sync rule
- POST /v1/sync\_rules Coming soon Override for a product
- PUT /v1/sync\_rules/{id} Coming soon Replace a sync rule
- DELETE /v1/sync\_rules/{id} Coming soon Delete an override

## The Sync rule object

- `id` string

  Starts rule\_; the default rule is rule\_default.

- `applies_to` string

  all for the default rule, or a product id for an override.

- `on_cost_increase.action` string

  reprice to keep your margin, pause the product, or notify only.

- `on_cost_increase.keep_margin_percent` string

  With reprice: the margin to keep, of the sale price.

- `on_cost_increase.max_increase_percent` string|null

  With reprice: the most a price may rise at once. Above it, above\_max applies: pause or notify.

- `on_cost_decrease` string

  keep\_price, or reprice down to the same margin.

- `on_out_of_stock` string

  Always zero\_stock: a sold-out SKU shows 0 on your channels.

- `on_back_in_stock` string

  restock, or stay\_paused until you resume it.

- `round_to` string|null

  A price ending for repriced prices, such as .99 or .00.

sync\_rule

```json
{  "id": "rule_default",  "applies_to": "all",  "on_cost_increase": {    "action": "reprice",    "keep_margin_percent": "30",    "max_increase_percent": "15",    "above_max": "pause"  },  "on_cost_decrease": "keep_price",  "on_out_of_stock": "zero_stock",  "on_back_in_stock": "restock",  "round_to": ".99",  "updated_at": "2026-11-02T08:00:00Z"}
```

## List sync rules

GET /v1/sync\_rules Coming soon

The default rule first, then every per-product override.

Scope products:read

```bash
curl "https://www.ninjabuy.com/api/v1/sync_rules" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11"
```

Response · 200

```
HTTP/2 200 OK​{  "data": [    {      "id": "rule_default",      "applies_to": "all",      "on_cost_increase": {        "action": "reprice",        "keep_margin_percent": "30",        "max_increase_percent": "15",        "above_max": "pause"      },      "on_cost_decrease": "keep_price",      "on_out_of_stock": "zero_stock",      "on_back_in_stock": "restock",      "round_to": ".99",      "updated_at": "2026-11-02T08:00:00Z"    },    {      "id": "rule_9p3e",      "applies_to": "prd_1x0a",      "on_cost_increase": { "action": "pause" },      "on_cost_decrease": "keep_price",      "on_out_of_stock": "zero_stock",      "on_back_in_stock": "stay_paused",      "round_to": null,      "updated_at": "2026-11-03T10:14:00Z"    }  ],  "has_more": false,  "cursor": null}
```

## Retrieve a sync rule

GET /v1/sync\_rules/{id} Coming soon

One rule.

Scope products:read

### Path parameters

- `id` string required

  The rule's id.

### Errors

| Status | Type      | When                          |
| ------ | --------- | ----------------------------- |
| 404    | not-found | No such rule on this account. |

```bash
curl "https://www.ninjabuy.com/api/v1/sync_rules/rule_default" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11"
```

Response · 200

```
HTTP/2 200 OK​{  "id": "rule_default",  "applies_to": "all",  "on_cost_increase": {    "action": "reprice",    "keep_margin_percent": "30",    "max_increase_percent": "15",    "above_max": "pause"  },  "on_cost_decrease": "keep_price",  "on_out_of_stock": "zero_stock",  "on_back_in_stock": "restock",  "round_to": ".99",  "updated_at": "2026-11-02T08:00:00Z"}
```

## Override for a product

POST /v1/sync\_rules Coming soon

A product with its own rule follows it instead of the default. Fields you leave out take the default's.

Scope products:write

### Body

- `applies_to` string required

  all for the default rule, or a product id for an override.

- `on_cost_increase.action` string

  reprice to keep your margin, pause the product, or notify only.

- `on_cost_increase.keep_margin_percent` string

  With reprice: the margin to keep, of the sale price.

- `on_cost_increase.max_increase_percent` string|null

  With reprice: the most a price may rise at once. Above it, above\_max applies: pause or notify.

- `on_cost_decrease` string

  keep\_price, or reprice down to the same margin.

- `on_out_of_stock` string

  Always zero\_stock: a sold-out SKU shows 0 on your channels.

- `on_back_in_stock` string

  restock, or stay\_paused until you resume it.

- `round_to` string|null

  A price ending for repriced prices, such as .99 or .00.

### Errors

| Status | Type          | When                                                   |
| ------ | ------------- | ------------------------------------------------------ |
| 404    | not-found     | No such product on this account.                       |
| 409    | invalid-state | The product has an override already: replace that one. |

```bash
curl -X POST "https://www.ninjabuy.com/api/v1/sync_rules" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11" \  -H "Idempotency-Key: $(uuidgen)" \  -H "Content-Type: application/json" \  -d '{    "applies_to": "prd_1x0a",    "on_cost_increase": { "action": "pause" },    "on_back_in_stock": "stay_paused"  }'
```

Response · 201

```
HTTP/2 201 Created​{  "id": "rule_9p3e",  "applies_to": "prd_1x0a",  "on_cost_increase": { "action": "pause" },  "on_cost_decrease": "keep_price",  "on_out_of_stock": "zero_stock",  "on_back_in_stock": "stay_paused",  "round_to": null,  "updated_at": "2026-11-03T10:14:00Z"}
```

## Replace a sync rule

PUT /v1/sync\_rules/{id} Coming soon

Send the whole rule. It applies from the next time we read each listing.

Scope products:write

### Path parameters

- `id` string required

  The rule's id.

### Body

- `on_cost_increase.action` string

  reprice to keep your margin, pause the product, or notify only.

- `on_cost_increase.keep_margin_percent` string

  With reprice: the margin to keep, of the sale price.

- `on_cost_increase.max_increase_percent` string|null

  With reprice: the most a price may rise at once. Above it, above\_max applies: pause or notify.

- `on_cost_decrease` string

  keep\_price, or reprice down to the same margin.

- `on_out_of_stock` string

  Always zero\_stock: a sold-out SKU shows 0 on your channels.

- `on_back_in_stock` string

  restock, or stay\_paused until you resume it.

- `round_to` string|null

  A price ending for repriced prices, such as .99 or .00.

### Errors

| Status | Type      | When                          |
| ------ | --------- | ----------------------------- |
| 404    | not-found | No such rule on this account. |

```bash
curl -X PUT "https://www.ninjabuy.com/api/v1/sync_rules/rule_default" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11" \  -H "Content-Type: application/json" \  -d '{    "on_cost_increase": { "action": "notify" },    "on_cost_decrease": "keep_price",    "on_out_of_stock": "zero_stock",    "on_back_in_stock": "restock",    "round_to": ".99"  }'
```

Response · 200

```
HTTP/2 200 OK​{  "id": "rule_default",  "applies_to": "all",  "on_cost_increase": { "action": "notify" },  "on_cost_decrease": "keep_price",  "on_out_of_stock": "zero_stock",  "on_back_in_stock": "restock",  "round_to": ".99",  "updated_at": "2026-11-02T08:00:00Z"}
```

## Delete an override

DELETE /v1/sync\_rules/{id} Coming soon

The product follows the default rule again. rule\_default itself cannot be deleted.

Scope products:write

### Path parameters

- `id` string required

  The rule's id.

### Errors

| Status | Type          | When                             |
| ------ | ------------- | -------------------------------- |
| 409    | invalid-state | rule\_default cannot be deleted. |

```bash
curl -X DELETE "https://www.ninjabuy.com/api/v1/sync_rules/rule_9p3e" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11"
```

Response · 200

```
HTTP/2 200 OK​{ "id": "rule_9p3e", "deleted": true }
```

- The API is open on request. Our team sets up your Business account and issues its API keys.

  [Contact sales](https://www.ninjabuy.com/business#contact)
