Skip to main content

Query Threads

# Get single thread by ID
query {
  thread(id: "thread-123") {
    id
    contractName
    status
    steps {
      stepName
      status
    }
  }
}

# Search threads with filters
query {
  threads(
    contractName: "order_fulfillment"
    status: "completed"
    limit: 50
  ) {
    totalCount
    threads {
      id
      status
      startedAt
    }
  }
}

# Find by external reference
query {
  threadsByRef(
    refKey: "order_id"
    refValue: "ORD-12345"
  ) {
    totalCount
    threads {
      id
      refs
    }
  }
}

Query Parameters

ParameterTypeDescription
actorStringFilter by actor (user or service)
contractNameStringFilter by contract name
contractVersionIntFilter by contract version
statusStringFilter by thread status
startedAfterStringISO timestamp - threads started after
startedBeforeStringISO timestamp - threads started before
completedAfterStringISO timestamp - threads completed after
completedBeforeStringISO timestamp - threads completed before
limitIntMax results (default: 50, max: 100)
offsetIntPagination offset

Thread Fields

FieldTypeDescription
idID!Unique thread identifier
contractIdStringContract ID (if contract-based)
contractNameStringContract name
contractVersionIntContract version
ownerIdString!Thread owner ID
companyIdString!Company ID
statusString!Thread status
createdByStringCreator ID
lastHashStringLast hash in chain
refsJSONExternal references
startedAtStringStart timestamp
completedAtStringCompletion timestamp
errorStringError message (if failed)

Available Queries

QueryDescription
thread(id)Get single thread by ID
threads(...)Search with filters and pagination
threadsByContract(...)Contract-specific search
threadsByRef(...)Find by external reference
threadChain(rootId)Get thread relationships

Next Steps