---
title: Specify a time range (v2)
source: https://docs.newrelic.com/docs/apis/rest-api-v2/basic-functions/specify-time-range-v2
---

You can specify a time range for the data to be returned in a New Relic REST API call. You can also request to [return an average](https://docs.newrelic.com/docs/apm/apis/requirements/calculating-average-metric-values-summarize) over the time range instead of the series of values returned by default.

## Change the default 30 minute time range [#api-call]

The default time range for an API call is the last 30 minutes. To modify the time range, include `from=` and optional `to=` values. (To end the time range at the current time, omit `to=`.)

> #### 💡 TIP
>
> Data availability is subject to the [data retention policy](https://docs.newrelic.com/docs/accounts-partnerships/accounts/account-maintenance/data-retention) for your subscription level.

**Example:**

```sh
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \ 
     -H "Api-Key:$API_KEY" -i \
     -d 'names[]=Agent/MetricsReported/count&from=2014-08-11T14:42:00+00:00&to=2014-08-11T15:12:00+00:00'
```

The time period returned for each data point depends on the [time range](https://docs.newrelic.com/docs/apm/apis/requirements/extracting-metric-data#time) you specify. To modify the time period, include the [period parameter](https://docs.newrelic.com/docs/apm/apis/requirements/extracting-metric-data#period) in your query.

If you are using the New Relic REST API Explorer (v2), you can use the diamond ![icon-api-diamond](https://docs.newrelic.com/images/apis-and-data_icon_REST-API-explorer-diamond.webp "icon-api-diamond") icon to select time ranges. If you have an [EU region account](https://docs.newrelic.com/docs/using-new-relic/welcome-new-relic/getting-started/introduction-eu-region-data-center), the above URL begins with `https://api.eu.newrelic.com`.

## Offset UTC [#utc]

By default the API time input uses Universal Time Coordinated (UTC). To offset the UTC, use plus or minus `00:00` in your API call. This allows you to input times in a different time zone; however, this **does not** modify the output times, which are always UTC.

-   For time zones east of UTC, use a minus sign (`-`). This symbol has no special meaning in HTTP or HTTPS requests.
-   For time zones west of UTC, use the encoded value `%2B` to indicate a plus sign (+).
-   If you have an [EU region account](https://docs.newrelic.com/docs/using-new-relic/welcome-new-relic/getting-started/introduction-eu-region-data-center), the following URLs begin with `https://api.eu.newrelic.com`.

**This API call shows a time zone east of UTC by 2 hours (`-02:00`)**

````sh
curl -X GET "https://api.newrelic.com/v2/applications/$APP_ID/metrics/data.json" \
     -H "Api-Key:$API_KEY" -i \
     -d 'names[]=Agent/MetricsReported/count&from=2014-08-11T14:42:00-02:00&to=2014-08-11T15:12:00-02:00'
```

````

**This API call shows a time zone west of UTC by +8 hours (`%2B08:00`)**

````sh
curl -X GET "https://api.newrelic.com/v2/applications/$APP_ID/metrics/data.json" \
     -H "Api-Key:$API_KEY" -i \
     -d 'names[]=Agent/MetricsReported/count&from=2014-08-11T14:42:00%2B08:00&to=2014-08-11T15:12:00%2B08:00
```

````
