> 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/customers

分頁查詢客戶清單，用於遺失 id 對照，或客戶是在後台先建立時，重新在 API 端找回既有客戶。可用 outerSysCode、name 篩選，兩者皆為大小寫不敏感的子字串比對（查 A100 也會比對到 A1000）；用 internalUserId 篩負責業務；用 updatedSince 篩「異動時間等於或晚於此刻」的資料，邊界含在內，剛好等於這一刻的資料也會被回傳，須帶明確時區或 Z（例如 2026-07-01T00:00:00Z），網址中的 + 記得轉成 %2B 編碼。page 從 1 起算，pageSize 為 1–100（預設 100），超出範圍一律回 400，不會自動夾限，避免分批掃描時誤判為已經抓完全部資料。

Reference: https://docs.orderupb2b.com/api-reference/customers/list-customers

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

### Query parameters

- `outerSysCode` (string, optional) — 依 ERP 端的客戶代碼篩選。大小寫不敏感的子字串比對，查 A100 也會一併比對到 A1000；要精確命中某一筆，請在你端再比對一次完整字串。
- `name` (string, optional) — 依企業名稱篩選。大小寫不敏感的子字串比對，規則與 outerSysCode 相同。
- `internalUserId` (long, optional) — 依負責業務（內部使用者）的序號篩選，只回傳指派給這位業務的客戶。合法的序號可由 GET /v1/internal-users 取得。
- `UpdatedSince` (string, optional) — 只回傳異動時間等於或晚於此刻的客戶，用於增量同步；邊界含在內，剛好等於這一刻的資料也會被回傳。必須是 ISO-8601 格式，並帶明確的時區位移或 Z（例如 2026-07-01T00:00:00Z）；沒有時區資訊會回傳 400 invalid_updated_since，不會被猜成任何時區。放進網址時記得把 + 編碼成 %2B。
- `Page` (integer, optional) — 頁碼，從 1 起算，省略時預設 1。小於 1 回傳 400 invalid_page；頁碼大到讓內部位移量溢位時同樣回傳 400 invalid_page。
- `PageSize` (integer, optional) — 每頁筆數，範圍 1 至 100，省略時預設 100。超出範圍一律回傳 400 invalid_page_size，不會自動夾限成合法值，避免分批掃描時誤判為已經抓完全部資料。

## Response

### 200

OK

- `data` (list of object, optional, nullable) — 本頁的客戶資料，每一筆為一個 CustomerResponse。
  - `id` (long, optional) — 客戶序號。
  - `outerSysCode` (string, optional, nullable) — ERP 端的客戶代碼。
  - `name` (string, optional, nullable) — 企業名稱。
  - `shortName` (string, optional, nullable) — 企業簡稱。
  - `cellPhone` (string, optional, nullable) — 公司電話。
  - `shippingAddress` (string, optional, nullable) — 收貨地址。
  - `internalUserId` (long, optional) — 負責業務（內部使用者）的序號。
  - `status` (string, optional, nullable) — 客戶狀態，Active（啟用）或 Inactive（停用）。透過本 API 建立的客戶一律為 Active；後續狀態變更由後台維護，本 API 目前不提供寫入。
- `totalCount` (integer, optional) — 符合篩選條件的客戶總數，涵蓋所有頁，不受目前頁碼影響。
- `currentPage` (integer, optional) — 目前頁碼，即請求帶入的 page，從 1 起算。
- `pageSize` (integer, optional) — 目前頁面的筆數上限，即請求帶入的 pageSize。
- `totalPages` (integer, optional) — 總頁數，等於 totalCount 除以 pageSize 後無條件進位；沒有符合的資料時為 0。

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

**Response**

```json
{
  "data": [
    {
      "id": 1,
      "outerSysCode": "string",
      "name": "string",
      "shortName": "string",
      "cellPhone": "string",
      "shippingAddress": "string",
      "internalUserId": 1,
      "status": "string"
    }
  ],
  "totalCount": 1,
  "currentPage": 1,
  "pageSize": 1,
  "totalPages": 1
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/v1/customers"

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

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

print(response.json())
```

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

	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/customers")

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

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

```csharp
using RestSharp;

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