# Lookup docs > Lookup is a church search box and autofill SDK for any church app, from Here's My Church: one script tag, an open API, no key. People pick their church and the address, website and service times fill in. # Overview > Lookup is a church search box that fills in your form from Here's My Church. One script tag, an open API, no key. Source: https://lookup.heresmychurch.com/docs Church tools keep asking people for the same details. Lookup fills them in from [Here's My Church](https://heresmychurch.com), an open directory of 587,842 churches in 19 countries. Someone types a few letters, picks their church, and the address, website, phone and service times fill in. ## What you get - [Quickstart](/docs/quickstart): Add the search box to a form in a few minutes, or hand the job to your agent. - [Example apps](/docs/examples): A church management app, a nonprofit sign-up and a church website builder. - [The widget](/docs/widget): Every attribute, event and form option, with a live preview. - [API](/docs/api): Search and church records over plain HTTP, with open CORS and no key. ## How it works 1. **Search as you type.** Prefixes, typos and places like "church in dallas" all work, nearby churches first. 2. **Fill your form.** Pick a church and the empty fields you tagged with `data-hmc-field` fill in. Anything already typed is left alone. 3. **Share fixes back.** When someone corrects a detail Lookup filled, they can share it back to Here's My Church, one checked box at a time. A church that has claimed its listing reviews changes to it first. Otherwise Here's My Church checks them automatically, for example against the church's own website, where AI locates a quote and code confirms it, and a person reviews whatever the checks can't decide. Because every pick comes from the same open directory, each app that uses Lookup helps keep church data accurate. ## Credits - **[Here's My Church](https://heresmychurch.com)**, the open, crowd-sourced church directory every result comes from. - **[OpenStreetMap](https://www.openstreetmap.org/copyright) contributors**, whose map data many listings started from (ODbL). - **[Cam Pak](https://cameronpak.com)** and **[Sensible UI](https://sensibleui.com)**. The widget reads the same design token names Sensible UI uses, so it fits right in on those pages. Lookup was built for the AI for Church hackathon and is open source on [GitHub](https://github.com/harvouscom/lookup). --- # Quickstart > Add a church search box that fills in your form. Hand this to your AI agent, or follow three steps yourself. Source: https://lookup.heresmychurch.com/docs/quickstart **Add Lookup to your app** ```text # Add church lookup with Lookup by Here's My Church Add a church search field to the form in this project where people enter a church (sign-up, profile, partner or settings form). When someone picks their church, its details should fill the other fields. ## Steps 1. Load the widget once on the page: (Service times editor, optional: https://lookup.heresmychurch.com/sdk/0.4.0/service-times.js) 2. Put inside the form, above the fields it fills. - `name` submits the chosen church's ID with the form. Store it so you can look the church up again. - Add `required` if a church must be chosen. - On an edit screen, set `value` to the saved ID. 3. Inputs named for the church (church_city, churchWebsite) fill on their own. Tag the other existing inputs with data-hmc-field. Use only these names: name, street, city, region, regionName, postalCode, country, countryName, latitude, longitude, phone, email, website, denomination, serviceTimes, languages, ministries, pastorName, id Don't create new inputs unless I ask. Don't rename existing ones. 4. React or Vue: the element is a custom element. React 19: pass onchurch-select and onchurch-clear props. React 18: add `church-select` and `church-clear` listeners with addEventListener in an effect. Vue: @church-select and @church-clear. Values are set the way typing sets them, so controlled inputs stay in sync. Types: import type {} from "@heresmychurch/lookup/react" (or /vue). 5. While testing, add client="lookup-demo" so corrections people share are checked but never sent. Remove it (or set your app's name) before shipping. 6. Match my styles: set --hmc-accent, --hmc-radius, --hmc-border and friends on church-lookup, or rely on shadcn-style tokens (--background, --foreground, --accent, --radius) if the app already has them. ## Check - Type "grace comm", pick a result, confirm the tagged fields fill and the form submits church_id. - Keyboard: arrow keys move, Enter picks, Escape closes. Docs: https://lookup.heresmychurch.com/llms-full.txt ``` Or set it up yourself. There's no key to request. ## 1. Add the script ```html ``` That URL is pinned to version 0.4.0 and never changes, so an update can't change your form until you change the number. To always get the latest release instead, load `https://lookup.heresmychurch.com/element.js`. See the [changelog](https://github.com/harvouscom/lookup/blob/main/packages/sdk/CHANGELOG.md) for what's in each version. ## 2. Put the search box in your form Fields named for the church, like `church_city`, fill on their own. Tag any others with `data-hmc-field`. Give it a `name` and the chosen church's ID submits with the form. script tag: ```html
``` client only: ```javascript import { createLookup } from "https://lookup.heresmychurch.com/sdk/0.4.0/lookup.js"; const lookup = createLookup({ client: "my-app" }); const { results } = await lookup.search("grace comm"); const church = await lookup.getChurch(results[0].id); ``` npm: ```bash npm install @heresmychurch/lookup # then, once in your app: import "@heresmychurch/lookup/element"; ``` ## 3. Try it Values are set the way typing sets them, so React and other frameworks see them. > **Testing:** Add `client="lookup-demo"` while you build. Corrections people share are checked the same way, but never sent to Here's My Church. ## Next steps - [The widget](/docs/widget): Attributes, events, icons and the form field, with a live preview. - [Theming](/docs/theming): Match your design system with a few CSS variables. - [Example apps](/docs/examples): Three made-up apps built with Lookup. --- # Example apps > Made-up apps built with Lookup, using the real widget and live data. A church management app, a nonprofit sign-up and a church website builder. Source: https://lookup.heresmychurch.com/docs/examples Each one is a made-up app using the real widget and live data, in demo mode so nothing you share is sent. They open full screen on the homepage. ## What each one shows | Example | Shows | |---|---| | Kinship, web component | React controlled inputs, `church-select` and `church-clear` events, the share panel | | Harvest | `name` and `required` in a plain form, service times feeding distribution hours | | Steeple | Filling a live preview, ``, theming to a product's own look | | Kinship, shadcn/ui | `shadcn add` from the registry, `ChurchLookup` in a React Hook Form `FormField`, `ChurchConsent` | Every example uses `client="lookup-demo"`, so corrections are checked but never sent to Here's My Church. --- # The widget > is an accessible combobox: it searches as people type and fills your form when they choose. Source: https://lookup.heresmychurch.com/docs/widget It also asks for smarter results when people pause. Change the options below to see each one live. ## Attributes | Attribute | What it does | |---|---| | `name` | Submit the chosen church's ID with your form under this name, like any input. | | `required` | The form won't submit until a church is chosen from the list. | | `value` | A church ID to show, such as one saved earlier on an edit screen. | | `fill-on-load` | Also fill the form from `value` when the page loads. | | `label`, `placeholder` | The visible label and the hint inside the box. | | `lang` | English, Spanish, French, German, Portuguese or Polish. Defaults to the page's language. Set the `strings` property to change any text. | | `region`, `country` | Limit results, such as `region="TX"` or `country="DE"`. | | `near` | Rank results near a place, such as `near="Dallas"`. | | `lat`, `lng` | Rank results near a point, such as the device's location. Set both. | | `geo="off"` | Don't use the visitor's approximate location. | | `form` | The id of the form to fill. Defaults to the enclosing form. | | `fill` | Which fields to fill. See [Fields](#fields). `auto` adds plain names like `city`, `tagged` uses only tags, `off` fills nothing. | | `overwrite` | Replace fields that already have values. | | `limit` | Results on the first page and each **Show more**. Defaults to 8. | | `max-results` | The most results **Show more** can reach, up to 50. Defaults to 50. Set it to `limit` to hide Show more. | | `density="comfortable"` | Taller rows with larger icons. Rows are compact by default. | | `icons="none"` | Hide the icon beside each result. | | `show-distance="off"` | Hide how far away each church is. | | `min-chars` | Characters typed before searching. Defaults to 2. | | `debounce` | Milliseconds to wait after typing before searching. Defaults to 150. | | `semantic="off"` | Skip the slower search after a pause, which can find churches by meaning. | | `disabled` | Turn the field off, like any input. A disabled `fieldset` does the same. | | `contribute="off"` | Don't offer to share corrections, report problems or add missing churches. | | `client` | Your app's name, sent with requests. Use `lookup-demo` while testing. | ## In your form It's a real form field. Give it a `name` and the chosen church's ID submits with your form, so you can store the ID and look the church up again later. React and Vue get types for the tag and its events. React 19 adds `onchurch-select` and other `onchurch-*` props as event listeners; React 18 needs them added in an effect. html form: ```html
``` react 19: ```tsx "use client"; // Next.js: load the element in a client component. import "@heresmychurch/lookup/element"; import type {} from "@heresmychurch/lookup/react"; // types the props and onchurch-* events function ChurchField({ onChange }) { return ( onChange(e.detail.result.id)} onchurch-clear={() => onChange("")} /> ); } ``` react 18: ```tsx "use client"; // Next.js: load the element in a client component. import "@heresmychurch/lookup/element"; function ChurchField({ onChange }) { const ref = useRef(null); useEffect(() => { const el = ref.current; const pick = (e) => onChange(e.detail.result.id); const clear = () => onChange(""); el.addEventListener("church-select", pick); el.addEventListener("church-clear", clear); return () => { el.removeEventListener("church-select", pick); el.removeEventListener("church-clear", clear); }; }, [onChange]); return ; } ``` vue: ```vue ``` ## Fields Fields named for the church fill without any setup: `church_city`, `churchWebsite`, `church[phone]`, or `autocomplete="section-church address-level2"`. It reads the field's `name`, `id` and `autocomplete`, and skips address line 2, hidden fields and passwords. On a form that's only about the church, add `fill="auto"` and plain names fill too: `city`, `state`, `zip`, `phone`, `email`, `website`, or autocomplete tokens like `postal-code` and `tel`. A plain `name` or `id` never fills, since on most forms those are the person's. To say exactly which field gets what, tag it with `data-hmc-field`. A tag always wins, and `data-hmc-field="none"` leaves a field alone. Use any of these: `name`, `street`, `city`, `region`, `regionName`, `postalCode`, `country`, `countryName`, `latitude`, `longitude`, `phone`, `email`, `website`, `denomination`, `serviceTimes`, `languages`, `ministries`, `pastorName` and `id`. A ` Share my fixes with Here's My Church ``` ### Missing churches When nothing matches, the "Add it" link opens Here's My Church's add form with the typed name. If someone fills in your form without picking a church, the widget offers to add it, listing the values it would send from your mapped fields (it needs a name, city and region). Similar listings come first as "Is it one of these?"; picking one selects it. Once added, the widget's value is the new church's ID. ## Icons Use the icons your design system already has. Put one with `slot="search-icon"` in the box, and one with `slot="result-icon"` to repeat beside every result. It works with SVG sets like Lucide or Heroicons, icon fonts like Tabler or Font Awesome, and icon components like Iconify, because the icons stay in your page and pick up its CSS. ```html ``` ## Events | Event | When it fires | |---|---| | `church-results` | Results appeared. `detail` has `query`, `results`, `settled`, and `more` when they came from **Show more**. | | `church-select` | A church was chosen. Cancel it to stop the fill. | | `church-fill` | Fields are about to fill. Cancel it to fill them yourself from `detail.record`. | | `church-clear` | The choice was cleared, with the clear button or by editing the name. | | `church-error` | A search or a church's details failed to load. `detail` has `query` or `id`, plus `status`, `code`, `retryAfter` and the `error`. | | `church-contribute` | Someone chose Share, reported a problem, or submitted with `data-hmc-share` checked (`detail.onSubmit`). `detail` has `churchId` and `changes`; an address change's `value` is `{ street, city, postalCode }`. Cancel it to send them yourself, or not at all. | | `church-confirm` | Someone chose Still correct. Cancel it to skip the confirmation. | | `church-add` | Someone chose to add a church that isn't listed. `detail` has `church` and `confirmAdd`. Cancel it to stop the add. | | `church-added` | A church was added. `detail` has its new `id` (null with `lookup-demo`), the `church` and `sandbox`. The widget's value is already the new ID. | ## Accessibility An ARIA 1.2 combobox: arrow keys move through results, Enter chooses and Escape closes. **Show more** is the last option, so the arrow keys reach it too, and pressing down on it loads the next page. Results, added results and fills are announced, targets are 44 pixels, and it respects forced colors and reduced motion. --- # React and shadcn/ui > Own the code. Add a ChurchLookup component, a hook and a share-fixes panel to your shadcn app from Lookup's registry. Source: https://lookup.heresmychurch.com/docs/react Lookup has two front doors with one engine behind them: | Path | Best for | How | |---|---|---| | Drop it in | Any page or framework, no build step, Sensible UI pages | `` from one script tag. See [the widget](/docs/widget). | | Own the code | React apps with shadcn/ui, such as ones built with Lovable or v0 | Add components from the registry below. They're copied into your app, so you can change them. | Both use the same headless core for search, **Show more**, field matching and sharing fixes back, and take the same options. The React component is yours to edit, so the two can differ once you change it. **Add Lookup to my shadcn app** ```text Add a church picker to this React + shadcn/ui app using Lookup by Here's My Church. 1. Run: pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/church-lookup.json (it adds components/church-lookup.tsx, hooks/use-church-lookup.ts and lib/lookup-core.ts) 2. In the form that asks for a church, render inside a React Hook Form FormField named church_id: render={({ field }) => } 3. Inputs named for the church (church_city, churchWebsite) fill on their own. Add data-hmc-field to any others it should fill (name, street, city, regionName, postalCode, phone, website, serviceTimes). Don't rename existing fields. 4. Optional: pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/church-consent.json and render under the fields, with record from ChurchLookup's onFill. 5. Use client="lookup-demo" while testing; set your app's name before shipping. Check: type "grac", pick a church, the tagged fields fill and handleSubmit receives church_id. ``` Not on shadcn/ui? Use the element with `onchurch-select` props in React 19 (see [the widget](/docs/widget#in-your-form)), or build your own picker with `useChurchLookup` from `@heresmychurch/lookup/react` (`npm install @heresmychurch/lookup`). ## Install ```bash pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/church-lookup.json ``` That adds three files, plus shadcn's `command` and `popover` if you don't have them. The component is a client component (`"use client"`), so it works in the Next.js app router. | File | What it is | |---|---| | `components/church-lookup.tsx` | `ChurchLookup`, the search box, built from Command and Popover | | `hooks/use-church-lookup.ts` | `useChurchLookup`, the engine as a hook, for your own UI | | `lib/lookup-core.ts` | The headless core: search, fill and consent rules. Generated from `@heresmychurch/lookup/core`. | ## With React Hook Form Spread the field onto `ChurchLookup`. Inputs named for the church, like `church_city`, fill on their own; tag any others with `data-hmc-field` (see [Fields](/docs/widget#fields)). Values are set the way typing sets them, so `register` and `Controller` fields both update. ```tsx ( Church setRecord(record)} /> )} /> ``` Without a form library, pass `name` and a hidden input submits the church ID, add `required` if a church must be chosen, or use `value` and `onChange` for controlled state. To fill fields yourself, return `false` from `onFill`, or set `fill={false}`. ## Props | Prop | What it does | |---|---| | `value`, `onChange`, `onBlur`, `name` | Form field basics. `value` is the church ID; setting it shows that church. A saved ID that moved calls `onChange` with the new one. | | `required` | The form won't submit until a church is chosen from the list. | | `onFill` | Called with the record and what will fill, before it fills. Return `false` to fill fields yourself. | | `fill` | Which fields to fill: tagged and church-named by default, `"auto"` adds plain names like `city`, `"tagged"` only tags, `false` none. | | `fillOnLoad` | Also fill from `value` when it's first shown. | | `form` | The id of the form to fill. Defaults to the enclosing form. | | `overwrite` | Replace fields that already have values. | | `onSelect`, `onClear`, `onError` | A church is about to be chosen (return `false` to cancel), the choice was cleared, or something failed to load. | | `client` | Your app's name. Use `lookup-demo` while testing. | | `region`, `country`, `near`, `lat`, `lng`, `geo` | Where to search, as on the widget. | | `limit`, `maxResults` | Results per page, and the most **Show more** reaches (up to 50). | | `minChars`, `debounce`, `semantic` | When to search: characters first, milliseconds after typing, and `false` to skip the search after a pause. | | `density`, `icon`, `searchIcon`, `showDistance` | How results look: `"comfortable"` rows, your own icons (`icon={null}` hides it), and distances. | | `lang`, `strings` | The text's language, and any text to change. | | `label`, `placeholder` | The accessible name and the hint. | | `onAdd`, `onAdded`, `addChurch` | The form was filled without picking a church and the person chose to add it (return `false` to stop), it was added (with its new ID), or `addChurch={false}` to never offer it. | ## Other languages English is built in. For Spanish, French, German, Portuguese and Polish, add the language file once and set `lang`, or let it follow the page's: ```bash pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/lookup-strings.json ``` ```tsx import "@/lib/lookup-strings" ``` ## Share fixes back ```bash pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/church-consent.json ``` ```tsx ``` It shows only fields Here's My Church accepts for that church's country. Changed fields start checked, `street`, `city` and `postalCode` show as one Address row, each says whether it goes live, is checked automatically or goes to the church first (a claimed listing), and nothing is sent until the person chooses Share. A checked `data-hmc-share` checkbox in the submitted form sends them too, without blocking the submit. When nothing changed, it asks "Still correct?" of listings nobody confirmed this year. It also offers **Report a problem** and a link to fix anything else on Here's My Church. ## Your own UI ```bash pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/use-church-lookup.json ``` ```tsx const lookup = useChurchLookup({ client: "my-app" }) // lookup.search(text), lookup.results, lookup.active, lookup.move(1), lookup.choose(), lookup.loading // lookup.hasMore and lookup.more() for the next page, lookup.error and lookup.retry() ``` See it working in [Kinship, built with shadcn/ui](/demo/shadcn/). --- # Service times > Edit a service-times field as rows of day, time and label, while it still submits one plain string. Source: https://lookup.heresmychurch.com/docs/service-times Wrap a service-times field in `` to edit it as rows of day, time and label, the same way Here's My Church does. The field keeps one plain string, such as `Sun 9:00 AM (Main Service); Wed 7:00 PM`, so it submits like any input. ```html ``` When `` fills a `serviceTimes` field inside ``, the rows update with it. --- # Theming > Match your design system with a few CSS variables. On pages with shadcn/ui-style tokens, it matches with no setup. Source: https://lookup.heresmychurch.com/docs/theming The widget reads its own `--hmc-*` CSS variables. When one isn't set, it falls back to the shadcn/ui token names (`--background`, `--foreground`, `--accent`, `--border`, `--radius` and so on), the same names [Sensible UI](https://sensibleui.com) by [Cam Pak](https://cameronpak.com) uses. So on those pages it matches with no setup. Anywhere else, set a few variables. Try it below. The right side has no Lookup CSS at all, only the page's tokens. Pick a set, edit any value or paste a theme from [ui.shadcn.com/themes](https://ui.shadcn.com/themes), then drag across to compare it with no tokens. ## Variables | Variable | Falls back to | Used for | |---|---|---| | `--hmc-bg` | `--background` | The input background | | `--hmc-text` | `--foreground` | Text | | `--hmc-popover`, `--hmc-popover-text` | `--popover`, `--popover-foreground` | The results list | | `--hmc-border` | `--border` | The results list border | | `--hmc-input-border` | `--input` | The input border | | `--hmc-accent` | `--ring` | Focus ring and icons | | `--hmc-active-bg`, `--hmc-active-text` | `--accent`, `--accent-foreground` | The highlighted result | | `--hmc-muted` | `--muted-foreground` | Secondary text | | `--hmc-radius` | `--radius` | Corners | | `--hmc-z` | | The results list's `z-index`. Defaults to 1000. | The widget also takes your page's font. Rows are compact by default; `density="comfortable"` makes them taller with larger icons. ## Parts For anything else, style its parts with `::part()`, such as `church-lookup::part(option-name) { font-weight: 500 }`. | Part | What it is | |---|---| | `label`, `input`, `clear` | The label, the search box and its clear button | | `popup`, `listbox` | The results panel and the list inside it | | `option` | Each result row | | `option-name`, `option-detail`, `option-distance` | A result's name, its address line and its distance | | `more` | The **Show more** row | | `corrected` | The "Showing results for" line above corrected results | | `note`, `retry` | The no-results or error message, and its **Try again** button | | `footer` | The data credit under the results | | `consent` | The panel that offers to share fixes back | Want to see it fill a real form? [Open the full theming example](/examples/autofill). --- # API > Search churches and read autofill records over plain HTTP. Open CORS, no key, no cookies. Source: https://lookup.heresmychurch.com/docs/api Base URL `https://lookup.heresmychurch.com/v1`. Open CORS, no key, no cookies. Send a `client` name, such as your app's, so Here's My Church knows which tool is asking. ## GET /v1/search Try it against the live API: | Parameter | What it does | |---|---| | `q` | What the person typed. Place words like "in Dallas" or ", TX" are understood. | | `near`, `lat`, `lng` | Rank near a place or point. | | `country`, `region` | Only return churches there. | | `limit` | 1 to 50. Defaults to 8. | | `settled=1` | The person paused, so semantic search may run. | | `geo=off` | Don't use the request's approximate location. | The response has `results`, plus `hasMore` when more churches ranked past `limit`. To show more, ask again with a higher `limit` and add the results you haven't shown yet. A higher limit can search wider, so don't assume the first ones come back in the same order. It also has `place` (the place understood from the query, or `null`), `corrected` (the spelling searched instead, or `null`), `degraded` and `semantic`. ## GET /v1/churches/:id The autofill record. Every key in `fields` is always present, with `null` or `[]` when empty, plus `missing`, `completeness`, `hints`, `freshness.lastVerified` (when someone last confirmed it, in milliseconds, or `null`), `links.heresMyChurch` (the church's page; add `?suggest=1` to open its fix form) and `claimed` (`true` when the church has claimed its listing on Here's My Church, so others' changes go to the church first). Records are cached for a minute, and a change that goes live through Lookup refreshes it at once. ```bash curl https://lookup.heresmychurch.com/v1/churches/CA-ON-56994145 ``` ## GET /v1/meta Field names, what can be contributed and how it's checked (`contributableFields`, each with `countries`, `review` and `checks`), whether adding churches is on (`addEnabled`), completeness weights, counts and attribution. ## POST /v1/churches/:id/contributions Send corrections as `{ client, changes: [{ field, value }] }`. Fields are `serviceTimes`, `denomination`, `languages`, `ministries`, `phone`, `website`, `email`, `pastorName`, the address, and the reports `reportClosed`, `reportDuplicate` and `reportRelocated`. Send an address as `{ "field": "address", "value": { "street", "city", "postalCode" } }` (any of the three), or as separate `street`, `city` and `postalCode` changes; either way it goes to Here's My Church as one change, and parts you leave out keep their listed values. Up to 8 changes at once. Each field comes back with its own status: | Status | Meaning | |---|---| | `live` | Applied now, such as a blank field filled in. | | `in_review` | Held. Here's My Church checks it automatically, and a reviewer decides what the checks can't. With `reviewBy: "church"`, the church reviews it first, since it has claimed its listing. | | `not_applied` | Not changed: the listed value was already the same, or Here's My Church kept it. | | `rejected` | Not accepted, with a `message` saying why. | | `try_again` | A temporary problem, such as maintenance or a rate limit. Nothing was refused. | | `coming_soon` | A field Lookup will accept soon. Name is coming soon. | `reviewBy` is only present when Here's My Church says who reviews a held change, and so far it's only ever `"church"`. The statuses themselves don't change, so code that reads only `status` keeps working. [Data and review](/docs/data#sharing-fixes-back) has the rules for each field. ```bash curl -X POST https://lookup.heresmychurch.com/v1/churches/CA-ON-56994145/contributions \ -H "content-type: application/json" \ -d '{"client":"lookup-demo","changes":[{"field":"phone","value":"905-555-0100"}]}' ``` > **Sandbox:** Test with `client: "lookup-demo"`. Changes are checked the same way but never sent, and responses say `sandbox: true`. When a change goes live, the response has `updated: true` and the record and search already show it. ## POST /v1/churches/:id/confirm "Still correct." Send `{ client }` to mark a listing as checked today. The response has the new `lastVerified`. ## POST /v1/churches Add a church that isn't listed. Send `{ client, church }`, where `church` has `name`, `city` and `region` (a code like `TX` or a name like `Texas`), and optionally `street`, `postalCode`, `country` (code or name), `phone`, `email`, `website`, `denomination`, `serviceTimes`, `languages`, `ministries`, `pastorName`, `latitude` and `longitude`. | Status | Meaning | |---|---| | `live` | Added. `id` is its new church ID, already searchable. | | `similar` | It may already be listed. `similar` holds candidates shaped like search results. Send again with `confirmAdd: true` to add it anyway. | | `rejected` | Not accepted, with a `message`. | | `try_again` | A temporary problem. Nothing was added. | ```bash curl -X POST https://lookup.heresmychurch.com/v1/churches \ -H "content-type: application/json" \ -d '{"client":"lookup-demo","church":{"name":"New Hope Fellowship","city":"Dallas","region":"TX"}}' ``` With `lookup-demo`, the duplicate check runs against Lookup's own index and nothing is added: a `live` answer has `id: null` and `sandbox: true`. ## POST /v1/ask Ask a question about these docs. Send `{ question }` (up to 500 characters) and the answer streams back as server-sent events. It powers the Ask AI button and is limited to 10 questions a minute. ## Errors Errors are JSON with a readable `error` and a stable `code` to check in your code: | Status | `code` | |---|---| | 400 | `invalid` | | 404 | `not_found` | | 405 | `method_not_allowed` | | 413 | `too_large` | | 429 | `rate_limited` | | 500 | `unavailable` | | 503 | `overloaded` | ## Limits 120 requests and 30 semantic searches a minute per visitor, 5 contributions (adds included) and 10 docs questions a minute. Over the limit returns `429`, a busy database returns `503`, and both send `Retry-After`, which browsers on any origin can read. --- # How search works > Words first, then places, spelling and, only when words fail, meaning. And where AI is and isn't used. Source: https://lookup.heresmychurch.com/docs/how-search-works 1. **Words, as you type.** A full-text index finds names that start with what's typed: nearby first, then wider, then the whole country. Short forms count too: "1st", "bapt", "meth", "pres", "ch", and abbreviations like "umc", "fbc", "ame", "cogic", "sda" and "lds" match the words they stand for, and the other way round. 2. **Places.** "church in dallas", "grace, chicago", "first baptist TX" and "first baptist dallas tx" become a place filter. A lowercase state code like "tx" also finds churches in that state, but still works as the start of a word, so "grace co" keeps finding Grace Community. "nyc", "philly", "ft worth" and "n charleston" are understood, and so are postcodes where listings have them, mostly in Europe ("kirche 80331"; US listings don't carry ZIP codes yet). A lowercase "in" is never read as Indiana. 3. **Half-typed words and spelling.** When almost nothing matches, every word is tried as the start of a longer one, with "church" optional, so "first bap church dallas" finds First Baptist. Then the closest spelling is tried, so "gracee" finds Grace. 4. **Meaning, only when words fail.** If no result matches every word, a settled query also asks semantic search (bge-m3 in Cloudflare Vectorize). Those results always rank below real name matches. ## How it compares 78 held-out test queries we didn't tune on, against Here's My Church's search today: | System | Top result right | In top 5 | No results | Typical time | |---|---|---|---|---| | Today's search | 28% | 31% | 41% | 20 s | | Lookup, words only | 78% | 85% | 1% | 150 ms | | Lookup, with semantic | **78%** | **87%** | **0%** | 170 ms | Semantic search helped two queries in 78 and hurt none. It doesn't fix translations such as "trinity church munich", and common names with no location stay hard. [Full write-up](https://github.com/harvouscom/lookup/tree/main/eval/results). ## Ranking A formula, not AI, orders results. - **When you give a place or a point** (a city in the search, or `lat`/`lng`), every church that matches all your words competes on one footing: about 40% how well the words match, 30% how near it is, 10% for being in the city you named, a bonus for an exact name, and a little for a complete listing. So "Calvary Chapel West Boca" 28 km away beats an exact "Calvary Chapel" 300 km away. - **Otherwise** a better name match always comes first, then 60% name, 25% nearness to the visitor's approximate location, and 15% listing completeness. ## Where AI is used, and where it isn't | Where | How | |---|---| | Semantic search | One AI model, bge-m3 on Cloudflare Workers AI and Vectorize, runs only when no name matches every word. On the held-out test it moved "in top 5" from 85% to 87% and "no results" from 1% to 0%. | | Ask AI in these docs | An instruct model on Workers AI answers questions using only these docs, and links the pages it used. Questions aren't stored. | | Ranking | A formula, not AI. | | Church details | AI never writes or approves them. Every fill comes from Here's My Church, and every shared fix goes through its rules: the church first when it has claimed its listing, then automatic checks. When a check reads the church's own website, an AI model on Workers AI only points to the sentence that should hold the value; code confirms that quote is on the page and matches. What the checks can't decide goes to a person. | | Searches | Lookup doesn't log them. | --- # Data and review > Where the data comes from, how often it syncs, and how fixes people share go back to Here's My Church. Source: https://lookup.heresmychurch.com/docs/data Lookup reads Here's My Church's reviewed listings and re-syncs changed regions every 5 minutes. Searches aren't logged, and approximate location is only used in memory to rank nearby churches. > **Why fewer churches than Here's My Church shows?:** Its map counts every listing, about 655,000. Lookup leaves out about 68,000 that have no real name yet, such as "Unnamed church", since nobody can find those by typing. Once a listing gets a name on Here's My Church, the next sync adds it. ## Sharing fixes back When someone changes a detail Lookup filled, the widget offers to share it. Changed fields start checked, each says what will happen to it ("Goes live", "Checked automatically" or "The church reviews this"), and nothing is sent until they choose **Share** (or submit your form with a checked [`data-hmc-share`](/docs/widget#share-on-submit) box). Your form's own submit is never blocked. **Claimed listings come first.** When a church has claimed its listing on Here's My Church (verified its listed inbox), everyone else's changes go to the church to review. The record says `claimed: true`, and each held change comes back with `reviewBy: "church"`. **Filling a blank field** goes live on one vote, with an automatic spam check afterwards. Email and pastor name are the exception: from Lookup they're always held, since a host's form can hold someone's personal details. **Replacing a value that's already listed**, or reporting a problem, is held and checked automatically by Here's My Church: | Field | Approved when | Otherwise | |---|---|---| | Phone, service times | It appears on the church's own website, two or more people independently send the same value, or after three quiet days | A Here's My Church reviewer decides | | Denomination, languages, ministries (additions only) | People agree, it passes the naming rules, or after three quiet days | A Here's My Church reviewer decides | | Name, website, address (street, city and postal code, sent together) | There's evidence: the church's own website, a small spelling fix to a name, an address within 150 m of the map pin | A Here's My Church reviewer decides | | Email, pastor name | There's evidence, such as the church's own website | A Here's My Church reviewer decides | | Closed or duplicate reports | Strong evidence. The listing is hidden, not deleted, so it can come back | A Here's My Church reviewer decides | | Moved reports | Never automatically | A Here's My Church reviewer decides | Name corrections are coming soon through Lookup. The checks never let AI approve anything: where they read the church's website, an AI model only points to the sentence that should hold the value, and code confirms that the quote is really on the page and contains the value. `/v1/meta` lists each field with `checks`: `"automatic"`, `"automatic-then-reviewer"` or `"reviewer"`. A change that goes live shows in Lookup's search and records within seconds, without waiting for the next sync. "Still correct?" only appears for a listing nobody has confirmed in the last 12 months. Every chosen church also gets **Report a problem** (closed, duplicate, moved) and a link to fix anything else on its Here's My Church page. Turn the offer off with `contribute="off"`, or cancel the `church-contribute` event to send changes yourself. ## Adding a missing church When nothing matches, the "Add it" link opens Here's My Church's add form with the typed name filled in. If someone fills in your form without picking a church, the widget offers to add it with the name, address and other details they typed. If it looks like a church already listed, it asks "Is it one of these?" first; picking one selects it, and **None of these** adds the new one. A church added this way goes live right away and the widget's value becomes its new ID. ## Attribution Church data from OpenStreetMap contributors (ODbL) and Here's My Church contributors. Search responses include this line as `attribution`; please show it near results you display yourself.