# ペイウォールを更新する

> 特定のペイウォールのリモートコンフィグを更新します。このエンドポイントを使用して、ペイウォールの外観と動作をカスタマイズするためのリモートコンフィグ値を変更できます。
>
> **重要:** リモートコンフィグを更新すると、既存のすべてのリモートコンフィグが上書きされます。既存のリモートコンフィグを保持する必要がある場合は、まずペイウォールを取得し、そこから remote_configs をコピーして、更新リクエストで必要なオブジェクトのみを変更してください。

## OpenAPI

```yaml
/api-specs/adapty-api.yaml put /api/v2/server-side-api/paywalls/{paywall_id}/
openapi: 3.1.0
info:
  title: Adapty サーバーサイド API
  version: 1.0.0
servers:
  - url: https://api.adapty.io
    description: 本番サーバー
paths:
  /api/v2/server-side-api/paywalls/{paywall_id}/:
    put:
      summary: ペイウォールを更新する
      description: |
        特定のペイウォールのリモートコンフィグを更新します。このエンドポイントを使用して、ペイウォールの外観と動作をカスタマイズするためのリモートコンフィグ値を変更できます。

        **重要:** リモートコンフィグを更新すると、既存のすべてのリモートコンフィグが上書きされます。既存のリモートコンフィグを保持する必要がある場合は、まずペイウォールを取得し、そこから remote_configs をコピーして、更新リクエストで必要なオブジェクトのみを変更してください。
      operationId: updatePaywall
      tags:
        - Paywalls
      security:
        - apikeyAuth: []
      parameters:
        - name: paywall_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 更新するペイウォールの一意の識別子
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PaywallUpdateRequest"
            example:
              remote_configs:
                - locale: en
                  data: "{\"title\":\"Premium Features\",\"subtitle\":\"Unlock all premium content\"}"
      responses:
        "200":
          description: ペイウォールが正常に更新されました
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaywallResponse"
              example:
                title: Premium Subscription
                paywall_id: fd891d4f-5906-45b9-97c1-13cc3dc665df
                use_paywall_builder: true
                use_paywall_builder_legacy: false
                updated_at: "2025-07-30T11:13:58.798Z"
                created_at: "2025-07-30T11:13:58.798Z"
                state: live
                is_deleted: false
                web_purchase_url: https://example.com/purchase
                products:
                  - product_id: b95e9e51-a056-4eb6-9cf7-b75d139e7c3c
                    title: Premium Monthly
                    product_set: uncategorised
                    offer:
                      product_offer_id: e31a4296-f250-4faf-ac80-3cc93c2da8f5
                      title: Free Trial
                remote_configs:
                  - locale: en
                    data: "{\"title\":\"Premium Features\",\"subtitle\":\"Unlock all premium content\"}"
                main_screenshot:
                  image_id: 123456
                  url: https://public-media.adapty.io/public/screenshot.jpg
        "400":
          description: リクエストが不正です
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              example:
                errors:
                  - source: remote_configs
                    errors:
                      - At least one field must be provided
                error_code: validation_error
                status_code: 400
        "401":
          description: 認証エラー
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              example:
                errors:
                  - Invalid API key
                error_code: unauthorized
                status_code: 401
        "404":
          description: ペイウォールが見つかりません
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              example:
                errors:
                  - source: null
                    errors:
                      - Paywall not found
                error_code: paywall_does_not_exist
                status_code: 404
        "500":
          description: 内部サーバーエラー
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
components:
  schemas:
    PaywallUpdateRequest:
      type: object
      properties:
        remote_configs:
          type: array
          items:
            type: object
            properties:
              locale:
                type: string
                description: リモートコンフィグのロケール（例："en"、"es"、"fr"）
              data:
                type: string
                description: リモートコンフィグデータを含む JSON 文字列
            required:
              - locale
              - data
          description: 更新する RemoteConfig オブジェクトの配列
      required:
        - remote_configs
      description: 少なくとも 1 つのフィールドを指定する必要があります
    PaywallResponse:
      type: object
      properties:
        title:
          type: string
          description: Adapty ダッシュボードで定義されたペイウォールの名前
        paywall_id:
          type: string
          format: uuid
          description: ペイウォールの一意の識別子
        use_paywall_builder:
          type: boolean
          description: ペイウォールビルダーを使用しているかどうか
        use_paywall_builder_legacy:
          type: boolean
          description: レガシーペイウォールビルダーを使用しているかどうか
        updated_at:
          type: string
          format: date-time
          description: ペイウォールが最後に更新されたタイムスタンプ
        created_at:
          type: string
          format: date-time
          description: ペイウォールが作成されたタイムスタンプ
        state:
          type: string
          enum:
            - draft
            - live
            - inactive
            - archived
          description: ペイウォールの現在の状態
        is_deleted:
          type: boolean
          description: ペイウォールが削除済みとしてマークされているかどうか
        web_purchase_url:
          type: string
          format: uri
          nullable: true
          description: ウェブ購入用の URL（該当する場合）
        products:
          type: array
          items:
            type: object
            properties:
              product_id:
                type: string
                format: uuid
                description: プロダクトの一意の識別子
              title:
                type: string
                description: プロダクトのタイトル
              product_set:
                type: string
                enum:
                  - weekly
                  - monthly
                  - trimonthly
                  - semiannual
                  - annual
                  - lifetime
                  - uncategorised
                  - nonsubscriptions
                  - two_months
                  - consumable
                description: プロダクトセットのカテゴリ
              offer:
                type: object
                nullable: true
                properties:
                  product_offer_id:
                    type: string
                    format: uuid
                    description: プロダクトオファーの一意の識別子
                  title:
                    type: string
                    description: オファーのタイトル
                required:
                  - product_offer_id
                  - title
            required:
              - product_id
              - title
              - product_set
              - offer
          description: プロダクト情報を含む Product オブジェクトの配列
        remote_configs:
          type: array
          items:
            type: object
            properties:
              locale:
                type: string
                description: リモートコンフィグのロケール
              data:
                type: string
                description: リモートコンフィグデータを含む JSON 文字列
            required:
              - locale
              - data
          description: ロケールとデータを含む RemoteConfig オブジェクトの配列
        main_screenshot:
          type: object
          nullable: true
          properties:
            image_id:
              type: integer
              description: 画像の一意の識別子
            url:
              type: string
              format: uri
              description: 画像の URL
          required:
            - image_id
            - url
          description: image_id と url を含むメインスクリーンショットオブジェクト
      required:
        - title
        - paywall_id
        - use_paywall_builder
        - use_paywall_builder_legacy
        - updated_at
        - created_at
        - state
        - is_deleted
        - products
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
                nullable: true
                description: エラーの発生源
              errors:
                type: array
                items:
                  type: string
                description: エラーメッセージの配列
        error_code:
          type: string
          description: エラーの短縮名
        status_code:
          type: integer
          description: HTTP ステータスコード
      required:
        - errors
        - error_code
        - status_code
  securitySchemes:
    apikeyAuth:
      type: apiKey
      name: Authorization
      in: header
      default: Api-Key {Your secret API key}
      description: |
        API リクエストは、**Authorization** ヘッダーにシークレット API キーを `Api-Key {your_secret_api_key}` の形式（例: `Api-Key secret_live_...`）で指定して認証する必要があります。このキーは Adapty ダッシュボード → **App Settings** → **General** タブ → **API keys** セクションで確認できます。
```
