> 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.

# 查詢單一組合商品

GET https://api.example.com/v1/bundles/{id}

依商品序號查詢單一組合商品，含完整配方與即時算出的可組數量。若該 id 不存在、屬於其他租戶，或指向的是一般商品，一律回傳 404 not_found，這幾種情況無法從回應內容區分。

Reference: https://docs.orderupb2b.com/api-reference/bundles/get-bundle

## 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

### Path parameters

- `id` (long, required) — 要查詢的組合商品序號，是商品序號、不是規格序號。不存在、屬於其他租戶，或指向一般商品時，一律回傳 404 not_found。

## Response

### 200

OK

- `id` (long, optional) — 組合商品序號，即這個組合商品的商品序號。
- `skuId` (long, optional) — 唯讀。這個組合商品配對的規格（Bundle 型別）序號，僅供核對，任何情況下都不接受輸入。
- `outerSysCode` (string, optional, nullable) — ERP 端的組合商品代碼。
- `name` (string, optional, nullable) — 組合商品名稱。
- `status` (string, optional, nullable) — 狀態，語意與「商品」家族相同，共三種：Active（上架）、Inactive（下架）、InactiveVisible（下架-顯示）。透過本 API 建立的組合商品一律為 Active，狀態值只能在後台維護。
- `productCategoryId` (long, optional) — 目前所屬的分類序號。
- `unit` (string, optional, nullable) — 商品單位。
- `spec` (string, optional, nullable) — 規格內容。
- `barcode` (string, optional, nullable) — 條碼。
- `warehouse` (string, optional, nullable) — 倉別。
- `price` (double, optional) — 牌價，與組合商品價格家族讀寫的是同一個 sku 欄位，也可以用 GET /v1/bundles/\{id}/prices 單獨查詢。⚠️ 規格價格家族（PUT /v1/prices/batch）對組合品規格一律回傳 not\_found，不要對組合商品打那支端點。
- `sellPrice` (double, optional) — 對外售價，與 price 同樣可由 GET /v1/bundles/\{id}/prices 單獨查詢。
- `quantityPrecision` (integer, optional) — 數量精度（0 為整數，1 至 4 為小數位數）。
- `availableQty` (double, optional) — 可組數量，即以目前庫存最多能組出幾份這個組合商品：把每個元件的可售量除以它的每組用量、取其中最小值後無條件捨去，並夾在 0（不會是負數）。⚠️ 這不是前台可購買數量：允許負庫存銷售的元件在這裡仍然會被計入上限，前台則會把這種元件視為供應無限、整顆排除在外，兩個公式因此可能合法地給出不同的數字。這個落差不會出現在完全透過本 API 建立的元件身上——透過本 API 建立的規格一律不允許負庫存銷售，即使這個欄位在資料庫層的預設值其實是「允許」；落差只可能出現在透過本 API 以外的管道建立、且沿用了那個資料庫預設值的規格上，而這種規格你端無法從本 API 的回應裡分辨出來。這個欄位也不受 updatedSince 增量拉取涵蓋，細節見清單端點的說明。
- `components` (list of object, optional, nullable) — 配方，每一筆為一個 BundleComponentResponse；一個組合商品至少有 1 個元件。
  - `componentSkuId` (long, optional) — 元件規格序號。
  - `componentSkuOuterSysCode` (string, optional, nullable) — 元件規格的 ERP 代碼。
  - `componentSkuName` (string, optional, nullable) — 元件規格名稱。
  - `quantity` (double, optional) — 每組用量。
  - `sort` (integer, optional) — 排序，數字越小越前面。

## Errors

### 401 Unauthorized Error

Unauthorized

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

### 403 Forbidden Error

Forbidden

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

### 404 Not Found Error

Not Found

- `type` (string, optional, nullable) — 錯誤類型的識別 URI，通常可以忽略。
- `title` (string, optional, nullable) — 簡短的錯誤摘要。
- `status` (integer, optional, nullable) — 對應的 HTTP 狀態碼。
- `detail` (string, optional, nullable) — 詳細的錯誤說明文字。
- `instance` (string, optional, nullable) — 發生錯誤的請求路徑。

### 500 Internal Server Error

Internal Server Error

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

## Examples

**Response**

```json
{
  "id": 1,
  "skuId": 1,
  "outerSysCode": "string",
  "name": "string",
  "status": "string",
  "productCategoryId": 1,
  "unit": "string",
  "spec": "string",
  "barcode": "string",
  "warehouse": "string",
  "price": 1.1,
  "sellPrice": 1.1,
  "quantityPrecision": 1,
  "availableQty": 1.1,
  "components": [
    {
      "componentSkuId": 1,
      "componentSkuOuterSysCode": "string",
      "componentSkuName": "string",
      "quantity": 1.1,
      "sort": 1
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/v1/bundles/1"

headers = {"X-Signature": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/bundles/1';
const options = {method: 'GET', headers: {'X-Signature': '<apiKey>'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/bundles/1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Signature", "<apiKey>")

	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/bundles/1")

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

request = Net::HTTP::Get.new(url)
request["X-Signature"] = '<apiKey>'

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.get("https://api.example.com/v1/bundles/1")
  .header("X-Signature", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/v1/bundles/1', [
  'headers' => [
    'X-Signature' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/bundles/1");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Signature", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-Signature": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/bundles/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```