---
search:
  tags:
    - 購入者
    - POST
seo:
  description: >-
    必要なスコープ: customers:read。購入者のメールアドレスで、付与済みの機能フラグと設定… Reference for the POST
    /customers/state endpoint in the Cozeni 外部 API.
sidebar:
  label: 購入者の機能フラグを照会する
  badge: POST
title: 購入者の機能フラグを照会する
type: openapi-operation
---
必要なスコープ: customers:read。購入者のメールアドレスで、付与済みの機能フラグと設定値を返す。購入者がいない・機能フラグの権利が無いときも 200（customer_id: null・feature_flags: []）。同じ購入者の結果は最大60秒キャッシュしてよい。購入直後は反映まで数秒かかることがあるので、見つからなければ数秒おきに数回照会し直す。ログインのメールアドレスの本人確認は販売者のアプリで済ませること。

`POST /customers/state`

**Request body** (`application/json`, required)

- `email` (string<email>, required) — 購入者のメールアドレス。前後の空白を除き、大文字小文字を区別せずに照合する。URL には載せない（POST）。

Request body example:

```json
{
  "email": "hanako@example.com"
}
```

**Responses**

- `200` — 購入者の ID と機能フラグ。機能フラグの権利が1件以上あるときだけ customer\_id を返す。無ければ customer\_id: null・空配列。
- `400` — invalid\_input。メール形式の誤り・未知フィールド・JSON でない本文。
- `401` — unauthorized。失効、期限切れ、環境違いを含む。
- `403` — insufficient\_scope。customers:read が必要。
- `429` — rate\_limited。この API だけの別枠（キー・販売者・IP）。
- `500` — internal。DB の障害を含む。

Response example, 200:

```json
{
  "customer_id": "string",
  "feature_flags": [
    {
      "product_id": "string",
      "benefit_id": "string",
      "granted_at": "2019-08-24T14:15:22Z",
      "metadata": {
        "daily_messages": 100,
        "plan": "pro",
        "beta": true
      }
    }
  ]
}
```
