# Export TML

> For the complete documentation index, see [llms.txt](https://developers.thoughtspot.com/docs/llms.txt)

Source: https://developers.thoughtspot.com/docs/tml-export

# Export TML

To export the TML data, your account must have the `DATAMANAGEMENT` (Can manage data) or `ADMINISTRATION` (Can administer ThoughtSpot) privilege.

The default format to export the objects is JSON. To export the TML representation of the metadata objects from ThoughtSpot in JSON or YAML format, use the following endpoint:

-   [**POST** /api/rest/2.0/metadata/tml/export](https://developers.thoughtspot.com/docs/restV2-playground?apiResourceId=http%2Fapi-endpoints%2Fmetadata%2Fexport-metadata-tml)
    

To export the TML representation of the metadata objects in a **batch**, use the following endpoint:

-   [**POST** /api/rest/2.0/metadata/tml/export/batch](https://developers.thoughtspot.com/docs/restV2-playground?apiResourceId=http%2Fapi-endpoints%2Fmetadata%2Fexport-metadata-tml-batched)
    

There are several export options available with these APIs:

## Metadata specification for Answers

To export a specific metadata object, specify the name or ID of the object.

For Answer objects, the `identifier` is optional, and you can define parameters such as `session_identifier` and `generation_number` instead. These attributes can be used to export unsaved Answers generated from Spotter queries or Answers that do not have the name and ID assigned.

## Export associated objects

To export associated objects, set the following attributes:

-   `export_associated`  
    When set to `true`, exports the associated objects for the `export_ids` specified in the API request. The API exports any underlying Models, tables, or views for a given object. By default, the API does not export these underlying objects.
    
-   `export_dependent`  
    Specifies if the Tables of the referenced Connection object must be included in the export.
    
-   `export_connection_as_dependent`  
    Specifies if a Connection object must be included as a dependent object when exporting a Table, Model, Answer, or Liveboard TML.
    

## Export FQNs

When `export_fqn=true`, the API exports the FQNs of the referenced objects in the TML data. For example, if you are exporting a Liveboard and its associated objects, the API returns the Liveboard TML data with the FQNs of the referenced Model. Note that the FQN of a referenced object is the same as the GUID of that object.

ThoughtSpot recommends adding the fqn property before importing the TML objects into the system, because only the name of a referenced object is not sufficient to identify the referenced object during TML import. For example, if your ThoughtSpot instance has two Models with the same name, the TML import for a Liveboard that uses one of these Models would fail unless the Liveboard TML includes the FQN of the referenced object. The `export_fqn` attribute is useful when ThoughtSpot has multiple objects with the same name and you want to eliminate ambiguity during TML import. The `export_fqn=true` property adds the FQNs of the referenced objects in the TML export API response and saves the manual effort of adding FQNs for TML import.

> **NOTE:** When you import multiple objects in bulk and create objects using the create\_new attribute, the new object may refer to an existing object with the same FQN in the ThoughtSpot system instead of the other objects provided in the TML import request. For example, when you upload a TML representation of a Liveboard and the associated Model with the FQNs obtained from the TML export API, the imported Liveboard may refer to an existing Model with the same FQN in the ThoughtSpot system instead of the new Model created during the TML import. If you want the new objects created during the TML import to refer to the other associated objects created during the same import operation, set the export\_fqn attribute to false during TML export or remove the FQNs manually before the TML import.

For more information about using FQNs during import, see [Import TML]({{navprefix}}/{{tml-import}}#import-tml).

## Export schema

Specifies the schema version to use during TML export. For [Models](https://docs.thoughtspot.com/cloud/latest/models), set `export_schema_version` to v2. The v1 schema is used for Worksheet objects (Deprecated).

## Additional export options for REST API v2

Following are some additional attributes which can be set for exporting objects:

-   `include_obj_id_ref`  
    When set to `true`, exports the object ID of the referenced object. This flag will work only when the object ID feature is enabled. Contact ThoughtSpot Support to enable the feature.
    
-   `include_guid`  
    When set to `true`, exports the guid of the object. This flag will work only when the object ID feature is enabled. Contact ThoughtSpot Support to enable the feature.
    
-   `include_obj_id`  
    When set to `true`, exports the object ID of the object. This flag will work only when the object ID feature is enabled. Contact ThoughtSpot Support to enable the feature.
    
-   `export_with_associated_feedbacks`  
    When set to `true`, exports the TML of an object along with all feedback, such as Spotter or Sage feedback, associated with that object. No feedback file will be exported if there are no feedback entries associated with the object
    
-   `export_column_security_rules` Beta  
    When set to `true`, exports the column-level security rules defined on the object. Contact ThoughtSpot Support to enable the feature.
    
-   `export_with_column_aliases` Beta  
    When set to `true`, export column aliases of the Model if the data Model includes any [column aliases](https://docs.thoughtspot.com/cloud/latest/column-aliases).
    

## Export in a batch

This API operation supports exporting User, User Group, and Role objects only. To export objects in a batch, set the following additional attributes:

-   `metadata_type`  
    Type of the metadata object to export. Use one of the following values: `USER`, `USER_GROUP`, or `ROLE`. The `ROLE` value applies only to instances on which [Role-based access control]({{navprefix}}/{{roles}}) is enabled.
    
-   `batch_size`  
    Exports the specified number of objects in a single API request. A batch size of up to 200 objects is allowed for a single API operation. The default batch size is 20.
    
-   `batch_offset`  
    Offsets the API response by the specified number. Batch offset value defines the starting position of the records for the results returned by the API. The default batch offset is 0.
    

-   `export_dependent`  
    Specifies if the dependent objects must be exported. For example, the user groups to which user objects are assigned, or the sub-groups of a user group. To get full details of the dependent objects, the API call initiator must have view or edit access to the dependent object.
    

For more information, see the API documentation in REST API v2 Playground.