---
title: "Get metric SQL model"
method: GET
path: "/api/v2/experiments/metric-sql-models/{metric_sql_model_id}"
tags: ["Experiments"]
---

# Get metric SQL model

`GET /api/v2/experiments/metric-sql-models/{metric_sql_model_id}`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/experiments/metric-sql-models/{metric_sql_model_id}`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token` scopes: `product_analytics_metrics_read`
- TypeScript: <https://skmtc.dev/datadog/apis/datadog-api-v2-collection/docs/api/v2/experiments/metric-sql-models/:metric_sql_model_id/get.ts> (a function with typed inputs; its response is checked against the schema)

Get a metric SQL model. Returns a single model by its ID for the organization, including its subject types, measures and properties.

## Path parameters

- `metric_sql_model_id` string, uuid, required: The UUID of the metric SQL model.

## Query parameters

- `include` string[]: Optional fields to include. Repeat this parameter to request several fields. `counts` adds metric_count and experiment_count.

## Response `200`

OK

- ExperimentsMetricSQLModelV2DTO: Response containing the metric SQL model.
  - `data` ExperimentsMetricSQLModelV2DTOData, required: JSON:API resource containing the metric SQL model identity and fields.
    - `attributes` ExperimentsMetricSQLModelV2DTODataAttributes: Details of the metric SQL model.
      - `certified_at` string, date-time, nullable: Time when this resource was certified.
      - `created_at` string, date-time: Time when this resource was created.
      - `date_partition_column` string, nullable: SQL column used to partition the source data by date.
      - `description` string, nullable: Text that explains the metric SQL model.
      - `event_count_measure_id` string: Read-only measure ID. Pass it as warehouse_metric_measure.id when the metric operation is count.
      - `experiment_count` integer, nullable: Number of experiments that reference this resource.
      - `is_certified` boolean: Whether this resource has been certified.
      - `measures` ExperimentsMetricSQLModelV2DTODataAttributesMeasuresItems[]: Measures available from the SQL model's result columns.
        - `column_name` string: Name of the SQL result column that supplies this measure.
        - `column_type` 'STRING' | 'INTEGER' | 'FLOAT' | 'BOOLEAN' | 'DATE' | 'TIMESTAMP': Data type of a column in the SQL model.
        - `description` string: Text that explains the measure.
        - `id` string: ID of the measure.
        - `migration_metadata` unknown
        - `name` string: Display name of the measure.
      - `metric_count` integer, nullable: Number of metrics that use this SQL model.
      - `migration_metadata` unknown
      - `name` string: Display name of the metric SQL model.
      - `properties` ExperimentsMetricSQLModelV2DTODataAttributesMeasuresItems[]: Property columns exposed by the SQL model.
        - `column_name` string: Name of the SQL result column that supplies this measure.
        - `column_type` 'STRING' | 'INTEGER' | 'FLOAT' | 'BOOLEAN' | 'DATE' | 'TIMESTAMP': Data type of a column in the SQL model.
        - `description` string: Text that explains the measure.
        - `id` string: ID of the measure.
        - `migration_metadata` unknown
        - `name` string: Display name of the measure.
      - `sql` string: SQL query that produces the model's source data.
      - `subject_types` ExperimentsMetricSQLModelV2DTODataAttributesSubjectTypesItems[]: Subject types mapped to columns in the SQL model.
        - `column_name` string: Name of the SQL result column that identifies subjects of this type.
        - `subject_type_id` string: ID of the subject type used by this configuration.
        - `unique_subject_count_measure_id` string: Read-only measure ID. Pass it as warehouse_metric_measure.id when the metric operation is `uniqueSubjects`.
      - `timestamp_column` string: SQL column that supplies the event timestamp.
      - `updated_at` string, date-time: Time when this resource was last updated.
    - `id` string, uuid, required: ID of the metric SQL model.
    - `type` 'metric-sql-models', required: Metric SQL models resource type.

## Other responses

- `400`: Malformed metric SQL model ID (not a valid UUID), or unknown include value.
- `401`: Missing or invalid authentication.
- `403`: Authenticated caller lacks the product_analytics_metrics_read permission.
- `404`: No metric SQL model with this ID exists for the organization.
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/3f70db624329?raw)
