# Search phone prefix

`POST https://api.foxentry.com/phone/search`

Foxentry will list all phone prefixes matching your query. This can be used to implement a simple autocomplete. Pay attention to the client section in the request body. You can specify the user's location in order to receive more relevant suggestions.

## Headers

| Header | Value |
|---|---|
| `Api-Version` | `2.1` or `2.0` |
| `Authorization` | `Bearer <your API key>` |
| `Content-Type` | `application/json` |

## Request body

### request.query

Parameters you want to validate or search for.

| Field | Type | Description |
|---|---|---|
| `value` | string |  |

### request.options

Options that change how the endpoint behaves.

| Field | Type | Description |
|---|---|---|
| `resultsLimit` | number | Limits number of results returned by the endpoint. |
| `allowedPrefixes` | array[string] | List of allowed prefixes. If not provided, all prefixes are allowed. |

### request.client

Information about your user, to make results more relevant.

| Field | Type | Description |
|---|---|---|
| `ip` | string |  |
| `country` | string | Country code in ISO-3166-1 alpha-2 format. |
| `location.lat` | number | Client's latitude |
| `location.lon` | number | Client's longitude |

### Example

```json
{
  "request": {
    "query": {
      "value": "+42"
    },
    "options": {
      "resultsLimit": 5
    },
    "client": {
      "country": "CZ",
      "location": {
        "lat": 50.0628,
        "lon": 13.9271
      }
    }
  }
}
```

## Responses

- `200` Successful response. Examples: `searchResults`
- `400` Bad Request
- `401` Unauthorized
- `402` Payment Required
- `403` Forbidden
- `404` Not Found
- `405` Method Not Allowed
- `429` Too Many Requests
- `500` Internal Server Error
- `503` Service Unavailable
