Skip to main content

GraphQL Queries

The Klarity ImageFactory GraphQL API provides a powerful way to fetch data about your customers, accounts, templates, images, and more. This page provides a complete reference of the available queries, including their arguments and example usage.

The GraphQL endpoint is: https://api.imagefactory.nordcloudapp.com

Common Input Patterns

Many queries that return lists of resources use a common input pattern for pagination, sorting, and filtering.

Pagination

Most list queries accept a page and limit argument.

  • page: The page number to retrieve (default: 1).
  • limit: The number of items per page (default: 10).

The search input typically includes:

  • searchValue: The string to search for.
  • algorithm: The search algorithm to use (e.g., EXACT_MATCH, SUBSTRING_MATCH, REGEXP_MATCH, FUZZY_MATCH).

Sorting

The sort input allows you to specify the field to sort by and the order (ASC or DESC).


Customer Queries

customer(customerId: String!)

Fetches a single customer by their ID.

Example:

query GetCustomer($id: String!) {
customer(customerId: $id) {
id
name
organizationName
contract
createdAt
}
}

customers(input: CustomersInput!)

Lists customers with support for pagination, sorting, and searching.

Example:

query ListCustomers($input: CustomersInput!) {
customers(input: $input) {
items {
id
name
}
totalCount
pageInfo {
hasNextPage
currentPage
}
}
}

Account Queries

account(customerId: String!, accountId: String!)

Fetches a single cloud account associated with a customer.

Example:

query GetAccount($customerId: String!, $accountId: String!) {
account(customerId: $customerId, accountId: $accountId) {
id
name
provider
status
lastCheckAt
}
}

accounts(customerId: String!, input: AccountsInput!)

Lists all accounts for a specific customer.

Example:

query ListAccounts($customerId: String!, $input: AccountsInput!) {
accounts(customerId: $customerId, input: $input) {
items {
id
name
provider
}
totalCount
}
}

Template Queries

template(customerId: String!, templateId: String!)

Fetches a single template. Templates define how images are built. This query supports nested resolvers for distributions and images.

Example:

query GetTemplate($customerId: String!, $templateId: String!) {
template(customerId: $customerId, templateId: $templateId) {
id
name
osType
osSubtype
images {
items {
id
status
}
}
distributions {
id
region
}
}
}

templates(customerId: String!, input: TemplatesInput!)

Lists templates for a customer.

Example:

query ListTemplates($customerId: String!, $input: TemplatesInput!) {
templates(customerId: $customerId, input: $input) {
items {
id
name
buildStatus
}
totalCount
}
}

Image Queries

image(customerId: String!, templateId: String!, imageId: String!, presign: Boolean)

Fetches a single image. If presign is true, it returns pre-signed URLs for reports (e.g., security scan results).

Example:

query GetImage($customerId: String!, $templateId: String!, $imageId: String!) {
image(customerId: $customerId, templateId: $templateId, imageId: $imageId, presign: true) {
id
status
providerImageId
reportUrl
createdAt
}
}

images(customerId: String!, templateId: String!, input: ImagesInput!)

Lists images generated from a specific template.

Example:

query ListImages($customerId: String!, $templateId: String!, $input: ImagesInput!) {
images(customerId: $customerId, templateId: $templateId, input: $input) {
items {
id
status
createdAt
}
}
}

Component Queries

component(componentId: String!, presign: Boolean)

Fetches a single component (system or custom).

Example:

query GetComponent($id: String!) {
component(componentId: $id) {
id
name
type
content {
version
script
}
}
}

components(customerId: String!, input: ComponentsInput!)

Lists components. Use the includeSystem flag in the input to include global system components.

Example:

query ListComponents($customerId: String!, $input: ComponentsInput!) {
components(customerId: $customerId, input: $input) {
items {
id
name
type
}
}
}

Identity and Access Queries

role(customerId: String!, roleId: String!)

Fetches a single role definition.

roles(customerId: String!, input: RolesInput!)

Lists roles available for a customer.

roleBinding(customerId: String!, roleBindingId: String!)

Fetches a single role binding.

roleBindings(customerId: String!, input: RoleBindingsInput!)

Lists role bindings.

roleBindingsByUsers(customerId: String!, input: RoleBindingsByUsersInput!)

Lists role bindings grouped by the subject (user or API key).

apiKey(customerId: String!, apiKeyId: String!)

Fetches metadata for an API key. Note that the secret is never returned by this query.

apiKeys(customerId: String!, input: ApiKeysInput!)

Lists API keys for a customer.


Miscellaneous Queries

variables(customerId: String!)

Lists the names of all variables defined for a customer. For security, the actual values are not returned.

customerStats(customerId: String!)

Returns dashboard statistics for a customer, such as the number of active templates, failed builds, and total images.

settings

Returns global settings, such as available cloud regions for each provider.

auditLogs(customerId: String!, input: AuditLogsInput!)

Fetches audit logs for a customer, allowing you to track who performed what action and when.

Example:

query GetAuditLogs($customerId: String!, $input: AuditLogsInput!) {
auditLogs(customerId: $customerId, input: $input) {
items {
id
action
resource
subjectId
timestamp
}
}
}