Skip to main content
Applies to:


Summary

Views cannot be duplicated directly through the UI as they are scoped to specific projects. To copy a view configuration from one project to another, you must use the Braintrust API to export the view settings and recreate them in the destination project.

Configuration Steps

Step 1: Get the source view configuration

Use the List Views API to retrieve the view you want to duplicate and note the options payload. Note: This is an example curl command. You’ll need to edit the parameters accordingly and check the API documentation for details on what each key means.
curl --request GET \
  --url 'https://api.braintrust.dev/v1/view?view_name=your_view_name' \
  --header 'Authorization: Bearer <token>'

Step 2: Create the view in the destination project

Use the Create View API with the same options and view_type from Step 1, pointing to your destination project. Note: This is an example curl command. You’ll need to edit the parameters accordingly and check the API documentation for details on what each key means.
curl --request POST \
  --url https://api.braintrust.dev/v1/view \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "object_type": "organization",
  "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "view_type": "projects",
  "name": "<string>",
  "view_data": {
    "search": {
      "filter": [
        null
      ],
      "tag": [
        null
      ],
      "match": [
        null
      ],
      "sort": [
        null
      ]
    },
    "custom_charts": null
  },
  "options": {
    "viewType": "monitor",
    "options": {
      "spanType": "range",
      "rangeValue": "<string>",
      "frameStart": "<string>",
      "frameEnd": "<string>",
      "tzUTC": true,
      "chartVisibility": {},
      "projectId": "<string>",
      "type": "project",
      "groupBy": "<string>"
    },
    "freezeColumns": true
  },
  "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "deleted_at": "2023-11-07T05:31:56Z"
}'

Include the options JSON (columns, filters, sort configuration) and specify the destination project_id.

Step 3: Verify the duplicated view

Navigate to your destination project to confirm the view was created with the correct configuration.