> ## 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 Bank Transaction

> Create a new bank transaction.

**Bank Transactions** include the Transactional banking data for a specific company and account.

## Additional Required Fields

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

| Integration             | Field             | Description                                                 |
| ----------------------- | ----------------- | ----------------------------------------------------------- |
| ZOHO\_BOOKS             | from\_account\_id | The ID of the account from which the amount is transferred. |
| XERO                    | from\_account\_id | The ID of the account from which the amount is transferred. |
| FRESH\_BOOKS            | reference         | The reference for the transaction.                          |
| MYOB\_BUSINESS          | tax\_id           | The ID of the tax applied to the transaction.               |
| SAGE\_CLOUD\_ACCOUNTING | reference         | The reference for the transaction.                          |


## OpenAPI

````yaml POST /accounting/bank_transactions
openapi: 3.0.1
info:
  title: rootfi
  version: v2
servers:
  - url: https://api.rootfi.dev
    description: Production
security: []
paths:
  /accounting/bank_transactions:
    post:
      tags:
        - AccountingBankTransactions
      summary: Create Bank Transaction
      description: Add a bank transaction.
      operationId: accounting_bankTransactions_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/accountingtypesCreateBankTransactionsRequest
            examples:
              Example1:
                value:
                  company_id: 1
                  data:
                    - account_id: '123456'
                      contact_id: '123456'
                      transaction_date: '2021-09-28T15:00:00.000Z'
                      amount: 100
                      type: DEPOSIT
                      currency_id: GBP
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/accountingtypesCreateBankTransactionsResponse
              examples:
                Example1:
                  value:
                    data:
                      status: SUCCESS
                      upload_job_id: xQm2K441VosP8W4
                      data:
                        - job_id: aXI9pUDA5T7E2LS
                          status: success
                          response:
                            platform_id: '3770712000000893001'
                            account_id: '3770712000000493001'
                            contact_id: '3770712000000225001'
                            from_account_id: '3770712000000493001'
                            to_account_id: '3770712000000493001'
                            debit_or_credit: CREDIT
                            transaction_date: '2022-02-17T00:00:00.000Z'
                            amount: 112345
                            type: deposit
                            status: manually_added
                            updated_at: '2022-02-17T00:00:00.000Z'
                            raw_data:
                              id: '3770712000000893001'
                              account_id: '3770712000000493001'
                              contact_id: '3770712000000225001'
                              transaction_date: '2022-02-17'
                              amount: '112345.00'
                              type: deposit
                              updated_at: '2022-02-17T00:00:00.000Z'
                          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:
    accountingtypesCreateBankTransactionsRequest:
      title: accountingtypesCreateBankTransactionsRequest
      type: object
      properties:
        company_id:
          type: integer
          description: The company ID
          example: 1
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/accountingtypesBankTransactionWriteRequestFields
          description: The data to be passed through to the integration platform
      required:
        - company_id
        - data
    accountingtypesCreateBankTransactionsResponse:
      title: accountingtypesCreateBankTransactionsResponse
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/accountingtypesFinalBankTransactionResponse'
        - $ref: '#/components/schemas/timestamp'
    accountingtypesBankTransactionWriteRequestFields:
      title: accountingtypesBankTransactionWriteRequestFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            A JSON containing fields that you can directly pass to the
            accounting platform.
      allOf:
        - $ref: >-
            #/components/schemas/accountingtypesBankTransactionAllResponsesCommonFields
    accountingtypesFinalBankTransactionResponse:
      title: accountingtypesFinalBankTransactionResponse
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/accountingtypesCreateBankTransactionResponseData
      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
    accountingtypesBankTransactionAllResponsesCommonFields:
      title: accountingtypesBankTransactionAllResponsesCommonFields
      type: object
      properties:
        account_id:
          type: string
          nullable: true
          description: Platform ID for the account to which this transaction belongs
        contact_id:
          type: string
          nullable: true
          description: The platform’s ID for the contact to that made the transaction
        from_account_id:
          type: string
          nullable: true
          description: >-
            The platform’s ID for the account from which the transaction was
            made
        to_account_id:
          type: string
          nullable: true
          description: The platform’s ID for the account to which the transaction was made
        debit_or_credit:
          $ref: '#/components/schemas/BankTransactionType'
          nullable: true
          description: The type of transaction
        currency_id:
          type: string
          nullable: true
          description: The ISO-4217 currency code of the transaction
        transaction_date:
          type: string
          nullable: true
          description: Date of the transaction
        amount:
          type: number
          format: double
          nullable: true
          description: The total transaction amount
        type:
          type: string
          nullable: true
          description: The type of the transaction
        status:
          type: string
          nullable: true
          description: The status of the transaction
    accountingtypesCreateBankTransactionResponseData:
      title: accountingtypesCreateBankTransactionResponseData
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesBankTransactionResponse'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
    BankTransactionType:
      title: BankTransactionType
      type: string
      enum:
        - DEBIT
        - CREDIT
    accountingtypesBankTransactionResponse:
      title: accountingtypesBankTransactionResponse
      type: object
      properties:
        response:
          $ref: >-
            #/components/schemas/accountingtypesBankTransactionWriteResponseFields
        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
    accountingtypesBankTransactionWriteResponseFields:
      title: accountingtypesBankTransactionWriteResponseFields
      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/accountingtypesBankTransactionResponseField'
    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
    accountingtypesBankTransactionResponseField:
      title: accountingtypesBankTransactionResponseField
      type: object
      properties:
        currency_rate:
          type: number
          format: double
          nullable: true
          description: Rate between the currency of the payment and the base currency
        updated_at:
          type: string
          nullable: true
          description: >-
            The date at which the transaction was updated on the accounting
            platform
      allOf:
        - $ref: '#/components/schemas/accountingtypesBankTranscationPlatformId'
        - $ref: >-
            #/components/schemas/accountingtypesBankTransactionAllResponsesCommonFields
    JobResponseStatus:
      title: JobResponseStatus
      type: string
      enum:
        - success
        - failed
    accountingtypesBankTranscationPlatformId:
      title: accountingtypesBankTranscationPlatformId
      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

````