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

# Create multiple accounts in a single request

> 
Creates multiple bookkeeping accounts in a single batch operation.
This endpoint validates each account in the batch and returns both successfully created accounts and failed items with their failure reasons.
Accounts that pass validation will be created, while invalid accounts will be returned in the failed list.




## OpenAPI

````yaml post /v1/chart-of-accounts/batch
openapi: 3.0.1
info:
  title: Chart of Accounts API
  description: Bookkeeping Core OpenAPI definitions
  termsOfService: https://pleo.io/terms/
  contact:
    email: team.actina@pleo.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 24.9.0
servers:
  - url: https://external.pleo.io
    description: Production server
  - url: https://external.staging.pleo.io
    description: Staging server
security:
  - bearerAuth: []
  - basicAuth: []
tags:
  - name: BookkeepingCore
    description: This resource is associated with the BookkeepingCore API
  - name: Accounts
    description: >
      This API enables you to create an account in Pleo, search for an account
      by its ID, update details of an account recorded in Pleo, delete an
      account from Pleo, or apply specific filters to retrieve a list of
      accounts managed in Pleo.


      💡**Note**


      Please note that only response codes specific to the API behaviour are
      documented. Otherwise, we follow HTTP response codes.
  - name: Aggregated Bookkeeping Category Groups
    description: >-
      This API enables you to read aggregated bookkeeping category groups.


      💡**Note**


      Please note that only response codes specific to the API behaviour are
      documented. Otherwise, we follow HTTP response codes.
  - name: Aggregated Contra Accounts
    description: >-
      This API enables you to read aggregated contra accounts.


      💡**Note**


      Please note that only response codes specific to the API behaviour are
      documented. Otherwise, we follow HTTP response codes.
  - name: Bookkeeping Categories
    description: >
      This API enables you to perform operations on a bookkeeping category.


      💡**Note**


      Please note that only response codes specific to the API behaviour are
      documented. Otherwise, we follow HTTP response codes..
  - name: Bookkeeping Category Groups
    description: >-
      This API enables you to perform operations on a bookkeeping category
      group.


      💡**Note**


      Please note that only response codes specific to the API behaviour are
      documented. Otherwise, we follow HTTP response codes.
  - name: Contra Accounts
    description: >
      This API enables you to manage contra accounts.


      💡**Note**


      Please note that only response codes specific to the API behaviour are
      documented. Otherwise, we follow HTTP response codes..
  - name: Bookkeeping Preferences Resource
paths:
  /v1/chart-of-accounts/batch:
    post:
      tags:
        - Accounts
      summary: Create multiple accounts in a single request
      description: >

        Creates multiple bookkeeping accounts in a single batch operation.

        This endpoint validates each account in the batch and returns both
        successfully created accounts and failed items with their failure
        reasons.

        Accounts that pass validation will be created, while invalid accounts
        will be returned in the failed list.
      operationId: createAccountsBatchV1
      requestBody:
        content:
          application/json;charset=UTF-8:
            schema:
              $ref: '#/components/schemas/BookkeepingAccountBatchCreateRequestV1'
        required: true
      responses:
        '201':
          description: >-
            Batch creation completed. Check the response for created and failed
            items.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/DataResponseBookkeepingAccountBatchCreateResponseV1
              example:
                data:
                  created:
                    - archived: false
                      code: '2001'
                      companyId: 123e4567-e89b-12d3-a456-426614174006
                      externalId: ext-001
                      id: 123e4567-e89b-12d3-a456-426614174005
                      name: Bank Charges
                      taxCodeExternalId: IVA 20
                    - archived: false
                      code: '2002'
                      companyId: 123e4567-e89b-12d3-a456-426614174006
                      externalId: ext-002
                      id: 123e4567-e89b-12d3-a456-426614174007
                      name: Office Supplies
                      taxCodeExternalId: IVA 20
                  failed:
                    - reasons:
                        - EXTERNAL_ID_ALREADY_EXISTS
                        - NAME_EMPTY
                      request:
                        archived: false
                        code: '2003'
                        externalId: ext-duplicate
                        name: ''
                        taxCodeExternalId: IVA 20
        '400':
          description: >-
            Bad request: for example, batch size outside allowed range, missing
            required fields or contains invalid input.
components:
  schemas:
    BookkeepingAccountBatchCreateRequestV1:
      required:
        - companyId
        - items
      type: object
      properties:
        companyId:
          type: string
          description: >-
            Pleo's internal identifier for the company the accounts are
            associated with.
          format: uuid
        items:
          maxItems: 1000
          minItems: 1
          type: array
          description: |-
            List of bookkeeping accounts to be created.
            The number of accounts in the batch must be between 1 and 1000.
          items:
            $ref: '#/components/schemas/BookkeepingAccountBatchRequestItemV1'
    DataResponseBookkeepingAccountBatchCreateResponseV1:
      required:
        - data
      type: object
      properties:
        data:
          $ref: '#/components/schemas/BookkeepingAccountBatchCreateResponseV1'
    BookkeepingAccountBatchRequestItemV1:
      required:
        - archived
        - externalId
        - name
      type: object
      properties:
        archived:
          type: boolean
          description: Boolean flag used to determine if the account is archived.
        code:
          maxLength: 255
          minLength: 0
          type: string
          description: >-
            Account code or number used in the accounting system's chart of
            accounts. Maximum length: 255 characters.
          nullable: true
        externalId:
          maxLength: 255
          minLength: 1
          type: string
          description: >-
            Non empty unique external identifier of the account, assigned in the
            external ERP/accounting system. Can be the same as code if no other
            identifier is available. Maximum length: 255 characters.
        metadata:
          type: object
          additionalProperties:
            type: object
            description: Place for API users to store flexible data.
            nullable: true
          description: Place for API users to store flexible data.
          nullable: true
        name:
          maxLength: 255
          minLength: 0
          type: string
          description: 'Name of the account. Maximum length: 255 characters.'
        taxCodeExternalId:
          type: string
          description: >-
            The identifier in **the target system** for the tax code the account
            is associated with.

            - This is NOT the tax percentage (e.g. 20%)

            - This is NOT the Pleo UUID of the tax code
          nullable: true
      description: |-
        List of bookkeeping accounts to be created.
        The number of accounts in the batch must be between 1 and 1000.
    BookkeepingAccountBatchCreateResponseV1:
      required:
        - created
        - failed
      type: object
      properties:
        created:
          type: array
          description: List of successfully created accounts.
          items:
            $ref: '#/components/schemas/BookkeepingAccountRestModelV1'
        failed:
          type: array
          description: >-
            List of accounts that failed to be created, including the reasons
            for failure.
          items:
            $ref: '#/components/schemas/BookkeepingAccountBatchFailedItemV1'
      description: Response for batch account creation operation.
    BookkeepingAccountRestModelV1:
      required:
        - archived
        - companyId
        - externalId
        - id
        - name
      type: object
      properties:
        archived:
          type: boolean
          description: Boolean flag used to determine if the account is archived.
        code:
          type: string
          description: >-
            Account code or number used in the accounting system's chart of
            accounts.
          nullable: true
        companyId:
          type: string
          description: >-
            Pleo's internal identifier of the company the account is associated
            with.
          format: uuid
        externalId:
          type: string
          description: >-
            Unique external identifier of the account, assigned in the external
            ERP/accounting system. Can be the same as code if no other
            identifier is available.
        id:
          type: string
          description: Pleo's internal identifier of the account.
          format: uuid
        metadata:
          type: object
          additionalProperties:
            type: object
            description: Place for API users to store flexible data.
            nullable: true
          description: Place for API users to store flexible data.
          nullable: true
        name:
          type: string
          description: Name of the account.
        taxCodeExternalId:
          type: string
          description: >-
            The identifier in **the target system** for the tax code the account
            is associated with. 
          nullable: true
      description: Represents an account in Pleo.
    BookkeepingAccountBatchFailedItemV1:
      required:
        - reasons
        - request
      type: object
      properties:
        reasons:
          type: array
          description: List of reasons why the account creation failed.
          items:
            type: string
            description: Possible reasons for account creation failure in batch operations.
            enum:
              - EXTERNAL_ID_ALREADY_EXISTS
              - EXTERNAL_ID_TOO_LONG
              - EXTERNAL_ID_EMPTY
              - NAME_TOO_LONG
              - NAME_EMPTY
              - CODE_TOO_LONG
              - OTHER
        request:
          $ref: '#/components/schemas/BookkeepingAccountBatchRequestItemV1'
      description: Represents a failed account creation in a batch operation.
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        JWT Bearer token authentication. Include the token in the Authorization
        header as: `Bearer <token>`
      scheme: bearer
      bearerFormat: JWT
    basicAuth:
      type: http
      description: >-
        Basic HTTP authentication using API key. Use your API key as the
        username and leave the password empty. The credentials will be Base64
        encoded automatically.
      scheme: basic

````