Lightyear LogoLightyear Docs

AI collections

Sync your data into unified collections and query them with AI

AI collections

Collections bring your data from every connected service into a single, queryable store. Instead of making API calls to search across HubSpot, Salesforce, and Notion separately, sync them into a collection and ask questions in natural language.

Collections build on top of sync integrations. Data flows into collections through sync pipelines.

How it works

A collection is a unified data store that receives data from one or more sync integrations. Each record in a collection has:

  • Structured data — The original fields from the source service
  • Full-text index — For keyword and phrase search
  • Vector embedding — For semantic/natural language search

When you query a collection, Unscrambled searches across all indexed data and uses AI to synthesize an answer.

Create a collection

unscrambled collection create contacts

Configure the collection to receive data from multiple sources:

import { defineCollection } from "@unscrambled/sdk";
 
export default defineCollection({
  name: "contacts",
  title: "All contacts",
  description: "Unified view of contacts across CRM and marketing tools",
 
  sources: [
    {
      service: "hubspot",
      object: "contacts",
      fields: ["email", "firstname", "lastname", "company", "lifecycle_stage"],
    },
    {
      service: "salesforce",
      object: "Contact",
      fields: ["Email", "FirstName", "LastName", "Account.Name", "LeadSource"],
    },
    {
      service: "mailchimp",
      object: "members",
      fields: ["email_address", "merge_fields", "status", "tags"],
    },
  ],
 
  deduplication: {
    key: "email",
    strategy: "merge",
  },
});

Query with natural language

Once data is synced, query the collection from the CLI:

unscrambled collection query contacts "show me all leads from Acme Corp"
Found 3 contacts matching "leads from Acme Corp":

1. Jane Doe ([email protected])
   Source: HubSpot • Lifecycle: Lead • Company: Acme Corp

2. John Smith ([email protected])
   Source: Salesforce • Lead Source: Website • Account: Acme Corp

3. Alex Chen ([email protected])
   Source: Mailchimp • Status: Subscribed • Tags: acme, enterprise

Structured queries

For precise lookups, use structured filters alongside natural language:

# Filter by field values
unscrambled collection query contacts \
  --filter "company=Acme Corp" \
  --filter "lifecycle_stage=lead"
 
# Count records
unscrambled collection count contacts --filter "source=hubspot"
 
# Export results
unscrambled collection query contacts "enterprise leads" --format csv > leads.csv

Indexing

Every text field in a collection is indexed for full-text search. This supports exact phrases, boolean operators, and fuzzy matching:

unscrambled collection search contacts "product manager San Francisco"

Unscrambled generates vector embeddings for each record using a combination of its fields. This enables semantic search — finding records by meaning rather than exact keywords:

# These both find the same records:
unscrambled collection query contacts "people interested in our enterprise plan"
unscrambled collection query contacts "enterprise prospects"

Collection types

TypeDescriptionExample
ContactsPeople from CRM, marketing, support toolsHubSpot + Salesforce + Mailchimp
DealsRevenue opportunities across CRMsHubSpot deals + Salesforce opportunities
IssuesTickets and tasks from project toolsJira + Linear + GitHub issues
DocumentsFiles and pages from knowledge toolsNotion + Google Docs + Confluence
CustomAny structured data you defineMix of any API data

API access

Collections are also accessible via REST API for use in your applications:

# Via unscrambled curl
unscrambled curl https://api.unscrambled.com/v1/collections/contacts/search \
  -d '{"query": "enterprise leads", "limit": 10}'

Dashboard

View collection stats and browse records on the web dashboard:

unscrambled collection open contacts

This opens the collection in your browser, where you can browse records, run queries, and see sync status.

On this page