> 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/skus/{id}

依 id 查詢單一規格。若該 id 不存在，或屬於其他租戶，一律回傳 404 not_found，兩種情況無法從回應內容區分。

Reference: https://docs.orderupb2b.com/api-reference/skus/get-sku

## 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) — 規格序號。
- `productId` (long, optional) — 所屬的商品序號。
- `outerSysCode` (string, optional, nullable) — ERP 端的規格代碼。
- `name` (string, optional, nullable) — 名稱。
- `barcode` (string, optional, nullable) — 條碼。
- `warehouse` (string, optional, nullable) — 倉別。
- `unit` (string, optional, nullable) — 商品單位。
- `spec` (string, optional, nullable) — 規格內容（例如「12入」「500g」）。
- `price` (double, optional) — 價格。
- `sellPrice` (double, optional) — 賣價。
- `quantityPrecision` (integer, optional) — 數量精度（0 為整數，1 至 4 為小數位數）。
- `status` (string, optional, nullable) — 規格狀態，只有兩種：Active（上架）、Inactive（下架）。與商品狀態不同，規格沒有「下架-顯示」（InactiveVisible）這個狀態——商品下架-顯示時，其規格一律收斂為 Inactive。狀態值只能在後台維護，本 API 目前不提供寫入；透過本 API 建立的規格一律為 Active。
- `inventoryQty` (double, optional) — 目前的在庫數量，唯讀，規格主檔的寫入端點永遠不會異動這個值。這裡是實際在庫的物理數量，不含已保留／已成立訂單的扣抵；需要可售數請改查 GET /v1/skus/\{id}/stock 的 availableQty。

## 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,
  "productId": 1,
  "outerSysCode": "string",
  "name": "string",
  "barcode": "string",
  "warehouse": "string",
  "unit": "string",
  "spec": "string",
  "price": 1.1,
  "sellPrice": 1.1,
  "quantityPrecision": 1,
  "status": "string",
  "inventoryQty": 1.1
}
```

**SDK Code**

```python
import requests

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

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

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

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/skus/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/skus/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/skus/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/skus/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/skus/1', [
  'headers' => [
    'X-Signature' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/skus/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/skus/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()
```