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

# Create Account

> Create an account.

[The Accounts Data Model](https://docs.rootfi.dev/api-reference/accounts/overview) is designed to streamline the management and retrieval of account-related information across various accounting platforms.

## Additional Required Fields

To successfully create an account, certain fields must be included in the raw\_data object of the request body. The required fields are as follows:

| Integration                 | Field             | Description                                         |
| --------------------------- | ----------------- | --------------------------------------------------- |
| MS\_DYNAMICS\_365\_FO       | ChartOfAccounts   | The chart of accounts to which the account belongs. |
| MYOB\_BUSINESS              | tax\_id           | The tax ID associated to the account.               |
| SAGE\_ZA\_CLOUD\_ACCOUNTING | sub\_category\_id | The sub-category ID associated to the account.      |


## OpenAPI

````yaml POST /accounting/accounts
openapi: 3.0.1
info:
  title: rootfi
  version: v2
servers:
  - url: https://api.rootfi.dev
    description: Production
security: []
paths:
  /accounting/accounts:
    post:
      tags:
        - AccountingAccounts
      summary: Create Accounts
      description: Add an account.
      operationId: accounting_accounts_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountingtypesCreateAccountsRequest'
            examples:
              Example1:
                value:
                  company_id: 1
                  data:
                    - name: Rootfi Test Account
                      description: Rootfi Test Account
                      nominal_code: '123456'
                      sub_category: Test
                      currency_id: '123456'
                      parent_account_id: '1234567'
                      raw_data: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountingtypesCreateAccountsResponse'
              examples:
                Example1:
                  value:
                    data:
                      status: SUCCESS
                      upload_job_id: xQm2K441VosP8W4
                      data:
                        - job_id: aXI9pUDA5T7E2LS
                          status: success
                          response:
                            platform_id: '1234567890123456789'
                            currency_id: null
                            parent_account_id: null
                            nominal_code: Test Account
                            name: Test Account
                            description: Test Description
                            sub_category: long_term_liability
                            category: LIABILITY
                            status: ACTIVE
                            updated_at: '2021-09-28T15:00:00.000Z'
                            raw_data:
                              platform_id: '1234567890123456789'
                              nominal_code: Test Account
                              name: Test Account
                              description: Test Description
                              category: LIABILITY
                              sub_category: long_term_liability
                              status: ACTIVE
                          error: null
                    request_timestamp: '2021-09-28T15:00:00.000Z'
                    response_timestamp: '2021-09-28T15:00:00.000Z'
                    request_id: 7a1c0e42-9f85-4d6e-bb5d-358a72913c0b
      security:
        - ApiKeyAuth: []
components:
  schemas:
    accountingtypesCreateAccountsRequest:
      title: accountingtypesCreateAccountsRequest
      type: object
      properties:
        company_id:
          type: integer
          description: The company ID
          example: 1
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesAccountsWriteRequestFields'
      required:
        - company_id
        - data
    accountingtypesCreateAccountsResponse:
      title: accountingtypesCreateAccountsResponse
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/accountingtypesFinalCreateAccount'
        - $ref: '#/components/schemas/timestamp'
    accountingtypesAccountsWriteRequestFields:
      title: accountingtypesAccountsWriteRequestFields
      type: object
      properties:
        raw_data:
          nullable: true
          description: >-
            A JSON containing fields that you can directly pass to the
            accounting platform.
      allOf:
        - $ref: '#/components/schemas/accountingtypesAccountsAllResponsesCommonFields'
    accountingtypesFinalCreateAccount:
      title: accountingtypesFinalCreateAccount
      type: object
      properties:
        data:
          $ref: '#/components/schemas/accountingtypesCreateAccountsResponseHelper'
      required:
        - data
    timestamp:
      title: timestamp
      type: object
      properties:
        request_timestamp:
          type: string
          format: date-time
          description: The time at which the request was received by the server
        response_timestamp:
          type: string
          format: date-time
          description: The time at which the response was sent by the server
        request_id:
          type: string
          description: The unique ID of the request
      required:
        - request_timestamp
        - response_timestamp
        - request_id
    accountingtypesAccountsAllResponsesCommonFields:
      title: accountingtypesAccountsAllResponsesCommonFields
      type: object
      properties:
        currency_id:
          type: string
          nullable: true
          description: The Accounting Platform’s unique ID for the currency
        parent_account_id:
          type: string
          nullable: true
          description: The platform ID of the parent account
        nominal_code:
          type: string
          nullable: true
          description: >-
            Reference given to each account for a business. It ensures money is
            allocated to the correct account.
        name:
          type: string
          nullable: true
          description: The name of the account
        description:
          type: string
          nullable: true
          description: Description of the account
        sub_category:
          type: string
          nullable: true
          description: The sub category of the account
        current_balance:
          type: integer
          nullable: true
          description: Current balance of the account
    accountingtypesCreateAccountsResponseHelper:
      title: accountingtypesCreateAccountsResponseHelper
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesAccountsResponseHelper'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
    accountingtypesAccountsResponseHelper:
      title: accountingtypesAccountsResponseHelper
      type: object
      properties:
        response:
          $ref: '#/components/schemas/accountingtypesAccountsWriteResponseFields'
        error:
          $ref: '#/components/schemas/ErrorObject'
          nullable: true
          description: The error message if the job failed.
      required:
        - response
      allOf:
        - $ref: '#/components/schemas/JobSuccessResponse'
    SuccessResponse:
      title: SuccessResponse
      type: object
      properties:
        status:
          $ref: '#/components/schemas/Status'
          description: The status of the job.
        upload_job_id:
          type: string
          description: The ID of the job.
      required:
        - status
        - upload_job_id
    accountingtypesAccountsWriteResponseFields:
      title: accountingtypesAccountsWriteResponseFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            The raw JSON response we get from the accounting platform for that
            data
      allOf:
        - $ref: '#/components/schemas/accountingtypesAccountsResponseFields'
    ErrorObject:
      title: ErrorObject
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        platform_error:
          type: string
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
      required:
        - code
        - message
        - platform_error
    JobSuccessResponse:
      title: JobSuccessResponse
      type: object
      properties:
        job_id:
          type: string
          description: The ID of the job.
        status:
          $ref: '#/components/schemas/JobResponseStatus'
          description: The status of the job.
      required:
        - job_id
        - status
    Status:
      title: Status
      type: string
      enum:
        - SUCCESS
        - FAILED
        - CREATED
        - RUNNING
    accountingtypesAccountsResponseFields:
      title: accountingtypesAccountsResponseFields
      type: object
      properties:
        category:
          $ref: '#/components/schemas/CategoryEnum'
          nullable: true
          description: The category of the account.
        status:
          $ref: '#/components/schemas/BaseStaus'
          nullable: true
          description: The status of the account.
        updated_at:
          type: string
          nullable: true
          description: Date the record was last updated in the accounting platform.
      allOf:
        - $ref: '#/components/schemas/accountingtypesAccountsPlatformId'
        - $ref: '#/components/schemas/accountingtypesAccountsAllResponsesCommonFields'
    JobResponseStatus:
      title: JobResponseStatus
      type: string
      enum:
        - success
        - failed
    CategoryEnum:
      title: CategoryEnum
      type: string
      enum:
        - ASSET
        - EXPENSE
        - LIABILITY
        - EQUITY
        - INCOME
        - BANK
        - UNKNOWN
    BaseStaus:
      title: BaseStaus
      type: string
      enum:
        - ACTIVE
        - ARCHIVED
        - UNKNOWN
    accountingtypesAccountsPlatformId:
      title: accountingtypesAccountsPlatformId
      type: object
      properties:
        platform_id:
          type: string
          description: The ID that the accounting platform uses to identify this account
      required:
        - platform_id
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````