# Finding a business

> Look up one organization by name, website or pasted URL, and read score and match.

Source: https://api.tailend.dev/docs/finding-a-business

This page is for anyone who needs to look up one organization, for example an
app where a provider says "this is my business". People type a business as a
name, as a website address, or with a slightly different spelling, and all of
those should find it.

```bash
curl -sS -H "X-API-Key: $TAILEND_API_KEY" --get https://api.tailend.dev/v1/philadelphia/organizations \
  --data-urlencode "q=designgym.com" \
  --data-urlencode "limit=5"
```

```javascript
const res = await fetch(
  "https://api.tailend.dev/v1/philadelphia/organizations?q=" + encodeURIComponent("design gym"),
  { headers: { "X-API-Key": process.env.TAILEND_API_KEY } },
);
const { data } = await res.json();
console.log(data[0].name, data[0].score, data[0].match);
```

```json
{
  "data": [
    {
      "id": "a158148a-52d4-4ea3-a6b9-0c830ddc6768",
      "name": "designgym.co",
      "website_url": "https://www.designgym.co",
      "score": 0.94,
      "match": "domain"
    }
  ]
}
```

(Other fields are omitted above.) One request is enough. You do not need to try
several spellings.

## What `q` understands

- **Casing, punctuation and spacing do not matter.** `Design Gym`, `design-gym`
  and `DESIGN GYM` are the same search.
- **Endings are set aside**, on both sides of the comparison: `LLC`, `Inc`,
  `The`, `& Co`, and address endings such as `.com`, `.co`, `.org`, `.net`,
  `.io` and `.us`. `designgym.com` finds an organization named `designgym.co`.
- **Spaces do not matter.** `design gym` finds `designgym`, and the other way
  round.
- **A website address or pasted URL works.** `designgym.com`,
  `https://www.designgym.com/classes` and `www.designgym.com` all search by the
  address. An organization is found by its own website whether or not
  `website_url` is filled in.
- **A small typo still finds it.** `desing gym` finds `designgym`.
- **Part of a name works too.** `gym` finds organizations with `gym` in their
  name, ranked below closer matches. A very short fragment is not searched as a
  part of a name, and a near miss never ranks above a name that contains what
  you typed.
- **Words like `the`, `and` or `co` are not a search.** A query made only of
  those, or only of endings such as `llc` or `.com`, returns an empty list with
  a `meta.hint` saying so.
- **Pages on shared platforms do not identify a business.** A social page, a
  booking widget, a link-in-bio page or a website builder address is never an
  `exact_domain`, so one provider's page cannot be mistaken for another's.

Only organizations with a live listing in the metro are searched.

## Reading the result

Every result carries two fields when you send `q`:

| Field | Meaning |
| --- | --- |
| `score` | 0 to 1, higher is closer. It is the same for one organization whatever else is returned, so you can show it as a confidence. |
| `match` | How it was found. |

`match` is one of:

| `match` | What was found |
| --- | --- |
| `exact_name` | The whole name was typed (ignoring casing and punctuation). |
| `exact_domain` | The whole website address was typed (the host, ignoring `www.`). |
| `name` | The same words as the name once spelling, spacing and endings are set aside, or the start, or a word, of the name. |
| `domain` | The same, for a website address. |
| `fuzzy` | A small typo away. |

Results are ordered best first, then by name. `page`, `limit` and `cursor` work
as they do everywhere else; see [Pagination](https://api.tailend.dev/docs/pagination.md).

A good rule for "is this my business": treat `exact_name` and `exact_domain` as
a confident match, `name` and `domain` with a high `score` as a likely one worth
confirming with the person, and `fuzzy` as a suggestion. A `domain` match on a
different ending (`acme.org` for `acme.com`) is a suggestion to confirm, not a
confirmation, and so is the same registered domain on another host. An empty list means we
found nothing close, which is also worth telling the person.

## Website address

`website_url` is the organization's own website. When none is recorded, it is
the address of the site the organization itself runs, if we have one. It stays
`null` when there is nothing trustworthy to show.
