# Create views

URL: https://docs.hanzo.ai/docs/openapi/o11y/post-o11y-explorer-views

> Saves a new explorer view for the caller's org and returns its id.

`POST /v1/o11y/explorer/views`

> [O11y →](https://docs.hanzo.ai/docs/openapi/o11y) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                               |
| ------------- | --------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/o11y/explorer/views` |
| **Method**    | `POST`                                        |
| **Operation** | `post_o11y_explorer_views`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`        |

Saves a new explorer view for the caller's org and returns its
id.

Callers need the editor role; the runtime's own gate enforces it.

## Request

90 fields, body `application/json` (required).

| Field                                                          | In   | Type                   | Required | Description                                                                                               |
| -------------------------------------------------------------- | ---- | ---------------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `category`                                                     | body | string                 | —        |                                                                                                           |
| `compositeQuery`                                               | body | o11y.v3.CompositeQuery | —        |                                                                                                           |
| `compositeQuery.builderQueries`                                | body | object                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*`                              | body | o11y.BuilderQuery      | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.IsAnomaly`                    | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.QueriesUsedInFormula`         | body | string\[]              | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.ShiftBy`                      | body | integer (int64)        | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.aggregateAttribute`           | body | o11y.AttributeKey      | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.aggregateAttribute.dataType`  | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.aggregateAttribute.isColumn`  | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.aggregateAttribute.isJSON`    | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.aggregateAttribute.key`       | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.aggregateAttribute.type`      | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.aggregateOperator`            | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.dataSource`                   | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.disabled`                     | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.expression`                   | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters`                      | body | o11y.FilterSet         | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items`                | body | o11y.FilterItem\[]     | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items[].key`          | body | o11y.AttributeKey      | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items[].key.dataType` | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items[].key.isColumn` | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items[].key.isJSON`   | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items[].key.key`      | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items[].key.type`     | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items[].op`           | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.items[].value`        | body | any                    | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.filters.op`                   | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.functions`                    | body | o11y.Function\[]       | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.functions[].args`             | body | any\[]                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.functions[].name`             | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.functions[].namedArgs`        | body | object                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.functions[].namedArgs.*`      | body | any                    | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.groupBy`                      | body | o11y.AttributeKey\[]   | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.groupBy[].dataType`           | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.groupBy[].isColumn`           | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.groupBy[].isJSON`             | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.groupBy[].key`                | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.groupBy[].type`               | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.having`                       | body | o11y.Having\[]         | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.having[].columnName`          | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.having[].op`                  | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.having[].value`               | body | any                    | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.legend`                       | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.limit`                        | body | integer (uint64)       | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.offset`                       | body | integer (uint64)       | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.orderBy`                      | body | o11y.OrderBy\[]        | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.orderBy[].columnName`         | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.orderBy[].order`              | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.pageSize`                     | body | integer (uint64)       | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.queryName`                    | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.reduceTo`                     | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.selectColumns`                | body | o11y.AttributeKey\[]   | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.selectColumns[].dataType`     | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.selectColumns[].isColumn`     | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.selectColumns[].isJSON`       | body | boolean                | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.selectColumns[].key`          | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.selectColumns[].type`         | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.seriesAggregation`            | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.spaceAggregation`             | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.stepInterval`                 | body | integer (int64)        | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.temporality`                  | body | string                 | —        |                                                                                                           |
| `compositeQuery.builderQueries.*.timeAggregation`              | body | string                 | —        |                                                                                                           |
| `compositeQuery.chQueries`                                     | body | object                 | —        |                                                                                                           |
| `compositeQuery.chQueries.*`                                   | body | o11y.DatastoreQuery    | —        |                                                                                                           |
| `compositeQuery.chQueries.*.disabled`                          | body | boolean                | —        |                                                                                                           |
| `compositeQuery.chQueries.*.legend`                            | body | string                 | —        |                                                                                                           |
| `compositeQuery.chQueries.*.query`                             | body | string                 | —        |                                                                                                           |
| `compositeQuery.fillGaps`                                      | body | boolean                | —        | FillGaps is used to fill the gaps in the time series data                                                 |
| `compositeQuery.panelType`                                     | body | string                 | —        |                                                                                                           |
| `compositeQuery.promQueries`                                   | body | object                 | —        |                                                                                                           |
| `compositeQuery.promQueries.*`                                 | body | o11y.PromQuery         | —        |                                                                                                           |
| `compositeQuery.promQueries.*.disabled`                        | body | boolean                | —        |                                                                                                           |
| `compositeQuery.promQueries.*.legend`                          | body | string                 | —        |                                                                                                           |
| `compositeQuery.promQueries.*.query`                           | body | string                 | —        |                                                                                                           |
| `compositeQuery.promQueries.*.stats`                           | body | string                 | —        |                                                                                                           |
| `compositeQuery.queries`                                       | body | o11y.QueryEnvelope\[]  | —        |                                                                                                           |
| `compositeQuery.queries[].spec`                                | body | any                    | —        | Spec is the deferred decoding of the query if any.                                                        |
| `compositeQuery.queries[].type`                                | body | any                    | —        | Type is the type of the query.                                                                            |
| `compositeQuery.queryType`                                     | body | string                 | —        |                                                                                                           |
| `compositeQuery.unit`                                          | body | string                 | —        | Unit for the time series data shown in the graph This is used in alerts to format the value and threshold |
| `createdAt`                                                    | body | string (date-time)     | —        |                                                                                                           |
| `createdBy`                                                    | body | string                 | —        |                                                                                                           |
| `extraData`                                                    | body | string                 | —        | ExtraData is JSON encoded data used by frontend to store additional data                                  |
| `id`                                                           | body | any                    | —        |                                                                                                           |
| `name`                                                         | body | string                 | —        |                                                                                                           |
| `sourcePage`                                                   | body | string                 | —        |                                                                                                           |
| `tags`                                                         | body | string\[]              | —        |                                                                                                           |
| `updatedAt`                                                    | body | string (date-time)     | —        |                                                                                                           |
| `updatedBy`                                                    | body | string                 | —        |                                                                                                           |

## Response

| Status    | Body                        | Meaning           |
| --------- | --------------------------- | ----------------- |
| `200`     | o11y.O11ySavedViewCreateOut | ok                |
| `202`     | Approval                    | held for approval |
| `default` | problem-details             | refused           |

`200` body — 2 fields.

| Field    | In   | Type   | Always | Description                |
| -------- | ---- | ------ | ------ | -------------------------- |
| `data`   | body | any    | —      | Data is the new view's id. |
| `status` | body | string | —      | Status is "success".       |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo o11y explorer views create
```

**SDK**

**.ts**

```ts
import { Configuration, O11yApi } from 'hanzoai';

const api = new O11yApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postO11yExplorerViews({ category: "<category>", compositeQuery: {"builderQueries":{},"chQueries":{},"fillGaps":false,"panelType":"<panelType>"} });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import O11yApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = O11yApi(client).post_o11y_explorer_views(category="<category>", composite_query={"builderQueries":{},"chQueries":{},"fillGaps":false,"panelType":"<panelType>"})
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.O11yAPI.PostO11yExplorerViews(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, o11y_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = o11y_api::post_o11y_explorer_views(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.O11yApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new O11yApi(client).postO11yExplorerViews();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/o11y/explorer/views \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "category": "<category>",
       "compositeQuery": {
         "builderQueries": {},
         "chQueries": {},
         "fillGaps": false,
         "panelType": "<panelType>"
       }
     }'
```

**MCP**

MCP reaches **o11y** through the `o11y` tool, which names its 307 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_o11y_autocomplete_aggregate_attributes"
         }
       }
     }'
```

---

[O11y API](https://docs.hanzo.ai/docs/openapi/o11y) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
