# /autocomplete API (v0.2)

This document outlines the usage of the Autocomplete API route, which allows for suggesting search terms based on partial input.

Endpoint

| Method | URL                                                   |
| ------ | ----------------------------------------------------- |
| GET    | https\://{identifier}.search.abtasty.com/autocomplete |

Query Parameters

All request data is sent as URL query parameters.

| Parameter       | Type    | Description                                             | Required | Example |
| --------------- | ------- | ------------------------------------------------------- | -------- | ------- |
| query           | string  | The partial string for which suggestions are requested. | Yes      | a       |
| hits\_per\_page | integer | The maximum number of suggestions to return.            | No       | 5       |

Response Body

The response body is a JSON object with the following property:

| Property    | Type             | Description                                                        |
| ----------- | ---------------- | ------------------------------------------------------------------ |
| suggestions | array of objects | An array of objects, where each object contains a text suggestion. |

## Suggestions Object Structure

Each object in the suggestions array has the following structure:

| Property | Type   | Description                          |
| -------- | ------ | ------------------------------------ |
| text     | string | The text of the proposed suggestion. |

Example Request and Response

## Request

```http
GET https://search-api.abtasty.com/autocomplete?client_id={clientId}&query=a&hits_per_page=5
```

## Response

```json
{
  "suggestions": [
    {
      "text": "brosse a cheveux"
    },
    {
      "text": "baume à levre"
    },
    {
      "text": "rouge à lèvres"
    },
    {
      "text": "baume à lèvres"
    },
    {
      "text": "brosse a dent"
    }
  ]
}
```
