Create a workbook from a code representation (Beta)
Create a workbook from a code representation (Beta)
This endpoint creates a new workbook from a code representation. Use it to programmatically define and create workbooks that are then accessible from the Sigma UI.
**Beta**: This documentation describes a private beta feature and is subject to the [Beta features](/docs/sigma-product-releases#beta-features) disclaimer.
For more information on managing workbooks programmatically, see [Manage workbooks as code](https://help.sigmacomputing.com/docs/manage-workbooks-as-code). For more information on using this endpoint, including end-to-end instructions, see [Create a workbook from a code representation](https://help.sigmacomputing.com/docs/create-a-workbook-from-a-code-representation).
### System and user requirements
- To perform this operation, you must use API credentials owned by a user assigned an account type with **Create, edit, and publish workbooks** permission.
- To perform this operation, you must use API credentials owned by a user with **Can edit** access for the workbook.
### Usage notes
- You can define the layout of contents on the workbook page using XML in the `layout` field. For more information, see [Customize the layout of a workbook in code representation](https://help.sigmacomputing.com/docs/customize-the-layout-of-a-workbook-in-code-representation).
- You can combine multiple YAML documents to create one workbook representation. For more information, see [Prepare a representation from multiple YAML documents](https://help.sigmacomputing.com/docs/create-a-workbook-from-a-code-representation#prepare-a-representation-from-multiple-yaml-documents).
- To retrieve the representation of an existing workbook, use the [/v2/workbooks/{workbookId}/spec](https://help.sigmacomputing.com/reference/get-workbook-spec) endpoint.
- To update an existing workbook from code, use the [/v2/workbooks/{workbookId}/spec](https://help.sigmacomputing.com/reference/update-workbook-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`.
### Usage scenarios
- **Agentic workflows**: Agents can use these endpoints to directly manage workbook contents in code.
- **Automation**: If you want to create several workbooks across one or more organizations, you can use this endpoint to programmatically create the workbooks.
- **Integration**: Using this endpoint, you can create workbooks based on external data sources or integrate Sigma with other tools and platforms.
- **Migration**: You can use this endpoint to migrate workbooks from one organization to another.
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
The request body.
name
The name of the workbook.
folderId
The identifier of the folder in which the workbook is located.
schemaVersion
The schema version used by this representation of the workbook.
pages
The pages of the workbook spec and their contents.
themeName
Built-in theme name (Light, Dark, Surface) or org theme UUID.
themeOverrides
layout
Grid layout as XML.
description
The description of the workbook.
Response
The response body.
success
workbookId

