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



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/tables.yaml post /api/database/tables
openapi: 3.0.3
info:
  title: Insforge Tables API
  version: 1.0.0
servers: []
security: []
paths:
  /api/database/tables:
    post:
      tags:
        - Admin
      summary: Create Table
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - tableName
                - columns
              properties:
                tableName:
                  type: string
                columns:
                  type: array
                  items:
                    type: object
                    required:
                      - name
                      - type
                      - nullable
                    properties:
                      name:
                        type: string
                      type:
                        type: string
                        enum:
                          - string
                          - datetime
                          - integer
                          - float
                          - boolean
                          - uuid
                          - json
                          - file
                      nullable:
                        type: boolean
                      unique:
                        type: boolean
                      defaultValue:
                        type: string
                      foreignKey:
                        type: object
                        properties:
                          table:
                            type: string
                          column:
                            type: string
                          onDelete:
                            type: string
                            enum:
                              - CASCADE
                              - SET NULL
                              - NO ACTION
                              - RESTRICT
                            default: NO ACTION
                rlsEnabled:
                  type: boolean
                  default: false
                  description: Enable Row Level Security on the table
      responses:
        '201':
          description: Table created
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  table_name:
                    type: string
              example:
                message: Table created successfully
                tableName: posts
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: VALIDATION_ERROR
                message: Table name already exists
                statusCode: 400
                nextActions: Choose a different table name
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INVALID_FIELD_TYPE
                message: >-
                  Invalid field type: 'text'. Valid types are: string, integer,
                  float, boolean, datetime, uuid, json, file
                statusCode: 422
                nextActions: Use one of the valid field types
      security:
        - bearerAuth: []
        - apiKey: []
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
        message:
          type: string
          description: Human-readable error message
        statusCode:
          type: integer
          description: HTTP status code
        nextActions:
          type: string
          description: Suggested action to resolve the error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key

````