# Temporary costs

A temporary cost is a lower cost for a product or option between two dates, for example a supplier's promotion. While it is live, pricing rules price from it: prices that follow a supplier's pricing rules drop for the promotion and go back on their own when it ends. Prices set by hand never move.

The normal cost stays as it is. The temporary cost sits beside it with its own start, end and label, and the merchant sees it on the product page.

## How pricing uses it

- There is one temporary cost per price: the product's own price and each option's price, in each currency. Setting another one replaces it.
- While it is live, pricing uses the lower of the normal cost and the temporary cost. A temporary cost above the normal cost changes nothing.
- Prices set by the store's pricing rules (products imported from a supplier whose connection has pricing rules) are priced again when a temporary cost starts, changes or ends. A price set by hand, or held by a "leave the price as it is" rule, never moves.
- Orbit switches temporary costs on and off itself, every hour. Your integration does not need to be running when one starts or ends, so book them ahead with `startsAt`.
- A temporary cost that has ended is deleted.

## Scopes

| Route | Scope |
| --- | --- |
| `PUT /v1/temporary-costs` | `product:update` |
| `POST /v1/temporary-costs/clear` | `product:update` |
| `GET /v1/products/{productId}/temporary-costs` | `product:read` |

## Set temporary costs

`PUT /v1/temporary-costs` takes up to 500 items per call (the `X-Bulk-Max-Items` response header says so).

```json
{
  "currency": "GBP",
  "supplierConnectionId": "3f1c2b8e-6d4a-4b8f-9c1e-2a7d5e9f0b13",
  "label": "November promotion",
  "items": [
    { "sku": "CHAIR-OAK", "cost": 34.9, "startsAt": "2026-11-01T00:00:00Z", "endsAt": "2026-12-01T00:00:00Z" },
    { "variantId": "9b2d7c4e-1f3a-4e6b-8d2c-5a9e7f1b3c60", "cost": 12.5, "endsAt": "2026-11-15T00:00:00Z", "label": "Clearance" }
  ]
}
```

Each item names what it applies to with exactly one of:

- `sku`: a product's SKU sets the product's price and every option price it has in the currency; an option's SKU sets that option. A SKU that several products share sets each of them.
- `variantId`: one option.
- `productId`: the product's price and every option price.

| Field | Required | Meaning |
| --- | --- | --- |
| `cost` | yes | Above zero and below 100,000,000, with at most two decimal places, in `currency`. |
| `endsAt` | yes | ISO 8601, in the future and at most 400 days ahead. The cost stops at this instant. |
| `startsAt` | no | ISO 8601, before `endsAt`. Leave it out to start now. |
| `label` | no | Up to 120 characters on one line, shown to the merchant on the product page. A `label` at the top level applies to every item without one. |

At the top level, `currency` is a three letter ISO code and defaults to the store's main currency; a temporary cost applies to prices in that currency only. `supplierConnectionId` limits every item to products imported through that supplier connection: use it when two suppliers share a SKU.

One item reaches at most 50 prices. For a product with more options, send the options' `variantId` values.

The answer reports every item:

```json
{
  "requested": 2,
  "succeeded": 1,
  "failed": 1,
  "currency": "GBP",
  "results": [
    { "id": "CHAIR-OAK", "ok": true, "rows": 2 },
    { "id": "9b2d7c4e-1f3a-4e6b-8d2c-5a9e7f1b3c60", "ok": false, "error": "No option with this id has a GBP price in this shop among the products imported from this supplier." }
  ]
}
```

`rows` is how many prices the item set. A product without options answers `rows: 2` for its SKU: its price is kept on the product and on its default option, and both get the temporary cost. An item that names the same SKU, option or product as an earlier item in the call is skipped, and the answer counts it in `duplicateIdsIgnored`.

A body that cannot be used at all (more than 500 items, a date that is not a date, a cost of zero or below, a `currency` the shop does not sell in) answers `400` with a message naming the item and the field, and nothing is set.

Calls are safe to repeat: each item replaces the temporary cost of the prices it reaches, so sending the same body again changes nothing. An `Idempotency-Key` header works here as on every `/v1` write.

## Clear temporary costs

`POST /v1/temporary-costs/clear` takes up to 500 items, each with one of `sku`, `variantId` or `productId`, and the same optional `currency` and `supplierConnectionId`. It removes the temporary costs those items reach; prices set by pricing rules go back to the normal cost at once. Clearing a price that has no temporary cost succeeds with `rows: 0`. An item that names nothing in the shop answers `ok: false` with the reason, as for a set.

```json
{ "items": [{ "sku": "CHAIR-OAK" }] }
```

## Read a product's temporary costs

`GET /v1/products/{productId}/temporary-costs` answers the live and booked temporary costs of a product and its options:

```json
{
  "items": [
    {
      "variantId": null,
      "variantName": null,
      "sku": "CHAIR-OAK",
      "currency": "GBP",
      "cost": 34.9,
      "normalCost": 40,
      "startsAt": "2026-11-01T00:00:00.000Z",
      "endsAt": "2026-12-01T00:00:00.000Z",
      "label": "November promotion",
      "setBy": { "type": "plugin", "name": "Supplier Cost Tools" },
      "status": "live"
    }
  ],
  "meta": { "total": 1 },
  "rulePriced": true
}
```

`status` is `live` or `scheduled`. `setBy.type` is `plugin`, `api_key`, `mcp` or `user`, and `setBy.name` says who, for example the plugin's name (null when it is not known). `rulePriced` says whether pricing rules price the product, so whether its temporary costs move its price. A product that is not in the shop answers `404`.

## Webhooks

When a temporary cost starts, changes or ends, Orbit sends `product.cost_changed` with `source: "temporary_cost"`, and the values are the cost pricing uses before and after. When that moves a price, `product.price_changed` follows. See [Price and cost changes](/guides/webhooks#price-and-cost-changes).
