Update a workbook from a code representation (Beta)
Update a workbook from a code representation (Beta)
This endpoint replaces a workbook with a workbook defined in a code representation. You can programmatically update the workbook's structure, metadata, and contents. This creates a new version of the workbook, which is 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.
### 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
- The default format of the representation is YAML. To use JSON, add the header `Content-Type: application/json`.
- 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 create a new workbook from code, use the [/v2/workbooks/spec](https://help.sigmacomputing.com/reference/create-workbook-spec) endpoint.
- The endpoint only supports updates to the `pages` array and its contents. Additional fields are not required and are ignored in the request body.
- Partial updates are not supported. You must provide the entire representation of the workbook in the request body.
### Usage scenarios
- **Agentic workflows**: Agents can use these endpoints to directly manage workbook contents in code.
- **Automation**: If you want to update several workbooks across one or more organizations, or in response to external events, you can use this endpoint to programmatically update the workbooks.
- **Integration**: Using this endpoint, you can update workbooks based on external data sources or integrate Sigma with other tools and platforms.
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.
Path parameters
workbookId
Request
The request body.
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.
Response
The response body.
success
workbookId

