POST
/
admin
/
price-lists
/
{id}
/
prices
/
batch
import Medusa from "@medusajs/js-sdk"

export const sdk = new Medusa({
  baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
  debug: import.meta.env.DEV,
  auth: {
    type: "session",
  },
})

sdk.admin.priceList.batchPrices("plist_123", {
  create: [{
    variant_id: "variant_123",
    currency_code: "usd",
    amount: 10,
    rules: {
      region_id: "reg_123"
    }
  }],
  update: [{
    id: "price_123",
    variant_id: "variant_123",
    amount: 20,
  }],
  delete: ["price_123"]
})
.then(({ created, updated, deleted }) => {
  console.log(created, updated, deleted)
})
{
"created": [
{
"id": "<string>",
"title": "<string>",
"currency_code": "usd",
"amount": 123,
"raw_amount": {},
"min_quantity": 123,
"max_quantity": 123,
"price_set_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"updated": [
{
"id": "<string>",
"title": "<string>",
"currency_code": "usd",
"amount": 123,
"raw_amount": {},
"min_quantity": 123,
"max_quantity": 123,
"price_set_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"deleted": {
"ids": [
"<string>"
],
"object": "price",
"deleted": true
}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

The price list's ID.

Body

application/json

The prices to create, update, or delete.

Response

200
application/json

OK

The details of the created, updated, and deleted prices in a price list.