---
title: "List data model sources"
method: GET
path: "/v2/dataModels/{dataModelId}/sources"
tags: ["Data models"]
---

# List data model sources

`GET /v2/dataModels/{dataModelId}/sources`

## Request

- Base URL: `https://api.sigmacomputing.com`
- URL: `https://api.sigmacomputing.com/v2/dataModels/{dataModelId}/sources`
- Auth: HTTP bearer

List data sources of a data model given the dataModelId. The response can be a dataset (deprecated), table, custom SQL element, or the data model document and specific elements used as a source.

  ### Usage notes
  - Retrieve the **dataModelId** by calling the [/v2/dataModels](https://help.sigmacomputing.com/reference/list-data-models) endpoint.

## Path parameters

- `dataModelId` string, required

## Query parameters

- `pageToken` string
- `pageSize` integer

## Response `200`

The response body.

- DataModelsListDataModelSourcesResponse200
  - `entries` V2DataModelsDataModelIdSourcesGetResponsesContentApplicationJsonSchemaEntriesItems[], required: Array of results returned by the endpoint
    - union
      - V2DataModelsDataModelIdSourcesGetResponsesContentApplicationJsonSchemaEntriesItems0
        - `type` 'data-model', required
        - `dataModelId` string, required
        - `elementIds` string[], required: IDs of elements that make up this data model’s sources.
        - `versionTagId` string
      - V2DataModelsDataModelIdSourcesGetResponsesContentApplicationJsonSchemaEntriesItems1
        - `type` 'dataset', required
        - `datasetId` string, required
      - V2DataModelsDataModelIdSourcesGetResponsesContentApplicationJsonSchemaEntriesItems2
        - `type` 'table', required
        - `tableId` string, required
      - V2DataModelsDataModelIdSourcesGetResponsesContentApplicationJsonSchemaEntriesItems3
        - `type` 'custom-sql', required
        - `connectionId` string, required: ID of the connection where the custom SQL element is run.
        - `definition` string, required: Raw SQL definition for the custom SQL element.
        - `customSqlId` string, required: Element ID of the custom SQL.
        - `customSqlSourceId` string, required: ID of the custom SQL source. (Beta)
  - `nextPageToken` string: A string that can be passed to the `pageToken` parameter in the next request to fetch the next page of results. Not present in the last page of results. **Must be treated as an opaque string.**

---

[API](https://skmtc.dev/sigmacomputing/apis/sigma-rest-api.md) - [All operations](https://skmtc.dev/sigmacomputing/apis/sigma-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/sigmacomputing/apis/sigma-rest-api/revisions/fb6036208c49?raw)
