> For the complete documentation index, see [llms.txt](https://docs.cuoral.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cuoral.com/api-reference/customers/metrics/create-metric-definition.md).

# Create Metric Definition

POST /external/v1/external/v1/customers/metrics&#x20;

### Request&#x20;

#### Parameters

* None

#### Request Body (application/json)

| **Field**   | **Type** | **Description**                                                         | **Example**                          | **Required** |
| ----------- | -------- | ----------------------------------------------------------------------- | ------------------------------------ | ------------ |
| name        | `string` | The unique, human-readable name of the metric (e.g., 'Annual Revenue'). | `"ARR"`                              | Yes          |
| description | `string` | A detailed description of what the metric tracks.                       | `"Annual Recurring Revenue in USD."` | No           |
| data\_type  | `string` | The expected data type for the values of this metric.                   | `"NUMBER"`                           | Yes          |

Example Request Body:

```json
{
  "name": "Customer Tier",
  "description": "The service level tier the customer is subscribed to.",
  "data_type": "STRING"
}
```

***

### Responses&#x20;

#### Successful Response (201) (application/json)

Returns the newly created metric definition object.

| **Field**        | **Type**            | **Description**                                |
| ---------------- | ------------------- | ---------------------------------------------- |
| id               | `integer`           | The internal database ID of the definition.    |
| metric\_id       | `string`            | The unique external ID assigned to the metric. |
| name             | `string`            | The name of the metric.                        |
| description      | `string`            | The metric description.                        |
| data\_type       | `string`            | The expected data type.                        |
| organization\_id | `integer`           | The organization ID this metric belongs to.    |
| time\_created    | `string` (datetime) | Creation timestamp.                            |
| time\_updated    | `string` (datetime) | Last update timestamp.                         |

Example Response Body (201):

```json
{
  "id": 5,
  "metric_id": "METRIC-005",
  "name": "Customer Tier",
  "description": "The service level tier the customer is subscribed to.",
  "data_type": "STRING",
  "organization_id": 42,
  "time_created": "2025-11-27T10:06:09.459Z",
  "time_updated": "2025-11-27T10:06:09.459Z"
}
```

#### Validation Error (422) (application/json)

```json
{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cuoral.com/api-reference/customers/metrics/create-metric-definition.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
