顧客 API

ストアの顧客を作成、取得、更新、削除します。

エンドポイント
GET

/customers

customers:read

ページネーション付きの顧客一覧を取得します。

GET

/customers/:id

customers:read

IDで単一の顧客を取得します。

POST

/customers

customers:write

新しい顧客を作成します。

PUT

/customers/:id

customers:write

既存の顧客を更新します。部分更新に対応しています。

DELETE

/customers/:id

customers:write

顧客を論理削除します。レコードは30日以内に復元できます。

フィールドリファレンス
フィールド必須説明

id

string

いいえ

一意の顧客識別子(読み取り専用)

name

string

はい

顧客氏名

email

string

はい

顧客メールアドレス

phone

string

いいえ

国コード付き電話番号

createdAt

datetime

いいえ

ISO 8601 タイムスタンプ(読み取り専用)

updatedAt

datetime

いいえ

ISO 8601 タイムスタンプ(読み取り専用)

クエリパラメータ(一覧)
フィールド必須説明

page

integer

いいえ

ページ番号(デフォルト:1)

limit

integer

いいえ

1ページあたりの件数(デフォルト:20、最大:100)

q

string

いいえ

顧客名またはメールアドレスで検索

使用例
ページネーション付きで顧客を一覧表示
bash
curl "https://api.mercozy.com/api/v1/external/customers?page=1&limit=20" \
  -H "X-API-Key: mk_live_xxxxx"
顧客を作成
bash
curl -X POST "https://api.mercozy.com/api/v1/external/customers" \
  -H "X-API-Key: mk_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "john@example.com",
    "phone": "+1234567890"
  }'
レスポンス例
json
{
  "data": {
    "id": "cust_abc123",
    "name": "John Doe",
    "email": "john@example.com",
    "phone": "+1234567890",
    "createdAt": "2025-12-15T10:30:00Z",
    "updatedAt": "2025-12-15T10:30:00Z"
  }
}