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

# Query journal entries

> Use when listing journal entries by period, event type, account, customer, contract, performance obligation or source. Returns a paginated list with lines.



## OpenAPI

````yaml https://swagger.flexprice.io post /journal_entries/search
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /journal_entries/search:
    post:
      tags:
        - Journal Entries
      summary: Query journal entries
      description: >-
        Use when listing journal entries by period, event type, account,
        customer, contract, performance obligation or source. Returns a
        paginated list with lines.
      operationId: queryJournalEntry
      requestBody:
        description: Filter
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/journal.Filter'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListJournalEntriesResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: go
          label: Go
          source: "package main\n\nimport(\n\t\"context\"\n\tflexprice \"github.com/flexprice/go-sdk/v2\"\n\t\"github.com/flexprice/go-sdk/v2/models/types\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := flexprice.New(\n        flexprice.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n    )\n\n    res, err := s.JournalEntries.QueryJournalEntry(ctx, types.JournalFilter{})\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.ListJournalEntriesResponse != nil {\n        // handle response\n    }\n}"
        - lang: python
          label: Python
          source: |-
            from flexprice import Flexprice


            with Flexprice(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as f_client:

                res = f_client.journal_entries.query_journal_entry()

                # Handle response
                print(res)
        - lang: typescript
          label: TypeScript
          source: |-
            import { Flexprice } from "@flexprice/sdk";

            const flexprice = new Flexprice({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await flexprice.journalEntries.queryJournalEntry({});

              console.log(result);
            }

            run();
components:
  schemas:
    journal.Filter:
      type: object
      properties:
        accounting_period_ids:
          type: array
          items:
            type: string
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/types.LedgerAccountKey'
        contract_ids:
          type: array
          items:
            type: string
        customer_ids:
          type: array
          items:
            type: string
        end_time:
          type: string
          format: date-time
        event_types:
          type: array
          items:
            $ref: '#/components/schemas/types.JournalEventType'
        expand:
          type: string
        filters:
          type: array
          items:
            $ref: '#/components/schemas/types.FilterCondition'
        journal_entry_ids:
          type: array
          items:
            type: string
        limit:
          maximum: 1000
          minimum: 1
          type: integer
        offset:
          minimum: 0
          type: integer
        order:
          type: string
          enum:
            - asc
            - desc
        pob_ids:
          type: array
          items:
            type: string
        sort:
          type: array
          items:
            $ref: '#/components/schemas/types.SortCondition'
        source_entity_ids:
          type: array
          items:
            type: string
        source_entity_type:
          $ref: '#/components/schemas/types.RevRecEntityType'
        start_time:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/types.Status'
    ListJournalEntriesResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/JournalEntryResponse'
        pagination:
          $ref: '#/components/schemas/types.PaginationResponse'
    errors.ErrorResponse:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/errors.ErrorCode'
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.LedgerAccountKey:
      type: string
      enum:
        - cash
        - accounts_receivable
        - unbilled_receivable
        - deferred_revenue
        - customer_credit
        - tax_payable
        - revenue
        - contra_revenue
      x-enum-varnames:
        - LedgerAccountCash
        - LedgerAccountReceivable
        - LedgerAccountUnbilledReceivable
        - LedgerAccountDeferredRevenue
        - LedgerAccountCustomerCredit
        - LedgerAccountTaxPayable
        - LedgerAccountRevenue
        - LedgerAccountContraRevenue
      x-speakeasy-name-override: LedgerAccountKey
    types.JournalEventType:
      type: string
      enum:
        - invoice_finalized
        - invoice_voided
        - credit_note_finalized
        - credit_note_voided
        - payment_succeeded
        - payment_reversed
        - refund_succeeded
        - revenue_earned
        - revenue_offset
      x-enum-varnames:
        - JournalEventInvoiceFinalized
        - JournalEventInvoiceVoided
        - JournalEventCreditNoteFinalized
        - JournalEventCreditNoteVoided
        - JournalEventPaymentSucceeded
        - JournalEventPaymentReversed
        - JournalEventRefundSucceeded
        - JournalEventRevenueEarned
        - JournalEventRevenueOffset
      x-speakeasy-name-override: JournalEventType
    types.FilterCondition:
      type: object
      properties:
        data_type:
          $ref: '#/components/schemas/types.DataType'
        field:
          type: string
        operator:
          $ref: '#/components/schemas/types.FilterOperatorType'
        value:
          $ref: '#/components/schemas/types.Value'
      x-speakeasy-name-override: FilterCondition
    types.SortCondition:
      type: object
      properties:
        direction:
          $ref: '#/components/schemas/types.SortDirection'
        field:
          type: string
      x-speakeasy-name-override: SortCondition
    types.RevRecEntityType:
      type: string
      enum:
        - subscription
        - subscription_line_item
        - invoice
        - credit_note
        - payment
        - refund
        - pob
      x-enum-varnames:
        - RevRecEntityTypeSubscription
        - RevRecEntityTypeSubscriptionLineItem
        - RevRecEntityTypeInvoice
        - RevRecEntityTypeCreditNote
        - RevRecEntityTypePayment
        - RevRecEntityTypeRefund
        - RevRecEntityTypePOB
      x-speakeasy-name-override: RevRecEntityType
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
    JournalEntryResponse:
      type: object
      properties:
        accounting_period_id:
          type: string
        business_date:
          type: string
          format: date-time
        contract_id:
          type: string
        created_at:
          type: string
          format: date-time
        currency:
          type: string
        customer_id:
          type: string
        event_type:
          $ref: '#/components/schemas/types.JournalEventType'
        id:
          type: string
        lines:
          type: array
          items:
            $ref: '#/components/schemas/JournalLineResponse'
        reversal_of:
          type: string
        source_entity_id:
          type: string
        source_entity_type:
          $ref: '#/components/schemas/types.RevRecEntityType'
    types.PaginationResponse:
      type: object
      properties:
        limit:
          type: integer
        offset:
          type: integer
        total:
          type: integer
      x-speakeasy-name-override: PaginationResponse
    errors.ErrorCode:
      type: string
      enum:
        - http_client_error
        - system_error
        - internal_error
        - not_found
        - already_exists
        - version_conflict
        - validation_error
        - invalid_operation
        - permission_denied
        - database_error
        - service_unavailable
        - too_many_requests
        - not_implemented
      x-enum-varnames:
        - ErrCodeHTTPClient
        - ErrCodeSystemError
        - ErrCodeInternalError
        - ErrCodeNotFound
        - ErrCodeAlreadyExists
        - ErrCodeVersionConflict
        - ErrCodeValidation
        - ErrCodeInvalidOperation
        - ErrCodePermissionDenied
        - ErrCodeDatabase
        - ErrCodeServiceUnavailable
        - ErrCodeTooManyRequests
        - ErrCodeNotImplemented
      x-speakeasy-name-override: ErrorCode
    types.DataType:
      type: string
      enum:
        - string
        - number
        - date
        - array
      x-enum-varnames:
        - DataTypeString
        - DataTypeNumber
        - DataTypeDate
        - DataTypeArray
      x-speakeasy-name-override: DataType
    types.FilterOperatorType:
      type: string
      enum:
        - eq
        - contains
        - not_contains
        - gt
        - lt
        - gte
        - in
        - not_in
        - before
        - after
      x-enum-varnames:
        - EQUAL
        - CONTAINS
        - NOT_CONTAINS
        - GREATER_THAN
        - LESS_THAN
        - GREATER_THAN_EQUAL
        - IN
        - NOT_IN
        - BEFORE
        - AFTER
      x-speakeasy-name-override: FilterOperatorType
    types.Value:
      type: object
      properties:
        array:
          type: array
          items:
            type: string
        boolean:
          type: boolean
        date:
          type: string
        number:
          type: number
        string:
          type: string
      x-speakeasy-name-override: Value
    types.SortDirection:
      type: string
      enum:
        - asc
        - desc
      x-enum-varnames:
        - SortDirectionAsc
        - SortDirectionDesc
      x-speakeasy-name-override: SortDirection
    JournalLineResponse:
      type: object
      properties:
        account:
          $ref: '#/components/schemas/types.LedgerAccountKey'
        amount:
          type: string
        direction:
          $ref: '#/components/schemas/types.JournalDirection'
        id:
          type: string
        pob_id:
          type: string
    types.JournalDirection:
      type: string
      enum:
        - debit
        - credit
      x-enum-varnames:
        - JournalDirectionDebit
        - JournalDirectionCredit
      x-speakeasy-name-override: JournalDirection
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.