docs: add Leads list & search (FIND) API reference - #16
Merged
Conversation
Documents GET /api/v1/businesses/:urlKey/leads, added in refrens/serana#4781. Covers pagination and sort bounds, the three filter groups (structured, exact-match, free-text), range parameters, the unknown-value vs no-match distinction, query-safety guarantees, and the FIND error codes. Every documented behaviour was verified against prod with the refrens-video-demo business. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Reader-effort review (DeepSeek): - Intro said three filter groups but there are four; ranges were missing. - Named data[0].items up front instead of only in the response block. - Split the free-text and assignedTo rules so each sentence carries one rule. - Spelled out both followUpDate failure conditions in the error table. - Removed the business/isRemoved rule duplicated between intro and Query safety. - Separated status (a fixed Refrens set) from the CRM-configured filters. - Pinned the vague 'the environment' for Elasticsearch availability. Google developer documentation style guide: - Ampersand out of the heading. - Dropped 'Note that' and 'simply'. - Active voice where the actor matters. Also noted that optional fields are omitted when a lead has no value. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0xSagaCity
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents
GET /api/v1/businesses/:urlKey/leads, the list/search endpoint added in refrens/serana#4781 with the Elasticsearch indexing fix in refrens/seeds#65.Adds a List and Search Leads section to
docs/leads.mdx, following the same structure as the existing Create and Edit sections, and updates the page intro to mention listing.What it covers
$limit(default 10, max 50),$skip(max 1000), and the four sortable fields.$in) and match-any-within / match-all-across semantics.createdAt,followUpDate,budget, plus thefollowUpDate=nonespecial case and its mutual exclusion with the range bounds.SEARCH_UNAVAILABLErather than silently degrading where ES is off.400naming the offending value, while an unresolved id is an empty page.businessandisRemoved, and the$in-only operator rule.Verification
Every documented behaviour was exercised live against prod using the
refrens-video-demobusiness: 21 read-only scenarios plus 6 Elasticsearch probes, all passing. That includes the four ES scenarios serana#4781 listed as environment-blocked (free-text ORing across fields,.keywordfilter matching, populate, and relevance sort), which are confirmed working.Also verified from source that
find,getandcreateall return through the samemapInternalToExternal, so the shape claim in the intro holds, and that optional fields are omitted when a lead has no value for them.npm run buildpasses and the section renders correctly.Review passes applied
An independent reader-effort review (second commit) fixed seven things, most importantly a factual error: the intro said filters fall into three groups while four were documented — ranges were missing from the list. Also:
data[0].itemsis now named in the intro rather than only in the response block; the free-text andassignedTorules are split so each sentence carries one rule; bothfollowUpDatefailure conditions are stated inline in the error table; the duplicatedbusiness/isRemovedrule is trimmed to one home; andstatusis now separated from the CRM-configured filters, since it is a fixed Refrens set rather than business configuration.