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

> Create one or more records. Request body MUST be an array.



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/records.yaml post /api/database/records/{tableName}
openapi: 3.0.3
info:
  title: Insforge Records API
  version: 2.0.0
  description: PostgREST-style database record operations
servers: []
security:
  - bearerAuth: []
  - apiKey: []
paths:
  /api/database/records/{tableName}:
    post:
      tags:
        - Client
      summary: Create Records
      description: Create one or more records. Request body MUST be an array.
      parameters:
        - name: tableName
          in: path
          required: true
          schema:
            type: string
          description: Name of the table
          example: posts
        - name: Prefer
          in: header
          schema:
            type: string
            enum:
              - return=representation
          description: >-
            Include to return created records in response (otherwise returns
            empty array)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                additionalProperties: true
              minItems: 1
            example:
              - title: My First Post
                content: Hello world! This is my first post.
                published: true
      responses:
        '201':
          description: Records created
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
              examples:
                without_prefer:
                  summary: Response without Prefer header
                  value: []
                with_prefer:
                  summary: 'Response with Prefer: return=representation'
                  value:
                    - id: 248373e1-0aea-45ce-8844-5ef259203749
                      title: My First Post
                      content: Hello world! This is my first post.
                      published: true
                      createdAt: '2025-07-18T05:37:24.338Z'
                      updatedAt: '2025-07-18T05:37:24.338Z'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: VALIDATION_ERROR
                message: 'Invalid field type: expected boolean for ''published'''
                statusCode: 400
                nextActions: Ensure field types match the table schema
        '404':
          description: Table not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: TABLE_NOT_FOUND
                message: Table 'nonexistent' does not exist
                statusCode: 404
                nextActions: Create the table first
      security:
        - bearerAuth: []
        - apiKey: []
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
          example: VALIDATION_ERROR
        message:
          type: string
          description: Human-readable error message
          example: Invalid input data
        statusCode:
          type: integer
          description: HTTP status code
          example: 400
        nextActions:
          type: string
          description: Suggested action to resolve the error
          example: Check the request body format
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````