> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ondb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update encryption settings for an app (x402 payment flow)
POST /api/apps/:app_id/encryption

> Headers:
- X-PAYMENT: Base64-encoded payment proof (required if cost > 0)

Request body:
- private_app: bool (optional) - enable/disable app-level encryption
- action: "add" | "remove" (optional) - action for collection-level
- collections: ["col1", "col2"] - collections to add/remove

Returns 402 Payment Required with payment requirements if X-PAYMENT not provided



## OpenAPI

````yaml /openapi.yaml post /api/apps/{app_id}/encryption
openapi: 3.1.0
info:
  title: OnDB API
  description: Monetize anything
  license:
    name: ''
  version: 4.0.0
servers: []
security: []
tags:
  - name: Health
    description: Health check and system status
  - name: Applications
    description: Application management
  - name: Billing
    description: Billing information and usage
  - name: Pricing
    description: Pricing information and quotes
  - name: X402 Payment Protocol
    description: Payment verification and settlement
  - name: Data Storage
    description: Store data to Celestia blockchain
  - name: Data Query
    description: Query and retrieve data
  - name: Collections
    description: Collection management
  - name: Indexes
    description: Index management and relations
  - name: Retention
    description: Data retention policies
  - name: Materialized Views
    description: Materialized view management
  - name: Predefined Queries
    description: Create and execute predefined queries
  - name: View Query
    description: Query materialized view data
  - name: Wallet
    description: App wallet management
  - name: Tasks
    description: Task tracking and status
  - name: Transactions
    description: Transaction status
  - name: Authorization
    description: Authorization grant management
  - name: API Keys
    description: API key management
  - name: Encryption
    description: Encryption settings and configuration
  - name: Payout
    description: Payout settings and history
  - name: API Collections
    description: API collection management
paths:
  /api/apps/{app_id}/encryption:
    post:
      tags:
        - Encryption
      summary: |-
        Update encryption settings for an app (x402 payment flow)
        POST /api/apps/:app_id/encryption
      description: >-
        Headers:

        - X-PAYMENT: Base64-encoded payment proof (required if cost > 0)


        Request body:

        - private_app: bool (optional) - enable/disable app-level encryption

        - action: "add" | "remove" (optional) - action for collection-level

        - collections: ["col1", "col2"] - collections to add/remove


        Returns 402 Payment Required with payment requirements if X-PAYMENT not
        provided
      operationId: update_encryption_settings
      parameters:
        - name: app_id
          in: path
          description: Application ID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EncryptionSettingsRequest'
        required: true
      responses:
        '200':
          description: Encryption settings updated successfully
          content:
            application/json:
              schema: {}
        '401':
          description: Unauthorized - payment verification failed
        '402':
          description: Payment Required - payment details included in response
        '404':
          description: App not found
        '500':
          description: Internal server error
      security:
        - x402_payment: []
components:
  schemas:
    EncryptionSettingsRequest:
      type: object
      description: Request body for managing encryption settings
      properties:
        action:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/EncryptionAction'
              description: 'Action to perform on collections: "add" or "remove"'
        collections:
          type: array
          items:
            type: string
          description: Collection names to add/remove from private_collections
        private_app:
          type:
            - boolean
            - 'null'
          description: Enable/disable app-level encryption (all data encrypted)
    EncryptionAction:
      type: string
      enum:
        - add
        - remove

````