> 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/companies/{id}/point-quota

依客戶序號查詢目前的點數額度水位。查無此客戶（含跨租戶命中）一律回傳 404 company_not_found，兩種情況無法從回應內容區分。客戶存在但從未同步過點數時仍是 200，不是 404：balance 為 0、enabled 為 true（點數側「缺列即視為啟用」，與合約額度側的預設相反，見合約額度家族說明）、memo 為空字串、updatedAt 為 null。

Reference: https://docs.orderupb2b.com/api-reference/point-quota/get-point-quota

## 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) — 要查詢的客戶序號，即 CompanyResponse 的 id。查無此客戶或屬於其他租戶時，一律回傳 404 company_not_found。

## Response

### 200

OK

- `companyId` (long, optional) — 客戶序號，即 CompanyResponse 的 id。
- `companyOuterSysCode` (string, optional, nullable) — 這個客戶的 ERP 代碼，即 outerSysCode，方便你端核對。
- `balance` (double, optional) — 目前的絕對點數餘額，數值（小數 2 位），由批次同步端點寫入的最新值。
- `pendingUsed` (double, optional) — 已下單但尚未出貨、佔用中的點數保留量。
- `availableBalance` (double, optional) — 目前還能使用的點數，等於 balance 減去 pendingUsed；可能為負，代表保留量已經超過餘額，刻意不夾在 0，呈現層需要自行處理。
- `enabled` (boolean, optional) — 是否納入額度管控。⚠️ 目前只是回報，不是卡控：下單時真正檢查點數是否足夠的流程不會讀這個欄位，把它設成 false 不會讓這個客戶的點數變成無上限。與合約額度側的同名欄位不對稱——那邊的 enabled 真的會被下單流程拿來決定是否放行，這邊目前不會，詳見批次同步端點的說明。
- `memo` (string, optional, nullable) — 備註，最長 200 字元，由批次同步端點寫入。
- `updatedAt` (datetime, optional, nullable) — 最後一次同步的時間；從未同步過時為 null。

## 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
{
  "companyId": 1,
  "companyOuterSysCode": "string",
  "balance": 1.1,
  "pendingUsed": 1.1,
  "availableBalance": 1.1,
  "enabled": true,
  "memo": "string",
  "updatedAt": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/v1/companies/1/point-quota"

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

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

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/companies/1/point-quota';
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/companies/1/point-quota"

	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/companies/1/point-quota")

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/companies/1/point-quota")
  .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/companies/1/point-quota', [
  'headers' => [
    'X-Signature' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/companies/1/point-quota");
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/companies/1/point-quota")! 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()
```