You can flexibly query your data to generate financial reports, embed FRAGMENT in your product and build internal dashboards.
FRAGMENT is a GraphQL API, so data in the system is modeled as a graph. Entities in the API are nodes, and their relationships with other entities are edges. Ledgers have Ledger Accounts; Ledger Accounts and Ledger Entries have Ledger Lines; and so on.
FRAGMENT exposes several queries as entry points to the data graph. They return data about a single entity, or a list of entities.
When making a query, you can fetch related entities using expansions. As opposed to a REST interface, where you may require several round-trips to query nested data, expansions are nested queries that you let you retrieve related data in a single request. For example, you can expand from a Ledger Entry to all the Ledger Lines in it in one API call.
FRAGMENT uses connection types to return lists of entities. A connection type is a list of nodes, and a pageInfo
object that contains cursors to the next and previous pages of results.
query ListLedgerAccounts($ledger: LedgerMatchInput!) {
ledger(ledger: $ledger) {
ledgerAccounts {
nodes {
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
You can filter connection types with a filter
argument.
For example, you can filter a list of Ledger Accounts by their type:
query FilterLedgerAccounts(
$ledger: LedgerMatchInput!,
$filter: LedgerAccountsFilterSet!
) {
ledger(ledger: $ledger) {
ledgerAccounts {
nodes {
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"type": {
"equalTo": "asset"
}
}
}
You can combine filters by adding multiple components to the filter block. Results are AND'd:
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"type": {
"equalTo": "asset",
"hasParentLedgerAccount": true
}
}
}
Fields that return lists support cursor-based pagination:
nodes
property as an array. The pageInfo
property contains cursors pointing to the next page and previous pages.after
(or before
) arguments on list fields to retrieve a specific page.first
(or last
) argument sets the page size. The default is 20 and the maximum is 200.This query uses pagination to retrieve two Ledger Accounts at a time:
query GetLedgerAccounts(
$ledgerIk: SafeString!
$after: String
$first: Int
$before: String
) {
ledger(ledger: { ik: $ledgerIk }) {
ledgerAccounts(
after: $after
first: $first
before: $before
) {
nodes {
path
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"ledgerIk": "ik-used-to-create-ledger",
"first": 2
}
The response is:
{
"data": {
"ledger": {
"ledgerAccounts": {
"nodes": [
{
"path": "assets/test-assets/test:1",
"name": "Test 1",
"type": "asset"
},
{
"path": "assets/test-assets/test:2",
"name": "Test 2",
"type": "asset"
}
],
"pageInfo": {
"hasNextPage": true,
"endCursor": "<some-end-cursor>",
"hasPreviousPage": false,
"startCursor": null
}
}
}
}
}
To retrieve the next page, send the same query but with the after
parameter set on ledgerAccounts
:
{
"ledgerIk": "ik-used-to-create-ledger",
"after": "<some-end-cursor>"
}
The response is:
{
"data": {
"ledger": {
"ledgerAccounts": {
"nodes": [
{
"path": "assets/test-assets/test:3",
"name": "Test 3",
"type": "asset"
},
{
"path": "assets/test-assets/test:4",
"name": "Test 4",
"type": "asset"
}
],
"pageInfo": {
"hasNextPage": false,
"endCursor": null,
"hasPreviousPage": true,
"startCursor": "<some-start-cursor>"
}
}
}
}
}
To retrieve the previous page of results, send the same query but with the before
parameter set on ledgerAccounts
. The response is the first page of results.
{
"ledgerIk": "ik-used-to-create-ledger",
"before": "<some-start-cursor>"
}
Use the ledger
query to retrieve a Ledger by the IK used to create it:
query GetLedger($ledger: LedgerMatchInput!) {
ledger(ledger: $ledger) {
name
created
balanceUTCOffset
ledgerAccounts {
nodes {
name
type
}
}
schema {
key
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
}
}
Use the ledgers
query to list all the Ledgers in your workspace:
query ListLedgers {
ledgers {
nodes {
name
created
balanceUTCOffset
ledgerAccounts {
nodes {
name
type
}
}
schema {
key
}
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
The response is a paginated list of Ledgers.
Use the ledgerAccount
query to retrieve a Ledger Account by its path in the Schema:
query GetLedgerAccount(
$ledgerAccount: LedgerAccountMatchInput!
) {
ledgerAccount(ledgerAccount: $ledgerAccount) {
path
name
balance
type
lines {
nodes {
amount
posted
}
}
}
}
The IK of the Ledger needs to be provided along with the Ledger Account's path:
{
"ledgerAccount": {
"path": "assets/banks/user-cash",
"ledger": {
"ik": "quickstart-ledger"
}
}
}
You can also retrieve multiple Ledger Accounts using the ledgerAccounts
query and the in
filter:
query ListLedgerAccounts($ledger: LedgerMatchInput!) {
ledger(ledger: $ledger) {
ledgerAccounts {
nodes {
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"ledgerAccount": {
"in": [
{
"path": "assets/banks/user-cash"
},
{
"path": "income-root/income-revenue-root"
}
]
}
}
}
Use the ledger.ledgerAccounts
query to list all Ledger Accounts within a Ledger:
query ListLedgerAccounts($ledger: LedgerMatchInput!) {
ledger(ledger: $ledger) {
ledgerAccounts {
nodes {
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
}
}
The response is a paginated list of Ledger Accounts.
Since a Ledger Account can have balances in multiple currencies, you can list its balance and balance changes across all currencies:
query GetLedgerAccountBalances(
$ledgerAccount: LedgerAccountMatchInput!
) {
ledgerAccount(ledgerAccount: $ledgerAccount) {
path
name
balances {
nodes {
amount
currency {
code
customCurrencyId
}
}
}
end_of_year_balances: balances(at: "1969") {
nodes {
amount
currency {
code
customCurrencyId
}
}
}
last_year: balanceChanges(period: "1968") {
nodes {
amount
currency {
code
customCurrencyId
}
}
}
}
}
{
"ledgerAccount": {
"path": "assets/banks/user-cash",
"ledger": {
"ik": "quickstart-ledger"
}
}
}
Read more about handling multi-currency balances in Handle currencies.
Use the type
parameter to filter Ledger Account lists:
query FilterLedgerAccounts(
$ledger: LedgerMatchInput!,
$filter: LedgerAccountsFilterSet!
) {
ledger(ledger: $ledger) {
ledgerAccounts(filter: $filter) {
nodes {
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
Use type
to filter Ledger Accounts by their type:
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"type": {
"equalTo": "asset"
}
}
}
You can also filter for multiple types in one query, using in
. This can be useful to Generate reports:
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"type": {
"in": ["asset", "liability"]
}
}
}
Use path
and wildcard matching (*
) in place of template variables to query all instances of Ledger Accounts with template: true
.
query FilterLedgerAccounts(
$ledger: LedgerMatchInput!,
$filter: LedgerAccountsFilterSet!
) {
ledger(ledger: $ledger) {
ledgerAccounts(filter: $filter) {
nodes {
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"path": {
"matches": "liability-root/user:*/pending"
}
}
}
Read more about filtering Ledger Accounts in filtering.
Use linkedAccount
to filter Ledger Accounts by the External Account they're linked to:
query FilterLedgerAccounts(
$ledger: LedgerMatchInput!,
$filter: LedgerAccountsFilterSet!
) {
ledger(ledger: $ledger) {
ledgerAccounts(filter: $filter) {
nodes {
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"linkedAccount": {
"in": [
{
"linkId": "<link id>",
"externalId": "account-id-at-bank"
},
{
"linkId": "<link id>",
"externalId": "account2-id-at-bank"
}
]
}
}
}
Use hasParentLedgerAccount
to filter Ledger Accounts by their parent status:
query FilterLedgerAccounts(
$ledger: LedgerMatchInput!,
$filter: LedgerAccountsFilterSet!
) {
ledger(ledger: $ledger) {
ledgerAccounts(filter: $filter) {
nodes {
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"hasParentLedgerAccount": false
}
}
Read more about filtering Ledger Accounts in filtering.
Use the ledgerLine
query to retrieve a Ledger Line by its ID:
query GetLedgerLine(
$ledgerLine: LedgerLineMatchInput!
) {
ledgerLine(ledgerLine: $ledgerLine) {
amount
currency {
code
customCurrencyId
}
account {
name
type
}
}
}
{
"ledgerLine": {
"id": "<ledger line ID>"
}
}
Use the ledgerAccount.lines
query to list the lines in a Ledger Account:
query GetLedgerAccountLines(
$ledgerAccount: LedgerAccountMatchInput!
) {
ledgerAccount(ledgerAccount: $ledgerAccount) {
path
name
lines {
nodes {
amount
currency {
code
customCurrencyId
}
}
}
}
}
{
"ledgerAccount": {
"path": "assets/banks/user-cash",
"ledger": {
"ik": "quickstart-ledger"
}
}
}
Use posted
to filter Ledger Lines by their posted timestamp between any two points in time:
query GetLedgerAccountLines(
$ledgerAccount: LedgerAccountMatchInput!,
$filter: LedgerLinesFilterSet!
) {
ledgerAccount(ledgerAccount: $ledgerAccount) {
path
name
lines(filter: $filter) {
nodes {
id
amount
currency {
code
customCurrencyId
}
}
}
}
}
{
"ledgerAccount": {
"path": "assets/banks/user-cash",
"ledger": {
"ik": "quickstart-ledger"
}
},
"filter": {
"posted": {
"after": "1969-07-01T00:00:00.000Z",
"before": "1969-07-30T23:59:59.999Z"
}
}
}
The after
and before
filters are inclusive, so use timestamps for the first and last moments of the period you're querying for.
Use key
to filter Ledger Lines by their keys in your Schema:
query GetLedgerAccountLines(
$ledgerAccount: LedgerAccountMatchInput!,
$filter: LedgerLinesFilterSet!
) {
ledgerAccount(ledgerAccount: $ledgerAccount) {
path
name
lines(filter: $filter) {
nodes {
id
amount
currency {
code
customCurrencyId
}
}
}
}
}
{
"ledgerAccount": {
"path": "assets/banks/user-cash",
"ledger": {
"ik": "quickstart-ledger"
}
},
"linesFilter": {
"key": {
"equalTo": "increase_user_balance"
}
}
}
Use the ledgerEntry
query to retrieve a Ledger Entry by its IK. You provide the IK when posting entries via addLedgerEntry
:
query GetLedgerEntry(
$ledgerEntry: LedgerEntryMatchInput!
) {
ledgerEntry(ledgerEntry: $ledgerEntry) {
id
ik
ledger {
id
name
}
lines {
nodes {
amount
currency {
code
customCurrencyId
}
}
}
}
}
{
"ledgerEntry": {
"ik": "<ledger entry IK>"
}
}
When you Reconcile transactions using reconcileTx
, the IK is the Transaction's externalId
. Query entry.ik
in ReconcileTxResult
to retrieve it:
mutation ReconcileTx(
$entry: LedgerEntryInput!
) {
reconcileTx(entry: $entry) {
... on ReconcileTxResult {
entry {
ik
type
created
posted
}
lines {
amount
account {
path
}
}
}
... on Error {
code
message
}
}
}
A Ledger Entry can also be retrieved using its ID:
{
"ledgerEntry": {
"id": "<ledger entry ID>"
}
}
You can also retrieve multiple Ledger Entries using the ledgerEntries
query and the in
filter:
query ListLedgerEntries(
$ledger: LedgerMatchInput!
$filter: LedgerEntriesFilterSet!
) {
ledger(ledger: $ledger) {
ledgerEntries(filter: $filter) {
nodes {
ik
type
posted
lines {
nodes {
amount
account {
path
}
}
}
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"ledgerEntry": {
"in": [
{
"ik": "fund-user-1-account"
},
{
"ik": "fund-user-2-account"
}
]
}
}
}
You can get a paginated list of Ledger Entries in a given group using the ledgerEntryGroup.ledgerEntries
expansion:
query GetGroupedLedgerEntries(
$ledger: LedgerMatchInput!,
$entryGroup: EntryGroupMatchInput!,
) {
ledger(ledger: $ledger) {
ledgerEntryGroup(ledgerEntryGroup: $entryGroup) {
ledgerEntries {
nodes {
ik
description
posted
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
}
}
{
"ledgerEntryGroup": {
"key": "withdrawal",
"value": "12345"
},
"ledger": {
"ik": "quickstart-ledger"
}
}
The response is:
{
"data": {
"ledger": {
"ledgerEntryGroup": {
"ledgerEntries": {
"nodes": [
{
"ik": "ledger-entry-2",
"description":"User user-id withdrawal settled",
"posted": "1969-06-21T02:56:05.000Z"
},
{
"ik": "ledger-entry-1",
"description": "User user-id initiated withdrawal for 50000.",
"posted": "1969-06-16T13:32:00.000Z"
}
],
"pageInfo": {
"hasNextPage": false,
"endCursor": null,
"hasPreviousPage": false,
"startCursor": null
}
}
}
}
}
}
Use the ledgerEntry.lines
expansion to list the Ledger Lines in a Ledger Entry:
query GetLedgerEntryLines(
$ledgerEntry: LedgerEntryMatchInput!
) {
ledgerEntry(ledgerEntry: $ledgerEntry) {
id
ik
lines {
nodes {
account {
path
}
amount
currency {
code
customCurrencyId
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
}
{
"ledgerEntry": {
"ik": "<ledger entry IK>"
}
}
Similar to Ledger Lines, Ledger Entries can be filtered by their posted timestamp between any two points in time using posted
:
query FilterLedgerEntries(
$ledger: LedgerMatchInput!,
$entriesFilter: LedgerEntriesFilterSet!
) {
ledger(ledger: $ledger) {
ledgerEntries(filter: $entriesFilter) {
nodes {
ik
type
posted
lines {
nodes {
amount
account {
path
}
}
}
}
}
}
}
Use after
and before
to filter Ledger Entries by their posted timestamp between any two points in time:
{
"ledger": {
"ik": "quickstart-ledger"
},
"entriesFilter": {
"posted": {
"after": "01-01-1968",
"before": "01-01-1969"
}
}
}
Use date
to filter Ledger Entries by the date they were posted on:
{
"ledger": {
"ik": "quickstart-ledger"
},
"entriesFilter": {
"date": {
"equalTo": "12-31-1968"
}
}
}
Use type
to filter Ledger Entries by their type defined in your Schema:
query FilterLedgerEntries(
$ledger: LedgerMatchInput!,
$entriesFilter: LedgerEntriesFilterSet!
) {
ledger(ledger: $ledger) {
ledgerEntries(filter: $entriesFilter) {
nodes {
ik
type
posted
lines {
nodes {
amount
account {
path
}
}
}
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"entriesFilter": {
"type": {
"in": ["withdrawal", "p2p_transfer"]
}
}
}
To retrieve Ledger Entries of multiple types, use the in
operator:
{
"ledger": {
"ik": "quickstart-ledger"
},
"entriesFilter": {
"type": {
"in": ["withdrawal", "p2p_transfer"]
}
}
}
Use tag
to filter Ledger Entries by tags:
query FilterLedgerEntries(
$ledger: LedgerMatchInput!,
$entriesFilter: LedgerEntriesFilterSet!
) {
ledger(ledger: $ledger) {
ledgerEntries(filter: $entriesFilter) {
nodes {
ik
type
posted
tags {
key
value
}
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"entriesFilter": {
"tag": {
"equalTo": {
"key": "user_id",
"value": "user-1"
}
}
}
}
Use the in
operator to return Ledger Entries that have any of the specified tags:
{
"ledger": {
"ik": "quickstart-ledger"
},
"entriesFilter": {
"tag": {
"in": [{
"key": "user_id",
"value": "user-1"
},{
"key": "user_id",
"value": "user-2"
}]
}
}
}
See Group Ledger Entries for more information about how to use Ledger Entry Groups.
Use the ledger.ledgerEntryGroup
expansion to lookup a group by key and value.
query GetLedgerEntryGroup(
$ledger: LedgerMatchInput!
$entryGroup: EntryGroupMatchInput!
) {
ledger(ledger: $ledger) {
ledgerEntryGroup(ledgerEntryGroup: $entryGroup) {
key
value
created
}
}
}
{
"entryGroup": {
"key": "withdrawal",
"value": "12345"
},
"ledger": {
"ik": "quickstart-ledger"
}
}
The response is:
{
"data": {
"ledger": {
"ledgerEntryGroup": {
"key": "withdrawal",
"value": "12345",
"created": "1969-06-16T13:32:00.000Z"
}
}
}
}
query ListLedgerEntryGroups(
$ledger: LedgerMatchInput!
) {
ledger(ledger: $ledger) {
ledgerEntryGroups {
nodes {
key
value
created
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
}
}
The response is:
{
"data": {
"ledger": {
"ledgerEntryGroups": {
"nodes": [
{
"key": "withdrawal",
"value": "12345",
"created": "1969-06-16T13:32:00.000Z"
},
{
"key": "withdrawal",
"value": "54321",
"created": "1969-06-21T02:56:05.000Z"
}
],
"pageInfo": {
"endCursor": null,
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": null
}
}
}
}
}
You can filter groups by key
, created
, and/or value
query ListLedgerEntryGroups(
$ledger: LedgerMatchInput!
$filter: LedgerEntryGroupsFilterSet,
) {
ledger(ledger: $ledger) {
ledgerEntryGroups(filter: $filter) {
nodes {
key
value
created
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
}
{
"ledger": {
"ik": "quickstart-ledger"
},
"filter": {
"key": {
"equalTo": "withdrawal"
},
"created": {
"before": "1969-06-20T00:00:00.000Z"
}
}
}
The response is:
{
"data": {
"ledger": {
"ledgerEntryGroups": {
"nodes": [
{
"key": "withdrawal",
"value": "12345",
"created": "1969-06-16T13:32:00.000Z"
}
],
"pageInfo": {
"endCursor": null,
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": null
}
}
}
}
}
Use the link
query to retrieve a Link by ID:
query GetLink($link: LinkMatchInput!) {
link(link: $link) {
__typename
name
}
}
{
"link": {
"id": "<Link ID>"
}
}
The __typename
field will indicate the type of of the Link
Use the link.externalAccounts
to list External Accounts represented by the Link.
query GetLinkExternalAccounts($link: LinkMatchInput!) {
link(link: $link) {
id
externalAccounts {
nodes {
name
id
externalId
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"link": {
"id": "<Link ID>"
}
}
The response is a paginated list of External Accounts.
Use the externalAccount
query to retrieve an ExternalAccount by its ID at your external system:
query GetExternalAccount(
$externalId: ID!
$linkId: ID!
) {
externalAccount(
externalAccount: {
externalId: $externalId
linkId: $linkId
}
) {
name
link {
__typename
id
name
}
}
}
{
"externalId": "<External ID>",
"linkId": "<Link ID>"
}
Or by its FRAGMENT ID:
query GetExternalAccount($id: ID!) {
externalAccount(externalAccount: { id: $id }) {
name
externalId
linkId
link {
__typename
id
name
}
}
}
{
"id": "<Fragment External Account ID>"
}
Use the externalAccount.txs
query to list Txs synced to an External Account:
query ListExternalAccountTxs(
$externalAccount: ExternalAccountMatchInput!
$after: String
$first: Int
$before: String
) {
externalAccount(
externalAccount: $externalAccount
) {
externalId
link {
__typename
id
name
}
txs(
after: $after
first: $first
before: $before
) {
nodes {
externalId
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
You may optionally specify before
and after
to paginate the results and first
to specify the page size.
{
"externalAccount": {
"externalId": "<External ID>",
"linkId": "<Link ID>"
},
"after": "2023-07-01T00:00:00.000Z",
"before": "2023-07-30T23:59:59.999Z",
"first": 20
}
The response is a paginated list of Txs.
Use the externalAccount.ledgerAccounts
query to list Ledger Accounts linked to this External Account:
query GetExternalAccountLinkedAccounts(
$externalAccount: ExternalAccountMatchInput!
) {
externalAccount(
externalAccount: $externalAccount
) {
externalId
name
link {
__typename
id
name
}
ledgerAccounts {
nodes {
path
name
type
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
{
"externalAccount": {
"externalId": "<External ID>",
"linkId": "<Link ID>"
}
}
The response is a paginated list of Ledger Accounts.
Use the tx
query to retrieve a Tx by its ID and Account ID at your external system:
query GetTx(
$externalId: ID!
$externalAccountId: ID!
$linkId: ID!
) {
tx(
tx: {
externalId: $externalId
externalAccountId: $externalAccountId
linkId: $linkId
}
) {
id
description
amount
currency {
code
}
externalId
link {
id
}
externalAccount {
id
externalId
}
}
}
{
"externalAccountId": "<External Account ID>",
"external": "<External Tx ID>",
"linkId": "<Link ID>"
}
Or by its FRAGMENT ID:
query GetTx(
$id: ID!
) {
tx(
tx: {
id: $id
}
) {
id
description
amount
currency {
code
}
externalId
link {
id
}
externalAccount {
id
externalId
}
}
}
{
"id": "<Fragment ID>"
}
Use the ledgerAccount.unreconciledTx
query to list a Ledger Account's unreconciled Txs:
query GetUnreconciledTxs(
$ledgerAccount: LedgerAccountMatchInput!
$after: String
$first: Int
$before: String
) {
ledgerAccount(ledgerAccount: $ledgerAccount) {
path
unreconciledTxs(
after: $after
first: $first
before: $before
) {
nodes {
id
description
amount
currency {
code
}
externalId
link {
id
}
externalAccount {
id
externalId
}
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
You may optionally specify before
and after
to paginate the results and first
to specify the page size.
{
"ledgerAccount": {
"path": "assets/banks/user-cash",
"ledger": {
"ik": "quickstart-ledger"
}
},
"after": "2023-07-01T00:00:00.000Z",
"before": "2023-07-30T23:59:59.999Z",
"first": 20
}
The response is a paginated list of Txs.
Use the schema
query to retrieve a Schema by its key:
query GetSchema($schema: SchemaMatchInput!) {
schema(schema: $schema) {
key
name
latestVersion: version {
created
version
}
firstVersion: version(version: 1) {
created
version
}
}
}
When retrieving a Schema, use the version
argument to query a specific version of the Schema. By default, the latest version is returned:
{
"schema": {
"key": "quickstart-schema"
}
}
The JSON of a Schema version can be retrieved by querying the json
field:
query GetLatestSchemaJSON(
$schema: SchemaMatchInput!
) {
schema(schema: $schema) {
key
name
version {
created
version
json
}
}
}
{
"schema": {
"key": "quickstart-schema"
}
}
Use the schema.versions
query to query all the versions of your Schema:
query ListSchemaVersions(
$schema: SchemaMatchInput!
) {
schema(schema: $schema) {
key
name
versions {
nodes {
created
version
json
}
}
}
}
The response is a paginated list of your Schema's versions:
{
"schema": {
"key": "quickstart-schema"
}
}
Use the schema.ledgers
query to list the Ledgers created off a Schema:
query ListSchemaLedgers(
$schema: SchemaMatchInput!
) {
schema(schema: $schema) {
key
name
ledgers {
nodes {
ik
name
created
balanceUTCOffset
}
}
}
}
{
"schema": {
"key": "quickstart-schema"
}
}
FRAGMENT asynchronously migrates Ledgers when their Schema is updated. The current status of a Ledger's migration can be queried using the API, via version.migrations
:
query GetLedgerMigrationStatus(
$schema: SchemaMatchInput!
) {
schema(schema: $schema) {
key
name
latestVersion: version {
migrations {
nodes {
ledger {
ik
name
}
status
}
}
}
}
}
{
"schema": {
"key": "quickstart-schema"
}
}