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

# Create account

> Create a new account for an organisation.



## OpenAPI

````yaml /openAPI/openapi-20240301.json post /accounting_new/accounts
openapi: 3.1.0
info:
  title: zenskar
  version: 2.0.0
servers:
  - url: https://api.zenskar.com
security:
  - ApiTokenAuth: []
    OrganisationAuth: []
paths:
  /accounting_new/accounts:
    post:
      tags:
        - Accounting
      summary: Create account
      description: Create a new account for an organisation.
      operationId: Create-account
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountResponseSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateAccountRequestSchema:
      properties:
        account_category:
          $ref: '#/components/schemas/AccountCategory'
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        custom_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Data
      type: object
      required:
        - account_category
        - name
      title: CreateAccountRequestSchema
      description: >-
        not accepting parent_path as of now as we only want to allow the user to
        create a top-level account.

        creating a child account is a more involved task. Eg. if an account has
        journal lines, and no child account initially.

        Then a new child account is created, we need to update the account_id in
        all the journal lines of that account.

        Problems: How do we sync it to connector? Accounting connector currently
        relies of knowing the account mapping beforehand.

        Also we don't know if connectors allow us to update the account ID of
        lines in locked journal entries.
    AccountResponseSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        organisation_id:
          type: string
          format: uuid
          title: Organisation Id
        account_category:
          $ref: '#/components/schemas/AccountCategory'
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        balance_normality:
          $ref: '#/components/schemas/AccountMovementDirection'
        is_parent:
          type: boolean
          title: Is Parent
        parent_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Path
        custom_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Data
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
      type: object
      required:
        - id
        - organisation_id
        - account_category
        - name
        - balance_normality
        - is_parent
        - created_at
      title: AccountResponseSchema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AccountCategory:
      type: string
      enum:
        - Assets
        - Liabilities
        - Equity
        - Income
        - Expenses
      title: AccountCategory
    AccountMovementDirection:
      type: string
      enum:
        - credit
        - debit
      title: AccountMovementDirection
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiTokenAuth:
      type: apiKey
      in: header
      name: x-api-key
      x-default: <your-api-key>
    OrganisationAuth:
      type: apiKey
      in: header
      name: organisation
      x-default: <your-organisation-id>

````