# API Queries Source: https://fragment.dev/api-reference/ledger-queries [Documentation index](https://fragment.dev/llms.txt) ## customCurrencies Query Custom Currencies in the workspace ###### Response Returns a [CustomCurrenciesConnection!](https://fragment.dev/markdown/api-reference/ledger-types.md#connection-types-customcurrenciesconnection) ```graphql query CustomCurrencies( $after: String, $before: String, $first: Int, $last: Int ) { customCurrencies( after: $after, before: $before, first: $first, last: $last ) { nodes { ...CurrencyFragment } pageInfo { ...PageInfoFragment } } } ``` ```json {"after": "abc123", "before": "abc123", "first": 2277, "last": 2277} ``` ```json { "data": { "customCurrencies": { "nodes": [Currency], "pageInfo": PageInfo } } } ``` ###### Arguments - **after** ([String](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string)) Where to start paginating from, when paginating forwards. Send endCursor from a response to get its next page. Learn more about [pagination](https://fragment.dev/markdown/guides/query-data.md#basics-pagination). - **before** ([String](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string)) Where to start paginating from, when paginating backwards. Send startCursor from a response to get the previous page. Learn more about [pagination](https://fragment.dev/markdown/guides/query-data.md#basics-pagination). - **first** ([Int](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-int)) The number of currencies to return per page, when paginating forwards. Defaults to 20, maximum is 200. - **last** ([Int](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-int)) The number of currencies to return per page, when paginating backwards. Defaults to 20, maximum is 200. ## externalAccount Get External Account by Link and External ID or Fragment ID. ###### Response Returns an [ExternalAccount](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-externalaccount) ```graphql query ExternalAccount($externalAccount: ExternalAccountMatchInput!) { externalAccount(externalAccount: $externalAccount) { currency { ...CurrencyFragment } currencyMode externalId id ledgerAccounts { ...LedgerAccountsConnectionFragment } link { ...LinkFragment } linkId name txs { ...TxsConnectionFragment } } } ``` ```json {"externalAccount": ExternalAccountMatchInput} ``` ```json { "data": { "externalAccount": { "currency": Currency, "currencyMode": "multi", "externalId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "ledgerAccounts": LedgerAccountsConnection, "link": Link, "linkId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "name": "abc123", "txs": TxsConnection } } } ``` ###### Arguments - **externalAccount** ([ExternalAccountMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-externalaccountmatchinput)) ## ledger Get a Ledger by ID ###### Response Returns a [Ledger](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-ledger) ```graphql query Ledger($ledger: LedgerMatchInput!) { ledger(ledger: $ledger) { balanceUTCOffset created dashboardUrl entryStats { ...LedgerEntryStatsConnectionFragment } id ik ledgerAccountDataMigrations { ...LedgerAccountDataMigrationConnectionFragment } ledgerAccounts { ...LedgerAccountsConnectionFragment } ledgerEntries { ...LedgerEntriesConnectionFragment } ledgerEntryDataMigrations { ...LedgerEntryDataMigrationConnectionFragment } ledgerEntryGroup { ...LedgerEntryGroupFragment } ledgerEntryGroups { ...LedgerEntryGroupsConnectionFragment } lines { ...LedgerLinesConnectionFragment } migrations { ...LedgerMigrationConnectionFragment } name payments { ...PaymentsConnectionFragment } reconciliationReport { ...ReconciliationReportFragment } schema { ...SchemaFragment } type unreconciledTxs { ...TxsConnectionFragment } workspaceId } } ``` ```json {"ledger": LedgerMatchInput} ``` ```json { "data": { "ledger": { "balanceUTCOffset": "-08:00", "created": "2007-12-03T10:15:30Z", "dashboardUrl": "abc123", "entryStats": LedgerEntryStatsConnection, "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "ik": "some-safe-string-ik", "ledgerAccountDataMigrations": LedgerAccountDataMigrationConnection, "ledgerAccounts": LedgerAccountsConnection, "ledgerEntries": LedgerEntriesConnection, "ledgerEntryDataMigrations": LedgerEntryDataMigrationConnection, "ledgerEntryGroup": LedgerEntryGroup, "ledgerEntryGroups": LedgerEntryGroupsConnection, "lines": LedgerLinesConnection, "migrations": LedgerMigrationConnection, "name": "abc123", "payments": PaymentsConnection, "reconciliationReport": ReconciliationReport, "schema": Schema, "type": "double", "unreconciledTxs": TxsConnection, "workspaceId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1" } } } ``` ###### Arguments - **ledger** ([LedgerMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgermatchinput)) An object specifying the ID of the ledger you want to query ## ledgerAccount Get a Ledger Account by ID ###### Response Returns a [LedgerAccount](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-ledgeraccount) ```graphql query LedgerAccount($ledgerAccount: LedgerAccountMatchInput!) { ledgerAccount(ledgerAccount: $ledgerAccount) { balance balanceChange balanceChanges { ...CurrencyAmountConnectionFragment } balanceChangesDuring { ...BalanceChangeDuringConnectionFragment } balances { ...CurrencyAmountConnectionFragment } balancesDuring { ...HistoricalBalanceConnectionFragment } childBalance childBalanceChange childBalanceChanges { ...CurrencyAmountConnectionFragment } childBalanceChangesDuring { ...BalanceChangeDuringConnectionFragment } childBalances { ...CurrencyAmountConnectionFragment } childBalancesDuring { ...HistoricalBalanceConnectionFragment } childLedgerAccounts { ...LedgerAccountsConnectionFragment } clearingStatus consistencyConfig { ...LedgerAccountConsistencyConfigFragment } created currency { ...CurrencyFragment } currencyMode dashboardUrl id ik ledger { ...LedgerFragment } ledgerEntries { ...LedgerEntriesConnectionFragment } ledgerId lines { ...LedgerLinesConnectionFragment } link { ...LinkFragment } linkedAccount { ...ExternalAccountFragment } name ownBalance ownBalanceChange ownBalanceChanges { ...CurrencyAmountConnectionFragment } ownBalanceChangesDuring { ...BalanceChangeDuringConnectionFragment } ownBalances { ...CurrencyAmountConnectionFragment } ownBalancesDuring { ...HistoricalBalanceConnectionFragment } parentLedgerAccount { ...LedgerAccountFragment } parentLedgerAccountId path payment { ...LedgerAccountPaymentFragment } postedWindow { ...PostedWindowFragment } type unreconciledTxs { ...TxsConnectionFragment } workspaceId } } ``` ```json {"ledgerAccount": LedgerAccountMatchInput} ``` ```json { "data": { "ledgerAccount": { "balance": "999999999999", "balanceChange": "999999999999", "balanceChanges": CurrencyAmountConnection, "balanceChangesDuring": BalanceChangeDuringConnection, "balances": CurrencyAmountConnection, "balancesDuring": HistoricalBalanceConnection, "childBalance": "999999999999", "childBalanceChange": "999999999999", "childBalanceChanges": CurrencyAmountConnection, "childBalanceChangesDuring": BalanceChangeDuringConnection, "childBalances": CurrencyAmountConnection, "childBalancesDuring": HistoricalBalanceConnection, "childLedgerAccounts": LedgerAccountsConnection, "clearingStatus": "cleared", "consistencyConfig": LedgerAccountConsistencyConfig, "created": "2007-12-03T10:15:30Z", "currency": Currency, "currencyMode": "multi", "dashboardUrl": "abc123", "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "ik": "abc123", "ledger": Ledger, "ledgerEntries": LedgerEntriesConnection, "ledgerId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "lines": LedgerLinesConnection, "link": Link, "linkedAccount": ExternalAccount, "name": "abc123", "ownBalance": "999999999999", "ownBalanceChange": "999999999999", "ownBalanceChanges": CurrencyAmountConnection, "ownBalanceChangesDuring": BalanceChangeDuringConnection, "ownBalances": CurrencyAmountConnection, "ownBalancesDuring": HistoricalBalanceConnection, "parentLedgerAccount": LedgerAccount, "parentLedgerAccountId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "path": "abc123", "payment": LedgerAccountPayment, "postedWindow": PostedWindow, "type": "asset", "unreconciledTxs": TxsConnection, "workspaceId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1" } } } ``` ###### Arguments - **ledgerAccount** ([LedgerAccountMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgeraccountmatchinput)) An object specifying the ID of the ledger account you want to query ## ledgerEntry Get Ledger Entry by ID. ###### Response Returns a [LedgerEntry](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-ledgerentry) ```graphql query LedgerEntry($ledgerEntry: LedgerEntryMatchInput!) { ledgerEntry(ledgerEntry: $ledgerEntry) { conditions { ...LedgerEntryConditionFragment } created dashboardUrl date description groups { ...LedgerEntryGroupFragment } hidden id ik isReversal isReversed ledger { ...LedgerFragment } ledgerId lines { ...LedgerLinesConnectionFragment } parameters posted reversalHistory { ...LedgerEntriesConnectionFragment } reversalPosition reversedAt reversedBy { ...LedgerEntryFragment } reverses { ...LedgerEntryFragment } tags { ...LedgerEntryTagFragment } type typeVersion workspaceId } } ``` ```json {"ledgerEntry": LedgerEntryMatchInput} ``` ```json { "data": { "ledgerEntry": { "conditions": [LedgerEntryCondition], "created": "2007-12-03T10:15:30Z", "dashboardUrl": "abc123", "date": "2022-03-28", "description": "abc123", "groups": [LedgerEntryGroup], "hidden": true, "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "ik": "abc123", "isReversal": true, "isReversed": true, "ledger": Ledger, "ledgerId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "lines": LedgerLinesConnection, "parameters": {"bank_name": "bank-name", "deposit_amount": "10000"}, "posted": "2007-12-03T10:15:30Z", "reversalHistory": LedgerEntriesConnection, "reversalPosition": 2277, "reversedAt": "2007-12-03T10:15:30Z", "reversedBy": LedgerEntry, "reverses": LedgerEntry, "tags": [LedgerEntryTag], "type": "some-safe-string-ik", "typeVersion": 2277, "workspaceId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1" } } } ``` ###### Arguments - **ledgerEntry** ([LedgerEntryMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgerentrymatchinput)) An object specifying the ID of the Ledger Entry you want to query. ## ledgerEntryGroup Query a Ledger Entry Group given its Ledger, key, and value. ###### Response Returns a [LedgerEntryGroup](https://fragment.dev/markdown/api-reference/ledger-types.md#utility-types-ledgerentrygroup) ```graphql query LedgerEntryGroup($ledgerEntryGroup: LedgerEntryGroupMatchInput!) { ledgerEntryGroup(ledgerEntryGroup: $ledgerEntryGroup) { balances { ...LedgerEntryGroupBalanceConnectionFragment } created dashboardUrl key ledger { ...LedgerFragment } ledgerEntries { ...LedgerEntriesConnectionFragment } ledgerId value } } ``` ```json {"ledgerEntryGroup": LedgerEntryGroupMatchInput} ``` ```json { "data": { "ledgerEntryGroup": { "balances": LedgerEntryGroupBalanceConnection, "created": "2007-12-03T10:15:30Z", "dashboardUrl": "abc123", "key": "some-safe-string-ik", "ledger": Ledger, "ledgerEntries": LedgerEntriesConnection, "ledgerId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "value": "some-safe-string-ik" } } } ``` ###### Arguments - **ledgerEntryGroup** ([LedgerEntryGroupMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgerentrygroupmatchinput)) ## ledgerEntryHistory Get the reversal history of a Ledger Entry. ###### Response Returns a [LedgerEntriesConnection!](https://fragment.dev/markdown/api-reference/ledger-types.md#connection-types-ledgerentriesconnection) ```graphql query LedgerEntryHistory($ledgerEntry: LedgerEntryMatchInput!) { ledgerEntryHistory(ledgerEntry: $ledgerEntry) { nodes { ...LedgerEntryFragment } pageInfo { ...PageInfoFragment } } } ``` ```json {"ledgerEntry": LedgerEntryMatchInput} ``` ```json { "data": { "ledgerEntryHistory": { "nodes": [LedgerEntry], "pageInfo": PageInfo } } } ``` ###### Arguments - **ledgerEntry** ([LedgerEntryMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgerentrymatchinput)) An object specifying the ID or IK of the Ledger Entry's reversal history to query. ## ledgerLine Get LedgerLine by ID ###### Response Returns a [LedgerLine](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-ledgerline) ```graphql query LedgerLine($ledgerLine: LedgerLineMatchInput!) { ledgerLine(ledgerLine: $ledgerLine) { account { ...LedgerAccountFragment } accountId amount created currency { ...CurrencyFragment } date description externalTransferId externalTransferType externalTxId hidden id isReversal isReversed key ledger { ...LedgerFragment } ledgerEntry { ...LedgerEntryFragment } ledgerEntryId ledgerId otherTxExternalAccountExternalId otherTxExternalAccountId otherTxExternalId otherTxId posted reversedAt reversedBy { ...LedgerLineFragment } reverses { ...LedgerLineFragment } tags { ...LedgerLineTagFragment } tx { ...TxFragment } txId type workspaceId } } ``` ```json {"ledgerLine": LedgerLineMatchInput} ``` ```json { "data": { "ledgerLine": { "account": LedgerAccount, "accountId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "amount": "999999999999", "created": "2007-12-03T10:15:30Z", "currency": Currency, "date": "2022-03-28", "description": "abc123", "externalTransferId": "abc123", "externalTransferType": "ach", "externalTxId": "abc123", "hidden": true, "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "isReversal": true, "isReversed": true, "key": "abc123", "ledger": Ledger, "ledgerEntry": LedgerEntry, "ledgerEntryId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "ledgerId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "otherTxExternalAccountExternalId": "abc123", "otherTxExternalAccountId": "abc123", "otherTxExternalId": "abc123", "otherTxId": "abc123", "posted": "2007-12-03T10:15:30Z", "reversedAt": "2007-12-03T10:15:30Z", "reversedBy": LedgerLine, "reverses": LedgerLine, "tags": [LedgerLineTag], "tx": Tx, "txId": "abc123", "type": "credit", "workspaceId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1" } } } ``` ###### Arguments - **ledgerLine** ([LedgerLineMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-ledgerlinematchinput)) An object specifying the ID of the LedgerLine you want to query ## ledgers Query Ledgers in workspace. Ledgers are paginated and returned in reverse-chronological order by their created date. ###### Response Returns a [LedgersConnection!](https://fragment.dev/markdown/api-reference/ledger-types.md#connection-types-ledgersconnection) ```graphql query Ledgers( $after: String, $before: String, $filter: LedgersFilterSet, $first: Int, $last: Int ) { ledgers( after: $after, before: $before, filter: $filter, first: $first, last: $last ) { nodes { ...LedgerFragment } pageInfo { ...PageInfoFragment } } } ``` ```json { "after": "abc123", "before": "abc123", "filter": LedgersFilterSet, "first": 2277, "last": 2277 } ``` ```json { "data": { "ledgers": { "nodes": [Ledger], "pageInfo": PageInfo } } } ``` ###### Arguments - **after** ([String](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string)) Where to start paginating from, when paginating forwards. Send endCursor from a response to get its next page. Learn more about [pagination](https://fragment.dev/markdown/guides/query-data.md#basics-pagination). - **before** ([String](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string)) Where to start paginating from, when paginating backwards. Send startCursor from a response to get the previous page. Learn more about [pagination](https://fragment.dev/markdown/guides/query-data.md#basics-pagination). - **filter** ([LedgersFilterSet](https://fragment.dev/markdown/api-reference/ledger-types.md#filter-types-ledgersfilterset)) Filter the Ledgers returned. Learn more about [querying Ledgers](https://fragment.dev/markdown/guides/query-data.md#ledgers). - **first** ([Int](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-int)) The number of Ledgers to return per page, when paginating forwards. Defaults to 20, maximum is 200. - **last** ([Int](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-int)) The number of Ledgers to return per page, when paginating backwards. Defaults to 20, maximum is 200. ## link Get a Link by ID or a Custom Link by creation IK. Returns a BadRequestError if the Link is not found. ###### Response Returns a [Link](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-link) ```graphql query Link($link: LinkMatchInput!) { link(link: $link) { created dashboardUrl externalAccounts { ...ExternalAccountsConnectionFragment } id name } } ``` ```json {"link": LinkMatchInput} ``` ```json { "data": { "link": { "created": "abc123", "dashboardUrl": "abc123", "externalAccounts": ExternalAccountsConnection, "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "name": "abc123" } } } ``` ###### Arguments - **link** ([LinkMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-linkmatchinput)) An object containing the ID or creation IK of the Link you are querying ## links Get all links in a workspace ###### Response Returns a [LinksConnection!](https://fragment.dev/markdown/api-reference/ledger-types.md#connection-types-linksconnection) ```graphql query Links { links { nodes { ...LinkFragment } pageInfo { ...PageInfoFragment } } } ``` ```json { "data": { "links": { "nodes": [Link], "pageInfo": PageInfo } } } ``` ## payment Get a single Payment by its ID or Idempotency Key in a Ledger. ###### Response Returns a [Payment](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-payment) ```graphql query Payment($payment: PaymentMatchInput!) { payment(payment: $payment) { amount attempts { ...PaymentAttemptsConnectionFragment } clientSecret created currency { ...PaymentCurrencyFragment } events { ...PaymentEventsConnectionFragment } id ik ledger { ...LedgerFragment } mode parameters refundedAmount refunds { ...PaymentRefundsConnectionFragment } status type typeVersion } } ``` ```json {"payment": PaymentMatchInput} ``` ```json { "data": { "payment": { "amount": "999999999999", "attempts": PaymentAttemptsConnection, "clientSecret": "abc123", "created": "2007-12-03T10:15:30Z", "currency": PaymentCurrency, "events": PaymentEventsConnection, "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "ik": "some-safe-string-ik", "ledger": Ledger, "mode": "production", "parameters": "{\"key\":\"value\"}", "refundedAmount": "999999999999", "refunds": PaymentRefundsConnection, "status": "accepted", "type": "some-safe-string-ik", "typeVersion": 2277 } } } ``` ###### Arguments - **payment** ([PaymentMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-paymentmatchinput)) The Ledger Payment to query. ## paymentMethod Get a Payment Method saved for a User. ###### Response Returns a [PaymentMethod](https://fragment.dev/markdown/api-reference/ledger-types.md#utility-types-paymentmethod) ```graphql query PaymentMethod($paymentMethod: PaymentMethodMatchInput!) { paymentMethod(paymentMethod: $paymentMethod) { created id user { ...UserFragment } } } ``` ```json {"paymentMethod": PaymentMethodMatchInput} ``` ```json { "data": { "paymentMethod": { "created": "2007-12-03T10:15:30Z", "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "user": User } } } ``` ###### Arguments - **paymentMethod** ([PaymentMethodMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-paymentmethodmatchinput)) The Payment Method to get. ## paymentMethodSetup Get a Payment Method Setup. ###### Response Returns a [PaymentMethodSetup!](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-paymentmethodsetup) ```graphql query PaymentMethodSetup($paymentMethodSetup: PaymentMethodSetupMatchInput!) { paymentMethodSetup(paymentMethodSetup: $paymentMethodSetup) { clientSecret created currency { ...PaymentCurrencyFragment } id ik mode paymentMethod { ...PaymentMethodFragment } status } } ``` ```json {"paymentMethodSetup": PaymentMethodSetupMatchInput} ``` ```json { "data": { "paymentMethodSetup": { "clientSecret": "abc123", "created": "2007-12-03T10:15:30Z", "currency": PaymentCurrency, "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "ik": "some-safe-string-ik", "mode": "production", "paymentMethod": PaymentMethod, "status": "canceled" } } } ``` ###### Arguments - **paymentMethodSetup** ([PaymentMethodSetupMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-paymentmethodsetupmatchinput)) The Payment Method Setup to get. ## paymentMethods List the Payment Methods a User saved in a Ledger, newest first. Deleted Payment Methods are not listed. ###### Response Returns a [PaymentMethodsConnection!](https://fragment.dev/markdown/api-reference/ledger-types.md#connection-types-paymentmethodsconnection) ```graphql query PaymentMethods( $after: String, $before: String, $filter: PaymentMethodsFilterSet!, $first: Int, $last: Int ) { paymentMethods( after: $after, before: $before, filter: $filter, first: $first, last: $last ) { nodes { ...PaymentMethodFragment } pageInfo { ...PageInfoFragment } } } ``` ```json { "after": "abc123", "before": "abc123", "filter": PaymentMethodsFilterSet, "first": 2277, "last": 2277 } ``` ```json { "data": { "paymentMethods": { "nodes": [PaymentMethod], "pageInfo": PageInfo } } } ``` ###### Arguments - **after** ([String](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string)) Ignored. The list is always one page. - **before** ([String](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string)) Ignored. The list is always one page. - **filter** ([PaymentMethodsFilterSet!](https://fragment.dev/markdown/api-reference/ledger-types.md#filter-types-paymentmethodsfilterset)) The User whose Payment Methods to list. - **first** ([Int](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-int)) Ignored. The list is always one page. - **last** ([Int](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-int)) Ignored. The list is always one page. ## schema Get a Schema by key. ###### Response Returns a [Schema](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-schema) ```graphql query Schema($schema: SchemaMatchInput!) { schema(schema: $schema) { key ledgers { ...LedgersConnectionFragment } name version { ...SchemaVersionFragment } versions { ...SchemaVersionConnectionFragment } } } ``` ```json {"schema": SchemaMatchInput} ``` ```json { "data": { "schema": { "key": "some-safe-string-ik", "ledgers": LedgersConnection, "name": "abc123", "version": SchemaVersion, "versions": SchemaVersionConnection } } } ``` ###### Arguments - **schema** ([SchemaMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-schemamatchinput)) This contains the key of the Schema you want to retrieve. ## schemas Retrieve all of the Schemas in the workspace. ###### Response Returns a [SchemaConnection!](https://fragment.dev/markdown/api-reference/ledger-types.md#connection-types-schemaconnection) ```graphql query Schemas( $after: String, $before: String, $first: Int, $last: Int ) { schemas( after: $after, before: $before, first: $first, last: $last ) { nodes { ...SchemaFragment } pageInfo { ...PageInfoFragment } } } ``` ```json {"after": "abc123", "before": "abc123", "first": 2277, "last": 2277} ``` ```json { "data": { "schemas": { "nodes": [Schema], "pageInfo": PageInfo } } } ``` ###### Arguments - **after** ([String](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string)) Where to start paginating from, when paginating forwards. Send endCursor from a response to get its next page. Learn more about [pagination](https://fragment.dev/markdown/guides/query-data.md#basics-pagination). - **before** ([String](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-string)) Where to start paginating from, when paginating backwards. Send startCursor from a response to get the previous page. Learn more about [pagination](https://fragment.dev/markdown/guides/query-data.md#basics-pagination). - **first** ([Int](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-int)) The number of schemas to return per page, when paginating forwards. Defaults to 20, maximum is 200. - **last** ([Int](https://fragment.dev/markdown/api-reference/ledger-types.md#scalars-and-enums-int)) The number of schemas to return per page, when paginating backwards. Defaults to 20, maximum is 200. ## tx Get a Tx by ID ###### Response Returns a [Tx](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-tx) ```graphql query Tx($tx: TxMatchInput!) { tx(tx: $tx) { accountId amount currency { ...CurrencyFragment } date deletedAt description externalAccount { ...ExternalAccountFragment } externalAccountId externalId id isDeleted ledgerEntries { ...LedgerEntriesConnectionFragment } ledgerEntryIds ledgerLineIds ledgerLines { ...LedgerLinesConnectionFragment } link { ...LinkFragment } linkId posted sequence workspaceId } } ``` ```json {"tx": TxMatchInput} ``` ```json { "data": { "tx": { "accountId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "amount": "999999999999", "currency": Currency, "date": "2022-03-28", "deletedAt": "2007-12-03T10:15:30Z", "description": "abc123", "externalAccount": ExternalAccount, "externalAccountId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "externalId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "id": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "isDeleted": true, "ledgerEntries": LedgerEntriesConnection, "ledgerEntryIds": ["3116551f-5efc-4c9e-84ac-5a36a51b09c1"], "ledgerLineIds": ["3116551f-5efc-4c9e-84ac-5a36a51b09c1"], "ledgerLines": LedgerLinesConnection, "link": Link, "linkId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1", "posted": "2007-12-03T10:15:30Z", "sequence": 2277, "workspaceId": "3116551f-5efc-4c9e-84ac-5a36a51b09c1" } } } ``` ###### Arguments - **tx** ([TxMatchInput!](https://fragment.dev/markdown/api-reference/ledger-types.md#matchinput-types-txmatchinput)) The transaction you're querying. You can specify either: * The Fragment ID of the transaction (id) * The external system's transaction ID (externalId) and Fragment ID of the external account (accountId) * The external system's transaction ID (externalId), the external system's account ID (externalAccountId) and Fragment ID of the Link (linkId) ## workspace Get the current Workspace ###### Response Returns a [Workspace!](https://fragment.dev/markdown/api-reference/ledger-types.md#core-types-workspace) ```graphql query Workspace { workspace { id name } } ``` ```json {"data": {"workspace": {"id": "abc123", "name": "abc123"\}\}} ```