Skip to main content
POST
/
admin
/
price-lists
/
{id}
/
prices
/
batch
JS SDK
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.

create
object[]

The prices to create.

update
object[]

The prices to update.

delete
string[]

The prices to delete.

A price's ID.

Response

OK

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

created
object[]
required

The created prices.

updated
object[]
required

The updated prices.

deleted
object
required

The details of the deleted prices.