> ## 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.

# Create a new API collection
POST /apps/:app_id/api_collections



## OpenAPI

````yaml /openapi.yaml post /apps/{app_id}/api_collections
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:
  /apps/{app_id}/api_collections:
    post:
      tags:
        - API Collections
      summary: |-
        Create a new API collection
        POST /apps/:app_id/api_collections
      operationId: create_api_collection
      parameters:
        - name: app_id
          in: path
          description: Application ID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiCollectionRequest'
        required: true
      responses:
        '200':
          description: API collection created successfully
          content:
            application/json:
              schema: {}
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: App not found
        '500':
          description: Internal server error
      security:
        - api_key: []
components:
  schemas:
    CreateApiCollectionRequest:
      type: object
      required:
        - name
        - description
        - api_config
      properties:
        api_config:
          $ref: '#/components/schemas/ApiConfig'
        description:
          type: string
        name:
          type: string
    ApiConfig:
      type: object
      required:
        - base_url
        - authentication
        - query_mapping
        - response_mapping
      properties:
        authentication:
          $ref: '#/components/schemas/ApiAuthentication'
        base_url:
          type: string
        query_mapping:
          $ref: '#/components/schemas/QueryMapping'
        response_mapping:
          $ref: '#/components/schemas/ResponseMapping'
    ApiAuthentication:
      oneOf:
        - type: string
          enum:
            - None
        - type: object
          required:
            - ApiKey
          properties:
            ApiKey:
              type: object
              required:
                - header_name
                - key
              properties:
                header_name:
                  type: string
                key:
                  type: string
        - type: object
          required:
            - Bearer
          properties:
            Bearer:
              type: object
              required:
                - token
              properties:
                token:
                  type: string
        - type: object
          required:
            - OAuth2
          properties:
            OAuth2:
              type: object
              required:
                - token_url
                - client_id
                - client_secret
              properties:
                client_id:
                  type: string
                client_secret:
                  type: string
                token_url:
                  type: string
    QueryMapping:
      type: object
      required:
        - field_mappings
        - method
        - path_template
      properties:
        field_mappings:
          type: object
          description: Maps internal query fields to API parameters
          additionalProperties:
            type: string
          propertyNames:
            type: string
        method:
          type: string
          description: HTTP method for queries (GET, POST)
        path_template:
          type: string
          description: Path template with {placeholders}
    ResponseMapping:
      type: object
      required:
        - records_path
        - field_mappings
      properties:
        field_mappings:
          type: object
          description: Field mappings from API response to internal schema
          additionalProperties:
            type: string
          propertyNames:
            type: string
        records_path:
          type: string
          description: JSONPath to extract records from API response

````