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

# Create Channel

> Create a new realtime channel with a pattern for subscription matching



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/realtime.yaml post /api/realtime/channels
openapi: 3.0.3
info:
  title: Insforge Realtime API
  version: 1.0.0
  description: >-
    Realtime channel management, message history, permissions, and retention
    API. Live pub/sub uses Socket.IO.
servers: []
security: []
tags:
  - name: Channels
    description: Configure realtime channel patterns, webhooks, and availability.
  - name: Messages
    description: Inspect realtime message history and delivery stats.
  - name: Permissions
    description: Manage helper endpoints for realtime RLS examples.
  - name: Configuration
    description: Manage realtime retention settings.
paths:
  /api/realtime/channels:
    post:
      tags:
        - Channels
      summary: Create Channel
      description: Create a new realtime channel with a pattern for subscription matching
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChannelRequest'
            example:
              pattern: order:%
              description: Order updates channel
              webhookUrls:
                - https://example.com/webhook
              enabled: true
      responses:
        '201':
          description: Channel created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Channel'
              example:
                id: 550e8400-e29b-41d4-a716-446655440000
                pattern: order:%
                description: Order updates channel
                webhookUrls:
                  - https://example.com/webhook
                enabled: true
                createdAt: '2024-01-15T10:30:00Z'
                updatedAt: '2024-01-15T10:30:00Z'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INVALID_INPUT
                message: 'pattern: Channel pattern is required'
                statusCode: 400
      security:
        - bearerAuth: []
        - apiKey: []
components:
  schemas:
    CreateChannelRequest:
      type: object
      required:
        - pattern
      properties:
        pattern:
          type: string
          minLength: 1
          description: >-
            Channel pattern for subscription matching. Uses SQL LIKE wildcards,
            for example "order:%".
          example: order:%
        description:
          type: string
          description: Human-readable description of the channel
          example: Order updates channel
        webhookUrls:
          type: array
          items:
            type: string
            format: uri
          description: URLs to receive webhook notifications
          example:
            - https://example.com/webhook
        enabled:
          type: boolean
          default: true
          description: Whether the channel should be active upon creation
          example: true
    Channel:
      type: object
      required:
        - id
        - pattern
        - enabled
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the channel
          example: 550e8400-e29b-41d4-a716-446655440000
        pattern:
          type: string
          minLength: 1
          description: >-
            Channel pattern for subscription matching. Uses SQL LIKE wildcards,
            for example "order:%".
          example: order:%
        description:
          type: string
          nullable: true
          description: Human-readable description of the channel
          example: Order updates channel
        webhookUrls:
          type: array
          nullable: true
          items:
            type: string
            format: uri
          description: URLs to receive webhook notifications for messages on this channel
          example:
            - https://example.com/webhook
        enabled:
          type: boolean
          description: Whether the channel is currently active
          example: true
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the channel was created
          example: '2024-01-15T10:30:00Z'
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the channel was last updated
          example: '2024-01-15T10:30:00Z'
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
          example: INVALID_INPUT
        message:
          type: string
          description: Human-readable error message
          example: Invalid request
        statusCode:
          type: integer
          description: HTTP status code
          example: 400
        nextActions:
          type: string
          description: Suggested action to resolve the error
          example: Check your request parameters
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key

````