> For the complete documentation index, see [llms.txt](https://hexpandify.gitbook.io/hexpandify-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hexpandify.gitbook.io/hexpandify-docs/api-docs/metric-definitions.md). Agents can also search and read this documentation through its [MCP server](https://hexpandify.gitbook.io/hexpandify-docs/~gitbook/mcp).

# Metric Definitions

## POST /api/v1/hex/metrics/definitions

> Process metric definitions

```json
{"openapi":"3.0.0","info":{"title":"Hexpandify API - Metric Definitions","version":"1.0.0"},"servers":[{"url":"http://app.hexpandify.com","description":"Production server"},{"url":"http://localhost:8080","description":"Local development"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"MetricDefinitionsInput":{"type":"object","required":["hex_metric_config"],"properties":{"hex_metric_config":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/MetricDefinition"},"description":"Map of metric definitions where key is the metric name"}}},"MetricDefinition":{"type":"object","properties":{"metricName":{"type":"string","maxLength":250,"description":"Name of the metric (will be converted to lowercase)"},"description":{"type":"string","description":"Metric description"},"metricType":{"type":"string","enum":["NUMBER","STRING"],"default":"NUMBER","description":"Type of metric data"},"aggType":{"type":"string","enum":["NONE","SUM","AVG","MIN","MAX"],"default":"NONE","description":"Aggregation type for the metric"},"fillStrategy":{"type":"string","enum":["LAST_VALUE","ZERO"],"default":"LAST_VALUE","description":"Strategy for filling missing values"},"unit":{"type":"string","maxLength":50,"default":"","description":"Unit of measurement"},"displayType":{"type":"string","enum":["VALUE","STARS","PERCENTAGE","PROGRESS"],"default":"VALUE","description":"How to display the metric"},"serieType":{"type":"string","enum":["normal","local_min","local_max","local_target","center","internal"],"default":"normal","description":"Type of time series"},"visibility":{"type":"string","enum":["PRIVATE","PUBLIC","OBFUSCATED"],"default":"PRIVATE","description":"Visibility level"}}}}},"paths":{"/api/v1/hex/metrics/definitions":{"post":{"summary":"Process metric definitions","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricDefinitionsInput"}}}},"responses":{"200":{"description":"Definitions processed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"count":{"type":"integer"},"definitions":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/MetricDefinition"}}}}}}}}}}}}
```

## GET /api/v1/hex/metrics/definitions

> Get metric definitions

```json
{"openapi":"3.0.0","info":{"title":"Hexpandify API - Metric Definitions","version":"1.0.0"},"servers":[{"url":"http://app.hexpandify.com","description":"Production server"},{"url":"http://localhost:8080","description":"Local development"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"MetricDefinition":{"type":"object","properties":{"metricName":{"type":"string","maxLength":250,"description":"Name of the metric (will be converted to lowercase)"},"description":{"type":"string","description":"Metric description"},"metricType":{"type":"string","enum":["NUMBER","STRING"],"default":"NUMBER","description":"Type of metric data"},"aggType":{"type":"string","enum":["NONE","SUM","AVG","MIN","MAX"],"default":"NONE","description":"Aggregation type for the metric"},"fillStrategy":{"type":"string","enum":["LAST_VALUE","ZERO"],"default":"LAST_VALUE","description":"Strategy for filling missing values"},"unit":{"type":"string","maxLength":50,"default":"","description":"Unit of measurement"},"displayType":{"type":"string","enum":["VALUE","STARS","PERCENTAGE","PROGRESS"],"default":"VALUE","description":"How to display the metric"},"serieType":{"type":"string","enum":["normal","local_min","local_max","local_target","center","internal"],"default":"normal","description":"Type of time series"},"visibility":{"type":"string","enum":["PRIVATE","PUBLIC","OBFUSCATED"],"default":"PRIVATE","description":"Visibility level"}}}}},"paths":{"/api/v1/hex/metrics/definitions":{"get":{"summary":"Get metric definitions","responses":{"200":{"description":"List of metric definitions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MetricDefinition"}}}}}}}}}}
```

## PUT /api/v1/hex/metrics-definitions/rename

> Rename metric definition

```json
{"openapi":"3.0.0","info":{"title":"Hexpandify API - Metric Definitions","version":"1.0.0"},"servers":[{"url":"http://app.hexpandify.com","description":"Production server"},{"url":"http://localhost:8080","description":"Local development"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}}},"paths":{"/api/v1/hex/metrics-definitions/rename":{"put":{"summary":"Rename metric definition","parameters":[{"name":"metricName","in":"query","required":true,"schema":{"type":"string"},"description":"Current metric name"},{"name":"newName","in":"query","required":true,"schema":{"type":"string"},"description":"New metric name"}],"responses":{"200":{"description":"Metric renamed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"}}}}}}}}}}}
```
