GraphQL Schema Types

This document provides a comprehensive reference of all GraphQL types, enums, input objects, and their fields in Crane Ledger's GraphQL API. Each type includes field descriptions, types, and nullability information.

Core Entity Types

OrganizationNode

Represents an organization/business entity in Crane Ledger.

type OrganizationNode {
  id: ID!                           # Unique identifier (ORG_ prefix)
  name: String!                     # Organization display name
  baseCurrency: CurrencyNode!       # Default currency for the organization
  isRoot: Boolean!                  # Whether this is a root organization
  parentOrganizationId: ID          # Parent organization ID for hierarchical relationships
  creditsRemaining: Int!            # Credit balance for billing organizations
  createdAt: DateTime!              # When the organization was created
  updatedAt: DateTime!              # When the organization was last updated
  metadata: Json!                   # Additional organization data as JSON

  # Complex resolvers (require additional API calls)
  accounts: [AccountNode!]!         # Get all accounts for this organization
  recentTransactions(limit: Int): [TransactionNode!]!  # Get recent transactions
  contacts: [ContactNode!]!         # Get all contacts for this organization
  invoices: [InvoiceNode!]!         # Get all invoices for this organization
  bills: [BillNode!]!               # Get all bills for this organization
  trialBalance: TrialBalanceReport! # Generate trial balance report
  balanceSheet: BalanceSheetReport! # Generate balance sheet report
  incomeStatement: IncomeStatementReport! # Generate income statement report
  creditBalance: CreditBalanceNode! # Get detailed credit balance information
  creditPackages: [CreditPackageNode!]! # Get available credit packages
}

CurrencyNode

Represents a currency with formatting information.

type CurrencyNode {
  code: String!           # Currency code (e.g., "USD", "EUR")
  name: String!           # Currency name (e.g., "US Dollar")
  symbol: String!         # Currency symbol (e.g., "$", "€")
  decimalPlaces: Int!     # Number of decimal places (0 for JPY, 2 for USD)
}

AccountNode

Represents a chart of accounts entry.

type AccountNode {
  id: ID!                     # Unique identifier (ACT_ prefix)
  organizationId: ID!         # Organization this account belongs to
  code: String!               # Account code (e.g., "1001", "2001")
  name: String!               # Account display name
  accountType: AccountType!   # Account type (ASSET, LIABILITY, EQUITY, REVENUE, EXPENSE)
  parentAccountId: ID         # Parent account ID for hierarchical accounts
  status: AccountStatus!      # Account status (ACTIVE, INACTIVE, SUSPENDED)
  description: String         # Optional account description
  isSystem: Boolean!          # Whether this is a system account (cannot be deleted)
  createdAt: DateTime!        # When the account was created
  updatedAt: DateTime!        # When the account was last updated
  metadata: Json!             # Additional account metadata as JSON

  # Complex resolvers
  balance: MoneyNode!                    # Get current account balance
  transactions(limit: Int): [TransactionNode!]!  # Get account transactions
}

TransactionNode

Represents a journal entry transaction.

type TransactionNode {
  id: ID!                           # Unique identifier (TXN_ prefix)
  organizationId: ID!               # Organization this transaction belongs to
  description: String!              # Transaction description
  date: DateTime!                   # Transaction date (business date)
  status: TransactionStatus!        # Transaction status (PENDING, POSTED, FAILED, REVERSED)
  amount: Decimal!                  # Total transaction amount in base currency
  currency: CurrencyNode!           # Transaction currency
  entries: [LedgerEntryNode!]!      # Journal entries for this transaction
  createdAt: DateTime!              # When the transaction was created
  updatedAt: DateTime!              # When the transaction was last updated
  metadata: Json!                   # Additional transaction metadata as JSON
}

LedgerEntryNode

Represents individual debit/credit entries within a transaction.

type LedgerEntryNode {
  id: ID!               # Unique identifier (LED_ prefix)
  transactionId: ID!    # Transaction this entry belongs to
  accountId: ID!        # Account being affected
  entryType: EntryType! # DEBIT or CREDIT
  amount: Decimal!      # Entry amount (always positive, sign determined by entryType)
  currency: CurrencyNode! # Currency of the original amount
  baseAmount: Decimal!  # Amount converted to base currency
  description: String   # Optional line item description
  reference: String     # External reference (invoice #, check #, etc.)
  createdAt: DateTime!  # When this entry was created
  metadata: Json!       # Additional entry metadata as JSON
}

MoneyNode

Represents an amount with currency formatting.

type MoneyNode {
  amount: Decimal!    # Numeric amount
  currency: CurrencyNode! # Currency information
  formatted: String!  # Formatted string (e.g., "$1,234.56")
}

ContactNode

Represents customers, vendors, and other business contacts.

type ContactNode {
  id: ID!                     # Unique identifier (CON_ prefix)
  organizationId: ID!         # Organization this contact belongs to
  name: String!               # Contact display name
  contactType: ContactType!   # Contact type (CUSTOMER, VENDOR, EMPLOYEE, OTHER)
  email: String               # Email address
  phone: String               # Phone number
  taxId: String               # Tax ID or VAT number
  billingAddress: String      # Billing street address
  billingCity: String         # Billing city
  billingState: String        # Billing state/province
  billingPostalCode: String   # Billing postal code
  billingCountry: String      # Billing country
  createdAt: DateTime!        # When the contact was created
  updatedAt: DateTime!        # When the contact was last updated
  metadata: Json!             # Additional contact metadata as JSON

  # Complex resolvers
  transactions(limit: Int): [TransactionNode!]!  # Get contact transactions
  invoices: [InvoiceNode!]!   # Get invoices for this contact
  bills: [BillNode!]!         # Get bills for this contact
}

AddressNode

Represents a physical address.

type AddressNode {
  street: String      # Street address
  city: String        # City
  state: String       # State/province/region
  postalCode: String  # Postal code
  country: String     # Country
}

Document Types

InvoiceNode

Represents sales invoices.

type InvoiceNode {
  id: ID!                     # Unique identifier (INV_ prefix)
  organizationId: ID!         # Organization this invoice belongs to
  invoiceNumber: String!      # Sequential invoice number
  contactId: ID!              # Customer contact ID
  invoiceDate: DateTime!      # Invoice creation date
  dueDate: DateTime!          # Payment due date
  status: InvoiceStatus!      # Invoice status (DRAFT, SENT, VIEWED, PARTIAL, PAID, CANCELLED, OVERDUE)
  subtotal: Decimal!          # Subtotal before tax
  taxAmount: Decimal!         # Total tax amount
  total: Decimal!             # Total amount (subtotal + tax)
  currency: CurrencyNode!     # Invoice currency
  items: [InvoiceItemNode!]!  # Invoice line items
  notes: String               # Invoice notes
  createdAt: DateTime!        # When the invoice was created
  updatedAt: DateTime!        # When the invoice was last updated
  metadata: Json!             # Additional invoice metadata as JSON

  # Complex resolvers
  payments: [PaymentNode!]!   # Get payments for this invoice
  pdfUrl: String!             # Get PDF download URL
}

InvoiceItemNode

Represents line items within an invoice.

type InvoiceItemNode {
  id: ID!             # Unique identifier
  invoiceId: ID!      # Invoice this item belongs to
  description: String! # Item description
  quantity: Decimal!  # Quantity ordered
  unitPrice: Decimal! # Price per unit
  lineTotal: Decimal! # Total for this line (quantity × unitPrice)
  taxAmount: Decimal! # Tax amount for this line
  itemId: ID          # Reference to catalog item (optional)
}

BillNode

Represents purchase bills from vendors.

type BillNode {
  id: ID!                     # Unique identifier (BIL_ prefix)
  organizationId: ID!         # Organization this bill belongs to
  billNumber: String!         # Sequential bill number
  contactId: ID!              # Vendor contact ID
  billDate: DateTime!         # Bill date
  dueDate: DateTime!          # Payment due date
  status: BillStatus!         # Bill status (DRAFT, RECEIVED, PARTIAL, PAID, CANCELLED, OVERDUE)
  subtotal: Decimal!          # Subtotal before tax
  taxAmount: Decimal!         # Total tax amount
  total: Decimal!             # Total amount (subtotal + tax)
  currency: CurrencyNode!     # Bill currency
  items: [BillItemNode!]!     # Bill line items
  notes: String               # Bill notes
  createdAt: DateTime!        # When the bill was created
  updatedAt: DateTime!        # When the bill was last updated
  metadata: Json!             # Additional bill metadata as JSON

  # Complex resolvers
  payments: [PaymentNode!]!   # Get payments for this bill
  pdfUrl: String!             # Get PDF download URL
}

BillItemNode

Represents line items within a bill.

type BillItemNode {
  id: ID!             # Unique identifier
  billId: ID!         # Bill this item belongs to
  description: String! # Item description
  quantity: Decimal!  # Quantity received
  unitPrice: Decimal! # Price per unit
  lineTotal: Decimal! # Total for this line (quantity × unitPrice)
  taxAmount: Decimal! # Tax amount for this line
  itemId: ID          # Reference to catalog item (optional)
}

PaymentNode

Represents payments made against invoices or bills.

type PaymentNode {
  id: ID!             # Unique identifier
  organizationId: ID! # Organization this payment belongs to
  documentType: String! # "invoice" or "bill"
  documentId: ID!     # Invoice or bill ID
  amount: Decimal!    # Payment amount
  currency: CurrencyNode! # Payment currency
  paymentDate: DateTime! # When the payment was made
  paymentMethod: String! # Payment method (check, wire, card, etc.)
  reference: String   # Reference number (check #, transaction ID)
  notes: String       # Payment notes
  createdAt: DateTime! # When the payment was recorded
  metadata: Json!     # Additional payment metadata as JSON
}

Report Types

TrialBalanceReport

Represents a trial balance financial report.

type TrialBalanceReport {
  generatedAt: DateTime!              # When the report was generated
  accounts: [TrialBalanceEntry!]!     # Account balances
  totalDebits: Decimal!               # Sum of all debit balances
  totalCredits: Decimal!              # Sum of all credit balances
}

TrialBalanceEntry

Individual account entry in a trial balance.

type TrialBalanceEntry {
  accountId: ID!        # Account ID
  accountCode: String!  # Account code
  accountName: String!  # Account name
  accountType: AccountType! # Account type
  debitBalance: Decimal! # Debit balance
  creditBalance: Decimal! # Credit balance
  netBalance: Decimal!  # Net balance (debit - credit or credit - debit based on type)
}

BalanceSheetReport

Represents a balance sheet financial report.

type BalanceSheetReport {
  generatedAt: DateTime!              # When the report was generated
  asOfDate: DateTime!                 # Report date
  assets: [BalanceSheetSection!]!     # Asset accounts
  liabilities: [BalanceSheetSection!]! # Liability accounts
  equity: [BalanceSheetSection!]!     # Equity accounts
  totalAssets: Decimal!               # Total assets
  totalLiabilities: Decimal!           # Total liabilities
  totalEquity: Decimal!               # Total equity
}

BalanceSheetSection

Account grouping in a balance sheet.

type BalanceSheetSection {
  accountId: ID!       # Account ID
  accountCode: String! # Account code
  accountName: String! # Account name
  balance: Decimal!    # Account balance
}

IncomeStatementReport

Represents an income statement (P&L) financial report.

type IncomeStatementReport {
  generatedAt: DateTime!                # When the report was generated
  periodStart: DateTime!                # Report period start
  periodEnd: DateTime!                  # Report period end
  revenue: [IncomeStatementSection!]!   # Revenue accounts
  expenses: [IncomeStatementSection!]!  # Expense accounts
  totalRevenue: Decimal!                # Total revenue
  totalExpenses: Decimal!               # Total expenses
  netIncome: Decimal!                   # Net income (revenue - expenses)
}

IncomeStatementSection

Account grouping in an income statement.

type IncomeStatementSection {
  accountId: ID!       # Account ID
  accountCode: String! # Account code
  accountName: String! # Account name
  amount: Decimal!     # Account activity amount
}

Billing Types

CreditBalanceNode

Represents credit balance information.

type CreditBalanceNode {
  organizationId: ID!     # Organization ID
  creditsRemaining: Int!  # Remaining credits
  creditsTotal: Int!      # Total credits ever purchased
  autoRechargeEnabled: Boolean! # Whether auto-recharge is enabled
  lowBalanceThreshold: Int! # Threshold for low balance warnings
}

CreditPackageNode

Represents available credit packages.

type CreditPackageNode {
  packageType: CreditPackageType! # Package type enum
  credits: Int!                   # Number of credits
  name: String!                   # Package name
  priceUsd: Float!                # Price in USD
  priceCents: Int!                # Price in cents (for Stripe)
}

CreditPurchaseNode

Response from credit purchase operations.

type CreditPurchaseNode {
  checkoutUrl: String!  # Stripe checkout URL
  creditsToAdd: Int!    # Credits that will be added
  priceCents: Int!      # Price in cents
  expiresAt: DateTime!  # Checkout session expiration
}

Async Operation Types

JobResultNode

Represents the result of async operations.

type JobResultNode {
  requestId: String!         # Unique request ID for tracking
  success: Boolean!          # Whether the job was successfully queued
  message: String            # Optional success message
  data: Json                 # Job result data (when completed)
  error: String              # Error message (when failed)
  durationMs: Int            # Processing duration in milliseconds
  creditCost: Decimal        # Credit cost for the operation
}

Enumeration Types

AccountType

Account classification types.

enum AccountType {
  ASSET       # Assets (normally debit balance)
  LIABILITY   # Liabilities (normally credit balance)
  EQUITY      # Equity (normally credit balance)
  REVENUE     # Revenue (normally credit balance)
  EXPENSE     # Expenses (normally debit balance)
}

AccountStatus

Account operational status.

enum AccountStatus {
  ACTIVE      # Account is active and usable
  INACTIVE    # Account is inactive but retains history
  SUSPENDED   # Account is suspended and cannot be used
}

TransactionStatus

Transaction processing status.

enum TransactionStatus {
  PENDING     # Transaction is pending posting
  POSTED      # Transaction has been posted to ledger
  FAILED      # Transaction failed to process
  REVERSED    # Transaction has been reversed
}

EntryType

Journal entry type (debit or credit).

enum EntryType {
  DEBIT       # Debit entry (increases asset/expense accounts)
  CREDIT      # Credit entry (increases liability/equity/revenue accounts)
}

ContactType

Contact classification.

enum ContactType {
  CUSTOMER    # Customer contact
  VENDOR      # Vendor/supplier contact
  EMPLOYEE    # Employee contact
  OTHER       # Other contact type
}

InvoiceStatus

Invoice lifecycle status.

enum InvoiceStatus {
  DRAFT       # Invoice is in draft state
  SENT        # Invoice has been sent to customer
  VIEWED      # Customer has viewed the invoice
  PARTIAL     # Partial payment received
  PAID        # Invoice is fully paid
  CANCELLED   # Invoice has been cancelled
  OVERDUE     # Invoice is past due date
}

BillStatus

Bill lifecycle status.

enum BillStatus {
  DRAFT       # Bill is in draft state
  RECEIVED    # Bill has been received from vendor
  PARTIAL     # Partial payment made
  PAID        # Bill is fully paid
  CANCELLED   # Bill has been cancelled
  OVERDUE     # Bill is past due date
}

CreditPackageType

Available credit package types.

enum CreditPackageType {
  SOLO_DEV    # Solo Developer - 1,000 credits for $10
  BUILDER     # Builder - 5,000 credits for $50
  SCALE       # Scale - 25,000 credits for $250
  CUSTOM      # Custom amount of credits
}

Input Types

LedgerEntryInput

Input for creating journal entries in transactions.

input LedgerEntryInput {
  accountId: ID!      # Account to affect
  entryType: EntryType! # DEBIT or CREDIT
  amount: Decimal!    # Entry amount
  description: String # Optional line description
  reference: String   # Optional external reference
}

InvoiceItemInput

Input for creating invoice line items.

input InvoiceItemInput {
  description: String!  # Item description
  quantity: Decimal!    # Quantity ordered
  unitPrice: Decimal!   # Price per unit
  itemId: ID            # Optional catalog item reference
}

BillItemInput

Input for creating bill line items.

input BillItemInput {
  description: String!  # Item description
  quantity: Decimal!    # Quantity ordered
  unitPrice: Decimal!   # Price per unit
  itemId: ID            # Optional catalog item reference
}

CreditPurchaseInput

Input for purchasing credits (alternative to direct parameters).

input CreditPurchaseInput {
  creditAmount: Int!    # Number of credits to purchase
  successUrl: String    # Success redirect URL
  cancelUrl: String     # Cancel redirect URL
}

Scalar Types

ID

Unique identifier scalar (represents database primary keys).

scalar ID  # String that represents unique identifiers

String

Standard UTF-8 string scalar.

scalar String  # UTF-8 string

Int

32-bit signed integer scalar.

scalar Int  # 32-bit signed integer

Float

Double-precision floating point scalar.

scalar Float  # Double-precision floating point

Boolean

Boolean true/false scalar.

scalar Boolean  # True or false

Decimal

High-precision decimal number for financial calculations.

scalar Decimal  # High-precision decimal (up to 19 digits)

DateTime

ISO 8601 timestamp scalar.

scalar DateTime  # ISO 8601 timestamp (e.g., "2024-01-15T10:30:00Z")

Json

Arbitrary JSON data scalar.

scalar Json  # Arbitrary JSON data

Schema Metadata

__Schema

Introspection type for schema information.

type __Schema {
  types: [__Type!]!                    # All types in the schema
  queryType: __Type!                   # Root query type
  mutationType: __Type                 # Root mutation type
  subscriptionType: __Type             # Root subscription type
  directives: [__Directive!]!          # Available directives
}

__Type

Introspection type for type information.

type __Type {
  kind: __TypeKind!                    # Type kind (OBJECT, SCALAR, etc.)
  name: String                         # Type name
  description: String                  # Type description
  fields(includeDeprecated: Boolean = false): [__Field!] # Object fields
  enumValues(includeDeprecated: Boolean = false): [__EnumValue!] # Enum values
  possibleTypes: [__Type!]             # Union/interface implementations
  inputFields: [__InputValue!]         # Input object fields
  ofType: __Type                       # List/item type
}

__Field

Introspection type for field information.

type __Field {
  name: String!                        # Field name
  description: String                  # Field description
  args: [__InputValue!]!               # Field arguments
  type: __Type!                        # Field return type
  isDeprecated: Boolean!               # Whether field is deprecated
  deprecationReason: String            # Deprecation reason
}

__InputValue

Introspection type for input value information.

type __InputValue {
  name: String!                        # Input name
  description: String                  # Input description
  type: __Type!                        # Input type
  defaultValue: String                 # Default value as string
}

__EnumValue

Introspection type for enum value information.

type __EnumValue {
  name: String!                        # Enum value name
  description: String                  # Enum value description
  isDeprecated: Boolean!               # Whether value is deprecated
  deprecationReason: String            # Deprecation reason
}

__Directive

Introspection type for directive information.

type __Directive {
  name: String!                        # Directive name
  description: String                  # Directive description
  locations: [__DirectiveLocation!]!   # Valid locations
  args: [__InputValue!]!               # Directive arguments
}

__TypeKind

Enumeration of type kinds for introspection.

enum __TypeKind {
  SCALAR      # Scalar types (String, Int, etc.)
  OBJECT      # Object types with fields
  INTERFACE   # Interface types
  UNION       # Union types
  ENUM        # Enumeration types
  INPUT_OBJECT # Input object types
  LIST        # List types
  NON_NULL    # Non-null wrapper types
}

__DirectiveLocation

Enumeration of locations where directives can be used.

enum __DirectiveLocation {
  QUERY               # Query operations
  MUTATION            # Mutation operations
  SUBSCRIPTION        # Subscription operations
  FIELD               # Field selections
  FRAGMENT_DEFINITION # Fragment definitions
  FRAGMENT_SPREAD     # Fragment spreads
  INLINE_FRAGMENT     # Inline fragments
  VARIABLE_DEFINITION # Variable definitions
  SCHEMA              # Schema definitions
  SCALAR              # Scalar type definitions
  OBJECT              # Object type definitions
  FIELD_DEFINITION    # Field definitions
  ARGUMENT_DEFINITION # Argument definitions
  INTERFACE           # Interface type definitions
  UNION               # Union type definitions
  ENUM                # Enum type definitions
  ENUM_VALUE          # Enum value definitions
  INPUT_OBJECT        # Input object definitions
  INPUT_FIELD_DEFINITION # Input field definitions
}

This comprehensive schema reference covers all GraphQL types available in Crane Ledger's API. Each type includes detailed field descriptions, types, and relationships to help you build robust GraphQL queries and mutations.


Need help?

Create a free account to access our support portal. Once signed in, use the Support tab in your dashboard to submit a support ticket — our team typically responds within 24 hours.