# API Mutations
Source: https://fragment.dev/api-reference/ledger-mutations
[Documentation index](https://fragment.dev/llms.txt)
## addLedgerEntries
Batch version of [addLedgerEntry](https://fragment.dev/markdown/api-reference/ledger-mutations.md#addledgerentry).
###### Response
Returns an [AddLedgerEntriesResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-addledgerentriesresponse)
```graphql
mutation AddLedgerEntries($entries: [AddLedgerEntryInput!]!) {
addLedgerEntries(entries: $entries) {
... on AddLedgerEntriesError {
...AddLedgerEntriesErrorFragment
}
... on AddLedgerEntriesResult {
...AddLedgerEntriesResultFragment
}
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{"entries": [AddLedgerEntryInput]}
```
```json
{"data": {"addLedgerEntries": AddLedgerEntriesError\}\}
```
###### Arguments
- **entries** ([[AddLedgerEntryInput!]!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-addledgerentryinput))
The Ledger Entries to post, each with its own [Idempotency Key](https://fragment.dev/markdown/api-reference/ledger-overview.md#idempotency).
## addLedgerEntry
Adds a Ledger Entry to a Ledger. This Ledger Entry cannot be into a Linked Ledger Account. For that, use [reconcileTx](https://fragment.dev/markdown/api-reference/ledger-mutations.md#reconciletx)
###### Response
Returns an [AddLedgerEntryResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-addledgerentryresponse)
```graphql
mutation AddLedgerEntry(
$entry: LedgerEntryInput!,
$ik: SafeString!
) {
addLedgerEntry(
entry: $entry,
ik: $ik
) {
... on AddLedgerEntryResult {
...AddLedgerEntryResultFragment
}
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{"entry": LedgerEntryInput, "ik": "some-safe-string-ik"}
```
```json
{"data": {"addLedgerEntry": AddLedgerEntryResult\}\}
```
###### Arguments
- **entry** ([LedgerEntryInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-ledgerentryinput))
An object containing the [Ledger Lines](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-ledgerlineinput) as well as an optional description and posted timestamp.
- **ik** ([SafeString!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-safestring))
The [Idempotency Key](https://fragment.dev/markdown/api-reference/ledger-overview.md#idempotency)
## createCustomCurrency
Creates a custom currency.
###### Response
Returns a [CreateCustomCurrencyResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-createcustomcurrencyresponse)
```graphql
mutation CreateCustomCurrency($customCurrency: CreateCustomCurrencyInput!) {
createCustomCurrency(customCurrency: $customCurrency) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on CreateCustomCurrencyResult {
...CreateCustomCurrencyResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{"customCurrency": CreateCustomCurrencyInput}
```
```json
{"data": {"createCustomCurrency": BadRequestError\}\}
```
###### Arguments
- **customCurrency** ([CreateCustomCurrencyInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-createcustomcurrencyinput))
The custom currency to be created.
## createCustomLink
Custom Links let you integrate external systems that don't have native support. See [Custom Links](https://fragment.dev/markdown/guides/sync-payments.md#custom-link)
###### Response
Returns a [CreateCustomLinkResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-createcustomlinkresponse)
```graphql
mutation CreateCustomLink(
$ik: SafeString!,
$name: String!
) {
createCustomLink(
ik: $ik,
name: $name
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on CreateCustomLinkResult {
...CreateCustomLinkResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{"ik": "some-safe-string-ik", "name": "abc123"}
```
```json
{"data": {"createCustomLink": BadRequestError\}\}
```
###### Arguments
- **ik** ([SafeString!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-safestring))
The [Idempotency Key](https://fragment.dev/markdown/api-reference/ledger-overview.md#idempotency)
- **name** ([String!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string))
The name of your custom link
## createLedger
Creates a Ledger.
###### Response
Returns a [CreateLedgerResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-createledgerresponse)
```graphql
mutation CreateLedger(
$ik: SafeString!,
$ledger: CreateLedgerInput!,
$schema: SchemaMatchInput
) {
createLedger(
ik: $ik,
ledger: $ledger,
schema: $schema
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on CreateLedgerResult {
...CreateLedgerResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{
"ik": "some-safe-string-ik",
"ledger": CreateLedgerInput,
"schema": SchemaMatchInput
}
```
```json
{"data": {"createLedger": BadRequestError\}\}
```
###### Arguments
- **ik** ([SafeString!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-safestring))
The [Idempotency Key](https://fragment.dev/markdown/api-reference/ledger-overview.md#idempotency)
- **ledger** ([CreateLedgerInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-createledgerinput))
The payload representing the Ledger to be created
- **schema** ([SchemaMatchInput](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-schemamatchinput))
The Schema to create this Ledger with
## createPayment
Create a Payment.
###### Response
Returns a [CreatePaymentResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-createpaymentresponse)
```graphql
mutation CreatePayment(
$ik: SafeString!,
$ledger: LedgerMatchInput!,
$payment: CreatePaymentInput!
) {
createPayment(
ik: $ik,
ledger: $ledger,
payment: $payment
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on CreatePaymentResult {
...CreatePaymentResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{
"ik": "some-safe-string-ik",
"ledger": LedgerMatchInput,
"payment": CreatePaymentInput
}
```
```json
{"data": {"createPayment": BadRequestError\}\}
```
###### Arguments
- **ik** ([SafeString!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-safestring))
The [Idempotency Key](https://fragment.dev/markdown/api-reference/ledger-overview.md#idempotency). Can be up to 128 characters long.
- **ledger** ([LedgerMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgermatchinput))
The Ledger this Payment belongs to.
- **payment** ([CreatePaymentInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-createpaymentinput))
The Payment to create.
## createPaymentMethodSetup
Save a Payment Method for a User without charging it.
###### Response
Returns a [CreatePaymentMethodSetupResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-createpaymentmethodsetupresponse)
```graphql
mutation CreatePaymentMethodSetup(
$ik: SafeString!,
$ledger: LedgerMatchInput!,
$user: UserMatchInput!
) {
createPaymentMethodSetup(
ik: $ik,
ledger: $ledger,
user: $user
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on CreatePaymentMethodSetupResult {
...CreatePaymentMethodSetupResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{
"ik": "some-safe-string-ik",
"ledger": LedgerMatchInput,
"user": UserMatchInput
}
```
```json
{"data": {"createPaymentMethodSetup": BadRequestError\}\}
```
###### Arguments
- **ik** ([SafeString!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-safestring))
The [Idempotency Key](https://fragment.dev/markdown/api-reference/ledger-overview.md#idempotency) for the Payment Method Setup. Can be up to 128 characters long. This is not the idempotency key for the saved Payment Method.
- **ledger** ([LedgerMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgermatchinput))
The Ledger the Payment Method is saved in.
- **user** ([UserMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-usermatchinput))
The User whose payment method to save.
## 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!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-deletecustomtxsresponse)
```graphql
mutation DeleteCustomTxs($txs: [ID!]!) {
deleteCustomTxs(txs: $txs) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on DeleteCustomTxsResult {
...DeleteCustomTxsResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{"txs": "3116551f-5efc-4c9e-84ac-5a36a51b09c1"}
```
```json
{"data": {"deleteCustomTxs": BadRequestError\}\}
```
###### Arguments
- **txs** ([[ID!]!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-id))
The Fragment IDs of the Txs to delete
## deleteLedger
Delete a Ledger.
###### Response
Returns a [DeleteLedgerResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-deleteledgerresponse)
```graphql
mutation DeleteLedger($ledger: LedgerMatchInput!) {
deleteLedger(ledger: $ledger) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on DeleteLedgerResult {
...DeleteLedgerResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{"ledger": LedgerMatchInput}
```
```json
{"data": {"deleteLedger": BadRequestError\}\}
```
###### Arguments
- **ledger** ([LedgerMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgermatchinput))
## deletePaymentMethod
Delete a Payment Method saved for a User.
###### Response
Returns a [DeletePaymentMethodResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-deletepaymentmethodresponse)
```graphql
mutation DeletePaymentMethod($paymentMethod: PaymentMethodMatchInput!) {
deletePaymentMethod(paymentMethod: $paymentMethod) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on DeletePaymentMethodResult {
...DeletePaymentMethodResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{"paymentMethod": PaymentMethodMatchInput}
```
```json
{"data": {"deletePaymentMethod": BadRequestError\}\}
```
###### Arguments
- **paymentMethod** ([PaymentMethodMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-paymentmethodmatchinput))
The Payment Method to delete.
## deleteSchema
Delete a Schema
###### Response
Returns a [DeleteSchemaResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-deleteschemaresponse)
```graphql
mutation DeleteSchema($schema: SchemaMatchInput!) {
deleteSchema(schema: $schema) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on DeleteSchemaResult {
...DeleteSchemaResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{"schema": SchemaMatchInput}
```
```json
{"data": {"deleteSchema": BadRequestError\}\}
```
###### Arguments
- **schema** ([SchemaMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-schemamatchinput))
## instantiateLedgerAccount
Instantiates a Ledger Account from a template in the Ledger's Schema before any Ledger Entry is posted to it. Creates any missing templated ancestors.
###### Response
Returns an [InstantiateLedgerAccountResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-instantiateledgeraccountresponse)
```graphql
mutation InstantiateLedgerAccount(
$ledger: LedgerMatchInput!,
$parameters: Parameters,
$path: String!
) {
instantiateLedgerAccount(
ledger: $ledger,
parameters: $parameters,
path: $path
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InstantiateLedgerAccountResult {
...InstantiateLedgerAccountResultFragment
}
... on InternalError {
...InternalErrorFragment
}
}
}
```
```json
{
"ledger": LedgerMatchInput,
"parameters": {"bank_name": "bank-name", "deposit_amount": "10000"},
"path": "abc123"
}
```
```json
{"data": {"instantiateLedgerAccount": BadRequestError\}\}
```
###### Arguments
- **ledger** ([LedgerMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgermatchinput))
The Ledger whose Schema defines the account.
- **parameters** ([Parameters](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-parameters))
Values for every parameter the account's template references: name, currency, and linked account fields.
- **path** ([String!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string))
The fully instantiated path of the account, e.g. assets/customer:cust-1. Must not contain placeholders.
## migrateLedgerEntry
Migrate an existing Ledger Entry to a new type and typeVersion.
###### Response
Returns a [MigrateLedgerEntryResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-migrateledgerentryresponse)
```graphql
mutation MigrateLedgerEntry($input: MigrateLedgerEntryInput!) {
migrateLedgerEntry(input: $input) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on MigrateLedgerEntryResult {
...MigrateLedgerEntryResultFragment
}
}
}
```
```json
{"input": MigrateLedgerEntryInput}
```
```json
{"data": {"migrateLedgerEntry": BadRequestError\}\}
```
###### Arguments
- **input** ([MigrateLedgerEntryInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-migrateledgerentryinput))
## reconcileTx
This mutation is used to [reconcile](https://fragment.dev/markdown/guides/reconcile-payments.md#reconcile-a-tx) 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!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-reconciletxresponse)
```graphql
mutation ReconcileTx($entry: LedgerEntryInput!) {
reconcileTx(entry: $entry) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on ReconcileTxResult {
...ReconcileTxResultFragment
}
}
}
```
```json
{"entry": LedgerEntryInput}
```
```json
{"data": {"reconcileTx": BadRequestError\}\}
```
###### Arguments
- **entry** ([LedgerEntryInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-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.
## refundPayment
Refund a settled Payment.
###### Response
Returns a [RefundPaymentResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-refundpaymentresponse)
```graphql
mutation RefundPayment(
$ik: SafeString!,
$payment: PaymentMatchInput!,
$refund: RefundPaymentInput!
) {
refundPayment(
ik: $ik,
payment: $payment,
refund: $refund
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on RefundPaymentResult {
...RefundPaymentResultFragment
}
}
}
```
```json
{
"ik": "some-safe-string-ik",
"payment": PaymentMatchInput,
"refund": RefundPaymentInput
}
```
```json
{"data": {"refundPayment": BadRequestError\}\}
```
###### Arguments
- **ik** ([SafeString!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-safestring))
The [Idempotency Key](https://fragment.dev/markdown/api-reference/ledger-overview.md#idempotency) for this Payment Refund. Can be up to 128 characters long.
- **payment** ([PaymentMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-paymentmatchinput))
The Payment to refund.
- **refund** ([RefundPaymentInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-refundpaymentinput))
The Payment Refund to create.
## retryPayment
Retry a Payment on a saved Payment Method after its latest attempt was declined, rejected or canceled.
###### Response
Returns a [RetryPaymentResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-retrypaymentresponse)
```graphql
mutation RetryPayment(
$attemptIk: SafeString!,
$payment: PaymentMatchInput!,
$paymentMethod: PaymentMethodMatchInput
) {
retryPayment(
attemptIk: $attemptIk,
payment: $payment,
paymentMethod: $paymentMethod
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on RetryPaymentResult {
...RetryPaymentResultFragment
}
}
}
```
```json
{
"attemptIk": "some-safe-string-ik",
"payment": PaymentMatchInput,
"paymentMethod": PaymentMethodMatchInput
}
```
```json
{"data": {"retryPayment": BadRequestError\}\}
```
###### Arguments
- **attemptIk** ([SafeString!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-safestring))
The [Idempotency Key](https://fragment.dev/markdown/api-reference/ledger-overview.md#idempotency) for this Retry, unique within the Payment. Can be up to 128 characters long.
- **payment** ([PaymentMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-paymentmatchinput))
The Payment to retry.
- **paymentMethod** ([PaymentMethodMatchInput](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-paymentmethodmatchinput))
The saved Payment Method to charge. When omitted, charges the previous attempt's saved Payment Method.
## reverseLedgerEntry
Reverses a Ledger Entry
###### Response
Returns a [ReverseLedgerEntryResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-reverseledgerentryresponse)
```graphql
mutation ReverseLedgerEntry($id: ID!) {
reverseLedgerEntry(id: $id) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on ReverseLedgerEntryResult {
...ReverseLedgerEntryResultFragment
}
}
}
```
```json
{"id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1"}
```
```json
{"data": {"reverseLedgerEntry": BadRequestError\}\}
```
###### Arguments
- **id** ([ID!](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-id))
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!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-storeschemaresponse)
```graphql
mutation StoreSchema($schema: SchemaInput!) {
storeSchema(schema: $schema) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on StoreSchemaResult {
...StoreSchemaResultFragment
}
}
}
```
```json
{"schema": SchemaInput}
```
```json
{"data": {"storeSchema": BadRequestError\}\}
```
###### Arguments
- **schema** ([SchemaInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-schemainput))
The Schema to store.
## syncCustomAccounts
Once you've created a [Custom Link](https://fragment.dev/markdown/guides/sync-payments.md#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!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-synccustomaccountsresponse)
```graphql
mutation SyncCustomAccounts(
$accounts: [CustomAccountInput!]!,
$link: LinkMatchInput!
) {
syncCustomAccounts(
accounts: $accounts,
link: $link
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on SyncCustomAccountsResult {
...SyncCustomAccountsResultFragment
}
}
}
```
```json
{
"accounts": [CustomAccountInput],
"link": LinkMatchInput
}
```
```json
{"data": {"syncCustomAccounts": BadRequestError\}\}
```
###### Arguments
- **accounts** ([[CustomAccountInput!]!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-customaccountinput))
A list of external accounts to sync
- **link** ([LinkMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-linkmatchinput))
An object containing the ID or creation IK of a Custom Link.
## syncCustomTxs
You can create transactions under a Custom Account in a [Custom Link](https://fragment.dev/markdown/guides/sync-payments.md#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!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-synccustomtxsresponse)
```graphql
mutation SyncCustomTxs(
$link: LinkMatchInput!,
$txs: [CustomTxInput!]!
) {
syncCustomTxs(
link: $link,
txs: $txs
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on SyncCustomTxsResult {
...SyncCustomTxsResultFragment
}
}
}
```
```json
{
"link": LinkMatchInput,
"txs": [CustomTxInput]
}
```
```json
{"data": {"syncCustomTxs": BadRequestError\}\}
```
###### Arguments
- **link** ([LinkMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-linkmatchinput))
An object containing the ID or creation IK of a Custom Link.
- **txs** ([[CustomTxInput!]!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-customtxinput))
A list of external transactions to sync
## updateLedger
Updates a Ledger. Currently, you can change only the Ledger 'name'.
###### Response
Returns an [UpdateLedgerResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-updateledgerresponse)
```graphql
mutation UpdateLedger(
$ledger: LedgerMatchInput!,
$update: UpdateLedgerInput!
) {
updateLedger(
ledger: $ledger,
update: $update
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on UpdateLedgerResult {
...UpdateLedgerResultFragment
}
}
}
```
```json
{
"ledger": LedgerMatchInput,
"update": UpdateLedgerInput
}
```
```json
{"data": {"updateLedger": BadRequestError\}\}
```
###### Arguments
- **ledger** ([LedgerMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgermatchinput))
An object containing the ID of the Ledger to update.
- **update** ([UpdateLedgerInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-updateledgerinput))
A payload of fields to update. Currently, you can change only the Ledger 'name'.
## updateLedgerEntry
Update a ledger entry
###### Response
Returns an [UpdateLedgerEntryResponse!](https://fragment.dev/markdown/api-reference/ledger-types.md#response-types-updateledgerentryresponse)
```graphql
mutation UpdateLedgerEntry(
$ledgerEntry: LedgerEntryMatchInput!,
$update: UpdateLedgerEntryInput!
) {
updateLedgerEntry(
ledgerEntry: $ledgerEntry,
update: $update
) {
... on BadRequestError {
...BadRequestErrorFragment
}
... on InternalError {
...InternalErrorFragment
}
... on UpdateLedgerEntryResult {
...UpdateLedgerEntryResultFragment
}
}
}
```
```json
{
"ledgerEntry": LedgerEntryMatchInput,
"update": UpdateLedgerEntryInput
}
```
```json
{"data": {"updateLedgerEntry": BadRequestError\}\}
```
###### Arguments
- **ledgerEntry** ([LedgerEntryMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgerentrymatchinput))
The Ledger Entry that is being updated
- **update** ([UpdateLedgerEntryInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#input-types-updateledgerentryinput))
The payload containing the fields to update. Only a Ledger Entry's tags and its Ledger Lines' tags can be updated.