Get the code representation of a workbook (Beta)

View as Markdown
This endpoint returns a code representation of a workbook, including metadata and contents. The response can be formatted as either JSON or YAML, and contains the workbook's pages, elements, columns, sources, and more. The representation can be used to store, copy, or modify the workbook programmatically. **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 [Get the code representation of a workbook](https://help.sigmacomputing.com/docs/get-the-code-representation-of-a-workbook). ### Usage notes - Retrieve the **workbookId** by calling the [/v2/workbooks](https://help.sigmacomputing.com/reference/list-workbooks) endpoint. - The response includes references to the data sources and metadata necessary to recreate the workbook. The data itself is not included in the response. - To create a new workbook from code, use the [/v2/workbooks/spec](https://help.sigmacomputing.com/reference/create-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. - The default format of the representation is YAML. To receive JSON, add the query parameter `?format=json` or the header `Accept: application/json`. ### Usage scenarios - **Backup and restore**: Developers can use this endpoint to programmatically back up workbooks and restore them if needed. - **Version control**: Developers can use this endpoint to programmatically manage, update, and version control workbooks between several organizations or tenants.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

workbookIdstringRequired

Query parameters

documentVersionintegerOptional
formatenumOptional

Response

The response body.
workbookIdstring
Unique identifier of the workbook.
namestring
The name of the workbook.
urlstring
The full URL for the requested document version of the workbook.
documentVersiondouble
The document version of the workbook.
latestDocumentVersiondouble
The most recently published document version of the workbook.
ownerIdstring
The identifier of the user who owns the workbook.
folderIdstring
The identifier of the folder in which the workbook is located.
createdBystring
The identifier of the user who created the workbook.
updatedBystring
The identifier of the user or process that last updated the workbook.
createdAtdatetime
When the workbook was created.
updatedAtdatetime
When the workbook was last updated.
schemaVersionenum
The schema version used by this representation of the workbook.
pageslist of objects
The pages of the workbook spec and their contents.
layoutstring or null
descriptionstring
The description of the workbook.
themeNameenum or string

Built-in theme name (Light, Dark, Surface) or org theme UUID.

themeOverridesobject