ReferenceAPI
POST/v1/insert
Cross-object insert
Insert events and feedback across object types
Authorization
AuthorizationRequiredBearer <token>
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.
In: header
Request Body (Optional)
A mapping from event object type -> object id -> events to insert
experimentobject | null
A mapping from experiment id to a set of log events and feedback items to insert
datasetobject | null
A mapping from dataset id to a set of log events and feedback items to insert
project_logsobject | null
A mapping from project id to a set of log events and feedback items to insert
| Status code | Description | 
|---|---|
200 | Returns the inserted row ids for the events on each individual object | 
400 | The request was unacceptable, often due to missing a required parameter | 
401 | No valid API key provided | 
403 | The API key doesn’t have permissions to perform the request | 
429 | Too many requests hit the API too quickly. We recommend an exponential backoff of your requests | 
500 | Something went wrong on Braintrust's end. (These are rare.) | 
curl -X POST "https://api.braintrustdata.com/v1/insert" \
  -d '{
  "experiment": {
    "property1": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": [
            "string"
          ],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "dataset_record_id": "string",
          "_object_delete": true,
          "created": "2019-08-24T14:15:22Z",
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": [
            "string"
          ],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "dataset_record_id": "string",
          "_object_delete": true,
          "created": "2019-08-24T14:15:22Z",
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  },
  "dataset": {
    "property1": {
      "events": [
        {
          "input": null,
          "expected": null,
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": [
            "string"
          ],
          "id": "string",
          "_object_delete": true,
          "created": "2019-08-24T14:15:22Z",
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "expected": null,
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": [
            "string"
          ],
          "id": "string",
          "_object_delete": true,
          "created": "2019-08-24T14:15:22Z",
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  },
  "project_logs": {
    "property1": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": [
            "string"
          ],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "_object_delete": true,
          "created": "2019-08-24T14:15:22Z",
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": [
            "string"
          ],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "_object_delete": true,
          "created": "2019-08-24T14:15:22Z",
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  }
}'{
  "experiment": {
    "property1": {
      "row_ids": [
        "string"
      ]
    },
    "property2": {
      "row_ids": [
        "string"
      ]
    }
  },
  "dataset": {
    "property1": {
      "row_ids": [
        "string"
      ]
    },
    "property2": {
      "row_ids": [
        "string"
      ]
    }
  },
  "project_logs": {
    "property1": {
      "row_ids": [
        "string"
      ]
    },
    "property2": {
      "row_ids": [
        "string"
      ]
    }
  }
}