Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.threadify.dev/llms.txt

Use this file to discover all available pages before exploring further.

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 (specific key)
query {
  threadsByRef(
    refKey: "order_id"
    refValue: "ORD-12345"
  ) {
    totalCount
    threads {
      id
      refs
    }
  }
}

# Find by value only (searches all ref keys)
# Useful when you don't know the ref key name
query {
  threadsByRef(
    refValue: "cus_ABC123"
  ) {
    totalCount
    threads {
      id
      refs
    }
  }
}

# Partial match search (case-insensitive)
query {
  threadsByRef(
    refValue: "ABC"
  ) {
    totalCount
    threads {
      id
      refs
    }
  }
}

# Filter threads by tags
query {
  threads(
    tags: ["production", "v2.1"]
    status: "completed"
    limit: 10
  ) {
    totalCount
    threads {
      id
      label
      tags
      status
      startedAt
    }
  }
}

Query Parameters

threads() Parameters

ParameterTypeDescription
actorStringFilter by actor (user or service)
contractNameStringFilter by contract name
contractVersionIntFilter by contract version
statusStringFilter by thread status
tags[String!]Filter by tags (all must match)
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

threadsByRef() Parameters

ParameterTypeDescription
refKeyStringOptional. Specific ref key to search. If omitted, searches across all ref keys.
refValueString!Required. Ref value to search for. Supports partial matches (case-insensitive).
statusStringFilter by thread status
startedAfterStringISO timestamp - threads started after
startedBeforeStringISO timestamp - threads started before
limitIntMax results (default: 50, max: 100)
offsetIntPagination offset
Flexible Search: threadsByRef uses case-insensitive pattern matching (ILIKE).
  • Searching for "ABC" will match "cus_ABC123", "order_ABC", "ABC-456", etc.
  • Omit refKey when you don’t know the exact ref key name (e.g., support scenarios).

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)
tags[String!]Immutable tags set at thread creation

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

Step Queries

Query step history and sub-steps

Validation Queries

Query contract validation results