openapi: 3.1.1 info: version: 1.0.0 title: Braintrust Acls Functions API description: 'API specification for the backend data server. The API is hosted globally at https://api.braintrust.dev or in your own environment. You can access the OpenAPI spec for this API at https://github.com/braintrustdata/braintrust-openapi.' license: name: Apache 2.0 servers: - url: https://api.braintrust.dev security: - bearerAuth: [] - {} tags: - name: Functions paths: /v1/function: post: tags: - Functions security: - bearerAuth: [] - {} operationId: postFunction description: Create a new function. If there is an existing function in the project with the same slug as the one specified in the request, will return the existing function unmodified summary: Create function requestBody: description: Any desired information about the new function object required: false content: application/json: schema: $ref: '#/components/schemas/CreateFunction' responses: '200': description: Returns the new function object content: application/json: schema: $ref: '#/components/schemas/Function' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true put: tags: - Functions security: - bearerAuth: [] - {} operationId: putFunction description: Create or replace function. If there is an existing function in the project with the same slug as the one specified in the request, will replace the existing function with the provided fields summary: Create or replace function requestBody: description: Any desired information about the new function object required: false content: application/json: schema: $ref: '#/components/schemas/CreateFunction' responses: '200': description: Returns the new function object content: application/json: schema: $ref: '#/components/schemas/Function' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true get: operationId: getFunction tags: - Functions description: List out all functions. The functions are sorted by creation date, with the most recently-created functions coming first summary: List functions security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/AppLimitParam' - $ref: '#/components/parameters/StartingAfter' - $ref: '#/components/parameters/EndingBefore' - $ref: '#/components/parameters/Ids' - $ref: '#/components/parameters/FunctionName' - $ref: '#/components/parameters/ProjectName' - $ref: '#/components/parameters/ProjectIdQuery' - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/PromptVersion' - $ref: '#/components/parameters/PromptEnvironment' - $ref: '#/components/parameters/OrgName' responses: '200': description: Returns a list of function objects content: application/json: schema: type: object properties: objects: type: array items: $ref: '#/components/schemas/Function' description: A list of function objects required: - objects additionalProperties: false '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true /v1/function/{function_id}: get: operationId: getFunctionId tags: - Functions description: Get a function object by its id summary: Get function security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/FunctionIdParam' - $ref: '#/components/parameters/PromptVersion' - $ref: '#/components/parameters/PromptEnvironment' responses: '200': description: Returns the function object content: application/json: schema: $ref: '#/components/schemas/Function' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true patch: operationId: patchFunctionId tags: - Functions description: Partially update a function object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null. summary: Partially update function security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/FunctionIdParam' requestBody: description: Fields to update required: false content: application/json: schema: $ref: '#/components/schemas/PatchFunction' responses: '200': description: Returns the function object content: application/json: schema: $ref: '#/components/schemas/Function' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true delete: operationId: deleteFunctionId tags: - Functions description: Delete a function object by its id summary: Delete function security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/FunctionIdParam' responses: '200': description: Returns the deleted function object content: application/json: schema: $ref: '#/components/schemas/Function' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true /v1/function/{function_id}/invoke: post: operationId: postFunctionIdInvoke tags: - Functions description: Invoke a function. summary: Invoke function security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/FunctionIdParam' requestBody: description: Function invocation parameters content: application/json: schema: $ref: '#/components/schemas/InvokeApi' responses: '200': description: Function invocation response content: application/json: schema: nullable: true components: schemas: ResponseFormatNullish: anyOf: - type: object properties: type: type: string enum: - json_object required: - type title: json_object - type: object properties: type: type: string enum: - json_schema json_schema: $ref: '#/components/schemas/ResponseFormatJsonSchema' required: - type - json_schema title: json_schema - type: object properties: type: type: string enum: - text required: - type title: text - type: 'null' GraphNode: anyOf: - type: object properties: description: type: string nullable: true description: The description of the node position: type: object nullable: true properties: x: type: number description: The x position of the node y: type: number description: The y position of the node required: - x - y description: The position of the node type: type: string enum: - function function: $ref: '#/components/schemas/FunctionIdRef' required: - type - function - type: object properties: description: type: string nullable: true description: The description of the node position: type: object nullable: true properties: x: type: number description: The x position of the node y: type: number description: The y position of the node required: - x - y description: The position of the node type: type: string enum: - input description: The input to the graph required: - type - type: object properties: description: type: string nullable: true description: The description of the node position: type: object nullable: true properties: x: type: number description: The x position of the node y: type: number description: The y position of the node required: - x - y description: The position of the node type: type: string enum: - output description: The output of the graph required: - type - type: object properties: description: type: string nullable: true description: The description of the node position: type: object nullable: true properties: x: type: number description: The x position of the node y: type: number description: The y position of the node required: - x - y description: The position of the node type: type: string enum: - literal value: nullable: true description: A literal value to be returned required: - type - type: object properties: description: type: string nullable: true description: The description of the node position: type: object nullable: true properties: x: type: number description: The x position of the node y: type: number description: The y position of the node required: - x - y description: The position of the node type: type: string enum: - btql expr: type: string description: A BTQL expression to be evaluated required: - type - expr - type: object properties: description: type: string nullable: true description: The description of the node position: type: object nullable: true properties: x: type: number description: The x position of the node y: type: number description: The y position of the node required: - x - y description: The position of the node type: type: string enum: - gate condition: type: string nullable: true description: A BTQL expression to be evaluated required: - type - type: object properties: description: type: string nullable: true description: The description of the node position: type: object nullable: true properties: x: type: number description: The x position of the node y: type: number description: The y position of the node required: - x - y description: The position of the node type: type: string enum: - aggregator required: - type - type: object properties: description: type: string nullable: true description: The description of the node position: type: object nullable: true properties: x: type: number description: The x position of the node y: type: number description: The y position of the node required: - x - y description: The position of the node type: type: string enum: - prompt_template prompt: $ref: '#/components/schemas/PromptBlockData' required: - type - prompt PromptOptionsNullish: type: object nullable: true properties: model: type: string params: $ref: '#/components/schemas/ModelParams' position: type: string OrgName: type: string description: Filter search results to within a particular organization PromptVersion: type: string description: 'Retrieve prompt at a specific version. The version id can either be a transaction id (e.g. ''1000192656880881099'') or a version identifier (e.g. ''81cd05ee665fdfb3'').' ModelParams: anyOf: - type: object properties: use_cache: type: boolean reasoning_enabled: type: boolean reasoning_budget: type: number temperature: type: number top_p: type: number max_tokens: type: number max_completion_tokens: type: number description: The successor to max_tokens frequency_penalty: type: number presence_penalty: type: number response_format: $ref: '#/components/schemas/ResponseFormatNullish' tool_choice: anyOf: - type: string enum: - auto title: auto - type: string enum: - none title: none - type: string enum: - required title: required - type: object properties: type: type: string enum: - function function: type: object properties: name: type: string required: - name required: - type - function title: function function_call: anyOf: - type: string enum: - auto title: auto - type: string enum: - none title: none - type: object properties: name: type: string required: - name title: function n: type: number stop: type: array items: type: string reasoning_effort: type: string enum: - none - minimal - low - medium - high verbosity: type: string enum: - low - medium - high additionalProperties: nullable: true title: OpenAIModelParams x-stainless-skip: - go - type: object properties: use_cache: type: boolean reasoning_enabled: type: boolean reasoning_budget: type: number max_tokens: type: number temperature: type: number top_p: type: number top_k: type: number stop_sequences: type: array items: type: string max_tokens_to_sample: type: number description: This is a legacy parameter that should not be used. required: - max_tokens - temperature additionalProperties: nullable: true title: AnthropicModelParams x-stainless-skip: - go - type: object properties: use_cache: type: boolean reasoning_enabled: type: boolean reasoning_budget: type: number temperature: type: number maxOutputTokens: type: number topP: type: number topK: type: number additionalProperties: nullable: true title: GoogleModelParams x-stainless-skip: - go - type: object properties: use_cache: type: boolean reasoning_enabled: type: boolean reasoning_budget: type: number temperature: type: number topK: type: number additionalProperties: nullable: true title: WindowAIModelParams x-stainless-skip: - go - type: object properties: use_cache: type: boolean reasoning_enabled: type: boolean reasoning_budget: type: number additionalProperties: nullable: true title: JsCompletionParams x-stainless-skip: - go CreateFunction: type: object properties: project_id: type: string format: uuid description: Unique identifier for the project that the prompt belongs under name: type: string minLength: 1 description: Name of the prompt slug: type: string minLength: 1 description: Unique identifier for the prompt description: type: string nullable: true description: Textual description of the prompt prompt_data: $ref: '#/components/schemas/PromptDataNullish' tags: type: array nullable: true items: type: string description: A list of tags for the prompt function_type: $ref: '#/components/schemas/FunctionTypeEnumNullish' function_data: $ref: '#/components/schemas/FunctionData' origin: type: object nullable: true properties: object_type: $ref: '#/components/schemas/AclObjectType' object_id: type: string format: uuid description: Id of the object the function is originating from internal: type: boolean nullable: true description: The function exists for internal purposes and should not be displayed in the list of functions. required: - object_type - object_id function_schema: type: object nullable: true properties: parameters: nullable: true returns: nullable: true description: JSON schema for the function's parameters and return type required: - project_id - name - slug - function_data PromptBlockData: anyOf: - type: object properties: type: type: string enum: - chat messages: type: array items: $ref: '#/components/schemas/ChatCompletionMessageParam' tools: type: string required: - type - messages title: chat - type: object properties: type: type: string enum: - completion content: type: string required: - type - content title: completion PromptEnvironment: type: string description: 'Filter by environment slug. Cannot be used together with `version`. For `GET /v1/prompt`, environment resolution currently requires the request to match a single prompt. If multiple prompts match, the endpoint returns `400` (for example when `limit=1` is not set). Use `limit=1` or other filters (for example `slug`, `project_id`) to narrow results.' FunctionData: anyOf: - type: object properties: type: type: string enum: - prompt required: - type title: prompt - type: object properties: type: type: string enum: - code data: anyOf: - allOf: - type: object properties: type: type: string enum: - bundle required: - type - $ref: '#/components/schemas/CodeBundle' title: bundle - type: object properties: type: type: string enum: - inline runtime_context: type: object properties: runtime: type: string enum: - node - python - browser - quickjs version: type: string required: - runtime - version code: type: string code_hash: type: string description: SHA256 hash of the code, computed at save time required: - type - runtime_context - code title: inline required: - type - data title: code - $ref: '#/components/schemas/GraphData' - type: object properties: type: type: string enum: - remote_eval endpoint: type: string eval_name: type: string parameters: type: object additionalProperties: nullable: true parameters_version: type: string nullable: true description: The version (transaction ID) of the parameters being used required: - type - endpoint - eval_name - parameters description: A remote eval to run title: remote_eval - type: object properties: type: type: string enum: - global name: type: string function_type: $ref: '#/components/schemas/FunctionTypeEnum' config: type: object nullable: true additionalProperties: nullable: true description: Configuration options to pass to the global function (e.g., for preprocessor customization) required: - type - name title: global - $ref: '#/components/schemas/FacetData' - $ref: '#/components/schemas/BatchedFacetData' - type: object properties: type: type: string enum: - parameters data: type: object additionalProperties: nullable: true description: The parameters data __schema: type: object properties: type: type: string enum: - object properties: type: object additionalProperties: type: object additionalProperties: nullable: true required: type: array items: type: string additionalProperties: type: boolean required: - type - properties description: JSON Schema format for parameters required: - type - data - __schema title: parameters - allOf: - $ref: '#/components/schemas/TopicMapData' - title: topic_map Slug: type: string description: Retrieve prompt with a specific slug ChatCompletionContentPartFileFile: type: object properties: file_data: type: string filename: type: string file_id: type: string title: The ID of an uploaded file to use as input. ChatCompletionMessageToolCall: type: object properties: id: type: string function: type: object properties: arguments: type: string name: type: string required: - arguments - name type: type: string enum: - function required: - id - function - type AclObjectType: type: string enum: - organization - project - experiment - dataset - prompt - prompt_session - group - role - org_member - project_log - org_project description: The object type that the ACL applies to PatchFunction: type: object properties: name: type: string nullable: true description: Name of the prompt description: type: string nullable: true description: Textual description of the prompt prompt_data: $ref: '#/components/schemas/PromptDataNullish' function_data: $ref: '#/components/schemas/FunctionDataNullish' tags: type: array nullable: true items: type: string description: A list of tags for the prompt ChatCompletionContentPart: anyOf: - $ref: '#/components/schemas/ChatCompletionContentPartTextWithTitle' - $ref: '#/components/schemas/ChatCompletionContentPartImageWithTitle' - $ref: '#/components/schemas/ChatCompletionContentPartFileWithTitle' title: chat_completion_content_part FunctionName: type: string description: Name of the function to search for AppLimitParam: type: integer nullable: true minimum: 0 description: Limit the number of objects to return ChatCompletionContentPartTextWithTitle: type: object properties: text: type: string default: '' type: type: string enum: - text cache_control: type: object properties: type: type: string enum: - ephemeral required: - type required: - type title: text FunctionDataNullish: anyOf: - type: object properties: type: type: string enum: - prompt required: - type title: prompt - type: object properties: type: type: string enum: - code data: anyOf: - allOf: - type: object properties: type: type: string enum: - bundle required: - type - $ref: '#/components/schemas/CodeBundle' title: bundle - type: object properties: type: type: string enum: - inline runtime_context: type: object properties: runtime: type: string enum: - node - python - browser - quickjs version: type: string required: - runtime - version code: type: string code_hash: type: string description: SHA256 hash of the code, computed at save time required: - type - runtime_context - code title: inline required: - type - data title: code - $ref: '#/components/schemas/GraphData' - type: object properties: type: type: string enum: - remote_eval endpoint: type: string eval_name: type: string parameters: type: object additionalProperties: nullable: true parameters_version: type: string nullable: true description: The version (transaction ID) of the parameters being used required: - type - endpoint - eval_name - parameters description: A remote eval to run title: remote_eval - type: object properties: type: type: string enum: - global name: type: string function_type: $ref: '#/components/schemas/FunctionTypeEnum' config: type: object nullable: true additionalProperties: nullable: true description: Configuration options to pass to the global function (e.g., for preprocessor customization) required: - type - name title: global - $ref: '#/components/schemas/FacetData' - $ref: '#/components/schemas/BatchedFacetData' - type: object properties: type: type: string enum: - parameters data: type: object additionalProperties: nullable: true description: The parameters data __schema: type: object properties: type: type: string enum: - object properties: type: object additionalProperties: type: object additionalProperties: nullable: true required: type: array items: type: string additionalProperties: type: boolean required: - type - properties description: JSON Schema format for parameters required: - type - data - __schema title: parameters - allOf: - $ref: '#/components/schemas/TopicMapData' - title: topic_map - type: 'null' BatchedFacetData: type: object properties: type: type: string enum: - batched_facet preprocessor: allOf: - $ref: '#/components/schemas/NullableSavedFunctionId' - description: The preprocessor function to use for facet extraction. If not provided, the project default preprocessor will be used, falling back to the global 'thread' preprocessor. facets: type: array items: type: object properties: name: type: string description: The name of the facet prompt: type: string description: The prompt to use for LLM extraction. The preprocessed text will be provided as context. model: type: string description: The model to use for facet extraction embedding_model: type: string description: The embedding model to use for vectorizing facet results. no_match_pattern: type: string description: Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' required: - name - prompt topic_maps: type: object additionalProperties: type: array items: type: object properties: function_name: type: string description: The name of the topic map function topic_map_id: type: string description: The id of the topic map function topic_map_data: $ref: '#/components/schemas/TopicMapData' required: - function_name - topic_map_data description: Topic maps that depend on facets in this batch, keyed by source facet name. Each source facet can have multiple topic maps. required: - type - facets title: batched_facet FacetData: type: object properties: type: type: string enum: - facet preprocessor: allOf: - $ref: '#/components/schemas/NullableSavedFunctionId' - description: The preprocessor function to use for facet extraction. If not provided, the project default preprocessor will be used, falling back to the global 'thread' preprocessor. prompt: type: string description: The prompt to use for LLM extraction. The preprocessed text will be provided as context. model: type: string description: The model to use for facet extraction embedding_model: type: string description: The embedding model to use for vectorizing facet results. no_match_pattern: type: string description: Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' required: - type - prompt title: facet GraphEdge: type: object properties: source: type: object properties: node: type: string maxLength: 1024 description: The id of the node in the graph variable: type: string required: - node - variable target: type: object properties: node: type: string maxLength: 1024 description: The id of the node in the graph variable: type: string required: - node - variable purpose: type: string enum: - control - data - messages description: The purpose of the edge required: - source - target - purpose Ids: anyOf: - type: string format: uuid - type: array items: type: string format: uuid description: Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times ChatCompletionMessageReasoning: type: object properties: id: type: string nullable: true content: type: string nullable: true description: 'Note: This is not part of the OpenAI API spec, but we added it for interoperability with multiple reasoning models.' ChatCompletionContentPartFileWithTitle: type: object properties: file: $ref: '#/components/schemas/ChatCompletionContentPartFileFile' type: type: string enum: - file required: - file - type title: file ChatCompletionContentPartImageWithTitle: type: object properties: image_url: type: object properties: url: type: string detail: anyOf: - type: string enum: - auto title: auto - type: string enum: - low title: low - type: string enum: - high title: high required: - url type: type: string enum: - image_url required: - image_url - type title: image_url ProjectName: type: string description: Name of the project to search for ResponseFormatJsonSchema: type: object properties: name: type: string description: type: string schema: anyOf: - type: object additionalProperties: nullable: true title: object x-stainless-skip: - go - type: string title: string strict: type: boolean nullable: true required: - name FunctionTypeEnum: type: string enum: - llm - scorer - task - tool - custom_view - preprocessor - facet - classifier - tag - parameters - sandbox - null default: scorer description: The type of global function. Defaults to 'scorer'. FunctionIdParam: type: string format: uuid description: Function id StartingAfter: type: string format: uuid description: 'Pagination cursor id. For example, if the final item in the last page you fetched had an id of `foo`, pass `starting_after=foo` to fetch the next page. Note: you may only pass one of `starting_after` and `ending_before`' NullableSavedFunctionId: anyOf: - type: object properties: type: type: string enum: - function id: type: string version: type: string description: The version of the function required: - type - id title: function - type: object properties: type: type: string enum: - global name: type: string function_type: $ref: '#/components/schemas/FunctionTypeEnum' required: - type - name title: global - type: 'null' description: Default preprocessor for this project. When set, functions that use preprocessors will use this instead of their built-in default. InvokeApi: type: object properties: input: nullable: true description: Argument to the function, which can be any JSON serializable value expected: nullable: true description: The expected output of the function metadata: type: object nullable: true additionalProperties: nullable: true description: Any relevant metadata. This will be logged and available as the `metadata` argument. tags: type: array nullable: true items: type: string description: Any relevant tags to log on the span. messages: type: array items: $ref: '#/components/schemas/ChatCompletionMessageParam' description: If the function is an LLM, additional messages to pass along to it parent: $ref: '#/components/schemas/InvokeParent' stream: type: boolean nullable: true description: Whether to stream the response. If true, results will be returned in the Braintrust SSE format. mode: $ref: '#/components/schemas/StreamingMode' strict: type: boolean nullable: true description: If true, throw an error if one of the variables in the prompt is not present in the input mcp_auth: type: object additionalProperties: type: object properties: oauth_token: type: string description: The OAuth token to use description: Map of MCP server URL to auth credentials overrides: type: object nullable: true additionalProperties: nullable: true description: 'Partial function definition to merge with the function being invoked. Fields are validated against the function type''s schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }.' version: type: string description: The version of the function description: The request to invoke a function InvokeParent: anyOf: - type: object properties: object_type: type: string enum: - project_logs - experiment - playground_logs object_id: type: string description: The id of the container object you are logging to row_ids: type: object nullable: true properties: id: type: string description: The id of the row span_id: type: string description: The span_id of the row root_span_id: type: string description: The root_span_id of the row required: - id - span_id - root_span_id description: Identifiers for the row to to log a subspan under propagated_event: type: object nullable: true additionalProperties: nullable: true description: Include these properties in every span created under this parent required: - object_type - object_id description: Span parent properties title: span_parent_struct - type: string description: The parent's span identifier, created by calling `.export()` on a span description: Options for tracing the function call ProjectIdQuery: type: string format: uuid description: Project id PromptDataNullish: type: object nullable: true properties: prompt: $ref: '#/components/schemas/PromptBlockDataNullish' options: $ref: '#/components/schemas/PromptOptionsNullish' parser: $ref: '#/components/schemas/PromptParserNullish' tool_functions: type: array nullable: true items: allOf: - $ref: '#/components/schemas/SavedFunctionId' - anyOf: - type: object properties: type: type: string enum: - function id: type: string version: type: string description: The version of the function required: - type - id title: function - type: object properties: type: type: string enum: - global name: type: string function_type: $ref: '#/components/schemas/FunctionTypeEnum' required: - type - name title: global template_format: type: string nullable: true enum: - mustache - nunjucks - none - null mcp: type: object nullable: true additionalProperties: oneOf: - type: object properties: type: type: string enum: - id id: type: string format: uuid is_disabled: type: boolean enabled_tools: type: array nullable: true items: type: string description: If omitted, all tools are enabled required: - type - id title: MCP server id. This is used for project-level MCP server definitions. - type: object properties: type: type: string enum: - url url: type: string is_disabled: type: boolean enabled_tools: type: array nullable: true items: type: string description: If omitted, all tools are enabled required: - type - url title: MCP server url. This is used for inline definitions of MCP servers. origin: type: object nullable: true properties: prompt_id: type: string project_id: type: string prompt_version: type: string description: The prompt, model, and its parameters TopicMapData: type: object properties: type: type: string enum: - topic_map source_facet: type: string description: The facet field name to use as input for classification embedding_model: type: string description: The embedding model to use for embedding facet values bundle_key: type: string description: Key of the topic map bundle in code_bundles bucket report_key: type: string description: Key of the clustering report in code_bundles bucket topic_names: type: object additionalProperties: type: string description: Mapping from topic_id to topic name generation_settings: $ref: '#/components/schemas/TopicMapGenerationSettings' disable_reconciliation: type: boolean description: Whether new topic generation should ignore the previously saved report during reconciliation. Defaults to false when omitted. distance_threshold: type: number description: Maximum distance to nearest centroid. If exceeded, returns no_match. required: - type - source_facet - embedding_model ChatCompletionContentPartText: type: object properties: text: type: string default: '' type: type: string enum: - text cache_control: type: object properties: type: type: string enum: - ephemeral required: - type required: - type GraphData: type: object properties: type: type: string enum: - graph nodes: type: object additionalProperties: $ref: '#/components/schemas/GraphNode' edges: type: object additionalProperties: $ref: '#/components/schemas/GraphEdge' required: - type - nodes - edges description: This feature is preliminary and unsupported. title: graph StreamingMode: type: string nullable: true enum: - auto - parallel - json - text - null description: The mode format of the returned value (defaults to 'auto') PromptParserNullish: type: object nullable: true properties: type: type: string enum: - llm_classifier use_cot: type: boolean choice_scores: type: object additionalProperties: type: number minimum: 0 maximum: 1 description: Map of choices to scores (0-1). Used by scorers. choice: type: array items: type: string description: List of valid choices without score mapping. Used by classifiers that deposit output to tags. allow_no_match: type: boolean description: If true, adds a 'No match' option. When selected, no tag is deposited. required: - type - use_cot Function: type: object properties: id: type: string format: uuid description: Unique identifier for the prompt _xact_id: type: string description: The transaction id of an event is unique to the network operation that processed the event insertion. Transaction ids are monotonically increasing over time and can be used to retrieve a versioned snapshot of the prompt (see the `version` parameter) project_id: type: string format: uuid description: Unique identifier for the project that the prompt belongs under log_id: type: string enum: - p description: A literal 'p' which identifies the object as a project prompt org_id: type: string format: uuid description: Unique identifier for the organization name: type: string description: Name of the prompt slug: type: string description: Unique identifier for the prompt description: type: string nullable: true description: Textual description of the prompt created: type: string nullable: true format: date-time description: Date of prompt creation prompt_data: $ref: '#/components/schemas/PromptDataNullish' tags: type: array nullable: true items: type: string description: A list of tags for the prompt metadata: type: object nullable: true additionalProperties: nullable: true description: User-controlled metadata about the prompt function_type: $ref: '#/components/schemas/FunctionTypeEnumNullish' function_data: $ref: '#/components/schemas/FunctionData' origin: type: object nullable: true properties: object_type: $ref: '#/components/schemas/AclObjectType' object_id: type: string format: uuid description: Id of the object the function is originating from internal: type: boolean nullable: true description: The function exists for internal purposes and should not be displayed in the list of functions. required: - object_type - object_id function_schema: type: object nullable: true properties: parameters: nullable: true returns: nullable: true description: JSON schema for the function's parameters and return type required: - id - _xact_id - project_id - log_id - org_id - name - slug - function_data PromptBlockDataNullish: anyOf: - type: object properties: type: type: string enum: - chat messages: type: array items: $ref: '#/components/schemas/ChatCompletionMessageParam' tools: type: string required: - type - messages title: chat - type: object properties: type: type: string enum: - completion content: type: string required: - type - content title: completion - type: 'null' CodeBundle: type: object properties: runtime_context: type: object properties: runtime: type: string enum: - node - python - browser - quickjs version: type: string required: - runtime - version location: anyOf: - type: object properties: type: type: string enum: - experiment eval_name: type: string position: anyOf: - type: object properties: type: type: string enum: - task required: - type - type: object properties: type: type: string enum: - scorer index: type: integer minimum: 0 required: - type - index title: scorer - type: object properties: type: type: string enum: - classifier index: type: integer minimum: 0 required: - type - index title: classifier required: - type - eval_name - position title: experiment - type: object properties: type: type: string enum: - function index: type: integer minimum: 0 required: - type - index title: function - type: object properties: type: type: string enum: - sandbox sandbox_spec: oneOf: - type: object properties: provider: type: string enum: - modal snapshot_ref: type: string description: sandbox snapshot ref required: - provider - snapshot_ref - type: object properties: provider: type: string enum: - lambda required: - provider entrypoints: type: array items: type: string description: Which entrypoints to execute in the sandbox eval_name: type: string parameters: type: object additionalProperties: nullable: true description: Parameter values for sandbox eval execution evaluator_definition: nullable: true description: Definition of current evaluator with parameters required: - type - sandbox_spec - eval_name bundle_id: type: string nullable: true preview: type: string nullable: true description: A preview of the code required: - runtime_context - location TopicMapGenerationSettings: type: object properties: algorithm: type: string enum: - hdbscan - kmeans dimension_reduction: type: string enum: - umap - pca - none sample_size: type: integer minimum: 0 exclusiveMinimum: true n_clusters: type: integer minimum: 0 exclusiveMinimum: true min_cluster_size: type: integer minimum: 0 exclusiveMinimum: true min_samples: type: integer minimum: 0 exclusiveMinimum: true hierarchy_threshold: type: integer minimum: 0 exclusiveMinimum: true naming_model: type: string required: - algorithm - dimension_reduction description: Clustering and naming settings used to generate this topic map ChatCompletionMessageParam: anyOf: - type: object properties: content: anyOf: - type: string default: '' title: text - type: array items: $ref: '#/components/schemas/ChatCompletionContentPartText' title: array role: type: string enum: - system name: type: string required: - role title: system - type: object properties: content: anyOf: - type: string default: '' title: text - type: array items: $ref: '#/components/schemas/ChatCompletionContentPart' title: array role: type: string enum: - user name: type: string required: - role title: user - type: object properties: role: type: string enum: - assistant content: anyOf: - type: string - type: array items: $ref: '#/components/schemas/ChatCompletionContentPartText' - type: 'null' function_call: type: object nullable: true properties: arguments: type: string name: type: string required: - arguments - name name: type: string nullable: true tool_calls: type: array nullable: true items: $ref: '#/components/schemas/ChatCompletionMessageToolCall' reasoning: type: array nullable: true items: $ref: '#/components/schemas/ChatCompletionMessageReasoning' reasoning_signature: type: string nullable: true required: - role title: assistant - type: object properties: content: anyOf: - type: string default: '' title: text - type: array items: $ref: '#/components/schemas/ChatCompletionContentPartText' title: array role: type: string enum: - tool tool_call_id: type: string default: '' required: - role title: tool - type: object properties: content: type: string nullable: true name: type: string role: type: string enum: - function required: - content - name - role title: function - type: object properties: content: anyOf: - type: string default: '' title: text - type: array items: $ref: '#/components/schemas/ChatCompletionContentPartText' title: array role: type: string enum: - developer name: type: string required: - role title: developer - type: object properties: role: type: string enum: - model content: type: string nullable: true required: - role title: fallback FunctionIdRef: type: object properties: {} additionalProperties: nullable: true description: Options for identifying a function SavedFunctionId: anyOf: - type: object properties: type: type: string enum: - function id: type: string version: type: string description: The version of the function required: - type - id title: function - type: object properties: type: type: string enum: - global name: type: string function_type: $ref: '#/components/schemas/FunctionTypeEnum' required: - type - name title: global - type: 'null' description: Optional function identifier that produced the classification EndingBefore: type: string format: uuid description: 'Pagination cursor id. For example, if the initial item in the last page you fetched had an id of `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only pass one of `starting_after` and `ending_before`' FunctionTypeEnumNullish: type: string nullable: true enum: - llm - scorer - task - tool - custom_view - preprocessor - facet - classifier - tag - parameters - sandbox - null parameters: EndingBefore: schema: $ref: '#/components/schemas/EndingBefore' required: false description: 'Pagination cursor id. For example, if the initial item in the last page you fetched had an id of `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only pass one of `starting_after` and `ending_before`' name: ending_before in: query FunctionName: schema: $ref: '#/components/schemas/FunctionName' required: false description: Name of the function to search for name: function_name in: query allowReserved: true StartingAfter: schema: $ref: '#/components/schemas/StartingAfter' required: false description: 'Pagination cursor id. For example, if the final item in the last page you fetched had an id of `foo`, pass `starting_after=foo` to fetch the next page. Note: you may only pass one of `starting_after` and `ending_before`' name: starting_after in: query AppLimitParam: schema: $ref: '#/components/schemas/AppLimitParam' required: false description: Limit the number of objects to return name: limit in: query PromptVersion: schema: $ref: '#/components/schemas/PromptVersion' required: false description: 'Retrieve prompt at a specific version. The version id can either be a transaction id (e.g. ''1000192656880881099'') or a version identifier (e.g. ''81cd05ee665fdfb3'').' name: version in: query PromptEnvironment: schema: $ref: '#/components/schemas/PromptEnvironment' required: false description: 'Filter by environment slug. Cannot be used together with `version`. For `GET /v1/prompt`, environment resolution currently requires the request to match a single prompt. If multiple prompts match, the endpoint returns `400` (for example when `limit=1` is not set). Use `limit=1` or other filters (for example `slug`, `project_id`) to narrow results.' name: environment in: query allowReserved: true Ids: schema: $ref: '#/components/schemas/Ids' required: false description: Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times name: ids in: query FunctionIdParam: schema: $ref: '#/components/schemas/FunctionIdParam' required: true description: Function id name: function_id in: path ProjectIdQuery: schema: $ref: '#/components/schemas/ProjectIdQuery' required: false description: Project id name: project_id in: query Slug: schema: $ref: '#/components/schemas/Slug' required: false description: Retrieve prompt with a specific slug name: slug in: query allowReserved: true OrgName: schema: $ref: '#/components/schemas/OrgName' required: false description: Filter search results to within a particular organization name: org_name in: query allowReserved: true ProjectName: schema: $ref: '#/components/schemas/ProjectName' required: false description: Name of the project to search for name: project_name in: query allowReserved: true securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: API key or JWT description: '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](https://www.braintrustdata.com/app/settings?subroute=api-keys).'