Skip to main content

Complex Query Examples

Organisation with Groups and Members

query GetOrganisationWithGroups($id: ID!) {
organisation(id: $id) {
id
name
retention
created
groupConnection(first: 10) {
totalCount
pageInfo {
hasNextPage
endCursor
}
groups {
id
name
publicName
credit
memberConnection(first: 5) {
totalCount
groupMembers {
id
name
canAdminister
canCreateSend
canEdit
isActive
lastLogin
user {
id
name
email
}
}
}
}
}
}
}

Group with Templates and Documents

query GetGroupWithContent($id: ID!, $from: AWSDateTime, $to: AWSDateTime) {
group(id: $id) {
id
name
credit
licensesRemaining
templateConnection(first: 20, archived: false) {
totalCount
templates {
id
title
pageCount
valid
locked
tags
created
lastSent
}
}
documentConnection(first: 20, from: $from, to: $to) {
totalCount
documents {
id
name
status
created
senderName
senderEmail
recipients {
id
firstName
lastName
email
status
signedDateTime
}
}
}
}
}

Template with Elements and Roles

query GetTemplateWithDetails($id: ID!) {
template(id: $id) {
id
title
pageCount
pageDimensions
fileName
link
valid
locked
tags
roles {
id
name
roleType
signerIndex
ordinal
experience
}
elementConnection(first: 100) {
totalCount
templateElements {
id
elementType
ax
ay
bx
by
page
label
optional
role
signer
validation
value
}
}
directLinks {
id
name
link
emailValidation
redirectLink
}
}
}

Document with Recipients and Elements

query GetDocumentWithDetails($id: ID!) {
document(id: $id) {
id
name
link
status
hash
created
modified
senderName
senderEmail
batchId
batchName
template {
id
title
}
recipients {
id
firstName
lastName
email
role
roleType
status
authentication
emailOpenedDateTime
documentFirstViewedDateTime
signedDateTime
sentDateTime
emailProblem
}
elementConnection(first: 100) {
totalCount
documentElements {
id
elementType
ax
ay
bx
by
page
label
value
role
signer
}
}
auditLog {
id
name
email
status
description
created
code
ip
}
}
}

Batch with Documents and Recipients

query GetBatchWithDocuments($id: ID!) {
batch(id: $id) {
id
name
enforceOrder
type
creatorName
documentCount
inProgressCount
rejectedCount
completedCount
bouncedCount
created
status
progress
documentConnection(first: 50) {
totalCount
documents {
id
name
status
created
recipients {
id
firstName
lastName
email
status
signedDateTime
}
}
}
}
}

User with Organisations and Groups

query GetUserWithMemberships($id: ID) {
user(id: $id) {
id
name
firstName
lastName
email
timeZone
companySize
companyRole
lastDocumentSentAt
lastValidTemplateMadeAt
uploadedTemplatesCount
organisationConnection {
totalCount
organisations {
id
name
created
}
}
memberConnection(first: 20) {
totalCount
groupMembers {
id
canAdminister
canCreateSend
canEdit
isActive
lastLogin
group {
id
name
publicName
credit
}
}
}
webhooks {
id
url
event
enabled
created
groupId
}
}
}

Group with Contacts and Contact Groups

query GetGroupWithContacts($id: ID!) {
group(id: $id) {
id
name
contactConnection(first: 50) {
totalCount
contacts {
id
name
firstName
lastName
email
timeZone
phoneNumber
}
}
contactGroupConnection(first: 20) {
totalCount
contactGroups {
id
name
colour
contacts {
id
name
email
}
}
}
}
}

Group with Experiences and Schedules

query GetGroupWithSettings($id: ID!) {
group(id: $id) {
id
name
experienceConnection(first: 10) {
totalCount
experiences {
id
name
defaultExperience
language
allowSignatureReuse
canReassign
created
}
}
scheduleConnection(first: 10) {
totalCount
schedules {
id
name
default
active
items {
id
daysAfter
frequency
subject
message
when
timeOfDay
skipWeekend
}
}
}
attachmentConnection(first: 10) {
totalCount
attachments {
id
filename
extension
description
autoAttach
created
createdBy
}
}
}
}

Organisation with Billing and Invoices

query GetOrganisationWithBilling($id: ID!) {
organisation(id: $id) {
id
name
billing {
id
customerName
address1
postcode
created
billingContactEmail
technicalContactEmail
taxRate
docSendCredit
userLimit
userCount
alertCount
planName
paymentSystem
currency
invoiceConnection(first: 20) {
totalCount
invoices {
id
created
invoiceNumber
subTotal
totalIncTax
currency
link
}
}
}
quotas {
docSendCredit
contactPrimaryEmail
contactSecondaryEmail
contactTechnicalEmail
}
}
}

Search and Filter Examples

Filter Documents by Status and Date Range

query FilterDocuments($groupId: ID!, $from: AWSDateTime!, $to: AWSDateTime!, $status: String!) {
group(id: $groupId) {
id
name
documentConnection(
first: 50
from: $from
to: $to
status: $status
) {
totalCount
documents {
id
name
status
created
senderName
senderEmail
}
}
}
}

Search Templates

query SearchTemplates($groupId: ID!, $search: String!) {
group(id: $groupId) {
id
name
templateConnection(
first: 20
search: $search
archived: false
) {
totalCount
templates {
id
title
created
lastSent
tags
}
}
}
}

Filter Contacts

query FilterContacts($groupId: ID!, $filter: AWSJSON!) {
group(id: $groupId) {
id
name
contactConnection(
first: 50
filter: $filter
) {
totalCount
contacts {
id
name
firstName
lastName
email
}
}
}
}