# The figure of a named metric, as its approved version defines it

`POST /datasources/metrics/{name}/value` · Rivier · hosting

The figure of a named metric, as its approved version defines it: over a period, by day, week, month, quarter or year, broken down by its allowed dimensions, computed over the whole table.

- Scope: hosting:read
- Mcp: rivier_metric_value
- Graphql: Query.hostingMetricValue
- Sdk: hosting.metric.value
- Cli: hosting metric value

## Parameters

- `name` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "from": {
      "type": "string",
      "maxLength": 40,
      "description": "Start of the period (inclusive), a date or ISO time"
    },
    "to": {
      "type": "string",
      "maxLength": 40,
      "description": "End of the period (exclusive)"
    },
    "grain": {
      "type": "string",
      "enum": [
        "day",
        "week",
        "month",
        "quarter",
        "year"
      ]
    },
    "by": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z_][a-z0-9_]{0,62}$"
      },
      "maxItems": 3,
      "default": [],
      "description": "Dimensions to break the figure down by"
    },
    "version": {
      "type": "integer",
      "minimum": 1,
      "description": "A version other than the approved one; drafts are read by the project's own people only"
    }
  },
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/datasources/metrics/{name}/value' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "from": "string",
  "to": "string",
  "grain": "day",
  "by": [],
  "version": 0
}'
```
