V1/metric

Get metrics

get

Retrieve metrics that match the given filters.

Permissions

This endpoint may be impacted by the following permissions:

  • Only metrics that the authenticated user has Metric:GetMetric permission for will be retrieved.

Authorizations
Path parameters
organizationstringRequired
Query parameters
idstring[]Optional

The ID of the metric to retrieve.

Default: []
limitinteger · max: 50Optional

The maximum number of metrics to return.

Default: 50
continuation_tokenintegerOptional

The continuation token from the previous request used to retrieve the next page of metrics.

Default: 0
applied_to_servicestring[]Optional

The IDs of the services that the metric is applied to.

Default: []
is_deletedbooleanOptional

Whether the metric is deleted.

Default: false
creatorstring[]Optional

The creators of the metrics. Each value must be of the format org_id,user_id.

Default: []
tagstring[]Optional

The tags of the metrics. Must be specified using the syntax key:value, which means to match all metrics with the given key and value pair among its tags. If value is *, it means the value does not matter. If value is empty, it matches against when the value is None.

Default: []
sort_bystring[]Optional

The fields to sort the metrics by. Supported fields are updated_at. Specify a + before the field name to indicate ascending sorting and - for descending sorting. Multiple fields can be specified to break ties.

Default: []
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Responses
200
Succeeded
application/json
get
GET /v1/{organization}/metric/ HTTP/1.1
Host: api.amigo.ai
Authorization: Bearer JWT
Accept: */*
{
  "metrics": [
    {
      "id": "text",
      "org_id": "text",
      "name": "text",
      "description": "text",
      "applied_to_services": [
        "text"
      ],
      "additional_notes": "text",
      "tags": [
        {
          "key": "text",
          "value": "text"
        }
      ],
      "created_at": "2025-06-24T20:29:50.244Z",
      "creator": {
        "org_id": "text",
        "user_id": "text"
      },
      "updated_at": "2025-06-24T20:29:50.244Z",
      "updated_by": {
        "org_id": "text",
        "user_id": "text"
      },
      "metric_value": {
        "type": "text"
      },
      "is_deleted": true
    }
  ],
  "has_more": true,
  "continuation_token": null,
  "filter_values": {
    "applied_to_services_ids": [
      "text"
    ],
    "creators": [
      {
        "org_id": "text",
        "user_id": "text"
      }
    ],
    "tags": [
      "text"
    ],
    "types": [
      "text"
    ]
  }
}

Create a metric

post

Create a metric.

Permissions

  • Metric:CreateMetric for the metric to create.

Authorizations
Path parameters
organizationstringRequired
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Body
namestring · min: 1Required

The name of the metric. Must be unique within the organization.

descriptionstring · min: 1Required

The description of the metric.

applied_to_servicesstring[]Required

The services that the metric is applied to.

additional_notesany ofRequired

Additional notes about the metric.

string · min: 1Optional
or
nullOptional
metric_valueone ofRequired
or
or
Responses
201
Succeeded
application/json
post
POST /v1/{organization}/metric/ HTTP/1.1
Host: api.amigo.ai
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 198

{
  "name": "text",
  "description": "text",
  "applied_to_services": [
    "text"
  ],
  "additional_notes": "text",
  "tags": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  },
  "metric_value": {
    "type": "text",
    "lower_bound": 1,
    "upper_bound": 1
  }
}
{
  "id": "text"
}

Update a metric

post

Update properties of a metric. The metric's name and metric values cannot be updated.

Permissions

This endpoint requires the following permissions:

  • Metric:ModifyMetric for the metric to modify.

Authorizations
Path parameters
organizationstringRequired
metric_idstringRequired

The ID of the metric to update.

Pattern: ^[a-f0-9]{24}$
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Body
descriptionany ofOptional

The description of the metric. Only updated if set.

string · min: 1Optional
or
nullOptional
applied_to_servicesany ofOptional

The services that the metric is applied to. Only updated if set.

string[]Optional
or
nullOptional
additional_notesany ofOptional

Additional notes about the metric. Only updated if set.

Default: {}
string · min: 1Optional
or
object · _NotSetOptional

A specific type to indicate that a field is not set in the request.

or
nullOptional
tagsany ofOptional

The tags of the metric. Only updated if set.

or
nullOptional
Responses
200
Succeeded
application/json
Responseany
post
POST /v1/{organization}/metric/{metric_id}/ HTTP/1.1
Host: api.amigo.ai
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 121

{
  "description": "text",
  "applied_to_services": [
    "text"
  ],
  "additional_notes": "text",
  "tags": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  }
}

No content

Delete a metric

delete

Delete a metric. The metric is no longer modifiable or usable, but remains in the database. One can still retrieve it using its ID to view metrics that were evaluated in previous conversations.

This endpoint will error if the metric is used in any simulation unit tests.

Permissions

This endpoint requires the following permissions:

  • Metric:DeleteMetric for the metric to delete.

Authorizations
Path parameters
organizationstringRequired
metric_idstringRequired

The ID of the metric to update.

Pattern: ^[a-f0-9]{24}$
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Responses
200
Succeeded.
application/json
Responseany
delete
DELETE /v1/{organization}/metric/{metric_id}/ HTTP/1.1
Host: api.amigo.ai
Authorization: Bearer JWT
Accept: */*

No content

get

Search for metrics that match the given filters and contain the given query in its name or description. Only the top 50 results will be returned. The results will be sorted by the relevance of the search query.

Permissions

This endpoint may be impacted by the following permissions:

  • Only metrics that the authenticated user has Metric:GetMetric permission for will be retrieved.

Authorizations
Path parameters
organizationstringRequired
Query parameters
querystring · min: 1Required

The query to search for. Any metrics containing the terms in its name and description would be returned.

applied_to_serviceany ofOptional

The IDs of the services that the metric is applied to.

string[]Optional
or
nullOptional
typeany ofOptional

The types of the metrics.

or
nullOptional
creatorany ofOptional

The creators of the metrics. Each value must be of the format org_id,user_id.

string[]Optional
or
nullOptional
tagany ofOptional

The tags of the metrics. Must be specified using the syntax key:value, which means to match all metrics with the given key and value pair among its tags. If value is *, it means the value does not matter. If value is empty, it matches against when the value is None.

string[]Optional
or
nullOptional
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Responses
200
Succeeded.
application/json
get
GET /v1/{organization}/metric/search/ HTTP/1.1
Host: api.amigo.ai
Authorization: Bearer JWT
Accept: */*
{
  "metrics": [
    {
      "_id": "text",
      "org_id": "text",
      "name": "text",
      "description": "text",
      "applied_to_services": [
        "text"
      ],
      "additional_notes": "text",
      "tags": [
        {
          "key": "text",
          "value": "text"
        }
      ],
      "created_at": "2025-06-24T20:29:50.244Z",
      "creator": {
        "org_id": "text",
        "user_id": "text"
      },
      "updated_at": "2025-06-24T20:29:50.244Z",
      "updated_by": {
        "org_id": "text",
        "user_id": "text"
      },
      "metric_value": {
        "type": "text"
      },
      "is_deleted": true
    }
  ]
}

Evaluate metrics

post

Evaluate the specified metrics for the given conversation, optionally up to the specified interaction.

Permissions

This endpoint requires the following permissions:

  • Metric:EvaluateMetric for the metrics.

  • Metric:GetMetricEvaluationResult for the metric results.

Authorizations
Path parameters
organizationstringRequired
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Body
metric_idsstring[] · min: 1 · max: 10Required

The IDs of the metrics to evaluate.

conversation_idstringRequired

The ID of the conversation to evaluate the metrics for.

Pattern: ^[a-f0-9]{24}$
evaluate_to_interaction_idany ofOptional

If specified, only messages up to (and including) this interaction will be evaluated.

stringOptionalPattern: ^[a-f0-9]{24}$
or
nullOptional
Responses
200
Succeeded.
application/json
post
POST /v1/{organization}/metric/evaluate HTTP/1.1
Host: api.amigo.ai
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 84

{
  "metric_ids": [
    "text"
  ],
  "conversation_id": "text",
  "evaluate_to_interaction_id": "text"
}
{
  "metrics": [
    {
      "metric_id": "text",
      "name": "text",
      "value": 1,
      "references": [
        "text"
      ],
      "justification": "text"
    }
  ]
}

Get metric evaluation results

get

Retrieve metric evaluation results that match the given filters.

Permissions

This endpoint may be impacted by the following permissions:

  • Only metric evaluation results that the authenticated user has Metric:GetMetricEvaluationResult permission for will be retrieved.

Authorizations
Path parameters
organizationstringRequired
Query parameters
limitinteger · max: 100Optional

The maximum number of metrics to return.

Default: 100
continuation_tokenintegerOptional

The continuation token from the previous request used to retrieve the next page of metrics.

Default: 0
timestamp_afterany ofOptional

An ISO8601 timestamp. Only results evaluated on or after this moment is returned.

string · date-timeOptional
or
nullOptional
timestamp_beforeany ofOptional

An ISO8601 timestamp. Only results evaluated on or before this moment is returned.

string · date-timeOptional
or
nullOptional
metric_idstring[]Optional

The ID of the metric to retrieve.

Default: []
conversation_idstring[]Optional

For metric evaluation sources with type post-session or manual, this field filters the metric evaluation results to only include those that were computed from the given conversation IDs.

Default: []
simulation_unit_test_set_run_idstring[]Optional

For metric evaluation sources with type simulation, this field filters the metric evaluation results to only include those that were computed from the given simulation unit test set run IDs.

Default: []
sort_bystring[]Optional

The fields to sort the metrics by. Supported fields are timestamp. Specify a + before the field name to indicate ascending sorting and - for descending sorting. Multiple fields can be specified to break ties.

Default: []
Header parameters
x-mongo-cluster-nameany ofOptional

The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.

stringOptional
or
nullOptional
Responses
200
Succeeded
application/json
get
GET /v1/{organization}/metric/metric_evaluation_result HTTP/1.1
Host: api.amigo.ai
Authorization: Bearer JWT
Accept: */*
{
  "metric_evaluation_results": [
    {
      "id": "text",
      "org_id": "text",
      "timestamp": "2025-06-24T20:29:50.244Z",
      "metric_id": "text",
      "result": 1,
      "justification": "text",
      "source": {
        "type": "post-session",
        "conversation_id": "text",
        "references": [
          "text"
        ]
      }
    }
  ],
  "has_more": true,
  "continuation_token": null,
  "filter_values": {
    "metric_ids": [
      "text"
    ]
  }
}

Was this helpful?