API Integration
This guide covers best practices for integrators using the Watt Data MCP tools as a direct JSON-RPC API rather than through an LLM client like Claude Desktop.
API Endpoints
The API supports versioned endpoints:
/v1/mcp- Versioned endpoint (recommended)/v1/mcp/m2m- Versioned M2M endpoint (recommended)/mcp- Legacy endpoint (supported for backward compatibility)/mcp/m2m- Legacy M2M endpoint (supported for backward compatibility)
Use versioned endpoints for new integrations to ensure stability across API updates.
Data Volatility Guidelines
Understanding data volatility is critical for building reliable integrations. Different identifiers have different stability characteristics and caching requirements.
Cluster IDs and Hashes
Cluster data can be referenced in two ways:
Cluster Hash (Recommended):
cluster_hashis a stable hash based ondomain,name, andvalue- Does not change when the identity graph is reprocessed
- Safe to cache and use in saved queries
- Returned by
list_clustersandsearch_clusters
Cluster ID (Legacy):
cluster_idis a numeric identifier that may change during data reprocessing- Subject to volatility when new signals are integrated or data is updated
- Use only for immediate queries, not for long-term storage
Recommended Approach - Use search_clusters:
Use the search_clusters tool to discover clusters on-demand using natural language descriptions. This provides the most flexibility and automatically adapts to data changes without caching concerns.
If Caching Clusters:
When building saved queries or long-term integrations:
- Use
cluster_hashfor stable references - Cache
cluster_hashvalues indefinitely - If using
cluster_id, cache for at most 1 hour - Implement empty-result detection logic that refreshes from
list_clustersorsearch_clusters
Person IDs
Person IDs should be treated as subject to change at any time. They must never be cached or persisted.
Requirements:
- Do not cache person IDs
- Do not persist person IDs
- Do not use person IDs as stable references
- Always use original identifiers (email, phone, address, MAID) as stable keys
To Retrieve Updated Information:
Call resolve_identities with the original identifiers to obtain current person IDs for each query.
Why This Matters:
Person IDs may change as the identity graph is updated. Storing person IDs leads to stale references that point to incorrect or non-existent records.
Integration Best Practices
Stateless Query Patterns
- Use
search_clustersfor cluster discovery - Describe your target audience in natural language instead of maintaining cluster mappings - Resolve identities at query time - Never cache person IDs; resolve fresh for each query
- Use original identifiers as stable keys - Email, phone, address are your persistent references
- Use
cluster_hashfor saved queries - Store cluster references using stable hashes instead of volatile IDs - Treat each API session as independent - Minimal state should persist between queries
Recommended Workflow
For audience discovery:
- Use
search_clusterswith natural language description of target audience - Extract cluster IDs from results
- Use cluster IDs in
find_personsboolean expressions - Export results if needed (CSV, JSON, JSONL)
For identity enrichment:
- Call
resolve_identitieswith email, phone, or address - Extract person IDs from resolution results
- Call
get_personwith person IDs and desired domains - Use enriched data immediately (do not persist person IDs)
Error Recovery
- On empty results from
search_clusters, try broader or alternative query terms - On "cluster not found" errors, refresh cluster cache and retry
- On empty results from
get_person, re-resolve identities and retry - Implement exponential backoff for transient failures
Workflow Sessions
Use workflow_id to correlate related queries within a single user interaction, but do not persist workflow state beyond the immediate session.
Next Steps
- Review Getting Started for authentication, workflow sessions, and export formats
- Explore individual tool documentation for detailed parameters and examples
- Review workflow guides for complete implementation examples