Amigo Metric API

The Metric API from Amigo — 7 operation(s) for metric.

OpenAPI Specification

amigo-metric-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amigo Account Metric API
  version: 0.1.0
servers:
- url: https://api.amigo.ai
- url: https://internal-api.amigo.ai
- url: https://api-eu-central-1.amigo.ai
- url: https://api-ap-southeast-2.amigo.ai
- url: https://api-ca-central-1.amigo.ai
security:
- Bearer-Authorization: []
  Bearer-Authorization-Organization: []
  Basic: []
tags:
- name: Metric
paths:
  /v1/{organization}/metric/{metric_id}/version/:
    post:
      tags:
      - Metric
      summary: Create a new version for a metric
      description: 'Create a new version for the given metric.


        #### Permissions:

        This endpoint requires the following permissions:

        * `Metric:ModifyMetric` for the metric to create a new version for.'
      operationId: create-metric-version
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: metric_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[a-f0-9]{24}$
          description: The ID of the metric to create a new version for.
          title: Metric Id
        description: The ID of the metric to create a new version for.
      - name: version
        in: query
        required: false
        schema:
          anyOf:
          - type: integer
            exclusiveMinimum: 0
          - type: 'null'
          description: The version number of the new metric version. If specified, this endpoint throws an error if the next version of the metric in the database doesn't equal to the value of this parameter.
          title: Version
        description: The version number of the new metric version. If specified, this endpoint throws an error if the next version of the metric in the database doesn't equal to the value of this parameter.
      - name: x-mongo-cluster-name
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 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.
          title: X-Mongo-Cluster-Name
        description: 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.
      - name: Sec-WebSocket-Protocol
        in: header
        required: false
        schema:
          type: array
          items:
            type: string
          default: []
          title: Sec-Websocket-Protocol
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/src__app__endpoints__metric__create_metric_version__Request'
      responses:
        '201':
          description: Succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/src__app__endpoints__metric__create_metric_version__Response'
        '404':
          description: Specified organization or metric is not found.
        '400':
          description: The metric value type cannot be changed between versions.
        '409':
          description: The next version of the metric in the database doesn't match the specified version.
        '422':
          description: Invalid request path parameter, request body, or request query parameter failed validation.
        '401':
          description: Invalid authorization credentials.
        '403':
          description: Missing required permissions.
        '503':
          description: The service is going through temporary maintenance.
        '429':
          description: The user has exceeded the rate limit of 60 requests per minute for this endpoint.
  /v1/{organization}/metric/{metric_id}/version:
    get:
      tags:
      - Metric
      summary: Get metric versions
      description: 'Retrieve the versions of a metric.


        #### Permissions

        This endpoint requires the following permissions:

        * `Metric:GetMetric` for the metric whose versions to retrieve.'
      operationId: get-metric-versions
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: metric_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[a-f0-9]{24}$
          description: The ID of the metric to retrieve versions for.
          title: Metric Id
        description: The ID of the metric to retrieve versions for.
      - name: version
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: The versions of the metric to retrieve. One can specify an exact version to retrieve, which is either the version number or `latest`, which retrieves the latest version. Alternatively, one can specify a range of inclusive lower and upper bound for the version number separated by `-`, and every version within the range would be retrieved.
          examples:
          - '1'
          - 1-latest
          - 2-5
          - latest
          title: Version
        description: The versions of the metric to retrieve. One can specify an exact version to retrieve, which is either the version number or `latest`, which retrieves the latest version. Alternatively, one can specify a range of inclusive lower and upper bound for the version number separated by `-`, and every version within the range would be retrieved.
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 10
          exclusiveMinimum: 0
          description: The maximum number of metric versions to return.
          default: 10
          title: Limit
        description: The maximum number of metric versions to return.
      - name: continuation_token
        in: query
        required: false
        schema:
          type: integer
          description: The continuation token from the previous request used to retrieve the next page of metric versions.
          default: 0
          title: Continuation Token
        description: The continuation token from the previous request used to retrieve the next page of metric versions.
      - name: sort_by
        in: query
        required: false
        schema:
          type: array
          items:
            type: string
          description: The fields to sort the versions by. Supported fields are `version`. Specify a `+` before the field name to indicate ascending sorting and `-` for descending sorting. Multiple fields can be specified to break ties.
          default: []
          title: Sort By
        description: The fields to sort the versions by. Supported fields are `version`. Specify a `+` before the field name to indicate ascending sorting and `-` for descending sorting. Multiple fields can be specified to break ties.
      - name: x-mongo-cluster-name
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 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.
          title: X-Mongo-Cluster-Name
        description: 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.
      - name: Sec-WebSocket-Protocol
        in: header
        required: false
        schema:
          type: array
          items:
            type: string
          default: []
          title: Sec-Websocket-Protocol
      responses:
        '200':
          description: Succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/src__app__endpoints__metric__get_metric_versions__Response'
        '404':
          description: Specified organization or metric is not found.
        '422':
          description: Invalid request path parameter or request query parameter failed validation.
        '401':
          description: Invalid authorization credentials.
        '403':
          description: Missing required permissions.
        '503':
          description: The service is going through temporary maintenance.
        '429':
          description: The user has exceeded the rate limit of 60 requests per minute for this endpoint.
  /v1/{organization}/metric/:
    post:
      tags:
      - Metric
      summary: Create a metric
      description: 'Create a metric.


        #### Permissions

        * `Metric:CreateMetric` for the metric to create.'
      operationId: create-metric
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: x-mongo-cluster-name
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 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.
          title: X-Mongo-Cluster-Name
        description: 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.
      - name: Sec-WebSocket-Protocol
        in: header
        required: false
        schema:
          type: array
          items:
            type: string
          default: []
          title: Sec-Websocket-Protocol
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/src__app__endpoints__metric__create_metric__Request'
      responses:
        '201':
          description: Succeeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/src__app__endpoints__metric__create_metric__Response'
        '409':
          description: A metric with this name already exists
        '404':
          description: Specified organization is not found.
        '422':
          description: Invalid request path parameter or request body failed validation.
        '401':
          description: Invalid authorization credentials.
        '403':
          description: Missing required permissions.
        '503':
          description: The service is going through temporary maintenance.
        '429':
          description: The user has exceeded the rate limit of 100 requests per minute for this endpoint.
    get:
      tags:
      - Metric
      summary: Get metrics
      description: '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.'
      operationId: get-metrics
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: id
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            type: string
            pattern: ^[a-f0-9]{24}$
          description: The IDs of the metrics to retrieve.
          default: []
          title: Id
        description: The IDs of the metrics to retrieve.
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 0
          description: The maximum number of metrics to return.
          default: 50
          title: Limit
        description: The maximum number of metrics to return.
      - name: continuation_token
        in: query
        required: false
        schema:
          type: integer
          description: The continuation token from the previous request used to retrieve the next page of metrics.
          default: 0
          title: Continuation Token
        description: The continuation token from the previous request used to retrieve the next page of metrics.
      - name: applied_to_service
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            type: string
            pattern: ^[a-f0-9]{24}$
          description: The IDs of the services that the metric is applied to.
          default: []
          title: Applied To Service
        description: The IDs of the services that the metric is applied to.
      - name: type
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            $ref: '#/components/schemas/MetricValueType'
          description: The types of the metrics.
          default: []
          title: Type
        description: The types of the metrics.
      - name: is_deleted
        in: query
        required: false
        schema:
          type: boolean
          description: Whether the metric is deleted.
          default: false
          title: Is Deleted
        description: Whether the metric is deleted.
      - name: creator
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            type: string
          description: The creators of the dynamic behavior sets.
          default: []
          title: Creator
        description: The creators of the dynamic behavior sets.
      - name: tag
        in: query
        required: false
        schema:
          type: array
          items:
            type: string
          description: The tags of the dynamic behavior sets. Must be specified using the syntax `key:value`, which means to match all sets 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: []
          title: Tag
        description: The tags of the dynamic behavior sets. Must be specified using the syntax `key:value`, which means to match all sets 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`.
      - name: sort_by
        in: query
        required: false
        schema:
          type: array
          items:
            type: string
          description: The fields to sort the sets 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: []
          title: Sort By
        description: The fields to sort the sets 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.
      - name: x-mongo-cluster-name
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 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.
          title: X-Mongo-Cluster-Name
        description: 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.
      - name: Sec-WebSocket-Protocol
        in: header
        required: false
        schema:
          type: array
          items:
            type: string
          default: []
          title: Sec-Websocket-Protocol
      responses:
        '200':
          description: Succeeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/src__app__endpoints__metric__get_metrics__Response'
        '404':
          description: Specified organization is not found.
        '422':
          description: Invalid request path parameter or request query parameter failed validation.
        '401':
          description: Invalid authorization credentials.
        '403':
          description: Missing required permissions.
        '503':
          description: The service is going through temporary maintenance.
        '429':
          description: The user has exceeded the rate limit of 20 requests per minute for this endpoint.
  /v1/{organization}/metric/{metric_id}/:
    post:
      tags:
      - Metric
      summary: Update a metric
      description: '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.'
      operationId: update-metric
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: metric_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[a-f0-9]{24}$
          description: The ID of the metric to update.
          title: Metric Id
        description: The ID of the metric to update.
      - name: x-mongo-cluster-name
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 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.
          title: X-Mongo-Cluster-Name
        description: 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.
      - name: Sec-WebSocket-Protocol
        in: header
        required: false
        schema:
          type: array
          items:
            type: string
          default: []
          title: Sec-Websocket-Protocol
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/src__app__endpoints__metric__update_metric__Request'
      responses:
        '200':
          description: Succeeded
          content:
            application/json:
              schema: {}
        '404':
          description: Specified organization or metric is not found.
        '422':
          description: Invalid request path parameter or request body failed validation.
        '401':
          description: Invalid authorization credentials.
        '403':
          description: Missing required permissions.
        '503':
          description: The service is going through temporary maintenance.
        '429':
          description: The user has exceeded the rate limit of 20 requests per minute for this endpoint.
    delete:
      tags:
      - Metric
      summary: Delete a metric
      description: 'Delete a metric. The metric is no longer modifiable or manually evaluable, but remains stored, and existing services or simulations that evaluate this metric

        will continue to do so. One can still retrieve it using its ID to view its specifics.


        #### Permissions

        This endpoint requires the following permissions:

        * `Metric:DeleteMetric` for the metric to delete.'
      operationId: delete-metric
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: metric_id
        in: path
        required: true
        schema:
          type: string
          pattern: ^[a-f0-9]{24}$
          description: The ID of the metric to update.
          title: Metric Id
        description: The ID of the metric to update.
      - name: x-mongo-cluster-name
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 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.
          title: X-Mongo-Cluster-Name
        description: 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.
      - name: Sec-WebSocket-Protocol
        in: header
        required: false
        schema:
          type: array
          items:
            type: string
          default: []
          title: Sec-Websocket-Protocol
      responses:
        '200':
          description: Succeeded.
          content:
            application/json:
              schema: {}
        '404':
          description: Specified organization or metric is not found.
        '400':
          description: Metric is used in a simulation unit test.
        '422':
          description: Invalid request path parameter failed validation.
        '401':
          description: Invalid authorization credentials.
        '403':
          description: Missing required permissions.
        '503':
          description: The service is going through temporary maintenance.
        '429':
          description: The user has exceeded the rate limit of 100 requests per minute for this endpoint.
  /v1/{organization}/metric/search/:
    get:
      tags:
      - Metric
      summary: Search metrics
      description: 'Search for metrics that match the given filters and contain the given query in its name. 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.'
      operationId: search-metrics
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: query
        in: query
        required: true
        schema:
          $ref: '#/components/schemas/amigo_lib__pydantic__base_model__StrippedNonemptyString__1'
          description: The query to search for. Any metrics containing the terms in its name would be returned.
        description: The query to search for. Any metrics containing the terms in its name would be returned.
      - name: applied_to_service
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            type: string
            pattern: ^[a-f0-9]{24}$
          description: The IDs of the services that the metric is applied to.
          default: []
          title: Applied To Service
        description: The IDs of the services that the metric is applied to.
      - name: type
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            $ref: '#/components/schemas/MetricValueType'
          description: The types of the metrics.
          default: []
          title: Type
        description: The types of the metrics.
      - name: creator
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            type: string
          description: The creators of the metrics. Each value must be of the format `org_id,user_id`.
          default: []
          title: Creator
        description: The creators of the metrics. Each value must be of the format `org_id,user_id`.
      - name: tag
        in: query
        required: false
        schema:
          type: array
          items:
            type: string
          description: '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: []
          title: Tag
        description: '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`.'
      - name: x-mongo-cluster-name
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 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.
          title: X-Mongo-Cluster-Name
        description: 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.
      - name: Sec-WebSocket-Protocol
        in: header
        required: false
        schema:
          type: array
          items:
            type: string
          default: []
          title: Sec-Websocket-Protocol
      responses:
        '200':
          description: Succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/src__app__endpoints__metric__search_metrics__Response'
        '404':
          description: Specified organization is not found.
        '422':
          description: Invalid request path parameter or request query parameter failed validation.
        '401':
          description: Invalid authorization credentials.
        '403':
          description: Missing required permissions.
        '503':
          description: The service is going through temporary maintenance.
        '429':
          description: The user has exceeded the rate limit of 20 requests per minute for this endpoint.
  /v1/{organization}/metric/evaluate:
    post:
      tags:
      - Metric
      summary: Evaluate metrics
      description: 'Evaluate the latest versions of specified metrics for a completed conversation. The results will be stored and retrievable through the [`GetMetricEvaluationResults`](get-metric-evaluation-results)

        endpoint with a special source type of `manual`.


        If the same conversation has been manually evaluated for the same metric, the previous evaluation result will be overwritten.


        #### Permissions

        This endpoint requires the following permissions:

        * `Metric:GetMetric` for the metrics.

        * `Metric:EvaluateMetric` for the metrics.

        * `Metric:GetMetricEvaluationResult` for the metric results.'
      operationId: evaluate-metrics
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: x-mongo-cluster-name
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 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.
          title: X-Mongo-Cluster-Name
        description: 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.
      - name: Sec-WebSocket-Protocol
        in: header
        required: false
        schema:
          type: array
          items:
            type: string
          default: []
          title: Sec-Websocket-Protocol
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/src__app__endpoints__metric__evaluate_metrics__Request'
      responses:
        '200':
          description: Succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/src__app__endpoints__metric__evaluate_metrics__Response'
        '404':
          description: Specified organization, conversation, or metric is not found.
        '422':
          description: Invalid request path parameter or request body failed validation.
        '400':
          description: The conversation has no interactions.
        '401':
          description: Invalid authorization credentials.
        '403':
          description: Missing required permissions.
        '503':
          description: The service is going through temporary maintenance.
        '429':
          description: The user has exceeded the rate limit of 50 requests per minute for this endpoint.
  /v1/{organization}/metric/metric_evaluation_result:
    get:
      tags:
      - Metric
      summary: Get metric evaluation results
      description: '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.'
      operationId: get-metric-evaluation-results
      parameters:
      - name: organization
        in: path
        required: true
        schema:
          type: string
          title: Organization
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 500
          minimum: 0
          description: The maximum number of metrics to return.
          default: 500
          title: Limit
        description: The maximum number of metrics to return.
      - name: continuation_token
        in: query
        required: false
        schema:
          type: integer
          description: The continuation token from the previous request used to retrieve the next page of metrics.
          default: 0
          title: Continuation Token
        description: The continuation token from the previous request used to retrieve the next page of metrics.
      - name: timestamp_after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: An ISO8601 timestamp. Only results evaluated on or after this moment is returned.
          title: Timestamp After
        description: An ISO8601 timestamp. Only results evaluated on or after this moment is returned.
      - name: timestamp_before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          description: An ISO8601 timestamp. Only results evaluated on or before this moment is returned.
          title: Timestamp Before
        description: An ISO8601 timestamp. Only results evaluated on or before this moment is returned.
      - name: metric_id
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            type: string
            pattern: ^[a-f0-9]{24}$
          description: The ID of the metric to retrieve.
          deprecated: true
          default: []
          title: Metric Id
        description: The ID of the metric to retrieve.
        deprecated: true
      - name: metric_id_and_version
        in: query
        required: false
        schema:
          type: array
          uniqueItems: true
          items:
            type: string
          description: The metric IDs and their versions to retrieve. Each value must be in the format of `<metric_id>-<version>`. If `version` is left empty, any versions of the metric would be retrieved.
          default: []
          title: Metric Id And Version
        description: The metric IDs and

# --- truncated at 32 KB (62 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/amigo/refs/heads/main/openapi/amigo-metric-api-openapi.yml