# Graphite Render API

Contents

* [Graphite Render API](https://docs.hostedgraphite.com/api-guides/graphite-render-api)
  * [Render Endpoint](#render-endpoint)
  * [Examples](#examples)

With the Graphite Render API, you can:

* View raw metric data outside of your primary dashboards.
* Apply functions to your metric data.
* Search for data within a specific or relative time frame.
* Retrieve the data in different display formats.
* Use Graphite [Access Keys](https://docs.hostedgraphite.com/account-management/access-keys) to integrate metric data into external tools or services.

### [Render Endpoint](#render-endpoint)

## Render endpoint

<mark style="color:blue;">`GET`</mark> `/YOUR-UID/ACCESS-KEY/graphite/render?target=`

To integrate Hosted Graphite data externally, [Create an Access Key](https://docs.hostedgraphite.com/account-management/access-keys) to authorize render requests. Copy the key URL and add `/render?target=`

#### Path Parameters

| Name                                     | Type   | Description                                                                                                                                                                                                                                                  |
| ---------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| target<mark style="color:red;">\*</mark> | String | This parameter specifies the path to identify one or more metrics,  supports wildcards (\*), and can be used with [Data Views](https://docs.hostedgraphite.com/additional-features/data-views).                                                              |
| from/to                                  | String | These parameters accept relative or absolute times (or both). Relative Time is the length of time from the current time and is always preceded by a minus sign (-). If no time parameters are specified, the default values are `from=now-24h` and `to=now`. |
| \&format=png                             | String | Renders a graph as a 330×250 px png (default option, if the \&format parameter is left unspecified).                                                                                                                                                         |
| \&format=svg                             | String | Renders a graph as a 330×250 px svg.                                                                                                                                                                                                                         |
| \&format=raw                             | String | Line-delimited output. (target, start timestamp, end timestamp, step, data)                                                                                                                                                                                  |
| \&format=csv                             | String | Creates a CSV file to download (metric, date/time, value)                                                                                                                                                                                                    |
| \&format=json                            | String | Returns a JSON object.                                                                                                                                                                                                                                       |

{% tabs %}
{% tab title="200 " %}
OK
{% endtab %}

{% tab title="403" %}
Forbidden Invalid
{% endtab %}
{% endtabs %}

The accepted units of time are:

| Abbreviation | Unit            |
| ------------ | --------------- |
| s            | Seconds         |
| min          | Minutes         |
| h            | Hours           |
| d            | Days            |
| w            | Weeks           |
| mon          | Month (30 Days) |
| y            | Year (365 Days) |

### [Examples](#examples)

Using the **sample** metric `foo.bar`, below are some example queries and outputs:

```
https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=foo.bar&from=now-30min
```

<figure><img src="https://495119770-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZtHmoGZNsmARIViZEdbz%2Fuploads%2FsnbR1nPFmEm6HpbP3Kog%2Fdefault-render.png?alt=media&#x26;token=35a47f7a-5c36-4579-bbf7-6d4495f6efb5" alt="" width="331"><figcaption><p>Default png render</p></figcaption></figure>

```
https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=alias(foo.bar,"Uptime")&from=now-30min
```

<figure><img src="https://495119770-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZtHmoGZNsmARIViZEdbz%2Fuploads%2F6c6OjsOVSEpWlvjNHxFQ%2Faliased-metric.png?alt=media&#x26;token=0c7dd57b-2fed-40ef-bf06-31bfec2e2c2f" alt="" width="331"><figcaption><p>Render with aliased metric</p></figcaption></figure>

```
https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=foo.bar&from=now-30min&format=json
```

<figure><img src="https://495119770-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZtHmoGZNsmARIViZEdbz%2Fuploads%2FHrcQrAuJjdY05EsITnMf%2Frender-json.png?alt=media&#x26;token=9f28345d-4af9-4280-bde9-e71c0378bb1d" alt="" width="375"><figcaption><p>Render as json</p></figcaption></figure>

**Curl Example:**

```
curl -X GET "https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=foo.bar&from=now-30min&format=json"
```

For more information about building queries and customizing outputs, visit the [Graphite Render Docs](https://graphite.readthedocs.io/en/latest/render_api.html).
