C API Mutations#

addLedgerEntries

#

Batch version of addLedgerEntry.

Response

Returns an AddLedgerEntriesResponse!

Query
mutation AddLedgerEntries($entries: [AddLedgerEntryInput!]!) {
  addLedgerEntries(entries: $entries) {
    ... on AddLedgerEntriesError {
      ...AddLedgerEntriesErrorFragment
    }
    ... on AddLedgerEntriesResult {
      ...AddLedgerEntriesResultFragment
    }
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
  }
}
Variables
{"entries": [AddLedgerEntryInput]}
Response
{"data": {"addLedgerEntries": AddLedgerEntriesError}}
Arguments
NameDescription
entries[AddLedgerEntryInput!]!

The Ledger Entries to post, each with its own Idempotency Key.

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
NameDescription
entryLedgerEntryInput!

An object containing the Ledger Lines as well as an optional description and posted timestamp.

ikSafeString!

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
NameDescription
customCurrencyCreateCustomCurrencyInput!

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
NameDescription
ikSafeString!
ledgerCreateLedgerInput!

The payload representing the Ledger to be created

schemaSchemaMatchInput

The Schema to create this Ledger with

createPayment

#

EXPERIMENTAL — subject to change.

Response

Returns a CreatePaymentResponse!

Query
mutation CreatePayment(
  $ik: SafeString!,
  $ledger: LedgerMatchInput!,
  $payment: CreatePaymentInput!
) {
  createPayment(
    ik: $ik,
    ledger: $ledger,
    payment: $payment
  ) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on Payment {
      ...PaymentFragment
    }
  }
}
Variables
{
  "ik": "some-safe-string-ik",
  "ledger": LedgerMatchInput,
  "payment": CreatePaymentInput
}
Response
{"data": {"createPayment": BadRequestError}}
Arguments
NameDescription
ikSafeString!
ledgerLedgerMatchInput!

The Ledger this Payment belongs to.

paymentCreatePaymentInput!

The Payment to create.

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
NameDescription
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
NameDescription
ledgerLedgerMatchInput!

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
NameDescription
schemaSchemaMatchInput!

migrateLedgerEntry

#

Migrate an existing Ledger Entry to a new type and typeVersion.

Response

Returns a MigrateLedgerEntryResponse!

Query
mutation MigrateLedgerEntry($input: MigrateLedgerEntryInput!) {
  migrateLedgerEntry(input: $input) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on MigrateLedgerEntryResult {
      ...MigrateLedgerEntryResultFragment
    }
  }
}
Variables
{"input": MigrateLedgerEntryInput}
Response
{"data": {"migrateLedgerEntry": BadRequestError}}
Arguments
NameDescription
inputMigrateLedgerEntryInput!

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
NameDescription
entryLedgerEntryInput!

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.

reverseLedgerEntry

#

Reverses a Ledger Entry

Response

Returns a ReverseLedgerEntryResponse!

Query
mutation ReverseLedgerEntry($id: ID!) {
  reverseLedgerEntry(id: $id) {
    ... on BadRequestError {
      ...BadRequestErrorFragment
    }
    ... on InternalError {
      ...InternalErrorFragment
    }
    ... on ReverseLedgerEntryResult {
      ...ReverseLedgerEntryResultFragment
    }
  }
}
Variables
{"id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1"}
Response
{"data": {"reverseLedgerEntry": BadRequestError}}
Arguments
NameDescription
idID!

The FRAGMENT ID of the Ledger Entry to reverse

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
NameDescription
schemaSchemaInput!

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
NameDescription
accounts[CustomAccountInput!]!

A list of external accounts to sync

linkLinkMatchInput!

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
NameDescription
linkLinkMatchInput!

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
NameDescription
ledgerLedgerMatchInput!

An object containing the ID of the Ledger to update.

updateUpdateLedgerInput!

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
NameDescription
ledgerEntryLedgerEntryMatchInput!

The Ledger Entry that is being updated

updateUpdateLedgerEntryInput!

The payload containing the fields to update. Only a Ledger Entry's tags and its Ledger Lines' tags can be updated.