---
title: "Evaluate an instant query"
description: "Evaluates a PromQL expression at one time. Prometheus HTTP API compatible: a Grafana Prometheus datasource's URL is the API host plus /v1/organizations/{orgId}/projects/{projectId}/obs/prometheus. Errors use Prometheus's error body (PrometheusError), with the platform's code. 422 is a query over one of its budgets (query_too_expensive, naming the budget) or one that can't be evaluated (query_failed); 429 is the organization's concurrent metric queries, or this service's capacity, with Retry-After. Reads every active dataset of the project the caller may query (obs.metrics.query); a selector's environment matcher narrows them."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Observability API

`GET /v1/organizations/{orgId}/projects/{projectId}/obs/prometheus/api/v1/query`

Evaluates a PromQL expression at one time. Prometheus HTTP API compatible: a Grafana Prometheus datasource's URL is the API host plus /v1/organizations/{orgId}/projects/{projectId}/obs/prometheus. Errors use Prometheus's error body (PrometheusError), with the platform's code. 422 is a query over one of its budgets (query_too_expensive, naming the budget) or one that can't be evaluated (query_failed); 429 is the organization's concurrent metric queries, or this service's capacity, with Retry-After. Reads every active dataset of the project the caller may query (obs.metrics.query); a selector's environment matcher narrows them.

## Authentication

Requires one of the following:

- `apiKey`, http, header `Authorization`
- `oauth`, http, header `Authorization`
- `sessionCookie`, apiKey, in cookie

## Path parameters

- `QueryMetrics.path.orgId` (string, required)
  - format `uuid`
- `QueryMetrics.path.projectId` (string, required)
  - format `uuid`

## Query parameters

- `QueryMetrics.query.query` (string, required) — The PromQL expression, at most 64 KiB.
- `QueryMetrics.query.time` (string, optional) — Evaluation time. A Unix timestamp in seconds (a float) or an RFC 3339 time. Defaults to now.
- `QueryMetrics.query.timeout` (string, optional) — Evaluation timeout, capped at the service's (30 s by default).
- `QueryMetrics.query.lookback_delta` (string, optional) — The lookback for instant vectors, 1s to 1h. Defaults to 5m.

## Code samples

### cURL

```curl
curl --request GET \
  --url 'https://obs.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/obs/prometheus/api/v1/query?query=string' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://obs.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/obs/prometheus/api/v1/query?query=string';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://obs.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/obs/prometheus/api/v1/query?query=string"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

The result: a vector, matrix, scalar or string.

#### Example

```json
{
  "data": {
    "result": [
      {
        "histograms": [
          [
            0,
            {
              "buckets": [
                []
              ],
              "count": "string",
              "sum": "string"
            }
          ]
        ],
        "metric": {
          "property1": "string",
          "property2": "string"
        },
        "values": [
          [
            0,
            "string"
          ]
        ]
      }
    ],
    "resultType": "matrix"
  },
  "infos": [
    "string"
  ],
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

- `QueryMetrics.response.200.data` (object, required)
  - `QueryMetrics.response.200.data.result` (one of, required) — matrix: PromSeries[]; vector: PromSample[]; scalar and string: a PromPoint.
    - one of: `array<unknown>`, `array<unknown>`, [PromPoint](/obs-api/schemas/PromPoint/)
  - `QueryMetrics.response.200.data.resultType` (string, required)
    - one of `"matrix"`, `"vector"`, `"scalar"`, `"string"`
- `QueryMetrics.response.200.status` (unknown, required)
- `QueryMetrics.response.200.infos` (array<string>, optional)
- `QueryMetrics.response.200.warnings` (array<string>, optional)

### 400

bad_data (invalid_request): a parameter, the query's syntax or the request body isn't valid.

#### Example

```json
{
  "budget": "string",
  "code": "string",
  "error": "string",
  "errorType": "string",
  "status": "error"
}
```

- `QueryMetrics.response.400.code` (string, required) — The platform's error code, as in every other EZGH Cloud API.
  - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
- `QueryMetrics.response.400.error` (string, required) — What went wrong, for people.
- `QueryMetrics.response.400.errorType` (string, required) — bad_data, unauthorized, forbidden, not_found, execution, timeout, unavailable or internal. Treat it as an open string.
- `QueryMetrics.response.400.status` (unknown, required)
- `QueryMetrics.response.400.budget` (string, optional) — query_too_expensive: the budget the query ran over.

### 401

unauthorized (unauthenticated): no credential, or one that doesn't check out.

#### Example

```json
{
  "budget": "string",
  "code": "string",
  "error": "string",
  "errorType": "string",
  "status": "error"
}
```

- `QueryMetrics.response.401.code` (string, required) — The platform's error code, as in every other EZGH Cloud API.
  - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
- `QueryMetrics.response.401.error` (string, required) — What went wrong, for people.
- `QueryMetrics.response.401.errorType` (string, required) — bad_data, unauthorized, forbidden, not_found, execution, timeout, unavailable or internal. Treat it as an open string.
- `QueryMetrics.response.401.status` (unknown, required)
- `QueryMetrics.response.401.budget` (string, optional) — query_too_expensive: the budget the query ran over.

### 403

forbidden (access_denied, forbidden_origin): the caller's policies don't allow the action, or a cookie-authenticated POST came from an origin that isn't allowed.

#### Example

```json
{
  "budget": "string",
  "code": "string",
  "error": "string",
  "errorType": "string",
  "status": "error"
}
```

- `QueryMetrics.response.403.code` (string, required) — The platform's error code, as in every other EZGH Cloud API.
  - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
- `QueryMetrics.response.403.error` (string, required) — What went wrong, for people.
- `QueryMetrics.response.403.errorType` (string, required) — bad_data, unauthorized, forbidden, not_found, execution, timeout, unavailable or internal. Treat it as an open string.
- `QueryMetrics.response.403.status` (unknown, required)
- `QueryMetrics.response.403.budget` (string, optional) — query_too_expensive: the budget the query ran over.

### 404

not_found (not_found): unknown, malformed, or in an organization the caller isn't in.

#### Example

```json
{
  "budget": "string",
  "code": "string",
  "error": "string",
  "errorType": "string",
  "status": "error"
}
```

- `QueryMetrics.response.404.code` (string, required) — The platform's error code, as in every other EZGH Cloud API.
  - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
- `QueryMetrics.response.404.error` (string, required) — What went wrong, for people.
- `QueryMetrics.response.404.errorType` (string, required) — bad_data, unauthorized, forbidden, not_found, execution, timeout, unavailable or internal. Treat it as an open string.
- `QueryMetrics.response.404.status` (unknown, required)
- `QueryMetrics.response.404.budget` (string, optional) — query_too_expensive: the budget the query ran over.

### 422

execution or timeout (query_too_expensive, with budget; query_failed): the query couldn't be evaluated within its limits.

#### Example

```json
{
  "budget": "string",
  "code": "string",
  "error": "string",
  "errorType": "string",
  "status": "error"
}
```

- `QueryMetrics.response.422.code` (string, required) — The platform's error code, as in every other EZGH Cloud API.
  - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
- `QueryMetrics.response.422.error` (string, required) — What went wrong, for people.
- `QueryMetrics.response.422.errorType` (string, required) — bad_data, unauthorized, forbidden, not_found, execution, timeout, unavailable or internal. Treat it as an open string.
- `QueryMetrics.response.422.status` (unknown, required)
- `QueryMetrics.response.422.budget` (string, optional) — query_too_expensive: the budget the query ran over.

### 429

unavailable (too_many_requests), with Retry-After.

#### Example

```json
{
  "budget": "string",
  "code": "string",
  "error": "string",
  "errorType": "string",
  "status": "error"
}
```

- `QueryMetrics.response.429.code` (string, required) — The platform's error code, as in every other EZGH Cloud API.
  - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
- `QueryMetrics.response.429.error` (string, required) — What went wrong, for people.
- `QueryMetrics.response.429.errorType` (string, required) — bad_data, unauthorized, forbidden, not_found, execution, timeout, unavailable or internal. Treat it as an open string.
- `QueryMetrics.response.429.status` (unknown, required)
- `QueryMetrics.response.429.budget` (string, optional) — query_too_expensive: the budget the query ran over.

### 500

internal (internal_error): a bug; the details are in the logs, under the request ID.

#### Example

```json
{
  "budget": "string",
  "code": "string",
  "error": "string",
  "errorType": "string",
  "status": "error"
}
```

- `QueryMetrics.response.500.code` (string, required) — The platform's error code, as in every other EZGH Cloud API.
  - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
- `QueryMetrics.response.500.error` (string, required) — What went wrong, for people.
- `QueryMetrics.response.500.errorType` (string, required) — bad_data, unauthorized, forbidden, not_found, execution, timeout, unavailable or internal. Treat it as an open string.
- `QueryMetrics.response.500.status` (unknown, required)
- `QueryMetrics.response.500.budget` (string, optional) — query_too_expensive: the budget the query ran over.

### 503

unavailable (unavailable): a dependency the request needs is down. Retry after Retry-After.

#### Example

```json
{
  "budget": "string",
  "code": "string",
  "error": "string",
  "errorType": "string",
  "status": "error"
}
```

- `QueryMetrics.response.503.code` (string, required) — The platform's error code, as in every other EZGH Cloud API.
  - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
- `QueryMetrics.response.503.error` (string, required) — What went wrong, for people.
- `QueryMetrics.response.503.errorType` (string, required) — bad_data, unauthorized, forbidden, not_found, execution, timeout, unavailable or internal. Treat it as an open string.
- `QueryMetrics.response.503.status` (unknown, required)
- `QueryMetrics.response.503.budget` (string, optional) — query_too_expensive: the budget the query ran over.


Source: https://docs.ezghcloud.com/obs-api/QueryMetrics/index.md
