Skip to main content
PUT
/
v1
/
view
Create or replace view
curl --request PUT \
  --url https://api.braintrust.dev/v1/view \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "view_data": {
    "search": {
      "filter": [
        null
      ],
      "tag": [
        null
      ],
      "match": [
        null
      ],
      "sort": [
        null
      ]
    },
    "custom_charts": null
  },
  "options": {
    "viewType": "monitor",
    "options": {
      "rangeValue": "<string>",
      "frameStart": "<string>",
      "frameEnd": "<string>",
      "tzUTC": true,
      "chartVisibility": {},
      "projectId": "<string>",
      "groupBy": "<string>"
    },
    "freezeColumns": true
  },
  "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "deleted_at": "2023-11-07T05:31:56Z"
}
'
import requests

url = "https://api.braintrust.dev/v1/view"

payload = {
    "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "view_data": {
        "search": {
            "filter": [None],
            "tag": [None],
            "match": [None],
            "sort": [None]
        },
        "custom_charts": None
    },
    "options": {
        "viewType": "monitor",
        "options": {
            "rangeValue": "<string>",
            "frameStart": "<string>",
            "frameEnd": "<string>",
            "tzUTC": True,
            "chartVisibility": {},
            "projectId": "<string>",
            "groupBy": "<string>"
        },
        "freezeColumns": True
    },
    "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "deleted_at": "2023-11-07T05:31:56Z"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    object_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    name: '<string>',
    view_data: {
      search: {filter: [null], tag: [null], match: [null], sort: [null]},
      custom_charts: null
    },
    options: {
      viewType: 'monitor',
      options: {
        rangeValue: '<string>',
        frameStart: '<string>',
        frameEnd: '<string>',
        tzUTC: true,
        chartVisibility: {},
        projectId: '<string>',
        groupBy: '<string>'
      },
      freezeColumns: true
    },
    user_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    deleted_at: '2023-11-07T05:31:56Z'
  })
};

fetch('https://api.braintrust.dev/v1/view', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.braintrust.dev/v1/view",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'object_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    'name' => '<string>',
    'view_data' => [
        'search' => [
                'filter' => [
                                null
                ],
                'tag' => [
                                null
                ],
                'match' => [
                                null
                ],
                'sort' => [
                                null
                ]
        ],
        'custom_charts' => null
    ],
    'options' => [
        'viewType' => 'monitor',
        'options' => [
                'rangeValue' => '<string>',
                'frameStart' => '<string>',
                'frameEnd' => '<string>',
                'tzUTC' => true,
                'chartVisibility' => [
                                
                ],
                'projectId' => '<string>',
                'groupBy' => '<string>'
        ],
        'freezeColumns' => true
    ],
    'user_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    'deleted_at' => '2023-11-07T05:31:56Z'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.braintrust.dev/v1/view"

	payload := strings.NewReader("{\n  \"object_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"name\": \"<string>\",\n  \"view_data\": {\n    \"search\": {\n      \"filter\": [\n        null\n      ],\n      \"tag\": [\n        null\n      ],\n      \"match\": [\n        null\n      ],\n      \"sort\": [\n        null\n      ]\n    },\n    \"custom_charts\": null\n  },\n  \"options\": {\n    \"viewType\": \"monitor\",\n    \"options\": {\n      \"rangeValue\": \"<string>\",\n      \"frameStart\": \"<string>\",\n      \"frameEnd\": \"<string>\",\n      \"tzUTC\": true,\n      \"chartVisibility\": {},\n      \"projectId\": \"<string>\",\n      \"groupBy\": \"<string>\"\n    },\n    \"freezeColumns\": true\n  },\n  \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"deleted_at\": \"2023-11-07T05:31:56Z\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.braintrust.dev/v1/view")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"object_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"name\": \"<string>\",\n  \"view_data\": {\n    \"search\": {\n      \"filter\": [\n        null\n      ],\n      \"tag\": [\n        null\n      ],\n      \"match\": [\n        null\n      ],\n      \"sort\": [\n        null\n      ]\n    },\n    \"custom_charts\": null\n  },\n  \"options\": {\n    \"viewType\": \"monitor\",\n    \"options\": {\n      \"rangeValue\": \"<string>\",\n      \"frameStart\": \"<string>\",\n      \"frameEnd\": \"<string>\",\n      \"tzUTC\": true,\n      \"chartVisibility\": {},\n      \"projectId\": \"<string>\",\n      \"groupBy\": \"<string>\"\n    },\n    \"freezeColumns\": true\n  },\n  \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"deleted_at\": \"2023-11-07T05:31:56Z\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.braintrust.dev/v1/view")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"object_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"name\": \"<string>\",\n  \"view_data\": {\n    \"search\": {\n      \"filter\": [\n        null\n      ],\n      \"tag\": [\n        null\n      ],\n      \"match\": [\n        null\n      ],\n      \"sort\": [\n        null\n      ]\n    },\n    \"custom_charts\": null\n  },\n  \"options\": {\n    \"viewType\": \"monitor\",\n    \"options\": {\n      \"rangeValue\": \"<string>\",\n      \"frameStart\": \"<string>\",\n      \"frameEnd\": \"<string>\",\n      \"tzUTC\": true,\n      \"chartVisibility\": {},\n      \"projectId\": \"<string>\",\n      \"groupBy\": \"<string>\"\n    },\n    \"freezeColumns\": true\n  },\n  \"user_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"deleted_at\": \"2023-11-07T05:31:56Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "created": "2023-11-07T05:31:56Z",
  "view_data": {
    "search": {
      "filter": [
        null
      ],
      "tag": [
        null
      ],
      "match": [
        null
      ],
      "sort": [
        null
      ]
    },
    "custom_charts": null
  },
  "options": {
    "viewType": "monitor",
    "options": {
      "rangeValue": "<string>",
      "frameStart": "<string>",
      "frameEnd": "<string>",
      "tzUTC": true,
      "chartVisibility": {},
      "projectId": "<string>",
      "groupBy": "<string>"
    },
    "freezeColumns": true
  },
  "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "deleted_at": "2023-11-07T05:31:56Z"
}
"<string>"
"<string>"
"<string>"
"<string>"
"<string>"

Authorizations

Authorization
string
header
required

Most Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.

Body

application/json

Any desired information about the new view object

object_type
enum<string>
required

The object type that the ACL applies to

Available options:
organization,
project,
experiment,
dataset,
prompt,
prompt_session,
group,
role,
org_member,
project_log,
org_project,
org_audit_logs
object_id
string<uuid>
required

The id of the object the view applies to

view_type
enum<string>
required

Type of object that the view corresponds to.

Available options:
projects,
experiments,
experiment,
playgrounds,
playground,
datasets,
dataset,
prompts,
parameters,
tools,
scorers,
classifiers,
logs,
monitor,
for_review_project_log,
for_review_experiments,
for_review_datasets,
null
name
string
required

Name of the view

view_data
object | null

The view definition

options
MonitorViewOptions · object

Options for the view in the app

user_id
string<uuid> | null

Identifies the user who created the view

deleted_at
string<date-time> | null

Date of role deletion, or null if the role is still active

Response

Returns the new view object

id
string<uuid>
required

Unique identifier for the view

object_type
enum<string>
required

The object type that the ACL applies to

Available options:
organization,
project,
experiment,
dataset,
prompt,
prompt_session,
group,
role,
org_member,
project_log,
org_project,
org_audit_logs
object_id
string<uuid>
required

The id of the object the view applies to

view_type
enum<string>
required

Type of object that the view corresponds to.

Available options:
projects,
experiments,
experiment,
playgrounds,
playground,
datasets,
dataset,
prompts,
parameters,
tools,
scorers,
classifiers,
logs,
monitor,
for_review_project_log,
for_review_experiments,
for_review_datasets,
null
name
string
required

Name of the view

created
string<date-time> | null

Date of view creation

view_data
object | null

The view definition

options
MonitorViewOptions · object

Options for the view in the app

user_id
string<uuid> | null

Identifies the user who created the view

deleted_at
string<date-time> | null

Date of role deletion, or null if the role is still active