Reference
GraphQL

GraphQL API

Queries

type Query {
  account(acct_id: String!): Account!
  commodity(id: String!): Commodity!
  ledger(ldgr_id: String!): Ledger!
  ledgers: [Ledger!]!
  transaction(tx_id: String!): Transaction!
}

Object Types

Account

type Account {
  id: ID!
 
  balance(at: DateTime): Balance
  transactions: [Transaction!]!
 
  ldgr_id: String!
  meta: JSON
}

Balance

type Balance {
  account: Account!
  acct_id: String!
  balance_lines: [BalanceLine!]!
  id: ID!
}
 
type BalanceLine {
  commodity: Commodity!
  cmy_id: String!
  credits: Int!
  debits: Int!
  total: Int!
  layer: Int!
}

Commodity

type Commodity {
  id: ID!
  name: String!
  precision: Int!
 
  ldgr_id: String!
  ledger: Ledger!
  meta: JSON
}

Ledger

type Ledger {
  id: ID!
 
  base_cmy_id: String!
  base_commodity: Commodity!
 
  accounts: [Account!]
  commodities: [Commodity!]
  transactions: [Transaction!]
 
  meta: JSON
}

Transaction

type Transaction {
  id: ID!
  description: String!
  date: DateTime!
  postings: [Posting!]!
  balances_after: [Balance!]!
 
  meta: JSON
  ldgr_id: String!
}
 
type Posting {
  id: ID!
 
  acct_id: String!
  cmy_id: String!
  credit: Int
  debit: Int
 
  account: Account!
  commodity: Commodity!
  meta: JSON
}

Mutations

type Mutation {
  accountCreate(account: AccountCreate!): Account!
  accountCreateMany(accounts: [AccountCreate!]): [Account!]!
  ledgerCreate(ledger: LedgerCreate!): Ledger!
  transactionCreate(transaction: TransactionCreate!): Transaction!
  transactionCreateMany(transactions: [TransactionCreate!]): [Transaction!]!
  ledgerDelete(ldgr_id: String!): Ledger!
}
 
input AccountCreate {
  ldgr_id: String!
  meta: JSON
}
 
input LedgerCreate {
  base_commodity_name: String!
  base_commodity_precision: Int!
  meta: JSON
}
 
input TransactionCreate {
  date: DateTime!
  desc: String!
  meta: JSON
  postings: [PostingCreate!]!
}
 
input PostingCreate {
  acct_id: String!
  cmy_id: String!
  credit: Int
  debit: Int
  layer: Int!
  meta: JSON
}