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

# Create a Transaction

> Create a Transaction



## OpenAPI

````yaml /api-reference/openapi.json post /v1/transactions
openapi: 3.0.3
info:
  title: Bookeeping.ai API
  version: 1.0.0
  description: API for accessing and managing bookkeeping.ai data.
servers:
  - url: https://api.bookeeping.ai/public-api
    description: USA Virginia Region
  - url: https://ca-api.bookeeping.ai/public-api
    description: Canada Toronto Region
  - url: https://eu-api.bookeeping.ai/public-api
    description: EU Belgium Region
security:
  - BearerAuth: []
paths:
  /v1/transactions:
    post:
      tags:
        - Transactions
      summary: Create a Transaction
      description: Create a Transaction
      operationId: createTransaction
      parameters:
        - name: force
          in: query
          required: false
          description: Force create the transaction if it already exists
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                refNo:
                  type: string
                  nullable: true
                  description: The reference number of the transaction
                totalAmount:
                  type: number
                  description: >-
                    The total amount of the transaction. Same as the sum of the
                    Total Credit = Total Debit.
                transactionDate:
                  type: string
                  format: date-time
                  description: The transaction date of the transaction
                paymentMethod:
                  type: string
                  enum:
                    - CASH
                    - CHEQUE
                    - NEFT
                    - IMPS
                    - UPI
                    - CARD
                    - TRANSFER
                    - OTHER
                  description: The payment method of the transaction
                isReconciled:
                  type: boolean
                  description: The reconciliation status of the transaction
                currency:
                  type: string
                  description: >-
                    The currency of the transaction. Use default currency if not
                    provided
                  nullable: true
                entries:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: The id of the entry
                      amount:
                        type: number
                        minimum: 0
                        description: The amount of the entry
                      type:
                        type: string
                        enum:
                          - DEBIT
                          - CREDIT
                        description: The type of the entry
                      parentCategory:
                        type: string
                        enum:
                          - INCOME
                          - OTHER_INCOME
                          - SALES
                          - EXPENSE
                          - DEPRECIATION
                          - COST_OF_GOODS_SOLD
                          - OTHER_EXPENSE
                          - OVERHEAD
                          - CURRENT_ASSET
                          - FIXED_ASSET
                          - INVENTORY
                          - NON_CURRENT_ASSET
                          - PREPAYMENT
                          - LIABILITY
                          - CURRENT_LIABILITY
                          - NON_CURRENT_LIABILITY
                          - TAX_PAYABLE
                          - TAX
                          - EQUITY
                          - OTHER
                        nullable: true
                        description: The parent category of the entry
                      isMain:
                        type: boolean
                        nullable: true
                        description: The main status of the entry
                      note:
                        type: string
                        nullable: true
                        description: The note of the entry
                      category:
                        type: string
                        description: The category id of the entry
                    required:
                      - id
                      - amount
                      - type
                      - category
                    additionalProperties: false
                  description: The entries of the transaction
                counterParty:
                  type: string
                  pattern: ^[0-9A-Fa-f]{24}$
                  description: >-
                    The counter party id of the transaction. Expected to be a
                    valid object id like 666666666666666666666666
                  nullable: true
                account:
                  type: string
                  pattern: ^[0-9A-Fa-f]{24}$
                  description: >-
                    The account id of the transaction. Expected to be a valid
                    object id like 666666666666666666666666
                  nullable: true
              required:
                - totalAmount
                - transactionDate
                - paymentMethod
                - isReconciled
                - entries
              additionalProperties: false
      responses:
        '200':
          description: Create a Transaction executed successfully
          headers:
            x-rate-limiter-daily-limit:
              description: Maximum number of requests allowed per day
              schema:
                type: integer
                example: 1500
            x-rate-limiter-minutely-limit:
              description: Maximum number of requests allowed per minute
              schema:
                type: integer
                example: 25
            x-rate-limiter-daily-usage:
              description: Number of requests made today
              schema:
                type: integer
                example: 106
            x-rate-limiter-minutely-usage:
              description: Number of requests made in the current minute
              schema:
                type: integer
                example: 1
            x-rate-limiter-operation-type:
              description: Operation type. Either read or write.
              schema:
                type: string
                enum:
                  - read
                  - write
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Success message
                  metaData:
                    type: object
                    properties:
                      warnings:
                        type: array
                        items:
                          type: string
                        description: Any validation warnings
                  data:
                    type: object
                    properties:
                      transaction:
                        type: object
                        properties:
                          _id:
                            type: string
                            description: The id of the transaction
                          projectId:
                            type: string
                            description: The project id of the transaction
                          refNo:
                            type: string
                            nullable: true
                            description: The reference number of the transaction
                          currency:
                            type: string
                            description: The currency of the transaction
                          totalAmount:
                            type: number
                            description: >-
                              The total amount of the transaction. Same as the
                              sum of the Total Credit = Total Debit.
                          transactionDate:
                            type: string
                            format: date-time
                            description: The transaction date of the transaction
                          paymentMethod:
                            type: string
                            enum:
                              - CASH
                              - CHEQUE
                              - NEFT
                              - IMPS
                              - UPI
                              - CARD
                              - TRANSFER
                              - OTHER
                            description: The payment method of the transaction
                          source:
                            type: string
                            enum:
                              - BANK
                              - CSV
                              - MANUAL
                              - STRIPE
                              - INVOICE_BILL
                              - QUICKBOOKS_IMPORT
                              - AIRBNB
                              - API_HOOK
                              - SHOPIFY
                              - OTHER
                            description: The source of the transaction
                          originalAmount:
                            type: number
                            nullable: true
                            description: The original amount of the transaction
                          originalCurrency:
                            type: string
                            nullable: true
                            description: The original currency of the transaction
                          isReconciled:
                            type: boolean
                            description: The reconciliation status of the transaction
                          nonProfitAllocations:
                            type: array
                            items:
                              type: object
                              properties:
                                program:
                                  type: object
                                  properties:
                                    _id:
                                      type: string
                                      description: The id of the program
                                    name:
                                      type: string
                                      description: The name of the program
                                    status:
                                      type: string
                                      enum:
                                        - PLANNING
                                        - ACTIVE
                                        - COMPLETED
                                        - CANCELLED
                                      description: The status of the program
                                    hexColor:
                                      type: string
                                      nullable: true
                                      description: The hex color of the program
                                    createdAt:
                                      type: string
                                      format: date-time
                                      description: The created at of the program
                                    updatedAt:
                                      type: string
                                      format: date-time
                                      description: The updated at of the program
                                  required:
                                    - _id
                                    - name
                                    - status
                                    - createdAt
                                    - updatedAt
                                  additionalProperties: false
                                  nullable: true
                                  description: The program of the non profit allocation
                                grant:
                                  type: object
                                  properties:
                                    _id:
                                      type: string
                                      description: The id of the grant
                                    name:
                                      type: string
                                      description: The name of the grant
                                    status:
                                      type: string
                                      enum:
                                        - ACTIVE
                                        - COMPLETED
                                        - CANCELLED
                                      description: The status of the grant
                                    hexColor:
                                      type: string
                                      nullable: true
                                      description: The hex color of the grant
                                    funders:
                                      type: array
                                      items:
                                        type: string
                                      nullable: true
                                      description: >-
                                        The funders of the grant, typically
                                        counterparty ids
                                    createdAt:
                                      type: string
                                      format: date-time
                                      description: The created at of the grant
                                    updatedAt:
                                      type: string
                                      format: date-time
                                      description: The updated at of the grant
                                  required:
                                    - _id
                                    - name
                                    - status
                                    - createdAt
                                    - updatedAt
                                  additionalProperties: false
                                  nullable: true
                                  description: The grant of the non profit allocation
                                percentage:
                                  type: number
                                  description: The percentage of the non profit allocation
                                note:
                                  type: string
                                  nullable: true
                                  description: The note of the non profit allocation
                              required:
                                - percentage
                              additionalProperties: false
                            description: The non profit allocations of the transaction
                          counterParty:
                            type: object
                            properties:
                              _id:
                                type: string
                                description: The id of the counterparty
                              accountName:
                                type: string
                                nullable: true
                                description: The account name of the counterparty
                              accountNumber:
                                type: string
                                nullable: true
                                description: The account number of the counterparty
                              email:
                                type: string
                                format: email
                                nullable: true
                                description: The email of the counterparty
                              phone:
                                type: string
                                nullable: true
                                description: The phone of the counterparty
                              type:
                                type: string
                                enum:
                                  - customer
                                  - vendor
                                  - both
                                nullable: true
                                description: The type of the counterparty
                            required:
                              - _id
                            additionalProperties: false
                            nullable: true
                            description: The counter party of the transaction
                          account:
                            type: object
                            properties:
                              _id:
                                type: string
                                description: The id of the account
                              accountName:
                                type: string
                                nullable: true
                                description: The account name of the account
                              accountNumber:
                                type: string
                                nullable: true
                                description: The account number of the account
                              accountType:
                                type: string
                                enum:
                                  - Depository
                                  - Credit
                                  - Loan
                                  - Investment
                                  - Other
                                description: The type of the account
                            required:
                              - _id
                              - accountType
                            additionalProperties: false
                            nullable: true
                            description: The account of the transaction
                          entries:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                  description: The id of the entry
                                amount:
                                  type: number
                                  minimum: 0
                                  description: The amount of the entry
                                type:
                                  type: string
                                  enum:
                                    - DEBIT
                                    - CREDIT
                                  description: The type of the entry
                                parentCategory:
                                  type: string
                                  enum:
                                    - INCOME
                                    - OTHER_INCOME
                                    - SALES
                                    - EXPENSE
                                    - DEPRECIATION
                                    - COST_OF_GOODS_SOLD
                                    - OTHER_EXPENSE
                                    - OVERHEAD
                                    - CURRENT_ASSET
                                    - FIXED_ASSET
                                    - INVENTORY
                                    - NON_CURRENT_ASSET
                                    - PREPAYMENT
                                    - LIABILITY
                                    - CURRENT_LIABILITY
                                    - NON_CURRENT_LIABILITY
                                    - TAX_PAYABLE
                                    - TAX
                                    - EQUITY
                                    - OTHER
                                  nullable: true
                                  description: The parent category of the entry
                                category:
                                  type: object
                                  properties:
                                    _id:
                                      type: string
                                      description: The id of the category
                                    name:
                                      type: string
                                      description: The name of the category
                                    emoji:
                                      type: string
                                      nullable: true
                                      description: The emoji of the category
                                    parentCategory:
                                      type: string
                                      enum:
                                        - INCOME
                                        - OTHER_INCOME
                                        - SALES
                                        - EXPENSE
                                        - DEPRECIATION
                                        - COST_OF_GOODS_SOLD
                                        - OTHER_EXPENSE
                                        - OVERHEAD
                                        - CURRENT_ASSET
                                        - FIXED_ASSET
                                        - INVENTORY
                                        - NON_CURRENT_ASSET
                                        - PREPAYMENT
                                        - LIABILITY
                                        - CURRENT_LIABILITY
                                        - NON_CURRENT_LIABILITY
                                        - TAX_PAYABLE
                                        - TAX
                                        - EQUITY
                                        - OTHER
                                      nullable: true
                                      description: The parent category of the category
                                    number:
                                      type: string
                                      nullable: true
                                      description: The number of the category
                                    group:
                                      type: string
                                      nullable: true
                                      description: The group of the category
                                  required:
                                    - _id
                                    - name
                                  additionalProperties: false
                                  nullable: true
                                  description: The category of the entry
                                isMain:
                                  type: boolean
                                  nullable: true
                                  description: The main status of the entry
                                note:
                                  type: string
                                  nullable: true
                                  description: The note of the entry
                              required:
                                - id
                                - amount
                                - type
                              additionalProperties: false
                            description: The entries of the transaction
                          classes:
                            type: array
                            items:
                              type: object
                              properties:
                                _id:
                                  type: string
                                  description: The id of the class
                                name:
                                  type: string
                                  description: The name of the class
                                description:
                                  type: string
                                  nullable: true
                                  description: The description of the class
                                emoji:
                                  type: string
                                  nullable: true
                                  description: The emoji of the class
                                color:
                                  type: string
                                  nullable: true
                                  description: The color of the class
                              required:
                                - _id
                                - name
                              additionalProperties: false
                            description: The classes of the transaction
                          attachmentsIds:
                            type: array
                            items:
                              type: string
                            description: The attachments ids of the transaction
                          nonProfitGrantId:
                            type: string
                            nullable: true
                            description: Non profit grant source transaction id
                          attachedTransactionId:
                            type: string
                            nullable: true
                            description: Attached transaction id
                          createdAt:
                            type: string
                            format: date-time
                            description: The created at of the transaction
                          updatedAt:
                            type: string
                            format: date-time
                            description: The updated at of the transaction
                        required:
                          - _id
                          - projectId
                          - currency
                          - totalAmount
                          - transactionDate
                          - paymentMethod
                          - source
                          - isReconciled
                          - nonProfitAllocations
                          - entries
                          - classes
                          - attachmentsIds
                          - createdAt
                          - updatedAt
                        additionalProperties: false
                      action:
                        type: string
                        enum:
                          - CREATED
                          - ALREADY_EXISTS
                        description: The action of the transaction
                    required:
                      - transaction
                      - action
                    additionalProperties: false
                    description: >-
                      The response of the transaction creation. CREATED if
                      transaction created successfully, ALREADY_EXISTS if
                      similar transaction already exists, send query params
                      force=true to override
        '400':
          description: Bad Request - Invalid input parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - BadRequestError
                  message:
                    type: string
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - UnauthorizedError
                  message:
                    type: string
        '409':
          description: Conflict - Resource already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - ConflictError
                  message:
                    type: string
        '429':
          description: >-
            Too Many Requests - Rate limit exceeded. Either daily or minutely
            limit exceeded. If you have any questions, please contact
            support@bookeeping.ai.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - TooManyRequestsError
                  message:
                    type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API key for authentication. Get your key from the Dashboard > Settings >
        API Access.

````