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

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

Reference: https://docs.orderupb2b.com/api-reference/products/get-product

## 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) — 商品序號。
- `outerSysCode` (string, optional, nullable) — ERP 端的商品代碼。
- `name` (string, optional, nullable) — 商品名稱。
- `status` (string, optional, nullable) — 商品狀態，共三種：Active（上架）、Inactive（下架，前台完全不會陳列）、InactiveVisible（下架-顯示，前台仍會陳列，但標示為不可購買）。狀態值只能在後台維護，本 API 目前不提供寫入；透過本 API 建立的商品一律為 Active。
- `productCategoryId` (long, optional) — 商品目前所屬的分類 id，方便 ERP 核對自己設定的值是否生效。

## 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,
  "outerSysCode": "string",
  "name": "string",
  "status": "string",
  "productCategoryId": 1
}
```

**SDK Code**

```python
import requests

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

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

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

print(response.json())
```

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

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

```csharp
using RestSharp;

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