> For the complete documentation index, see [llms.txt](https://multisource.gitbook.io/multisource-integration-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://multisource.gitbook.io/multisource-integration-api/integration/search-and-autocomplete.md).

# Search & Autocomplete

Enables a progressive search for individual elements (e.g. name, street) with the option to successively refine the results.

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="image">Cover image</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Autocomplete Test-GUI</strong></td><td>Try Autocomplete live.</td><td><a href="https://145843038-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaKvS0w0duT7N2oY0PNRV%2Fuploads%2FSDCtiAXgXGKx68XsOLsE%2Fautocomplete-test-gui.png?alt=media&amp;token=61e2c603-0c21-4c65-a232-10457156d1c4">autocomplete-test-gui.png</a></td><td><a href="https://developers.multisource.ch/tools/autocomplete.html">https://developers.multisource.ch/tools/autocomplete.html</a></td></tr></tbody></table>

## Authentication with API key

An API key is required to access the API.

* The API key is provided by us upon successful [onboarding](https://www.multisource.ch/en/autocomplete-start).
* The API key must be transmitted in the header with every request.

Example:&#x20;

{% code overflow="wrap" %}

```http
curl 'https://api.multisource.ch/v2/Search/AutoComplete?source=business&value=swisscom+directories' \
  --header 'Auth-Key: <API-KEY>'
```

{% endcode %}

## API Endpoint

## GET /search/autocomplete

>

```json
{"openapi":"3.0.1","info":{"title":"multisource•api","version":"v2"},"tags":[{"name":"Search"}],"servers":[{"url":"https://api.multisource.ch/v2","description":"Production - v2"}],"security":[{"auth-key":[]}],"components":{"securitySchemes":{"auth-key":{"type":"apiKey","description":"API Key required for authorized endpoints.","name":"auth-key","in":"header"}},"schemas":{"SearchOutputOfListOfOutputDataSearch":{"type":"object","properties":{"hitCount":{"type":"integer","format":"int32"},"resultCount":{"type":"integer","format":"int32"},"data":{"type":"array","items":{"$ref":"#/components/schemas/OutputDataSearch"}}}},"OutputDataSearch":{"type":"object","properties":{"dwhId":{"type":"string","nullable":true},"companyname":{"type":"string","nullable":true},"firstname":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"street":{"type":"string","nullable":true},"houseNumber":{"type":"string","nullable":true},"zip":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"category":{"type":"object","additionalProperties":{"type":"string"},"nullable":true},"email":{"type":"string"},"url":{"type":"string"},"phoneNumbers":{"type":"array","items":{"type":"string"},"nullable":true},"mobileNumbers":{"type":"array","items":{"type":"string"},"nullable":true}}}}},"paths":{"/search/autocomplete":{"get":{"tags":["Search"],"parameters":[{"name":"source","in":"query","required":true,"schema":{"type":"string"}},{"name":"value","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputDataSearch"}},"application/json":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputDataSearch"}},"text/json":{"schema":{"$ref":"#/components/schemas/SearchOutputOfListOfOutputDataSearch"}}}}}}}}}
```

## Parameters

<table><thead><tr><th width="130.1171875">Parameter</th><th width="110.0078125">Type</th><th width="500.01953125">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>source</code></td><td>string</td><td><p>Data source:</p><ul><li><code>consumer</code> (Private individuals)</li><li><code>business</code> (Companies)</li><li><code>geo</code> (Addresses)</li><li>Multiple sources can be combined, comma-separated: <code>consumer,business</code></li></ul></td><td><code>consumer,business</code></td></tr><tr><td><code>value</code></td><td>string</td><td>Search term or phrase – combinations of name, city, street possible.</td><td><code>Lara Graf Zürich</code></td></tr></tbody></table>

## Response Fields

### Root-Level Fields

<table><thead><tr><th width="145">Field</th><th width="88">Type</th><th width="290">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>hitCount</code></td><td>integer</td><td>Total number of matches in the database for the query</td><td><code>1</code></td></tr><tr><td><code>resultCount</code></td><td>integer</td><td>Number of entries actually returned in the <code>data</code> array</td><td><code>1</code></td></tr><tr><td><code>data</code></td><td>array</td><td>Array containing the found directory entries</td><td>see output fields below</td></tr></tbody></table>

### Output Fields

<table><thead><tr><th width="145">Field</th><th width="88">Type</th><th width="290">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>companyname</code></td><td>string</td><td>Company name for business entries</td><td><code>Swisscom Directories AG</code></td></tr><tr><td><code>firstname</code></td><td>string</td><td>First name for private individuals</td><td><code>Lara</code></td></tr><tr><td><code>name</code></td><td>string</td><td>Last name for private individuals</td><td><code>Graf</code></td></tr><tr><td><code>street</code></td><td>string</td><td>Street name</td><td><code>Förrlibuckstrasse</code></td></tr><tr><td><code>houseNumber</code></td><td>string</td><td>House number</td><td><code>62</code></td></tr><tr><td><code>zip</code></td><td>string</td><td> Postal code</td><td><code>8005</code></td></tr><tr><td><code>location</code></td><td>string</td><td>City or town name</td><td><code>Zürich</code></td></tr><tr><td><code>category</code></td><td>string</td><td><p>Category / industry</p><p>(multilingual: DE, FR, IT, EN)</p></td><td><p><code>"de": "Pizzakurier",</code></p><p><code>"en": "Pizza delivery",</code></p><p><code>"it": "Pizza consegne a domicilio",</code></p><p><code>"fr": Pizza livraison à domicile"</code></p></td></tr><tr><td><code>email</code></td><td>string</td><td>Email</td><td><code>info@abc.com</code></td></tr><tr><td><code>url</code></td><td>string</td><td>Website</td><td><code>www.multisource.ch</code></td></tr><tr><td><code>phoneNumbers</code></td><td>array</td><td>Array with one or more landline numbers</td><td><p><code>[</code></p><p><code>“*0800 123 456",</code></p><p><code>"*058 123 45 67"</code></p><p><code>]</code> </p></td></tr><tr><td><code>mobileNumbers</code></td><td>array</td><td>Array with one or more mobile numbers</td><td><p><code>[</code></p><p><code>“*079  123 45 67"</code></p><p><code>]</code></p></td></tr></tbody></table>

### Advertising block marker

Numbers returned with a leading asterisk (`*`) (e.g. `*0791234567`) are flagged with an advertising block. The subscriber has objected to their number being used for advertising purposes. The asterisk is currently part of the number string rather than a separate field – please account for this (parse it out) when processing the data.

* Information from the FDPIC: [Advertising and marketing](https://www.edoeb.admin.ch/en/advertising-marketing)
* Information from SECO: [Unsolicited advertising calls](https://www.seco.admin.ch/de/unerbetene-werbeanrufe) (only available in German, French and Italian)

## Metrics & Usage

**Monitor your usage** Use the `metrics/usage` endpoint to retrieve the number of requests sent and data elements returned for this module – broken down by time period. [**Learn more**](/multisource-integration-api/integration/metrics-and-usage.md)<br>
