GraphQL

Queries

Queries retrieve data from the system by specifying the fields to be returned.

account

Get a single account by its accountId.

Resolves to

Account

Arguments

id - UUID! Unique identifier. Example: "3ea12e45-7df2-4293-9434-feb792affc91"

Example

query GetAccount {
  account(id: "a9c8dde6-c0e5-407c-9d99-029c523f7ea8") {
    accountId
    code
    name
    description
    normalBalanceType
    status
  }
}

accountSet

Get a single account set by its accountSetId.

Resolves to

AccountSet

Arguments

id - UUID! Unique identifier.

Example

query GetAccountSet {
  accountSet(id: "29ef3f18-97b1-40d9-9852-27f1607b6ca8") {
    accountSetId
    name
    description
    members(first: 10) {
      nodes {
        ... on Account {
          accountId
          code
          name
        }
      }
    }
  }
}

accountSets

Select one or more account sets. Specify the index to use and apply filters to your query.

Resolves to

AccountSetConnection!

Arguments

index - AccountSetIndexInput! Select from a list of pre-defined indexes. For optimal performance, choose specific indexes on unique fields over more general ones.
where - AccountSetFilterInput Filter the query according to specified conditions. Depending on the index chosen, different filters will be allowed.
first - Int! Number of sets to return on the connection.
after - String Cursor indicating the start point to retrieve sets. When no cursor is provided, the query uses the default starting cursor.

Example

query GetAccountSets {
  accountSets(
    index: { name: NAME }
    where: {
      name: { like: "" }
      journalId: { eq: "822cb59f-ce51-4837-8391-2af3b7a5fc51" }
    }
    first: 10
  ) {
    nodes {
      accountSetId
      name
      description
    }
  }
}

accounts

Select one or more accounts. Specify the index to use and apply filters to your query.

Resolves to

AccountConnection!

Arguments

index - AccountIndexInput! Select from a list of pre-defined indexes. For optimal performance, choose specific indexes on unique fields over more general ones.
where - AccountFilterInput Filter the query according to specified conditions. Depending on the index chosen, different filters will be allowed.
first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetAccounts {
  accounts(
    index: { name: CODE }
    where: { code: { like: "CUST." } }
    first: 2
  ) {
    nodes {
      accountId
      code
      name
      description
      normalBalanceType
      status
    }
  }
}

admin

Queries in the admin namespace retrieve organization data like users, groups, and tenants.

groups

Get the list of groups, ordered by name.

Resolves to

GroupConnection!

Arguments

first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetAdminGroups {
  admin {
    groups(first: 5) {
      nodes {
        name
        description
        policy
      }
    }
  }
}

organization

Get the current organization.

Resolves to

Organization!

Arguments

Example

query GetAdminOrganization {
  admin {
    organization {
      id
      name
      description
    }
  }
}

tenants

Get the list of tenants, ordered by accountId.

Resolves to

TenantConnection!

Arguments

first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetAdminTenants {
  admin {
    tenants(first: 5) {
      nodes {
        name
        organizationId
        description
      }
    }
  }
}

users

Get the list of human users, ordered by email.

Resolves to

UserConnection!

Arguments

first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetAdminUsers {
  admin {
    users(first: 5) {
      nodes {
        email
        organizationId
        groupIds
      }
    }
  }
}

auth

Queries in the auth namespace are used to retrieve clients and their policies. Use the client query to retrieve a single client, and clients to retrieve a list of clients.

client

Get a single client by the principal.

Resolves to

Client

Arguments

principal - String! Principal of the client.

Example

query GetAuthClient($authClientGithub: String!) {
  auth {
    client(principal: $authClientGithub) {
      principal
      name
      policies {
        effect
        actions
        resources
      }
    }
  }
}

clients

Lists all clients.

Resolves to

ClientConnection!

Arguments

first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetAuthClients {
  auth {
    clients(first: 10) {
      nodes {
        principal
        name
      }
    }
  }
}

balance

Get a balance for an account.

Resolves to

Balance

Arguments

journalId - UUID ID of the journal for the balance. If omitted, the default journal will be used.
accountId - UUID! ID of the account for the balance.
currency - CurrencyCode! Currency of the balance. Default: "USD"
calculationId - UUID If provided, look up based on calculation id and dimensions for calculation.
dimension - JSON If provided, look up based on calculation id and dimensions for calculation. The values in this should be string representation of values.
effective - Effective If enabled and provided, look up balances based on effective date.
materialize - Boolean If concurrent enabled, compute balance with all visible transactions.

Example

query GetBalance($journalGLId: UUID!, $accountCardSettlementId: UUID!) {
  balance(
    accountId: $accountCardSettlementId
    journalId: $journalGLId
    currency: "USD"
  ) {
    available(layer: SETTLED) {
      drBalance {
        units
      }
      crBalance {
        units
      }
      normalBalance {
        formatted(as: { locale: "en-US" })
      }
    }
    entries(first: 10) {
      nodes {
        entryType
        amount {
          units
          currency
        }
        direction
        layer
      }
    }
  }
}

balances

Select one or more balances. Specify the index to use and apply filters to your query.

Resolves to

BalanceConnection!

Arguments

index - BalanceIndexInput! Select from a list of pre-defined indexes. For optimal performance, choose specific indexes on unique fields over more general ones.
where - BalanceFilterInput Filter the query according to specified conditions. Depending on the index chosen, different filters will be allowed.
first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetBalances($journalGLId: String!, $accountCustomerAliciaId: String!) {
  balances(
    index: { name: ACCOUNT_ID }
    where: {
      accountId: { eq: $accountCustomerAliciaId }
      journalId: { eq: $journalGLId }
    }
    first: 20
  ) {
    nodes {
      entry {
        entryType
      }
      currency
      settled {
        normalBalance {
          formatted(as: { locale: "en-US" })
        }
      }
      version
    }
  }
}

bulk

execution

Retrieve single bulk query execution by it's executionId.

Resolves to

BulkQueryExecution

Arguments

id - UUID! 128-bit universally unique identifier (UUID). Used for most ID fields on records.

calculation

Retrieve a calculation by its identifier.

Resolves to

Calculation

Arguments

calculationId - UUID! 128-bit universally unique identifier (UUID). Used for most ID fields on records.

Example

query ReadCalculation {
  calculation(calculationId: "5867b5dd-fc69-416c-80f5-62e8a53610d5") {
    calculationId
    code
    description
    dimensions {
      alias
      value
    }
  }
}

calculations

Retrieve calculations by index.

Resolves to

CalculationConnection!

Arguments

index - CalculationIndexInput!
where - CalculationFilterInput
first - Int! The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
after - String The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example

query ListActiveCalculations {
  calculations(
    index: { name: STATUS }
    where: { status: { eq: "ACTIVE" } }
    first: 1
  ) {
    nodes {
      calculationId
      code
      description
      dimensions {
        alias
        value
      }
    }
  }
}

entries

Select one or more entries. Specify the index to use and apply filters to your query.

Resolves to

EntryConnection!

Arguments

index - EntryIndexInput! Select from a list of pre-defined indexes. For optimal performance, choose specific indexes on unique fields over more general ones.
where - EntryFilterInput Filter the query according to specified conditions. Depending on the index chosen, different filters will be allowed.
first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetEntries {
  entries(
    index: { name: TRANSACTION_ID }
    where: { transactionId: { eq: "114a8b1e-d00b-4e13-ab27-ec3472622c0a" } }
    first: 10
  ) {
    nodes {
      entryType
      account {
        name
      }
      direction
      amount {
        units
        currency
      }
    }
  }
}

entry

Get a single entry by its entryId.

Resolves to

Entry

Arguments

id - UUID! Unique identifier.

events

Mutations in the events namespace are used to manage event subscriptions, such as webhooks.

endpoint

Get a single endpoint by it's endpointId

Resolves to

Endpoint

Arguments

id - UUID! 128-bit universally unique identifier (UUID). Used for most ID fields on records.

Example

query GetEndpoint {
  events {
    endpoint(id: "345940ed-2726-4b20-88aa-820857ac0e68") {
      endpointId
      status
      endpointType
      url
      subscription
      description
    }
  }
}

endpoints

Select one or more endpoints. Specify the index to use and apply filters to your query.

Resolves to

EndpointConnection!

Arguments

index - EndpointIndexInput! Select from a list of pre-defined indexes. For optimal performance, choose specific indexes on unique fields over more general ones.
where - EndpointFilterInput! Filter the query according to specified conditions. Depending on the index chosen, different filters will be allowed.
first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

journal

Get a single journal by its journalId. If journalId is omitted, return the default journal.

Resolves to

Journal

Arguments

id - UUID Unique identifier.

Example

query GetJournal($journalGLId: UUID!) {
  journal(id: $journalGLId) {
    name
    description
    status
    version
  }
}

journals

Select one or more journals. Specify the index to use and apply filters to your query.

Resolves to

JournalConnection!

Arguments

index - JournalIndexInput! Select from a list of pre-defined indexes. For optimal performance, choose specific indexes on unique fields over more general ones.
where - JournalFilterInput Filter the query according to specified conditions. Depending on the index chosen, different filters will be allowed.
first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetJournals {
  journals(
    index: { name: STATUS }
    where: { status: { eq: "ACTIVE" } }
    first: 10
  ) {
    nodes {
      journalId
      name
      description
      status
    }
  }
}

node

Resolves to

Node

Arguments

id - ID! The ID scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.

schema

Queries in the schema namespace are used to retrieve information about custom indexes, including historical indexes.

index

Get a single index by name.

Resolves to

Index

Arguments

name - String! Unique identifier of this index. Typically human readable.
on - IndexOnEnum! The type of record this index applies to.

Example

query GetSchemaIndex($indexName: String!) {
  schema {
    index(name: $indexName, on: Account) {
      name
      on
      unique
      range {
        alias
        value
        sort
      }
      partition {
        alias
        value
      }
      constraints
    }
  }
}

indexes

List all indexes, ordered by name.

Resolves to

IndexConnection!

Arguments

first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetSchemaIndexes {
  schema {
    indexes(first: 10) {
      nodes {
        name
        range {
          alias
          value
          sort
        }
        partition {
          alias
          value
        }
        on
        constraints
        unique
      }
    }
  }
}

tranCode

Get a single tran code by its tranCodeId.

Resolves to

TranCode

Arguments

id - UUID! Unique identifier.

Example

query GetTranCode($tcCardHoldId: UUID!) {
  tranCode(id: $tcCardHoldId) {
    code
    description
    params {
      name
      type
      description
    }
    transaction {
      journalId
      effective
      correlationId
      description
    }
    entries {
      accountId
      layer
      direction
      units
      currency
    }
    status
    metadata
  }
}

tranCodes

Select one or more tran codes. Specify the index to use and apply filters to your query.

Resolves to

TranCodeConnection!

Arguments

index - TranCodeIndexInput! Select from a list of pre-defined indexes. For optimal performance, choose specific indexes on unique fields over more general ones.
where - TranCodeFilterInput Filter the query according to specified conditions. Depending on the index chosen, different filters will be allowed.
first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetTranCodes {
  tranCodes(
    index: { name: STATUS }
    where: { status: { eq: "ACTIVE" } }
    first: 10
  ) {
    nodes {
      code
      metadata
    }
  }
}

transaction

Get a single transaction by its transactionId.

Resolves to

Transaction

Arguments

id - UUID! Unique identifier.

Example

query GetTransaction {
  transaction(id: "434696a7-56e5-4e14-a97a-884820690a22") {
    description
    effective
    tranCode {
      code
    }
    journal {
      name
    }
    metadata
    entries(first: 10) {
      nodes {
        sequence
        entryType
        layer
        direction
        account {
          name
        }
        amount {
          formatted(as: { locale: "en-US" })
        }
      }
    }
  }
}

transactions

Select one or more transactions. Specify the index to use and apply filters to your query.

Resolves to

TransactionConnection!

Arguments

index - TransactionIndexInput! Select from a list of pre-defined indexes. For optimal performance, choose specific indexes on unique fields over more general ones.
where - TransactionFilterInput Filter the query according to specified conditions. Depending on the index chosen, different filters will be allowed.
first - Int! Number of nodes to return on the connection.
after - String Cursor indicating the start point to retrieve nodes. When no cursor is provided, the query uses the default starting cursor.

Example

query GetTransactions($journalGLId: String!) {
  transactions(
    index: { name: CORRELATION_ID }
    where: {
      correlationId: { eq: "4f2ac9a7-5e83-458b-a194-c8ac8d8fdcd5" }
      journalId: { eq: $journalGLId }
    }
    first: 10
  ) {
    nodes {
      transactionId
      description
      effective
      tranCode {
        code
      }
    }
  }
}

warehouse

Queries in the warehouse namespace are used to perform reads against the twisp data warehouse

describeStatement

Resolves to

DescribeStatementOutput

Arguments

describeTable

Resolves to

DescribeTableOutput

Arguments

getStatementResult

Resolves to

GetStatementResultOutput

Arguments

listDatabases

Resolves to

ListDatabasesOutput

Arguments

listSchemas

Resolves to

ListSchemasOutput

Arguments

listStatements

Resolves to

ListStatementsOutput

Arguments

listTables

Resolves to

ListTablesOutput

Arguments

Example

query listTables {
  warehouse {
    listTables(
      input: { maxResults: 5, database: "twisp", schemaPattern: "public" }
    ) {
      tables {
        name
      }
    }
  }
}