C API Mutations#

addLedgerEntry

#

Adds a Ledger Entry to a Ledger. This Ledger Entry cannot be into a Linked Ledger Account. For that, use reconcileTx

Response

Returns an AddLedgerEntryResponse!

Query
mutation AddLedgerEntry(
  $entry: LedgerEntryInput!,
  $ik: SafeString!
) {
  addLedgerEntry(
    entry: $entry,
    ik: $ik
  ) {
    ... on AddLedgerEntryResult {
      ...AddLedgerEntryResultFragment
    }
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
  }
}

Variables
{"entry": LedgerEntryInput, "ik": "some-safe-string-ik"}

Response
{"data": {"addLedgerEntry": AddLedgerEntryResult}}

Arguments
Name Description
entry - LedgerEntryInput! An object containing the Ledger Lines as well as an optional description and posted timestamp.
ik - SafeString! The Idempotency Key

createCustomCurrency

#

Creates a custom currency.

Response

Returns a CreateCustomCurrencyResponse!

Query
mutation CreateCustomCurrency($customCurrency: CreateCustomCurrencyInput!) {
  createCustomCurrency(customCurrency: $customCurrency) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on CreateCustomCurrencyResult {
      ...CreateCustomCurrencyResultFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
  }
}

Variables
{"customCurrency": CreateCustomCurrencyInput}

Response
{"data": {"createCustomCurrency": BadRequestError}}

Arguments
Name Description
customCurrency - CreateCustomCurrencyInput! The custom currency to be created.

createLedger

#

Creates a Ledger.

Response

Returns a CreateLedgerResponse!

Query
mutation CreateLedger(
  $ik: SafeString!,
  $ledger: CreateLedgerInput!,
  $schema: SchemaMatchInput
) {
  createLedger(
    ik: $ik,
    ledger: $ledger,
    schema: $schema
  ) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on CreateLedgerResult {
      ...CreateLedgerResultFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
  }
}

Variables
{
  "ik": "some-safe-string-ik",
  "ledger": CreateLedgerInput,
  "schema": SchemaMatchInput
}

Response
{"data": {"createLedger": BadRequestError}}

Arguments
Name Description
ik - SafeString! The Idempotency Key
ledger - CreateLedgerInput! The payload representing the Ledger to be created
schema - SchemaMatchInput The Schema to create this Ledger with

deleteCustomTxs

#

Delete Txs on a Custom Link. Once deleted, a Tx will not show up in listing queries, but can be resolved by if you lookup by its FRAGMENT ID.

Response

Returns a DeleteCustomTxsResponse!

Query
mutation DeleteCustomTxs($txs: [ID!]!) {
  deleteCustomTxs(txs: $txs) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on DeleteCustomTxsResult {
      ...DeleteCustomTxsResultFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
  }
}

Variables
{"txs": "3116551f-5efc-4c9e-84ac-5a36a51b09c1"}

Response
{"data": {"deleteCustomTxs": BadRequestError}}

Arguments
Name Description
txs - [ID!]! The FRAGMENT IDs of the Txs to delete

deleteLedger

#

Delete a Ledger.

Response

Returns a DeleteLedgerResponse!

Query
mutation DeleteLedger($ledger: LedgerMatchInput!) {
  deleteLedger(ledger: $ledger) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on DeleteLedgerResult {
      ...DeleteLedgerResultFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
  }
}

Variables
{"ledger": LedgerMatchInput}

Response
{"data": {"deleteLedger": BadRequestError}}

Arguments
Name Description
ledger - LedgerMatchInput!

deleteSchema

#

Delete a Schema

Response

Returns a DeleteSchemaResponse!

Query
mutation DeleteSchema($schema: SchemaMatchInput!) {
  deleteSchema(schema: $schema) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on DeleteSchemaResult {
      ...DeleteSchemaResultFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
  }
}

Variables
{"schema": SchemaMatchInput}

Response
{"data": {"deleteSchema": BadRequestError}}

Arguments
Name Description
schema - SchemaMatchInput!

reconcileTx

#

This mutation is used to reconcile transactions from an external system into a Ledger Entry. This mutation does not require an idempotency key since a transaction can only be reconciled once per Linked Ledger Account. If you are reconciling a transfer between two Link Accounts which are both linked to the same Ledger, use a transit account in between to split the transfer into two reconcileTx calls.

Response

Returns a ReconcileTxResponse!

Query
mutation ReconcileTx($entry: LedgerEntryInput!) {
  reconcileTx(entry: $entry) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on ReconcileTxResult {
      ...ReconcileTxResultFragment
    }
  }
}

Variables
{"entry": LedgerEntryInput}

Response
{"data": {"reconcileTx": BadRequestError}}

Arguments
Name Description
entry - LedgerEntryInput! The ledger entry containing lines that specify the transaction from a linked ledger account to reconcile, as well as the ledger account with which to offset the external transaction.

storeSchema

#

Stores a Schema in your workspace. If no Schema with the same key exists in your worksapce, a new Schema is created. Else, the Schema is updated, and every Ledger associated with it is migrated to the latest version.

Response

Returns a StoreSchemaResponse!

Query
mutation StoreSchema($schema: SchemaInput!) {
  storeSchema(schema: $schema) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on StoreSchemaResult {
      ...StoreSchemaResultFragment
    }
  }
}

Variables
{"schema": SchemaInput}

Response
{"data": {"storeSchema": BadRequestError}}

Arguments
Name Description
schema - SchemaInput! The Schema to store.

syncCustomAccounts

#

Once you've created a Custom Link, create accounts under it using this mutation. Each Custom Account is an immutable, single-entry view of all the transactions in the external account. You can sync up to 100 Custom Accounts in one API call.

Response

Returns a SyncCustomAccountsResponse!

Query
mutation SyncCustomAccounts(
  $accounts: [CustomAccountInput!]!,
  $link: LinkMatchInput!
) {
  syncCustomAccounts(
    accounts: $accounts,
    link: $link
  ) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on SyncCustomAccountsResult {
      ...SyncCustomAccountsResultFragment
    }
  }
}

Variables
{
  "accounts": [CustomAccountInput],
  "link": LinkMatchInput
}

Response
{"data": {"syncCustomAccounts": BadRequestError}}

Arguments
Name Description
accounts - [CustomAccountInput!]! A list of external accounts to sync
link - LinkMatchInput! An object containing the ID of a Custom Link.

syncCustomTxs

#

You can create transactions under a Custom Account in a Custom Link using this mutation. Once you've imported transactions, you can use the reconcileTx mutation to add them to a Ledger via the Linked Ledger Account. You can sync up to 100 Custom Transactions in one API call.

Response

Returns a SyncCustomTxsResponse!

Query
mutation SyncCustomTxs(
  $link: LinkMatchInput!,
  $txs: [CustomTxInput!]!
) {
  syncCustomTxs(
    link: $link,
    txs: $txs
  ) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on SyncCustomTxsResult {
      ...SyncCustomTxsResultFragment
    }
  }
}

Variables
{
  "link": LinkMatchInput,
  "txs": [CustomTxInput]
}

Response
{"data": {"syncCustomTxs": BadRequestError}}

Arguments
Name Description
link - LinkMatchInput! An object containing the ID of a Custom Link.
txs - [CustomTxInput!]! A list of external transactions to sync

updateLedger

#

Updates a Ledger. Currently, you can change only the Ledger 'name'.

Response

Returns an UpdateLedgerResponse!

Query
mutation UpdateLedger(
  $ledger: LedgerMatchInput!,
  $update: UpdateLedgerInput!
) {
  updateLedger(
    ledger: $ledger,
    update: $update
  ) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on UpdateLedgerResult {
      ...UpdateLedgerResultFragment
    }
  }
}

Variables
{
  "ledger": LedgerMatchInput,
  "update": UpdateLedgerInput
}

Response
{"data": {"updateLedger": BadRequestError}}

Arguments
Name Description
ledger - LedgerMatchInput! An object containing the ID of the Ledger to update.
update - UpdateLedgerInput! A payload of fields to update. Currently, you can change only the Ledger 'name'.

updateLedgerEntry

#

Update a ledger entry

Response

Returns an UpdateLedgerEntryResponse!

Query
mutation UpdateLedgerEntry(
  $ledgerEntry: LedgerEntryMatchInput!,
  $update: UpdateLedgerEntryInput!
) {
  updateLedgerEntry(
    ledgerEntry: $ledgerEntry,
    update: $update
  ) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on UpdateLedgerEntryResult {
      ...UpdateLedgerEntryResultFragment
    }
  }
}

Variables
{
  "ledgerEntry": LedgerEntryMatchInput,
  "update": UpdateLedgerEntryInput
}

Response
{"data": {"updateLedgerEntry": BadRequestError}}

Arguments
Name Description
ledgerEntry - LedgerEntryMatchInput! The Ledger Entry that is being updated
update - UpdateLedgerEntryInput! The payload containing the fields to update. Only a Ledger Entry's tags can be updated.