> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.orderupb2b.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.orderupb2b.com/_mcp/server.

# 批次更新組合商品價格

PUT https://api.example.com/v1/bundle-prices/batch
Content-Type: application/json

批次更新多筆組合商品的牌價與對外售價，逐筆結果互不影響，規則鏡像規格價格的批次端點：price、sellPrice 各自可省略，省略（null）保留現有值，不會被歸零；兩者若有帶值，必須介於 0 到 9999999.99，超出範圍該筆失敗並帶 invalid_price。bundleId 必填，是商品序號，不是規格序號——伺服器會解析成該商品配對的組合品規格；指向不存在、屬於其他租戶，或一般商品的 bundleId，該筆失敗並帶 not_found。⚠️ 逐筆狀態一律是 updated，不會是 created：價格是既有規格上的欄位，這支端點只會更新既有的組合商品，不會建立新的。送出空陣列或沒有 body 會在受理前被拒絕，回傳 400 empty_batch；已受理的請求一律回傳 HTTP 200，逐筆的處理結果放在回應 body 的 items 裡（見 BatchUpsertResult / BatchItemResult），單筆失敗不會讓其他筆一起失敗。

Reference: https://docs.orderupb2b.com/api-reference/bundle-prices/batch-update-bundle-prices

## Authentication

- `X-Signature` header (required) — 每個 /v1 請求都必須帶 X-Client-Id、X-Timestamp、X-Nonce 與 X-Signature 四個標頭。X-Signature 是以 client secret 對 canonical string 做 HMAC-SHA256 後的 Base64。canonical string 的組成、可複製的簽章範例與 401 排查步驟，請參閱「驗證與簽章」。

## Request

### Body (application/json)

This endpoint expects a list of object.

- `list of object`
  - `bundleId` (long, optional) — 要更新價格的組合商品序號，是商品序號、不是規格序號，伺服器會解析成該商品配對的組合品規格。必填；指向不存在、屬於其他租戶，或一般商品時，這一筆會在逐筆結果中回報 failed，不影響其他筆。
  - `price` (double, optional, nullable) — 牌價。省略（null）保留現值；若有帶值，必須介於 0 到 9999999.99 之間，超出範圍該筆失敗並帶 invalid_price。
  - `sellPrice` (double, optional, nullable) — 對外售價。省略（null）保留現值；範圍規則與 price 相同。

## Response

### 200

OK

- `items` (list of object, optional, nullable) — 逐筆的處理結果，順序與送出的陣列相同，一筆對一筆。
  - `index` (integer, optional) — 這一筆在原始批次陣列中的索引位置（從 0 起算），用來比對是哪一筆。
  - `status` (string, optional, nullable) — 這一筆的結果。created=新增、updated=更新、failed=失敗（原因見 errors）。
  - `id` (long, optional, nullable) — 新增或更新成功時，這一筆資料的 id；失敗時為 null。
  - `errors` (list of string, optional, nullable) — 失敗時的錯誤訊息，目前永遠只有一則；成功時為空陣列。雖然是陣列形狀，仍建議把它當「可能有多則」的陣列處理，不要假設長度一定是 1。

## Errors

### 400 Bad Request Error

Bad Request

- `error` (string, optional, nullable) — 錯誤代碼，固定為 snake_case 字串，依代碼判斷失敗原因。

### 401 Unauthorized Error

Unauthorized

- `error` (string, optional, nullable) — 錯誤代碼，固定為 snake_case 字串，依代碼判斷失敗原因。

### 403 Forbidden Error

Forbidden

- `error` (string, optional, nullable) — 錯誤代碼，固定為 snake_case 字串，依代碼判斷失敗原因。

### 500 Internal Server Error

Internal Server Error

- `code` (string, optional, nullable) — 錯誤代碼字串。
- `message` (string, optional, nullable) — 對應的錯誤說明文字。

## Examples

**Request**

```json
[
  {}
]
```

**Response**

```json
{
  "items": [
    {
      "index": 1,
      "status": "string",
      "id": 1,
      "errors": [
        "string"
      ]
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/v1/bundle-prices/batch"

payload = [{}]
headers = {
    "X-Signature": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/bundle-prices/batch';
const options = {
  method: 'PUT',
  headers: {'X-Signature': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/bundle-prices/batch"

	payload := strings.NewReader("[\n  {}\n]")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-Signature", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/bundle-prices/batch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Signature"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {}\n]"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.example.com/v1/bundle-prices/batch")
  .header("X-Signature", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {}\n]")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.example.com/v1/bundle-prices/batch', [
  'body' => '[
  {}
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Signature' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/bundle-prices/batch");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-Signature", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {}\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Signature": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [[]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/bundle-prices/batch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```