# Sun times at an airport

## Get sun times at an airport

<mark style="color:blue;">`GET`</mark> `https://api.aviowiki.com/airports/{aid}/sun`

This endpoint returns information about the sunrise and sunset times at an airport.

#### Path Parameters

| Name                                  | Type   | Description                           |
| ------------------------------------- | ------ | ------------------------------------- |
| aid<mark style="color:red;">\*</mark> | String | The AID of the airport being queried. |

#### Query Parameters

| Name  | Type    | Description                                                                                                                                                                            |
| ----- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| local | Boolean | <p><code>true</code> to request that the times in the response refer to the local time of the requested airport, <code>false</code> for UTC.<br>Default value: <code>false</code> </p> |
| date  | String  | <p>A date string in format YYYY-MM-DD to indicate for which local day the data should be returned.<br>If not set, the current local day will be returned.</p>                          |

#### Headers

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

{% tabs %}
{% tab title="200 The query ran successfully. " %}
{% tabs %}
{% tab title="Response properties" %}
All times returned are either with reference to the local time of the airport requested or to UTC, depending on the value of the request parameter `local`.

| Property     | Type    | Description                                                                             |
| ------------ | ------- | --------------------------------------------------------------------------------------- |
| `sunrise`    | String  | The date and time of the civil sunrise, in ISO 8601 format.                             |
| `sunset`     | String  | The date and time of the civil sunset, in ISO 8601 format.                              |
| `zenith`     | String  | The date and time when the sun will be at the highest point in the sky.                 |
| `nadir`      | String  | The date and time when the sun will be at the lowest point in the sky, hidden by Earth. |
| `alwaysUp`   | Boolean | `true` if the sun never sets on the `date` specified in the request.                    |
| `alwaysDown` | Boolean | `true` if the sun never rises on the `date` specified in the request.                   |
| {% endtab %} |         |                                                                                         |

{% tab title="Example response" %}

```json
{
  "sunrise": "2020-03-30T06:38:00",
  "sunset": "2020-03-30T19:31:00",
  "zenith": "2020-03-30T13:01:00",
  "nadir": "2020-03-30T01:01:00",
  "alwaysUp": false,
  "alwaysDown": false
}
```

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

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

```javascript
```

{% endtab %}
{% endtabs %}
