Get the code representation of a data model
This endpoint returns a code representation of an existing data model, including metadata and contents. The response can be formatted as either JSON or YAML, and contains a data model’s pages, elements, columns, sources, and more. The representation can be used to store, copy, or modify the data model programmatically.
For more information on managing data models via the Sigma API, see Manage data models as code. For more information on using this endpoint, including an end-to-end example, see Get the code representation of a data model.
Usage notes
- To perform this operation, you must use API credentials owned by a user with Can view access to the data model.
- Retrieve the dataModelId by calling the /v2/dataModels endpoint. Invalid or nonexistent IDs return an error.
- The response includes the data sources, metadata, and relationships necessary to recreate the data model. The data itself is not included in the response.
- To create a new data model from code, use the /v2/dataModels/spec endpoint.
- To update an existing data model from code, use the /v2/dataModels/{dataModelId}/spec endpoint.
- The default format of the representation is JSON. To receive YAML, add the query parameter
?format=yamlor the headerAccept: application/yaml.
Usage scenarios
- Backup and restore: Developers can use this endpoint to programmatically back up data models and restore them if needed.
- Version control: Developers can use this endpoint to programmatically manage, update, and version control data models between several organizations or tenants.
- Administration: Administrators can use this endpoint to programmatically analyze and govern data models across an organization.
- Migration: Administrators can use this endpoint to programmatically migrate data models between organizations or tenants.
- Agentic workflows: Agents can use these endpoints to directly manage data model contents in code.
Authentication
Bearer authentication of the form Bearer <token>, where token is your auth token.
Path parameters
Query parameters
Response
Non-fatal issues found while reading the data model. Includes content that was dropped because it cannot be represented in code. Absent or empty when there are no issues.

