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

# Create a new ledger

> Create a new accounting ledger with specified type and settings



## OpenAPI

````yaml post /v1/ledgers
openapi: 3.0.0
info:
  title: Ledgers API
  version: 1.0.0
  description: API for managing accounting ledgers and entries
servers: []
security:
  - bearerAuth: []
tags:
  - name: Ledgers
    description: Ledger management operations
paths:
  /v1/ledgers:
    post:
      tags:
        - Ledgers
      summary: Create a new ledger
      description: Create a new accounting ledger with specified type and settings
      operationId: createNewLedger
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLedgerInput'
      responses:
        '201':
          description: Ledger created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LedgerResponse'
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
        '403':
          description: Insufficient permissions
        '500':
          description: Internal server error
components:
  schemas:
    CreateLedgerInput:
      type: object
      required:
        - code
        - description
        - type
        - currency_id
        - currency_code
      properties:
        code:
          type: string
          description: Unique ledger code
          example: MAIN-USD-001
        description:
          type: string
          description: Ledger description
          example: Main USD Operating Account
        type:
          type: string
          enum:
            - asset
            - liability
            - equity
            - income
            - expense
          description: Type of ledger
          example: asset
        currency_id:
          type: string
          format: uuid
          description: Currency UUID
          example: 550e8400-e29b-41d4-a716-446655440000
        currency_code:
          type: string
          minLength: 3
          maxLength: 3
          description: ISO currency code
          example: USD
        balance_current:
          type: integer
          description: Current balance in cents
          example: 100000
        balance_available:
          type: integer
          description: Available balance in cents
          example: 100000
        overdraft_enabled:
          type: boolean
          description: Enable overdraft facility
          default: false
        overdraft_limit:
          type: integer
          description: Maximum overdraft amount in cents
          default: 0
        opening_date:
          type: string
          format: date-time
          description: Ledger opening date
        parent_ledger_id:
          type: string
          format: uuid
          description: Parent ledger UUID
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
    LedgerResponse:
      type: object
      properties:
        ledger:
          type: object
          properties:
            id:
              type: string
              format: uuid
            code:
              type: string
            description:
              type: string
            type:
              type: string
              enum:
                - asset
                - liability
                - equity
                - income
                - expense
            currency_id:
              type: string
              format: uuid
            currency_code:
              type: string
            balance_current:
              type: integer
              description: Amount in cents
            balance_available:
              type: integer
              description: Amount in cents
            overdraft_enabled:
              type: boolean
            overdraft_limit:
              type: integer
              description: Amount in cents
            last_activity_date:
              type: string
              format: date-time
            opening_date:
              type: string
              format: date-time
            closing_date:
              type: string
              format: date-time
              nullable: true
            parent_ledger_id:
              type: string
              format: uuid
              nullable: true
            child_ledger_ids:
              type: array
              items:
                type: string
                format: uuid
            created_at:
              type: string
              format: date-time
            created_by:
              type: string
              format: uuid
            modified_at:
              type: string
              format: date-time
            modified_by:
              type: string
              format: uuid
            active:
              type: boolean
            metadata:
              type: object
              nullable: true
    Error:
      type: object
      properties:
        code:
          type: string
          description: Error code
        message:
          type: string
          description: Error message
        details:
          type: object
          description: Additional error details
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````