---
title: "List metric SQL models"
method: GET
path: "/api/v2/experiments/metric-sql-models"
tags: ["Experiments"]
---

# List metric SQL models

`GET /api/v2/experiments/metric-sql-models`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/experiments/metric-sql-models`
- 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/get.ts> (a function with typed inputs; its response is checked against the schema)

List metric SQL models. Returns a paginated list of the SQL models that metrics are defined on for the organization.

## Query parameters

- `include` string[]: Optional fields to include. Repeat this parameter to request several fields. `counts` adds metric_count and experiment_count, which cost an extra aggregate query.
- `page[limit]` integer: Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links.
- `page[offset]` integer: Number of results to skip for pagination. Defaults to 0 when omitted.
- `sort` string: Sort field: name, created_at, updated_at, metric_count, or experiment_count. A single field only; a comma-separated list is rejected. Prefix with `-` for descending (for example, `-created_at`). Defaults to created_at descending.

## Response `200`

OK

- ExperimentsMetricSQLModelV2DTOArray: List of metric SQL model resources with pagination information.
  - `data` ExperimentsMetricSQLModelV2DTOData[], required: Resources returned in this response.
    - `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.
  - `links` ExperimentsOffsetLinks: Links for navigating a paginated result set.
    - `first` string: URL of the first page of results.
    - `last` string: URL of the last page of results.
    - `next` string: URL of the next page of results.
    - `prev` string: URL of the previous page of results.
    - `self` string: URL of the current page of results.
  - `meta` ExperimentsOffsetMeta: Pagination information for a list response.
    - `page` ExperimentsOffsetMetaPage: Result counts and offsets for a page of results.
      - `first_offset` integer: Offset of the first page of results.
      - `last_offset` integer, nullable: Offset of the last page of results.
      - `limit` integer: Maximum number of results returned in one page.
      - `next_offset` integer, nullable: Offset of the next page of results.
      - `offset` integer: Number of results skipped before this page.
      - `prev_offset` integer, nullable: Offset of the previous page of results.
      - `total` integer, nullable: Total number of matching results across all pages.
      - `type` string: Pagination method used for this result set.

## Other responses

- `400`: Invalid query parameter: bad page[offset]/page[limit], unknown sort field, or unknown include value.
- `401`: Missing or invalid authentication (dd-api-key + dd-application-key headers, or a valid user session).
- `403`: Authenticated caller lacks the product_analytics_metrics_read permission.
- `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)
