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

# Create Schema

> Registers a new event schema for the app.



## OpenAPI

````yaml POST /apps/{appId}/schemas
openapi: 3.1.0
info:
  title: Vela API
  description: Event ingestion, schema management, and notification rules for Vela.
  version: 1.0.0
  contact:
    name: Vela Support
    email: support@vela.dev
servers:
  - url: https://api.vela.dev/v1
    description: Production
  - url: http://localhost:3000/v1
    description: Local development
security:
  - clientSecret: []
paths:
  /apps/{appId}/schemas:
    post:
      tags:
        - Schemas
      summary: Create Schema
      description: Registers a new event schema for the app.
      operationId: create-schema
      parameters:
        - $ref: '#/components/parameters/AppId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSchemaInput'
            example:
              eventName: order.placed
              description: Emitted when a checkout completes
              fields:
                - id: fld-order-id
                  name: orderId
                  type: string
                  required: true
                - id: fld-amount
                  name: amountCents
                  type: number
                  required: true
              metadataFields:
                - id: meta-env
                  name: environment
                  type: string
      responses:
        '201':
          description: Schema created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventSchema'
      security:
        - clientSecret: []
components:
  parameters:
    AppId:
      name: appId
      in: path
      required: true
      description: App UUID or slug
      schema:
        type: string
      example: order-service
  schemas:
    CreateSchemaInput:
      type: object
      required:
        - eventName
        - fields
      properties:
        eventName:
          type: string
          description: Event name (unique per app)
        description:
          type: string
          description: Human-readable description
        fields:
          type: array
          items:
            $ref: '#/components/schemas/SchemaField'
          description: At least one field definition
          minItems: 1
        metadataFields:
          type: array
          items:
            $ref: '#/components/schemas/SchemaField'
          description: Optional metadata field definitions
    EventSchema:
      type: object
      properties:
        id:
          type: string
          description: Schema identifier
        appId:
          type: string
          format: uuid
          description: Associated app
        eventName:
          type: string
          description: Event name (unique per app)
        description:
          type: string
          description: Human-readable description
        fields:
          type: array
          items:
            $ref: '#/components/schemas/SchemaField'
          description: Event data field definitions
        metadataFields:
          type: array
          items:
            $ref: '#/components/schemas/SchemaField'
          description: Metadata field definitions
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    SchemaField:
      type: object
      required:
        - id
        - name
        - type
      properties:
        id:
          type: string
          description: Field identifier
        name:
          type: string
          description: Field name
        type:
          type: string
          enum:
            - string
            - number
            - boolean
            - enum
          description: Field data type
        required:
          type: boolean
          description: Whether the field is required
          default: false
        enumValues:
          type: array
          items:
            type: string
          description: Allowed values (only for `enum` type)
  securitySchemes:
    clientSecret:
      type: http
      scheme: bearer
      description: 'Client secret for management API access. Format: `vela_cs_...`'

````