JournalEntry

Canonical contract for journal entry payloads.

Identity source_id

Attributes

Field
Type
Description
id
string
Canonical ID — Backfill canonical record ID assigned after persistence. This is distinct from the source-system ID.
source_idrequiredidentity
string
Source ID — Stable external record ID from the source system. Backfill uses this with source_system and, when present, connection_id for idempotent imports and upserts.
source_systemrequired
string
Source System — Connector or provider that supplied the record, such as stripe, shopify, qbo, csv_upload, or manual.
connection_id
string
Connection ID — Backfill tenant connection ID that scopes records to a specific external account, store, realm, or integration instance. It may participate in source identity without being required on every create payload.
entry_number
string
Entry Number
entry_daterequired
date
Entry Date
document_date
date
Document Date — Date on the source document, such as the invoice date. Used for document-period reporting; when omitted, invoice normalization derives it from issued_at when possible.
effective_date
date
Effective Date — Accounting effective date for reporting, posting, and period cutoffs. Defaults to document_date when omitted.
posting_period
string
Posting Period
statusrequired
string
Status
draftpostedpending_reversalreversedsuperseded
approval_status
string
Approval Status
draftpending_approvalapprovedrejectedvoid
memo
string
Memo
reverses_entry_id
string
Reverses Entry ID — Identifier for the related reverses entry record.
currency
string
Currency
lines[]required
array<object>
Lines
default: []
line_number
integer
Line Number — One-based display order of the line within the document. Use for ordering and presentation, not stable identity.
line_ref
string
Line Ref — Provider-native line reference. Use it to match the same source line across document versions and related documents.
account_idrequired
string
Account ID — Backfill account identifier for a related account record. Use account_id for lookups; account_code is display-only when referring to general ledger accounts and may be absent.
account_code
string
Account Code
debit_amount
decimal
Debit Amount
credit_amount
decimal
Credit Amount
description
string
Description
class_id
string
Class ID — Identifier for the related class record.
location_id
string
Location ID — Identifier for the related location record.
dimensions
map
Dimensions
metadata
map
Metadata
dimensions
map
Dimensions
default: %{}
metadata
map
Metadata
default: %{}

TypeScript SDK

Import

Every canonical resource is exposed as a top-level entity global on @backfill-io/sdk.

import { JournalEntry } from "@backfill-io/sdk";

Create

Pass an object matching JournalEntryCreateInput. Required fields are shown below.

const journalEntry = JournalEntry.create({
  source_id: "source_id_123",
  source_system: "…",
  entry_date: "2026-01-15",
  status: "draft",
  lines: [{
    account_id: "account_id_123",
  }],
});

Get and query

Look up a single record by canonical ID, or query with filters and pagination.

const journalEntry = JournalEntry.get("journal_entry_123");

const results = JournalEntry.query({
  where: { },
  orderBy: [{ field: "inserted_at", direction: "desc" }],
  limit: 50,
});

Update

Partial update — pass only the fields you want to change.

JournalEntry.update("journal_entry_123", {
  // …fields to update
});

Delete

JournalEntry.delete("journal_entry_123");