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

# Retrieving Metric By Name

> Retrieve a specific metric by its name.

> [!WARNING]
>
> You are reading the docs of Galtea 5.19. [Read this page in the latest version](https://docs.galtea.ai/sdk/api/metric/get-by-name.md).

## Returns

Returns a [Metric](https://docs.galtea.ai/v5.19/concepts/metric.md) object for the given metric name.

## Example

```python theme={"system"}
metric = galtea.metrics.get_by_name(name=metric_name)
```

## Parameters

**name** `string` *required*

The name of the metric you want to retrieve.

## How a name is resolved

The platform looks for the name in two steps:

1. A metric whose name it is. The call returns that metric's active revision.
2. Only when no metric you can see holds the name: an active revision saved under that name as its own.

A revision can keep its own name after its metric is renamed. In that case the returned `name` is the revision's own name, so it can differ from the name you asked for. Do not compare the returned `name` with the name you passed.

> [!TIP]
>
> Names can change. When you have a metric's ID, call [`galtea.metrics.get`](https://docs.galtea.ai/v5.19/sdk/api/metric/get) instead.

## Errors

| Error | Cause |
| - | - |
| `EntityNotFoundException` | No metric and no active revision carries that name. Import it with `from galtea import EntityNotFoundException`. |
| `AmbiguousMetricNameException` | No metric holds the name, and more than one active revision carries it as its own name. The API answers 409. Import it with `from galtea import AmbiguousMetricNameException`, then call [`galtea.metrics.get`](https://docs.galtea.ai/v5.19/sdk/api/metric/get) with the ID of the metric you mean. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.