PUT/api/orgs/{org_id}/identities/{identity_id}/customer-plan

顧客プランを割り当て

プロビジョニングキーが割り当てられるのは、管理者がそのキーに委任したプランだけです。プランの削除(plan_key: null)はダッシュボードからのみ行えます。effective=immediateを指定しない限り、変更は翌月から有効になります。カウンターはリビジョンをまたいで引き継がれます。expected_revisionで保護されます(古い場合は409)。

認証: AuthorizationヘッダーにBearer形式のAPIキー

パスパラメーター

  • org_idstring必須

    お客様の組織ID(uuid)。GET /api/whoamiで取得できます。

  • identity_idstring必須

    アイデンティティID。

リクエストボディ

  • plan_keystring | null必須

    nullでプランを削除します(セッションの管理者のみ)。

  • plan_versioninteger | null必須

    plan_keyと一緒に設定するか、両方nullにします。

  • expected_revisioninteger必須

    割り当ての現在のrevision(ない場合は0)。

  • effectiveenum
    "next_month""immediate"
    既定値: "next_month"
  • budget_periodobject | null

    省略すると現在の期間を維持します。変更するにはプランとeffective=immediateが必要です。

レスポンス

  • 200

    割り当て。

    レスポンス
    • org_idstring必須
    • identity_idstring必須
    • revisioninteger必須

      次のPUTでexpected_revisionとして渡します。

    • plan_keystring | null必須
    • plan_versioninteger | null必須
    • pending_plan_keystring | null必須
    • pending_plan_versioninteger | null必須
    • pending_effective_atstring | null必須
    • updated_atstring必須
    • budget_periodobject
      いずれか

      object

      • kindstring必須

      object

      • kindstring必須
      • source_period_idstring必須
      • startstring必須
      • endstring必須
  • 401

    APIキーがない、不明、または失効しています。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 403

    このポリシー変更の権限がない、または顧客プランのキーです。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 404

    不明な組織、アイデンティティ、またはプランです。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 409

    expected_revisionが古いか、このデプロイ環境では顧客プランの適用が無効です。

    レスポンス
    • errorstring必須

      人が読めるメッセージ。

    • codestring

      エンドポイントが定義している場合の、安定した機械可読の理由(例:pro_required)。

    • actionstring

      エンドポイントが定義している場合の、安定した対処アクション。

    • detailsobject

      呼び出し元が対処するために必要な、顧客に提示して安全な文字列情報(推奨される識別子など)。

  • 422

    ボディの検証に失敗した、またはポリシーが無効です。

リクエスト

curl -X PUT 'https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/identities/acme-support/customer-plan' \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "plan_key": "starter",
  "plan_version": 2,
  "expected_revision": 3,
  "effective": "next_month"
}'

レスポンス

{
  "org_id": "3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10",
  "identity_id": "acme-support",
  "revision": 4,
  "plan_key": "starter",
  "plan_version": 2,
  "pending_plan_key": "starter",
  "pending_plan_version": 2,
  "pending_effective_at": "2026-12-01T00:00:00Z",
  "updated_at": "2026-11-10T16:00:00Z",
  "budget_period": {
    "kind": "calendar_month_utc"
  }
}

https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/identities/acme-support/customer-plan