Create a data model from a code representation
This endpoint creates a new data model in Sigma from a code representation. Use it to programmatically define and create data models that are then accessible from the Sigma UI.
For more information on managing data models via the Sigma API, see [Manage data models as code](https://help.sigmacomputing.com/docs/manage-data-models-as-code). For more information on using this endpoint, including an end-to-end example, see [Create a data model from a code representation](https://help.sigmacomputing.com/docs/create-a-data-model-from-a-code-representation).
### Usage notes
- To perform this operation, you must use API credentials owned by a user assigned an account type with **Create, edit, and publish data models** permission.
- Retrieve a representation of an existing data model by calling the [/v2/dataModels/{dataModelId}/spec](https://help.sigmacomputing.com/reference/get-data-model-spec) endpoint.
- To get a list of folders, call the [/v2/files](https://help.sigmacomputing.com/reference/list-files) endpoint and review the `id` field in the response for files with a `type` of `folder`.
- The default format of the representation is JSON. To use YAML, add the header `Content-Type: application/yaml`.
### Usage scenarios
- **Automation**: If you want to create several data models across one or more organizations, you can use this endpoint to programmatically create the data models.
- **Integration**: Using this endpoint, you can create data models based on external data sources or integrate Sigma with other tools and platforms.
- **Migration**: You can use this endpoint to migrate data models from one organization to another.
- **Version control**: Developers can use this endpoint to programmatically manage, update, and version control data models between several organizations or tenants.
- **Agentic workflows**: Agents can use these endpoints to directly manage data model contents in code.
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
The request body.
name
The name of the data model.
folderId
The identifier of the folder in which the data model is located.
schemaVersion
The schema version used by this representation of the data model.
pages
The pages of the data model and their contents.
description
The description of the data model.
Response
The response body.
success
dataModelId

