ReferenceAPIApps

Prometheus

Prometheus API methods, requests, and responses for RawTree Cloud and RawTree BYOC.

Prometheus

Install the Prometheus app first. Queries need read permission. Remote write needs write permission.

The service exposes Prometheus remote write and query-compatible endpoints under /prometheus/api/v1. The Prometheus app must be installed on the target cluster before any endpoint in this group can be used. See the Prometheus guide for configuration and supported endpoints.

Query parameters

GET methods accept URL parameters. POST methods accept URL parameters plus a form or JSON body. Use --data-urlencode for PromQL expressions and repeated match[] selectors.

MethodsParameters
/queryRequired query. Optional time selects the evaluation instant
/query_rangeRequired query, start, end, and step
/labels, /label/{label_name}/values, /seriesOptional match[], start, and end. /series requires at least one selector
/metadataOptional metric filters the metric name
/status/buildinfoNo query parameters beyond authentication scope

Timestamps accept Unix seconds or RFC 3339. Range steps accept seconds or supported duration strings. The service implements a PromQL subset. See Prometheus for supported expressions and limits. Errors use the Prometheus response envelope with status: "error", errorType, and error.

GET /prometheus/api/v1/query

Read Prometheus query.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus query.
curl -X GET "https://api.rawtree.com/prometheus/api/v1/query?database=analytics&query=up" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": []
  }
}

POST /prometheus/api/v1/query

Read Prometheus query.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus query.
curl -X POST "https://api.rawtree.com/prometheus/api/v1/query?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY" \
  --data-urlencode 'query=up'

Expected response: HTTP 200.

{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": []
  }
}

GET /prometheus/api/v1/query_range

Read Prometheus query_range.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus query_range.
curl -X GET "https://api.rawtree.com/prometheus/api/v1/query_range?database=analytics&query=up&start=1794214800&end=1794218400&step=60" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": {
    "resultType": "matrix",
    "result": []
  }
}

POST /prometheus/api/v1/query_range

Read Prometheus query_range.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus query_range.
curl -X POST "https://api.rawtree.com/prometheus/api/v1/query_range?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY" \
  --data-urlencode 'query=up' \
  --data-urlencode 'start=1794214800' \
  --data-urlencode 'end=1794218400' \
  --data-urlencode 'step=60'

Expected response: HTTP 200.

{
  "status": "success",
  "data": {
    "resultType": "matrix",
    "result": []
  }
}

GET /prometheus/api/v1/labels

Read Prometheus labels.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus labels.
curl -X GET "https://api.rawtree.com/prometheus/api/v1/labels?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": []
}

POST /prometheus/api/v1/labels

Read Prometheus labels.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus labels.
curl -X POST "https://api.rawtree.com/prometheus/api/v1/labels?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": []
}

GET /prometheus/api/v1/label/{label_name}/values

Read the values for a Prometheus label.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read the values for a Prometheus label.
curl -X GET "https://api.rawtree.com/prometheus/api/v1/label/job/values?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": []
}

POST /prometheus/api/v1/label/{label_name}/values

Read the values for a Prometheus label.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read the values for a Prometheus label.
curl -X POST "https://api.rawtree.com/prometheus/api/v1/label/job/values?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": []
}

GET /prometheus/api/v1/series

Read Prometheus series.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus series.
curl -X GET "https://api.rawtree.com/prometheus/api/v1/series?database=analytics&match%5B%5D=up" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": []
}

POST /prometheus/api/v1/series

Read Prometheus series.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus series.
curl -X POST "https://api.rawtree.com/prometheus/api/v1/series?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY" \
  --data-urlencode 'match[]=up'

Expected response: HTTP 200.

{
  "status": "success",
  "data": []
}

GET /prometheus/api/v1/metadata

Read Prometheus metadata.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus metadata.
curl -X GET "https://api.rawtree.com/prometheus/api/v1/metadata?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": {}
}

GET /prometheus/api/v1/status/buildinfo

Read Prometheus status/buildinfo.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Read Prometheus status/buildinfo.
curl -X GET "https://api.rawtree.com/prometheus/api/v1/status/buildinfo?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY"

Expected response: HTTP 200.

{
  "status": "success",
  "data": {
    "version": "0.1.0",
    "revision": "rawtree",
    "branch": "rawtree",
    "buildUser": "rawtree",
    "buildDate": "",
    "goVersion": ""
  }
}

Remote write payload

Prometheus remote write uses a Snappy-compressed Protobuf WriteRequest. Configure your Prometheus exporter with the remote write guide. The file in the HTTP example is a captured exporter payload. JSON is not a remote write format. A successful write returns 204 with no body. Unsupported or malformed payloads return an error.

POST /prometheus/api/v1/write

Write Prometheus samples.

Use an API key, a permitted workload token, or a user bearer token. Database-role keys support only the operations listed in Authentication.

Request:

# Send a Snappy-compressed Prometheus WriteRequest from your exporter.
curl -X POST "https://api.rawtree.com/prometheus/api/v1/write?database=analytics" \
  -H "Authorization: Bearer $RAWTREE_API_KEY" \
  -H "Content-Type: application/x-protobuf" \
  -H "Content-Encoding: snappy" \
  -H "X-Prometheus-Remote-Write-Version: 0.1.0" \
  --data-binary @write-request.snappy

Expected response: HTTP 204.

The response body is empty.