# Searching airports

## Search for airports using a text query or additional options and filters.

<mark style="color:blue;">`GET`</mark> `https://api.aviowiki.com/airports/search`

This endpoint allows you to conduct an airport search using a free-text query string. It further allows to restrict the search results to certain locations based on filters passed as query parameters.

#### Query Parameters

| Name                | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| query               | String  | The query string (name, city etc.) you want to look for.                                                                                                                                                                                                                                                                                                                                              |
| page                | Number  | The page number for pagination, starting from `0` to indicate the first page. Default: `0`                                                                                                                                                                                                                                                                                                            |
| size                | Number  | The number of results in a page, for pagination. Default: `10`                                                                                                                                                                                                                                                                                                                                        |
| types               | List    | <p>A comma-separated list of <a href="#undefined">airport</a> types to return. Possible options are <code>AIRPORT</code>, <code>HELIPORT</code>, <code>AIRSTRIP</code>, <code>WATER</code>.</p><p>If set it limits the returned locations to those with matching types in the <code>type</code> field.</p>                                                                                            |
| accepts             | List    | <p>A comma-separated list of the accepted types of traffic. Possible options are <code>SCHEDULED</code>, <code>NON\_SCHEDULED</code>, <code>GENERAL\_AVIATION</code>, <code>TRAINING</code>, <code>BUSINESS\_AVIATION</code>, <code>MILITARY</code>, <code>HELICOPTER</code>.</p><p>If set it limits the returned locations to those with matching types in the <code>accessibleFor</code> field.</p> |
| requiresPermission  | Boolean | <p>If set to <code>true</code>, returns locations that have any value in <code>nonScheduledPermission</code> except for <code>NONE</code> or <code>null</code>.</p><p>If set to <code>false</code>, returns location that have only <code>NONE</code> or <code>null</code> as <code>nonScheduledPermission</code>.</p>                                                                                |
| isVfr               | Boolean | <p>If set to <code>true</code>, returns locations that allow VFR traffic.</p><p>If set to <code>false</code>, returns locations that </p>                                                                                                                                                                                                                                                             |
| regions             | List    |                                                                                                                                                                                                                                                                                                                                                                                                       |
| country             | String  |                                                                                                                                                                                                                                                                                                                                                                                                       |
| countries           | List    |                                                                                                                                                                                                                                                                                                                                                                                                       |
| governingDistrict   | String  |                                                                                                                                                                                                                                                                                                                                                                                                       |
| minimumRunwayLength | Double  | <p>Minimum runway TORA the returned airports need to have. <br>If set, it limits the returned locations to those that have at least one runway with TORA at least <code>minimumRunwayLength</code>.</p>                                                                                                                                                                                               |
| maximumRunwayLength | Double  | <p>Maximum TORA the returned airports need to have. <br>If set, it limits the returned locations to those that's runways have TORA at most <code>maximumRunwayLength</code>.</p>                                                                                                                                                                                                                      |
| minimumRunwayWidth  | Double  | <p>Minimum runway width the returned airports need to have. <br>If set, it limits the returned locations to those that have at least one runway with width at least <code>minimumRunwayWidth</code>.</p>                                                                                                                                                                                              |
| maximumElevation    | Double  | <p>Maximum elevation the returned airports need to have.<br>If set, it limits the returned locations to those that have elevation at most <code>maximumElevation</code>.</p>                                                                                                                                                                                                                          |
| latitude            | Double  | Latitude of the reference point to search locations around.                                                                                                                                                                                                                                                                                                                                           |
| longitude           | Double  | Longitude of the reference point to search locations around.                                                                                                                                                                                                                                                                                                                                          |
| distance            | Double  | Maximum great circle distance in kilometers the returned locations need to be from the reference point set by the `latitude` and `longitude` parameters. Default: `100`                                                                                                                                                                                                                               |

#### Headers

| Name                                            | Type   | Description                              |
| ----------------------------------------------- | ------ | ---------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | An API Token using Bearer authorization. |

{% tabs %}
{% tab title="200: OK Paginated airport list" %}
Detailed properties of the pagination can be found at [pagination](https://docs.aviowiki.com/conventions/pagination "mention").&#x20;

Properties of the contained airports:

{% tabs %}
{% tab title="Response properties" %}

{% endtab %}

{% tab title="Example response" %}

```
{
	"page": {
		"number": 0,
		"size": 10,
		"totalPages": 1,
		"totalResults": 1
	},
	"content": [
		{
			"name": "John F. Kennedy International ",
			"country": {
				"iso2": "US",
				"iso3": "USA",
				"isoNumeric": 840,
				"name": "United States",
				"officialName": "United States of America",
				"localIdentifierName": null
			},
			"timeZone": "America/New_York",
			"aid": "APT-KS1J-8E0L",
			"coordinates": {
				"latitude": 40.6399278,
				"longitude": -73.7786944
			},
			"icao": "KJFK",
			"iata": "JFK",
			"localIdentifier": "JFK",
			"servedCityGoverningDistrict": {
				"code": "US-NY",
				"name": "New York",
				"administrativeType": "State"
			},
			"servedCity": "New York",
			"elevation": 3.96,
			"longestRunwayLength": 3800.25,
			"widestRunwayWidth": 60.96,
			"openingIndicator": "OPEN",
			"icon": "CIVIL",
			"distanceFromSearchCoordinates": null,
			"operationalStatus": null
		}
	]
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="403: Forbidden No API token was provided or it was invalid." %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Retrieve random airports

<mark style="color:blue;">`GET`</mark> `https://api.aviowiki.com/airports/search/random`

#### Query Parameters

| Name | Type   | Description                                                                     |
| ---- | ------ | ------------------------------------------------------------------------------- |
| page | Number | The page number for pagination, starting from \`0\` to indicate the first page. |
| size | Number | The number of results in a page, for pagination                                 |

#### Headers

| Name          | Type   | Description                              |
| ------------- | ------ | ---------------------------------------- |
| Authorization | String | An API Token using Bearer authorization. |

{% tabs %}
{% tab title="200: OK Paginated airport list" %}
{% tabs %}
{% tab title="Response properties" %}

{% endtab %}

{% tab title="Example response" %}

```
{
	"page": {
		"number": 0,
		"size": 1,
		"totalPages": 10000,
		"totalResults": 10000
	},
	"content": [
		{
			"name": "Rundu Airport",
			"country": {
				"iso2": "NA",
				"iso3": "NAM",
				"isoNumeric": 516,
				"name": "Namibia",
				"officialName": "Republic of Namibia",
				"localIdentifierName": null
			},
			"timeZone": "Africa/Windhoek",
			"aid": "APT-NYRI-716E",
			"coordinates": {
				"latitude": -17.9561111,
				"longitude": 19.7205556
			},
			"icao": "FYRU",
			"iata": "NDU",
			"localIdentifier": null,
			"servedCityGoverningDistrict": null,
			"servedCity": null,
			"aid": "APT-NYRI-716E",
			"elevation": 1106.0,
			"longestRunwayLength": 3354.0,
			"widestRunwayWidth": 30.0,
			"openingIndicator": "UNKNOWN",
			"icon": "OTHER",
			"distanceFromSearchCoordinates": null,
			"operationalStatus": null
		}
	]
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="403: Forbidden No API token was provided or it was invalid." %}

{% endtab %}
{% endtabs %}
