> ## 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 journal entry

> Create a journal entry for an organisation.



## OpenAPI

````yaml /openAPI/openapi-20240301.json post /accounting_new/journal_entry
openapi: 3.1.0
info:
  title: zenskar
  version: 2.0.0
servers:
  - url: https://api.zenskar.com
security:
  - ApiTokenAuth: []
    OrganisationAuth: []
paths:
  /accounting_new/journal_entry:
    post:
      tags:
        - Accounting
      summary: Create journal entry
      description: Create a journal entry for an organisation.
      operationId: Create-journal-entry
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateJournalEntryRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JournalEntrySchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateJournalEntryRequestSchema:
      properties:
        description:
          type: string
          title: Description
        event:
          anyOf:
            - type: string
            - type: 'null'
          title: Event
        posted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Posted At
        custom_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Data
        currency:
          type: string
          title: Currency
        journal_lines:
          items:
            anyOf:
              - $ref: '#/components/schemas/CreateJournalLineRequestSchema'
              - $ref: >-
                  #/components/schemas/CreateJournalLineFromAccountDataRequestSchema
          type: array
          title: Journal Lines
        status_type:
          anyOf:
            - $ref: '#/components/schemas/JournalEntryStatusType'
            - type: 'null'
        auto_adjust_closed_period:
          type: boolean
          title: Auto Adjust Closed Period
          description: >-
            If True, automatically adjust posted_at to next open period if it
            falls in a closed period. Set to False to raise
            PeriodClosedException instead.
        source_event_log_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Source Event Log Id
        source_resource_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Resource Type
        source_resource_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Source Resource Id
        source_operation:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Operation
      type: object
      required:
        - description
        - currency
        - journal_lines
      title: CreateJournalEntryRequestSchema
    JournalEntrySchema:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        organisation_id:
          type: string
          format: uuid
          title: Organisation Id
        description:
          type: string
          title: Description
        posted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Posted At
        custom_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Data
        currency:
          type: string
          title: Currency
        journal_lines:
          items:
            $ref: '#/components/schemas/JournalLineSchema'
          type: array
          title: Journal Lines
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - organisation_id
        - description
        - currency
        - journal_lines
        - created_at
        - updated_at
      title: JournalEntrySchema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CreateJournalLineRequestSchema:
      properties:
        account_id:
          type: string
          format: uuid
          title: Account Id
        credits:
          type: integer
          title: Credits
        debits:
          type: integer
          title: Debits
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/AddTagsSchema'
              type: array
            - type: 'null'
          title: Tags
        currency:
          type: string
          title: Currency
        customer_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Customer Id
        contract_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Contract Id
        invoice_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Invoice Id
        credit_note_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Credit Note Id
        tax_jurisdiction_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Tax Jurisdiction Id
        payment_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Payment Id
        refund_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Refund Id
        revenue_contract_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Revenue Contract Id
        revenue_contract_item_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Revenue Contract Item Id
        performance_obligation_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Performance Obligation Id
        product_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Product Id
        custom_tags:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Tags
          default: {}
      type: object
      required:
        - account_id
        - credits
        - debits
        - currency
      title: CreateJournalLineRequestSchema
    CreateJournalLineFromAccountDataRequestSchema:
      properties:
        account_category:
          $ref: '#/components/schemas/AccountCategory'
        parent_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Path
        name:
          type: string
          title: Name
        credits:
          type: integer
          title: Credits
        debits:
          type: integer
          title: Debits
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/AddTagsSchema'
              type: array
            - type: 'null'
          title: Tags
        currency:
          type: string
          title: Currency
        account_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Account Id
        customer_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Customer Id
        contract_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Contract Id
        invoice_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Invoice Id
        credit_note_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Credit Note Id
        tax_jurisdiction_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Tax Jurisdiction Id
        payment_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Payment Id
        refund_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Refund Id
        revenue_contract_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Revenue Contract Id
        revenue_contract_item_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Revenue Contract Item Id
        performance_obligation_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Performance Obligation Id
        product_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Product Id
        custom_tags:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Tags
          default: {}
      type: object
      required:
        - account_category
        - name
        - credits
        - debits
        - currency
      title: CreateJournalLineFromAccountDataRequestSchema
    JournalEntryStatusType:
      type: string
      enum:
        - pending
        - forecasted
        - estimated
        - posted
      title: JournalEntryStatusType
    JournalLineSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        account_id:
          type: string
          format: uuid
          title: Account Id
        credits:
          type: integer
          title: Credits
        debits:
          type: integer
          title: Debits
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/JournalLineTagSchema'
              type: array
            - type: 'null'
          title: Tags
        customer_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Customer Id
        contract_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Contract Id
        invoice_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Invoice Id
        credit_note_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Credit Note Id
        tax_jurisdiction_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Tax Jurisdiction Id
        payment_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Payment Id
        revenue_contract_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Revenue Contract Id
        revenue_contract_item_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Revenue Contract Item Id
        performance_obligation_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Performance Obligation Id
        product_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Product Id
        custom_tags:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Tags
        currency:
          type: string
          title: Currency
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - account_id
        - credits
        - debits
        - currency
        - created_at
        - updated_at
      title: JournalLineSchema
    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
    AddTagsSchema:
      properties:
        reference_tag_type:
          type: string
          title: Reference Tag Type
        reference_tag_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Reference Tag Id
        reference_tag_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Reference Tag Content
      type: object
      required:
        - reference_tag_type
      title: AddTagsSchema
    AccountCategory:
      type: string
      enum:
        - Assets
        - Liabilities
        - Equity
        - Income
        - Expenses
      title: AccountCategory
    JournalLineTagSchema:
      properties:
        reference_tag_type:
          type: string
          title: Reference Tag Type
        reference_tag_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Reference Tag Id
        reference_tag_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Reference Tag Content
      type: object
      required:
        - reference_tag_type
      title: JournalLineTagSchema
  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>

````