<!-- block-id: lead -->

## Ultraviolet index (beta)

Access UV index (Clear Sky) for any location on Earth! Data is available in JSON.

NOTE: Documentation for older version is available [here](/api_uv.md).

NOTE: The tool that we provide for accessing the API is new and has not seen much testing from users or developers. We are using the Beta phase to collect feedback on this tool and make changes to make it as intuitive and easy to use as we can. If you try out the tool, please leave your feedback [here](https://home.openweathermap.org/questions) – it is very important to help us remove the 'Beta' label from these features.

NOTE: This service is only available to subscribers. API key usage is mandatory. Please register [here](https://home.openweathermap.org) in order to receive an API key.

<!-- block-id: urlformat -->

## URL format

```text
http://api.openweathermap.org/v3/uvi/{location}/{datetime}.json?appid={api_key}
```

`location`  Location coordinates

`datetime` ISO 8601 date or alias

`api_key` Your API key

<!-- block-id: locformat -->

## Location format

- Location format is `{lat},{lon}`.
- Accuracy of coordinates affects maximum distance for search among available data entries around specified location. More digits beyond decimal point means shorter search distance.

> Please note that currently geocoordinates should be specified with the following digits(2,7,25,75) after decimal point in any order.The data is not obtained, if other digits are specified. See examples below:
>
> `api.openweathermap.org/v3/uvi/40.7,-74.2/2017Z.json?appid={your-api-key}`
>
> `api.openweathermap.org/v3/uvi/40.25,-74.75/2017Z.json?appid={your-api-key}`

### Digits beyond decimal point to search radius

**No decimal part**  - ~78km

**1 digit** - 7862 m

**2 digits** - 786 m

**3 digits** - 78 m

**4 digits** - 8 m

**5 digits** - 1 m

Examples:
[`http://api.openweathermap.org/v3/uvi/40.7,-74.2/2016-03-01Z.json?appid={your-api-key}`](http://samples.openweathermap.org/v3/uvi/40.7,-74.2/2016-12-31T12:00:00Z.json?appid=b1b15e88fa797225412429c1c50c122a1) 1 digit (~78km)

[`http://api.openweathermap.org/v3/uvi/40.700,-74.2/2016-03-01Z.json?appid={your-api-key}`](http://samples.openweathermap.org/v3/uvi/40.7,-74.2/2016-12-31T12:00:00Z.json?appid=b1b15e88fa797225412429c1c50c122a1) 3 digits (78m)

<!-- block-id: dateformat -->

## Date format

Date can be specified using either of two specifications.

### ISO 8601

- Searches for the latest available point within specified date (see examples below).

All dates are UTC-only. Using local time zones is not supported at the moment.

**Date values**

`2016-01-02T15:04:05Z` searches between `2016-01-02T15:04:05Z` and `2016-01-02T15:04:05.9999Z`

`2016-01-02T15:04Z` searches between `2016-01-02T15:04:00Z` and `2016-01-02T15:04:59.9999Z`

`2016-01-02T15Z` searches between `2016-01-02T15:00:00Z` and `2016-01-02T15:59:59.9999Z`

`2016-01-02Z` searches between `2016-01-02T00:00:00Z` and `2016-01-02T23:59:59.9999Z`

`2016-01Z` searches between `2016-01-01T00:00:00Z` and `2016-12-31T23:59:59.9999Z`

`2016Z` searches between `2016-01-01T00:00:00Z` and `2016-12-31T23:59:99.9999Z`

**NOTE:** currently, the data is only provided provided for 12:00:00 a.m. So, please specify time values as following format:

`2017-01-02T12:00:00Z`

`2017-01-02T12:00Z`

`2017-01-02T12Z`

### Examples

- [http://api.openweathermap.org/v3/uvi/40.7,-74.2/2016-01-02T15:04:05Z.json?appid={your-api-key}](http://samples.openweathermap.org/v3/uvi/40.7,-74.2/2016-12-31T12:00:00Z.json?appid=b1b15e88fa797225412429c1c50c122a1)
- [http://api.openweathermap.org/v3/uvi/40.7,-74.2/2016Z.json?appid={your-api-key}](http://samples.openweathermap.org/v3/uvi/40.7,-74.2/2016Z.json?appid=b1b15e88fa797225412429c1c50c122a1)

**NOTE:** data is not cut off at the current date and time. If search request falls into the future, furthermost forecast data available will be displayed.

### Alias

- A keyword bound to a certain date.

### Available aliases

**current**  Searches for the latest available data point up until now

[http://api.openweathermap.org/v3/uvi/40.7,-74.2/current.json?appid={your-api-key}](http://samples.openweathermap.org/v3/uvi/40.7,-74.2/current.json?appid=b1b15e88fa797225412429c1c50c122a1)

<!-- block-id: responseformat -->

## Server response format

`time`  **ISO 8601 timestamp** - date and time corresponding to returned data

`location`  **object** - location for which data is provided

`latitude` **float** - latitude for returned data

`longitude` **float** - longitude for returned data

`data` **float** - [ultraviolet index](https://en.wikipedia.org/wiki/Ultraviolet_index)

### Example of API response

```json
{
    "time": "2016-03-03T12:00:00Z",
    "location": {
                    "latitude": 40.75,
                    "longitude": -74.25
                },
    "data": 3.11
}
```