🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
chore(public-api): move legacy endpoints to separate namespace (#12435)
Hassieb Pakzad2eaf04100315
diff --git a/fern/apis/server/definition/legacy/metrics-v1.yml b/fern/apis/server/definition/legacy/metrics-v1.ymlnew file mode 100644index 0000000000..3fb254035b--- /dev/null+++ b/fern/apis/server/definition/legacy/metrics-v1.yml@@ -0,0 +1,74 @@+# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json+imports:+ pagination: ../utils/pagination.yml+ commons: ../commons.yml+service:+ auth: true+ base-path: /api/public+ endpoints:+ metrics:+ docs: |+ Get metrics from the Langfuse project using a query object.++ Consider using the [v2 metrics endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for better performance.++ For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).+ method: GET+ path: /metrics+ request:+ name: GetMetricsRequest+ query-parameters:+ query:+ type: string+ docs: |+ JSON string containing the query parameters with the following structure:+ ```json+ {+ "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"+ "dimensions": [ // Optional. Default: []+ {+ "field": string // Field to group by, e.g. "name", "userId", "sessionId"+ }+ ],+ "metrics": [ // Required. At least one metric must be provided+ {+ "measure": string, // What to measure, e.g. "count", "latency", "value"+ "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"+ }+ ],+ "filters": [ // Optional. Default: []+ {+ "column": string, // Column to filter on+ "operator": string, // Operator, e.g. "=", ">", "<", "contains"+ "value": any, // Value to compare against+ "type": string, // Data type, e.g. "string", "number", "stringObject"+ "key": string // Required only when filtering on metadata+ }+ ],+ "timeDimension": { // Optional. Default: null. If provided, results will be grouped by time+ "granularity": string // One of "minute", "hour", "day", "week", "month", "auto"+ },+ "fromTimestamp": string, // Required. ISO datetime string for start of time range+ "toTimestamp": string, // Required. ISO datetime string for end of time range+ "orderBy": [ // Optional. Default: null+ {+ "field": string, // Field to order by+ "direction": string // "asc" or "desc"+ }+ ],+ "config": { // Optional. Query-specific configuration+ "bins": number, // Optional. Number of bins for histogram (1-100), default: 10+ "row_limit": number // Optional. Row limit for results (1-1000)+ }+ }+ ```+ response: MetricsResponse+types:+ MetricsResponse:+ properties:+ data:+ type: list<map<string, unknown>>+ docs: |+ The metrics data. Each item in the list contains the metric values and dimensions requested in the query.+ Format varies based on the query parameters.+ Histograms will return an array with [lower, upper, height] tuples.diff --git a/fern/apis/server/definition/observations-v2.yml b/fern/apis/server/definition/legacy/observations-v1.ymlsimilarity index 58%rename from fern/apis/server/definition/observations-v2.ymlrename to fern/apis/server/definition/legacy/observations-v1.ymlindex 1c8079f800..b9f6bf05cc 100644--- a/fern/apis/server/definition/observations-v2.yml+++ b/fern/apis/server/definition/legacy/observations-v1.yml@@ -1,72 +1,39 @@# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.jsonimports:- commons: ./commons.yml+ commons: ../commons.yml+ pagination: ../utils/pagination.ymlservice:auth: truebase-path: /api/publicendpoints:+ get:+ docs: Get a observation+ method: GET+ path: /observations/{observationId}+ path-parameters:+ observationId:+ type: string+ docs: The unique langfuse identifier of an observation, can be an event, span or generation+ response: commons.ObservationsViewgetMany:docs: |- Get a list of observations with cursor-based pagination and flexible field selection.-- ## Cursor-based Pagination- This endpoint uses cursor-based pagination for efficient traversal of large datasets.- The cursor is returned in the response metadata and should be passed in subsequent requests- to retrieve the next page of results.-- ## Field Selection- Use the `fields` parameter to control which observation fields are returned:- - `core` - Always included: id, traceId, startTime, endTime, projectId, parentObservationId, type- - `basic` - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId- - `time` - completionStartTime, createdAt, updatedAt- - `io` - input, output- - `metadata` - metadata (truncated to 200 chars by default, use `expandMetadata` to get full values)- - `model` - providedModelName, internalModelId, modelParameters- - `usage` - usageDetails, costDetails, totalCost- - `prompt` - promptId, promptName, promptVersion- - `metrics` - latency, timeToFirstToken-- If not specified, `core` and `basic` field groups are returned.+ Get a list of observations.- ## Filters- Multiple filtering options are available via query parameters or the structured `filter` parameter.- When using the `filter` parameter, it takes precedence over individual query parameter filters.+ Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.method: GET- path: /v2/observations+ path: /observationsrequest:- name: GetObservationsV2Request+ name: GetObservationsRequestquery-parameters:- fields:- type: optional<string>- docs: |- Comma-separated list of field groups to include in the response.- Available groups: core, basic, time, io, metadata, model, usage, prompt, metrics.- If not specified, `core` and `basic` field groups are returned.- Example: "basic,usage,model"- expandMetadata:- type: optional<string>- docs: |- Comma-separated list of metadata keys to return non-truncated.- By default, metadata values over 200 characters are truncated.- Use this parameter to retrieve full values for specific keys.- Example: "key1,key2"+ page:+ type: optional<integer>+ docs: Page number, starts at 1.limit:type: optional<integer>- docs: Number of items to return per page. Maximum 1000, default 50.- cursor:- type: optional<string>- docs: Base64-encoded cursor for pagination. Use the cursor from the previous response to get the next page.- parseIoAsJson:- type: optional<boolean>- docs: |- **Deprecated.** Setting this to `true` will return a 400 error.- Input/output fields are always returned as raw strings.- Remove this parameter or set it to `false`.+ docs: Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.name: optional<string>userId: optional<string>- type:- type: optional<string>- docs: Filter by observation type (e.g., "GENERATION", "SPAN", "EVENT", "AGENT", "TOOL", "CHAIN", "RETRIEVER", "EVALUATOR", "EMBEDDING", "GUARDRAIL")+ type: optional<string>traceId: optional<string>level:type: optional<commons.ObservationLevel>@@ -127,13 +94,6 @@ service:- `level` (string) - Log level (DEBUG, DEFAULT, WARNING, ERROR)- `statusMessage` (string) - Status message- `version` (string) - Version tag- - `userId` (string) - User ID- - `sessionId` (string) - Session ID-- ### Trace-Related Fields- - `traceName` (string) - Name of the parent trace- - `traceTags` (arrayOptions) - Tags from the parent trace- - `tags` (arrayOptions) - Alias for traceTags### Performance Metrics- `latency` (number) - Latency in seconds (calculated: end_time - start_time)@@ -151,13 +111,19 @@ service:- `totalCost` (number) - Total cost in USD### Model Information- - `model` (string) - Provided model name (alias: `providedModelName`)+ - `model` (string) - Provided model name- `promptName` (string) - Associated prompt name- `promptVersion` (number) - Associated prompt version### Structured Data- `metadata` (stringObject/numberObject/categoryOptions) - Metadata key-value pairs. Use `key` parameter to filter on specific metadata keys.+ ### Associated Trace Fields (requires join with traces table)+ - `userId` (string) - User ID from associated trace+ - `traceName` (string) - Name from associated trace+ - `traceEnvironment` (string) - Environment from associated trace+ - `traceTags` (arrayOptions) - Tags from associated trace+## Filter Examples```json[@@ -182,24 +148,15 @@ service:}]```- response: ObservationsV2Response+ response: ObservationsViewstypes:- ObservationsV2Response:- docs: |- Response containing observations with field-group-based filtering and cursor-based pagination.-- The `data` array contains observation objects with only the requested field groups included.- Use the `cursor` in `meta` to retrieve the next page of results.+ Observations:properties:- data:- type: list<commons.ObservationV2>- docs: Array of observation objects. Fields included depend on the `fields` parameter in the request.- meta: ObservationsV2Meta+ data: list<commons.Observation>+ meta: pagination.MetaResponse- ObservationsV2Meta:- docs: Metadata for cursor-based pagination+ ObservationsViews:properties:- cursor:- type: optional<string>- docs: Base64-encoded cursor to use for retrieving the next page. If not present, there are no more results.+ data: list<commons.ObservationsView>+ meta: pagination.MetaResponsediff --git a/fern/apis/server/definition/score.yml b/fern/apis/server/definition/legacy/score-v1.ymlsimilarity index 98%rename from fern/apis/server/definition/score.ymlrename to fern/apis/server/definition/legacy/score-v1.ymlindex 27c2eb8017..85796c0820 100644--- a/fern/apis/server/definition/score.yml+++ b/fern/apis/server/definition/legacy/score-v1.yml@@ -1,7 +1,7 @@# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.jsonimports:- pagination: ./utils/pagination.yml- commons: ./commons.yml+ pagination: ../utils/pagination.yml+ commons: ../commons.ymlservice:auth: truebase-path: /api/publicdiff --git a/fern/apis/server/definition/metrics-v2.yml b/fern/apis/server/definition/metrics-v2.ymldeleted file mode 100644index d50fae563e..0000000000--- a/fern/apis/server/definition/metrics-v2.yml+++ /dev/null@@ -1,178 +0,0 @@-# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json-imports:- pagination: ./utils/pagination.yml- commons: ./commons.yml-service:- auth: true- base-path: /api/public- endpoints:- metrics:- docs: |- Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.-- ## V2 Differences- - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported)- - Direct access to tags and release fields on observations- - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view- - High cardinality dimensions are not supported and will return a 400 error (see below)-- For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).-- ## Available Views-- ### observations- Query observation-level data (spans, generations, events).-- **Dimensions:**- - `environment` - Deployment environment (e.g., production, staging)- - `type` - Type of observation (SPAN, GENERATION, EVENT)- - `name` - Name of the observation- - `level` - Logging level of the observation- - `version` - Version of the observation- - `tags` - User-defined tags- - `release` - Release version- - `traceName` - Name of the parent trace (backwards-compatible)- - `traceRelease` - Release version of the parent trace (backwards-compatible, maps to release)- - `traceVersion` - Version of the parent trace (backwards-compatible, maps to version)- - `providedModelName` - Name of the model used- - `promptName` - Name of the prompt used- - `promptVersion` - Version of the prompt used- - `startTimeMonth` - Month of start_time in YYYY-MM format-- **Measures:**- - `count` - Total number of observations- - `latency` - Observation latency (milliseconds)- - `streamingLatency` - Generation latency from completion start to end (milliseconds)- - `inputTokens` - Sum of input tokens consumed- - `outputTokens` - Sum of output tokens produced- - `totalTokens` - Sum of all tokens consumed- - `outputTokensPerSecond` - Output tokens per second- - `tokensPerSecond` - Total tokens per second- - `inputCost` - Input cost (USD)- - `outputCost` - Output cost (USD)- - `totalCost` - Total cost (USD)- - `timeToFirstToken` - Time to first token (milliseconds)- - `countScores` - Number of scores attached to the observation-- ### scores-numeric- Query numeric and boolean score data.-- **Dimensions:**- - `environment` - Deployment environment- - `name` - Name of the score (e.g., accuracy, toxicity)- - `source` - Origin of the score (API, ANNOTATION, EVAL)- - `dataType` - Data type (NUMERIC, BOOLEAN)- - `configId` - Identifier of the score config- - `timestampMonth` - Month in YYYY-MM format- - `timestampDay` - Day in YYYY-MM-DD format- - `value` - Numeric value of the score- - `traceName` - Name of the parent trace- - `tags` - Tags- - `traceRelease` - Release version- - `traceVersion` - Version- - `observationName` - Name of the associated observation- - `observationModelName` - Model name of the associated observation- - `observationPromptName` - Prompt name of the associated observation- - `observationPromptVersion` - Prompt version of the associated observation-- **Measures:**- - `count` - Total number of scores- - `value` - Score value (for aggregations)-- ### scores-categorical- Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`.-- **Measures:**- - `count` - Total number of scores-- ## High Cardinality Dimensions- The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.- Use them in filters instead.-- **observations view:**- - `id` - Use traceId filter to narrow down results- - `traceId` - Use traceId filter instead- - `userId` - Use userId filter instead- - `sessionId` - Use sessionId filter instead- - `parentObservationId` - Use parentObservationId filter instead-- **scores-numeric / scores-categorical views:**- - `id` - Use specific filters to narrow down results- - `traceId` - Use traceId filter instead- - `userId` - Use userId filter instead- - `sessionId` - Use sessionId filter instead- - `observationId` - Use observationId filter instead-- ## Aggregations- Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`, `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`-- ## Time Granularities- Available granularities for timeDimension: `auto`, `minute`, `hour`, `day`, `week`, `month`- - `auto` bins the data into approximately 50 buckets based on the time range- method: GET- path: /v2/metrics- request:- name: GetMetricsV2Request- query-parameters:- query:- type: string- docs: |- JSON string containing the query parameters with the following structure:- ```json- {- "view": string, // Required. One of "observations", "scores-numeric", "scores-categorical"- "dimensions": [ // Optional. Default: []- {- "field": string // Field to group by (see available dimensions above)- }- ],- "metrics": [ // Required. At least one metric must be provided- {- "measure": string, // What to measure (see available measures above)- "aggregation": string // How to aggregate: "sum", "avg", "count", "max", "min", "p50", "p75", "p90", "p95", "p99", "histogram"- }- ],- "filters": [ // Optional. Default: []- {- "column": string, // Column to filter on (any dimension field)- "operator": string, // Operator based on type:- // - datetime: ">", "<", ">=", "<="- // - string: "=", "contains", "does not contain", "starts with", "ends with"- // - stringOptions: "any of", "none of"- // - arrayOptions: "any of", "none of", "all of"- // - number: "=", ">", "<", ">=", "<="- // - stringObject/numberObject: same as string/number with required "key"- // - boolean: "=", "<>"- // - null: "is null", "is not null"- "value": any, // Value to compare against- "type": string, // Data type: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"- "key": string // Required only for stringObject/numberObject types (e.g., metadata filtering)- }- ],- "timeDimension": { // Optional. Default: null. If provided, results will be grouped by time- "granularity": string // One of "auto", "minute", "hour", "day", "week", "month"- },- "fromTimestamp": string, // Required. ISO datetime string for start of time range- "toTimestamp": string, // Required. ISO datetime string for end of time range (must be after fromTimestamp)- "orderBy": [ // Optional. Default: null- {- "field": string, // Field to order by (dimension or metric alias)- "direction": string // "asc" or "desc"- }- ],- "config": { // Optional. Query-specific configuration- "bins": number, // Optional. Number of bins for histogram aggregation (1-100), default: 10- "row_limit": number // Optional. Maximum number of rows to return (1-1000), default: 100- }- }- ```- response: MetricsV2Response-types:- MetricsV2Response:- properties:- data:- type: list<map<string, unknown>>- docs: |- The metrics data. Each item in the list contains the metric values and dimensions requested in the query.- Format varies based on the query parameters.- Histograms will return an array with [lower, upper, height] tuples.diff --git a/fern/apis/server/definition/metrics.yml b/fern/apis/server/definition/metrics.ymlindex af3fca04b0..d50fae563e 100644--- a/fern/apis/server/definition/metrics.yml+++ b/fern/apis/server/definition/metrics.yml@@ -8,15 +8,111 @@ service:endpoints:metrics:docs: |- Get metrics from the Langfuse project using a query object.+ Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.- Consider using the [v2 metrics endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for better performance.+ ## V2 Differences+ - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported)+ - Direct access to tags and release fields on observations+ - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view+ - High cardinality dimensions are not supported and will return a 400 error (see below)For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).++ ## Available Views++ ### observations+ Query observation-level data (spans, generations, events).++ **Dimensions:**+ - `environment` - Deployment environment (e.g., production, staging)+ - `type` - Type of observation (SPAN, GENERATION, EVENT)+ - `name` - Name of the observation+ - `level` - Logging level of the observation+ - `version` - Version of the observation+ - `tags` - User-defined tags+ - `release` - Release version+ - `traceName` - Name of the parent trace (backwards-compatible)+ - `traceRelease` - Release version of the parent trace (backwards-compatible, maps to release)+ - `traceVersion` - Version of the parent trace (backwards-compatible, maps to version)+ - `providedModelName` - Name of the model used+ - `promptName` - Name of the prompt used+ - `promptVersion` - Version of the prompt used+ - `startTimeMonth` - Month of start_time in YYYY-MM format++ **Measures:**+ - `count` - Total number of observations+ - `latency` - Observation latency (milliseconds)+ - `streamingLatency` - Generation latency from completion start to end (milliseconds)+ - `inputTokens` - Sum of input tokens consumed+ - `outputTokens` - Sum of output tokens produced+ - `totalTokens` - Sum of all tokens consumed+ - `outputTokensPerSecond` - Output tokens per second+ - `tokensPerSecond` - Total tokens per second+ - `inputCost` - Input cost (USD)+ - `outputCost` - Output cost (USD)+ - `totalCost` - Total cost (USD)+ - `timeToFirstToken` - Time to first token (milliseconds)+ - `countScores` - Number of scores attached to the observation++ ### scores-numeric+ Query numeric and boolean score data.++ **Dimensions:**+ - `environment` - Deployment environment+ - `name` - Name of the score (e.g., accuracy, toxicity)+ - `source` - Origin of the score (API, ANNOTATION, EVAL)+ - `dataType` - Data type (NUMERIC, BOOLEAN)+ - `configId` - Identifier of the score config+ - `timestampMonth` - Month in YYYY-MM format+ - `timestampDay` - Day in YYYY-MM-DD format+ - `value` - Numeric value of the score+ - `traceName` - Name of the parent trace+ - `tags` - Tags+ - `traceRelease` - Release version+ - `traceVersion` - Version+ - `observationName` - Name of the associated observation+ - `observationModelName` - Model name of the associated observation+ - `observationPromptName` - Prompt name of the associated observation+ - `observationPromptVersion` - Prompt version of the associated observation++ **Measures:**+ - `count` - Total number of scores+ - `value` - Score value (for aggregations)++ ### scores-categorical+ Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`.++ **Measures:**+ - `count` - Total number of scores++ ## High Cardinality Dimensions+ The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.+ Use them in filters instead.++ **observations view:**+ - `id` - Use traceId filter to narrow down results+ - `traceId` - Use traceId filter instead+ - `userId` - Use userId filter instead+ - `sessionId` - Use sessionId filter instead+ - `parentObservationId` - Use parentObservationId filter instead++ **scores-numeric / scores-categorical views:**+ - `id` - Use specific filters to narrow down results+ - `traceId` - Use traceId filter instead+ - `userId` - Use userId filter instead+ - `sessionId` - Use sessionId filter instead+ - `observationId` - Use observationId filter instead++ ## Aggregations+ Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`, `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`++ ## Time Granularities+ Available granularities for timeDimension: `auto`, `minute`, `hour`, `day`, `week`, `month`+ - `auto` bins the data into approximately 50 buckets based on the time rangemethod: GET- path: /metrics+ path: /v2/metricsrequest:- name: GetMetricsRequest+ name: GetMetricsV2Requestquery-parameters:query:type: string@@ -24,47 +120,55 @@ service:JSON string containing the query parameters with the following structure:```json{- "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"+ "view": string, // Required. One of "observations", "scores-numeric", "scores-categorical""dimensions": [ // Optional. Default: []{- "field": string // Field to group by, e.g. "name", "userId", "sessionId"+ "field": string // Field to group by (see available dimensions above)}],"metrics": [ // Required. At least one metric must be provided{- "measure": string, // What to measure, e.g. "count", "latency", "value"- "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"+ "measure": string, // What to measure (see available measures above)+ "aggregation": string // How to aggregate: "sum", "avg", "count", "max", "min", "p50", "p75", "p90", "p95", "p99", "histogram"}],"filters": [ // Optional. Default: []{- "column": string, // Column to filter on- "operator": string, // Operator, e.g. "=", ">", "<", "contains"+ "column": string, // Column to filter on (any dimension field)+ "operator": string, // Operator based on type:+ // - datetime: ">", "<", ">=", "<="+ // - string: "=", "contains", "does not contain", "starts with", "ends with"+ // - stringOptions: "any of", "none of"+ // - arrayOptions: "any of", "none of", "all of"+ // - number: "=", ">", "<", ">=", "<="+ // - stringObject/numberObject: same as string/number with required "key"+ // - boolean: "=", "<>"+ // - null: "is null", "is not null""value": any, // Value to compare against- "type": string, // Data type, e.g. "string", "number", "stringObject"- "key": string // Required only when filtering on metadata+ "type": string, // Data type: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"+ "key": string // Required only for stringObject/numberObject types (e.g., metadata filtering)}],"timeDimension": { // Optional. Default: null. If provided, results will be grouped by time- "granularity": string // One of "minute", "hour", "day", "week", "month", "auto"+ "granularity": string // One of "auto", "minute", "hour", "day", "week", "month"},"fromTimestamp": string, // Required. ISO datetime string for start of time range- "toTimestamp": string, // Required. ISO datetime string for end of time range+ "toTimestamp": string, // Required. ISO datetime string for end of time range (must be after fromTimestamp)"orderBy": [ // Optional. Default: null{- "field": string, // Field to order by+ "field": string, // Field to order by (dimension or metric alias)"direction": string // "asc" or "desc"}],"config": { // Optional. Query-specific configuration- "bins": number, // Optional. Number of bins for histogram (1-100), default: 10- "row_limit": number // Optional. Row limit for results (1-1000)+ "bins": number, // Optional. Number of bins for histogram aggregation (1-100), default: 10+ "row_limit": number // Optional. Maximum number of rows to return (1-1000), default: 100}}```- response: MetricsResponse+ response: MetricsV2Responsetypes:- MetricsResponse:+ MetricsV2Response:properties:data:type: list<map<string, unknown>>diff --git a/fern/apis/server/definition/observations.yml b/fern/apis/server/definition/observations.ymlindex 879da144d0..1c8079f800 100644--- a/fern/apis/server/definition/observations.yml+++ b/fern/apis/server/definition/observations.yml@@ -1,39 +1,72 @@# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.jsonimports:commons: ./commons.yml- pagination: ./utils/pagination.ymlservice:auth: truebase-path: /api/publicendpoints:- get:- docs: Get a observation- method: GET- path: /observations/{observationId}- path-parameters:- observationId:- type: string- docs: The unique langfuse identifier of an observation, can be an event, span or generation- response: commons.ObservationsViewgetMany:docs: |- Get a list of observations.+ Get a list of observations with cursor-based pagination and flexible field selection.++ ## Cursor-based Pagination+ This endpoint uses cursor-based pagination for efficient traversal of large datasets.+ The cursor is returned in the response metadata and should be passed in subsequent requests+ to retrieve the next page of results.++ ## Field Selection+ Use the `fields` parameter to control which observation fields are returned:+ - `core` - Always included: id, traceId, startTime, endTime, projectId, parentObservationId, type+ - `basic` - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId+ - `time` - completionStartTime, createdAt, updatedAt+ - `io` - input, output+ - `metadata` - metadata (truncated to 200 chars by default, use `expandMetadata` to get full values)+ - `model` - providedModelName, internalModelId, modelParameters+ - `usage` - usageDetails, costDetails, totalCost+ - `prompt` - promptId, promptName, promptVersion+ - `metrics` - latency, timeToFirstToken++ If not specified, `core` and `basic` field groups are returned.- Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.+ ## Filters+ Multiple filtering options are available via query parameters or the structured `filter` parameter.+ When using the `filter` parameter, it takes precedence over individual query parameter filters.method: GET- path: /observations+ path: /v2/observationsrequest:- name: GetObservationsRequest+ name: GetObservationsV2Requestquery-parameters:- page:- type: optional<integer>- docs: Page number, starts at 1.+ fields:+ type: optional<string>+ docs: |+ Comma-separated list of field groups to include in the response.+ Available groups: core, basic, time, io, metadata, model, usage, prompt, metrics.+ If not specified, `core` and `basic` field groups are returned.+ Example: "basic,usage,model"+ expandMetadata:+ type: optional<string>+ docs: |+ Comma-separated list of metadata keys to return non-truncated.+ By default, metadata values over 200 characters are truncated.+ Use this parameter to retrieve full values for specific keys.+ Example: "key1,key2"limit:type: optional<integer>- docs: Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.+ docs: Number of items to return per page. Maximum 1000, default 50.+ cursor:+ type: optional<string>+ docs: Base64-encoded cursor for pagination. Use the cursor from the previous response to get the next page.+ parseIoAsJson:+ type: optional<boolean>+ docs: |+ **Deprecated.** Setting this to `true` will return a 400 error.+ Input/output fields are always returned as raw strings.+ Remove this parameter or set it to `false`.name: optional<string>userId: optional<string>- type: optional<string>+ type:+ type: optional<string>+ docs: Filter by observation type (e.g., "GENERATION", "SPAN", "EVENT", "AGENT", "TOOL", "CHAIN", "RETRIEVER", "EVALUATOR", "EMBEDDING", "GUARDRAIL")traceId: optional<string>level:type: optional<commons.ObservationLevel>@@ -94,6 +127,13 @@ service:- `level` (string) - Log level (DEBUG, DEFAULT, WARNING, ERROR)- `statusMessage` (string) - Status message- `version` (string) - Version tag+ - `userId` (string) - User ID+ - `sessionId` (string) - Session ID++ ### Trace-Related Fields+ - `traceName` (string) - Name of the parent trace+ - `traceTags` (arrayOptions) - Tags from the parent trace+ - `tags` (arrayOptions) - Alias for traceTags### Performance Metrics- `latency` (number) - Latency in seconds (calculated: end_time - start_time)@@ -111,19 +151,13 @@ service:- `totalCost` (number) - Total cost in USD### Model Information- - `model` (string) - Provided model name+ - `model` (string) - Provided model name (alias: `providedModelName`)- `promptName` (string) - Associated prompt name- `promptVersion` (number) - Associated prompt version### Structured Data- `metadata` (stringObject/numberObject/categoryOptions) - Metadata key-value pairs. Use `key` parameter to filter on specific metadata keys.- ### Associated Trace Fields (requires join with traces table)- - `userId` (string) - User ID from associated trace- - `traceName` (string) - Name from associated trace- - `traceEnvironment` (string) - Environment from associated trace- - `traceTags` (arrayOptions) - Tags from associated trace-## Filter Examples```json[@@ -148,15 +182,24 @@ service:}]```- response: ObservationsViews+ response: ObservationsV2Responsetypes:- Observations:+ ObservationsV2Response:+ docs: |+ Response containing observations with field-group-based filtering and cursor-based pagination.++ The `data` array contains observation objects with only the requested field groups included.+ Use the `cursor` in `meta` to retrieve the next page of results.properties:- data: list<commons.Observation>- meta: pagination.MetaResponse+ data:+ type: list<commons.ObservationV2>+ docs: Array of observation objects. Fields included depend on the `fields` parameter in the request.+ meta: ObservationsV2Meta- ObservationsViews:+ ObservationsV2Meta:+ docs: Metadata for cursor-based paginationproperties:- data: list<commons.ObservationsView>- meta: pagination.MetaResponse+ cursor:+ type: optional<string>+ docs: Base64-encoded cursor to use for retrieving the next page. If not present, there are no more results.diff --git a/fern/apis/server/definition/score-v2.yml b/fern/apis/server/definition/scores.ymlsimilarity index 99%rename from fern/apis/server/definition/score-v2.ymlrename to fern/apis/server/definition/scores.ymlindex 7cd273ac68..603214aeac 100644--- a/fern/apis/server/definition/score-v2.yml+++ b/fern/apis/server/definition/scores.yml@@ -6,7 +6,7 @@ service:auth: truebase-path: /api/public/v2endpoints:- get:+ get-many:docs: Get a list of scores (supports both trace and session scores)method: GETpath: /scoresdiff --git a/web/public/generated/api/openapi.yml b/web/public/generated/api/openapi.ymlindex f2b621bbb8..ab0b617539 100644--- a/web/public/generated/api/openapi.yml+++ b/web/public/generated/api/openapi.yml@@ -1729,119 +1729,71 @@ paths:name: My Scorevalue: 0.9environment: default- /api/public/llm-connections:+ /api/public/metrics:get:- description: Get all LLM connections in a project- operationId: llmConnections_list- tags:- - LlmConnections- parameters:- - name: page- in: query- description: page number, starts at 1- required: false- schema:- type: integer- nullable: true- - name: limit- in: query- description: limit of items per page- required: false- schema:- type: integer- nullable: true- responses:- '200':- description: ''- content:- application/json:- schema:- $ref: '#/components/schemas/PaginatedLlmConnections'- '400':- description: ''- content:- application/json:- schema: {}- '401':- description: ''- content:- application/json:- schema: {}- '403':- description: ''- content:- application/json:- schema: {}- '404':- description: ''- content:- application/json:- schema: {}- '405':- description: ''- content:- application/json:- schema: {}- security:- - BasicAuth: []- put:description: >-- Create or update an LLM connection. The connection is upserted on- provider.- operationId: llmConnections_upsert- tags:- - LlmConnections- parameters: []- responses:- '200':- description: ''- content:- application/json:- schema:- $ref: '#/components/schemas/LlmConnection'- '400':- description: ''- content:- application/json:- schema: {}- '401':- description: ''- content:- application/json:- schema: {}- '403':- description: ''- content:- application/json:- schema: {}- '404':- description: ''- content:- application/json:- schema: {}- '405':- description: ''- content:- application/json:- schema: {}- security:- - BasicAuth: []- requestBody:- required: true- content:- application/json:- schema:- $ref: '#/components/schemas/UpsertLlmConnectionRequest'- /api/public/media/{mediaId}:- get:- description: Get a media record- operationId: media_get+ Get metrics from the Langfuse project using a query object.+++ Consider using the [v2 metrics+ endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for+ better performance.+++ For more details, see the [Metrics API+ documentation](https://langfuse.com/docs/metrics/features/metrics-api).+ operationId: legacy_metricsV1_metricstags:- - Media+ - LegacyMetricsV1parameters:- - name: mediaId- in: path- description: The unique langfuse identifier of a media record+ - name: query+ in: query+ description: >-+ JSON string containing the query parameters with the following+ structure:++ ```json++ {+ "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"+ "dimensions": [ // Optional. Default: []+ {+ "field": string // Field to group by, e.g. "name", "userId", "sessionId"+ }+ ],+ "metrics": [ // Required. At least one metric must be provided+ {+ "measure": string, // What to measure, e.g. "count", "latency", "value"+ "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"+ }+ ],+ "filters": [ // Optional. Default: []+ {+ "column": string, // Column to filter on+ "operator": string, // Operator, e.g. "=", ">", "<", "contains"+ "value": any, // Value to compare against+ "type": string, // Data type, e.g. "string", "number", "stringObject"+ "key": string // Required only when filtering on metadata+ }+ ],+ "timeDimension": { // Optional. Default: null. If provided, results will be grouped by time+ "granularity": string // One of "minute", "hour", "day", "week", "month", "auto"+ },+ "fromTimestamp": string, // Required. ISO datetime string for start of time range+ "toTimestamp": string, // Required. ISO datetime string for end of time range+ "orderBy": [ // Optional. Default: null+ {+ "field": string, // Field to order by+ "direction": string // "asc" or "desc"+ }+ ],+ "config": { // Optional. Query-specific configuration+ "bins": number, // Optional. Number of bins for histogram (1-100), default: 10+ "row_limit": number // Optional. Row limit for results (1-1000)+ }+ }++ ```required: trueschema:type: string@@ -1851,7 +1803,7 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/GetMediaResponse'+ $ref: '#/components/schemas/legacyMetricsResponse''400':description: ''content:@@ -1879,68 +1831,28 @@ paths:schema: {}security:- BasicAuth: []- patch:- description: Patch a media record- operationId: media_patch+ /api/public/observations/{observationId}:+ get:+ description: Get a observation+ operationId: legacy_observationsV1_gettags:- - Media+ - LegacyObservationsV1parameters:- - name: mediaId+ - name: observationIdin: path- description: The unique langfuse identifier of a media record+ description: >-+ The unique langfuse identifier of an observation, can be an event,+ span or generationrequired: trueschema:type: string- responses:- '204':- description: ''- '400':- description: ''- content:- application/json:- schema: {}- '401':- description: ''- content:- application/json:- schema: {}- '403':- description: ''- content:- application/json:- schema: {}- '404':- description: ''- content:- application/json:- schema: {}- '405':- description: ''- content:- application/json:- schema: {}- security:- - BasicAuth: []- requestBody:- required: true- content:- application/json:- schema:- $ref: '#/components/schemas/PatchMediaBody'- /api/public/media:- post:- description: Get a presigned upload URL for a media record- operationId: media_getUploadUrl- tags:- - Media- parameters: []responses:'200':description: ''content:application/json:schema:- $ref: '#/components/schemas/GetMediaUploadUrlResponse'+ $ref: '#/components/schemas/ObservationsView''400':description: ''content:@@ -1968,284 +1880,358 @@ paths:schema: {}security:- BasicAuth: []- requestBody:- required: true- content:- application/json:- schema:- $ref: '#/components/schemas/GetMediaUploadUrlRequest'- /api/public/v2/metrics:+ /api/public/observations:get:description: >-- Get metrics from the Langfuse project using a query object. V2 endpoint- with optimized performance.--- ## V2 Differences-- - Supports `observations`, `scores-numeric`, and `scores-categorical`- views only (traces view not supported)-- - Direct access to tags and release fields on observations-- - Backwards-compatible: traceName, traceRelease, traceVersion dimensions- are still available on observations view-- - High cardinality dimensions are not supported and will return a 400- error (see below)--- For more details, see the [Metrics API- documentation](https://langfuse.com/docs/metrics/features/metrics-api).+ Get a list of observations.- ## Available Views--- ### observations-- Query observation-level data (spans, generations, events).--- **Dimensions:**-- - `environment` - Deployment environment (e.g., production, staging)-- - `type` - Type of observation (SPAN, GENERATION, EVENT)-- - `name` - Name of the observation-- - `level` - Logging level of the observation-- - `version` - Version of the observation-- - `tags` - User-defined tags-- - `release` - Release version-- - `traceName` - Name of the parent trace (backwards-compatible)-- - `traceRelease` - Release version of the parent trace- (backwards-compatible, maps to release)-- - `traceVersion` - Version of the parent trace (backwards-compatible,- maps to version)-- - `providedModelName` - Name of the model used-- - `promptName` - Name of the prompt used-- - `promptVersion` - Version of the prompt used-- - `startTimeMonth` - Month of start_time in YYYY-MM format--- **Measures:**-- - `count` - Total number of observations-- - `latency` - Observation latency (milliseconds)-- - `streamingLatency` - Generation latency from completion start to end- (milliseconds)-- - `inputTokens` - Sum of input tokens consumed-- - `outputTokens` - Sum of output tokens produced-- - `totalTokens` - Sum of all tokens consumed-- - `outputTokensPerSecond` - Output tokens per second-- - `tokensPerSecond` - Total tokens per second-- - `inputCost` - Input cost (USD)-- - `outputCost` - Output cost (USD)-- - `totalCost` - Total cost (USD)-- - `timeToFirstToken` - Time to first token (milliseconds)-- - `countScores` - Number of scores attached to the observation--- ### scores-numeric-- Query numeric and boolean score data.--- **Dimensions:**+ Consider using the [v2 observations+ endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations)+ for cursor-based pagination and field selection.+ operationId: legacy_observationsV1_getMany+ tags:+ - LegacyObservationsV1+ parameters:+ - name: page+ in: query+ description: Page number, starts at 1.+ required: false+ schema:+ type: integer+ nullable: true+ - name: limit+ in: query+ description: >-+ Limit of items per page. If you encounter api issues due to too+ large page sizes, try to reduce the limit.+ required: false+ schema:+ type: integer+ nullable: true+ - name: name+ in: query+ required: false+ schema:+ type: string+ nullable: true+ - name: userId+ in: query+ required: false+ schema:+ type: string+ nullable: true+ - name: type+ in: query+ required: false+ schema:+ type: string+ nullable: true+ - name: traceId+ in: query+ required: false+ schema:+ type: string+ nullable: true+ - name: level+ in: query+ description: >-+ Optional filter for observations with a specific level (e.g.+ "DEBUG", "DEFAULT", "WARNING", "ERROR").+ required: false+ schema:+ $ref: '#/components/schemas/ObservationLevel'+ nullable: true+ - name: parentObservationId+ in: query+ required: false+ schema:+ type: string+ nullable: true+ - name: environment+ in: query+ description: >-+ Optional filter for observations where the environment is one of the+ provided values.+ required: false+ schema:+ type: array+ items:+ type: string+ nullable: true+ - name: fromStartTime+ in: query+ description: >-+ Retrieve only observations with a start_time on or after this+ datetime (ISO 8601).+ required: false+ schema:+ type: string+ format: date-time+ nullable: true+ - name: toStartTime+ in: query+ description: >-+ Retrieve only observations with a start_time before this datetime+ (ISO 8601).+ required: false+ schema:+ type: string+ format: date-time+ nullable: true+ - name: version+ in: query+ description: Optional filter to only include observations with a certain version.+ required: false+ schema:+ type: string+ nullable: true+ - name: filter+ in: query+ description: >-+ JSON string containing an array of filter conditions. When provided,+ this takes precedence over query parameter filters (userId, name,+ type, level, environment, fromStartTime, ...).- - `environment` - Deployment environment- - `name` - Name of the score (e.g., accuracy, toxicity)+ ## Filter Structure- - `source` - Origin of the score (API, ANNOTATION, EVAL)+ Each filter condition has the following structure:- - `dataType` - Data type (NUMERIC, BOOLEAN)+ ```json- - `configId` - Identifier of the score config+ [+ {+ "type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"+ "column": string, // Required. Column to filter on (see available columns below)+ "operator": string, // Required. Operator based on type:+ // - datetime: ">", "<", ">=", "<="+ // - string: "=", "contains", "does not contain", "starts with", "ends with"+ // - stringOptions: "any of", "none of"+ // - categoryOptions: "any of", "none of"+ // - arrayOptions: "any of", "none of", "all of"+ // - number: "=", ">", "<", ">=", "<="+ // - stringObject: "=", "contains", "does not contain", "starts with", "ends with"+ // - numberObject: "=", ">", "<", ">=", "<="+ // - boolean: "=", "<>"+ // - null: "is null", "is not null"+ "value": any, // Required (except for null type). Value to compare against. Type depends on filter type+ "key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata+ }+ ]- - `timestampMonth` - Month in YYYY-MM format+ ```- - `timestampDay` - Day in YYYY-MM-DD format- - `value` - Numeric value of the score+ ## Available Columns- - `traceName` - Name of the parent trace- - `tags` - Tags+ ### Core Observation Fields- - `traceRelease` - Release version+ - `id` (string) - Observation ID- - `traceVersion` - Version+ - `type` (string) - Observation type (SPAN, GENERATION, EVENT)- - `observationName` - Name of the associated observation+ - `name` (string) - Observation name- - `observationModelName` - Model name of the associated observation+ - `traceId` (string) - Associated trace ID- - `observationPromptName` - Prompt name of the associated observation+ - `startTime` (datetime) - Observation start time- - `observationPromptVersion` - Prompt version of the associated- observation+ - `endTime` (datetime) - Observation end time+ - `environment` (string) - Environment tag- **Measures:**+ - `level` (string) - Log level (DEBUG, DEFAULT, WARNING, ERROR)- - `count` - Total number of scores+ - `statusMessage` (string) - Status message- - `value` - Score value (for aggregations)+ - `version` (string) - Version tag- ### scores-categorical+ ### Performance Metrics- Query categorical score data. Same dimensions as scores-numeric except- uses `stringValue` instead of `value`.+ - `latency` (number) - Latency in seconds (calculated: end_time -+ start_time)+ - `timeToFirstToken` (number) - Time to first token in seconds- **Measures:**+ - `tokensPerSecond` (number) - Output tokens per second- - `count` - Total number of scores+ ### Token Usage- ## High Cardinality Dimensions+ - `inputTokens` (number) - Number of input tokens- The following dimensions cannot be used as grouping dimensions in v2- metrics API as they can cause performance issues.+ - `outputTokens` (number) - Number of output tokens- Use them in filters instead.+ - `totalTokens` (number) - Total tokens (alias: `tokens`)- **observations view:**+ ### Cost Metrics- - `id` - Use traceId filter to narrow down results+ - `inputCost` (number) - Input cost in USD- - `traceId` - Use traceId filter instead+ - `outputCost` (number) - Output cost in USD- - `userId` - Use userId filter instead+ - `totalCost` (number) - Total cost in USD- - `sessionId` - Use sessionId filter instead- - `parentObservationId` - Use parentObservationId filter instead+ ### Model Information+ - `model` (string) - Provided model name- **scores-numeric / scores-categorical views:**+ - `promptName` (string) - Associated prompt name- - `id` - Use specific filters to narrow down results+ - `promptVersion` (number) - Associated prompt version- - `traceId` - Use traceId filter instead- - `userId` - Use userId filter instead+ ### Structured Data- - `sessionId` - Use sessionId filter instead+ - `metadata` (stringObject/numberObject/categoryOptions) - Metadata+ key-value pairs. Use `key` parameter to filter on specific metadata+ keys.- - `observationId` - Use observationId filter instead+ ### Associated Trace Fields (requires join with traces table)- ## Aggregations+ - `userId` (string) - User ID from associated trace- Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`,- `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`+ - `traceName` (string) - Name from associated trace+ - `traceEnvironment` (string) - Environment from associated trace- ## Time Granularities+ - `traceTags` (arrayOptions) - Tags from associated trace- Available granularities for timeDimension: `auto`, `minute`, `hour`,- `day`, `week`, `month`- - `auto` bins the data into approximately 50 buckets based on the time- range- operationId: metricsV2_metrics- tags:- - MetricsV2- parameters:- - name: query- in: query- description: >-- JSON string containing the query parameters with the following- structure:+ ## Filter Examples```json- {- "view": string, // Required. One of "observations", "scores-numeric", "scores-categorical"- "dimensions": [ // Optional. Default: []- {- "field": string // Field to group by (see available dimensions above)- }- ],- "metrics": [ // Required. At least one metric must be provided- {- "measure": string, // What to measure (see available measures above)- "aggregation": string // How to aggregate: "sum", "avg", "count", "max", "min", "p50", "p75", "p90", "p95", "p99", "histogram"- }- ],- "filters": [ // Optional. Default: []- {- "column": string, // Column to filter on (any dimension field)- "operator": string, // Operator based on type:- // - datetime: ">", "<", ">=", "<="- // - string: "=", "contains", "does not contain", "starts with", "ends with"- // - stringOptions: "any of", "none of"- // - arrayOptions: "any of", "none of", "all of"- // - number: "=", ">", "<", ">=", "<="- // - stringObject/numberObject: same as string/number with required "key"- // - boolean: "=", "<>"- // - null: "is null", "is not null"- "value": any, // Value to compare against- "type": string, // Data type: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"- "key": string // Required only for stringObject/numberObject types (e.g., metadata filtering)- }- ],- "timeDimension": { // Optional. Default: null. If provided, results will be grouped by time- "granularity": string // One of "auto", "minute", "hour", "day", "week", "month"+ [+ {+ "type": "string",+ "column": "type",+ "operator": "=",+ "value": "GENERATION"},- "fromTimestamp": string, // Required. ISO datetime string for start of time range- "toTimestamp": string, // Required. ISO datetime string for end of time range (must be after fromTimestamp)- "orderBy": [ // Optional. Default: null- {- "field": string, // Field to order by (dimension or metric alias)- "direction": string // "asc" or "desc"- }- ],- "config": { // Optional. Query-specific configuration- "bins": number, // Optional. Number of bins for histogram aggregation (1-100), default: 10- "row_limit": number // Optional. Maximum number of rows to return (1-1000), default: 100+ {+ "type": "number",+ "column": "latency",+ "operator": ">=",+ "value": 2.5+ },+ {+ "type": "stringObject",+ "column": "metadata",+ "key": "environment",+ "operator": "=",+ "value": "production"}- }+ ]```+ required: false+ schema:+ type: string+ nullable: true+ responses:+ '200':+ description: ''+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/legacyObservationsViews'+ '400':+ description: ''+ content:+ application/json:+ schema: {}+ '401':+ description: ''+ content:+ application/json:+ schema: {}+ '403':+ description: ''+ content:+ application/json:+ schema: {}+ '404':+ description: ''+ content:+ application/json:+ schema: {}+ '405':+ description: ''+ content:+ application/json:+ schema: {}+ security:+ - BasicAuth: []+ /api/public/scores:+ post:+ description: Create a score (supports both trace and session scores)+ operationId: legacy_scoreV1_create+ tags:+ - LegacyScoreV1+ parameters: []+ responses:+ '200':+ description: ''+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/legacyCreateScoreResponse'+ '400':+ description: ''+ content:+ application/json:+ schema: {}+ '401':+ description: ''+ content:+ application/json:+ schema: {}+ '403':+ description: ''+ content:+ application/json:+ schema: {}+ '404':+ description: ''+ content:+ application/json:+ schema: {}+ '405':+ description: ''+ content:+ application/json:+ schema: {}+ security:+ - BasicAuth: []+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/legacyCreateScoreRequest'+ /api/public/scores/{scoreId}:+ delete:+ description: Delete a score (supports both trace and session scores)+ operationId: legacy_scoreV1_delete+ tags:+ - LegacyScoreV1+ parameters:+ - name: scoreId+ in: path+ description: The unique langfuse identifier of a scorerequired: trueschema:type: stringresponses:- '200':+ '204':description: ''- content:- application/json:- schema:- $ref: '#/components/schemas/MetricsV2Response''400':description: ''content:@@ -2273,81 +2259,34 @@ paths:schema: {}security:- BasicAuth: []- /api/public/metrics:+ /api/public/llm-connections:get:- description: >-- Get metrics from the Langfuse project using a query object.--- Consider using the [v2 metrics- endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for- better performance.--- For more details, see the [Metrics API- documentation](https://langfuse.com/docs/metrics/features/metrics-api).- operationId: metrics_metrics+ description: Get all LLM connections in a project+ operationId: llmConnections_listtags:- - Metrics+ - LlmConnectionsparameters:- - name: query+ - name: pagein: query- description: >-- JSON string containing the query parameters with the following- structure:-- ```json-- {- "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"- "dimensions": [ // Optional. Default: []- {- "field": string // Field to group by, e.g. "name", "userId", "sessionId"- }- ],- "metrics": [ // Required. At least one metric must be provided- {- "measure": string, // What to measure, e.g. "count", "latency", "value"- "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"- }- ],- "filters": [ // Optional. Default: []- {- "column": string, // Column to filter on- "operator": string, // Operator, e.g. "=", ">", "<", "contains"- "value": any, // Value to compare against- "type": string, // Data type, e.g. "string", "number", "stringObject"- "key": string // Required only when filtering on metadata- }- ],- "timeDimension": { // Optional. Default: null. If provided, results will be grouped by time- "granularity": string // One of "minute", "hour", "day", "week", "month", "auto"- },- "fromTimestamp": string, // Required. ISO datetime string for start of time range- "toTimestamp": string, // Required. ISO datetime string for end of time range- "orderBy": [ // Optional. Default: null- {- "field": string, // Field to order by- "direction": string // "asc" or "desc"- }- ],- "config": { // Optional. Query-specific configuration- "bins": number, // Optional. Number of bins for histogram (1-100), default: 10- "row_limit": number // Optional. Row limit for results (1-1000)- }- }-- ```- required: true+ description: page number, starts at 1+ required: falseschema:- type: string+ type: integer+ nullable: true+ - name: limit+ in: query+ description: limit of items per page+ required: false+ schema:+ type: integer+ nullable: trueresponses:'200':description: ''content:application/json:schema:- $ref: '#/components/schemas/MetricsResponse'+ $ref: '#/components/schemas/PaginatedLlmConnections''400':description: ''content:@@ -2375,12 +2314,13 @@ paths:schema: {}security:- BasicAuth: []- /api/public/models:- post:- description: Create a model- operationId: models_create+ put:+ description: >-+ Create or update an LLM connection. The connection is upserted on+ provider.+ operationId: llmConnections_upserttags:- - Models+ - LlmConnectionsparameters: []responses:'200':@@ -2388,7 +2328,7 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/Model'+ $ref: '#/components/schemas/LlmConnection''400':description: ''content:@@ -2421,34 +2361,27 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/CreateModelRequest'+ $ref: '#/components/schemas/UpsertLlmConnectionRequest'+ /api/public/media/{mediaId}:get:- description: Get all models- operationId: models_list+ description: Get a media record+ operationId: media_gettags:- - Models+ - Mediaparameters:- - name: page- in: query- description: page number, starts at 1- required: false- schema:- type: integer- nullable: true- - name: limit- in: query- description: limit of items per page- required: false+ - name: mediaId+ in: path+ description: The unique langfuse identifier of a media record+ required: trueschema:- type: integer- nullable: true+ type: stringresponses:'200':description: ''content:application/json:schema:- $ref: '#/components/schemas/PaginatedModels'+ $ref: '#/components/schemas/GetMediaResponse''400':description: ''content:@@ -2476,25 +2409,21 @@ paths:schema: {}security:- BasicAuth: []- /api/public/models/{id}:- get:- description: Get a model- operationId: models_get+ patch:+ description: Patch a media record+ operationId: media_patchtags:- - Models+ - Mediaparameters:- - name: id+ - name: mediaIdin: path+ description: The unique langfuse identifier of a media recordrequired: trueschema:type: stringresponses:- '200':+ '204':description: ''- content:- application/json:- schema:- $ref: '#/components/schemas/Model''400':description: ''content:@@ -2522,23 +2451,26 @@ paths:schema: {}security:- BasicAuth: []- delete:- description: >-- Delete a model. Cannot delete models managed by Langfuse. You can create- your own definition with the same modelName to override the definition- though.- operationId: models_delete+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/PatchMediaBody'+ /api/public/media:+ post:+ description: Get a presigned upload URL for a media record+ operationId: media_getUploadUrltags:- - Models- parameters:- - name: id- in: path- required: true- schema:- type: string+ - Media+ parameters: []responses:- '204':+ '200':description: ''+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/GetMediaUploadUrlResponse''400':description: ''content:@@ -2566,349 +2498,377 @@ paths:schema: {}security:- BasicAuth: []- /api/public/v2/observations:+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/GetMediaUploadUrlRequest'+ /api/public/v2/metrics:get:description: >-- Get a list of observations with cursor-based pagination and flexible- field selection.+ Get metrics from the Langfuse project using a query object. V2 endpoint+ with optimized performance.- ## Cursor-based Pagination+ ## V2 Differences- This endpoint uses cursor-based pagination for efficient traversal of- large datasets.+ - Supports `observations`, `scores-numeric`, and `scores-categorical`+ views only (traces view not supported)- The cursor is returned in the response metadata and should be passed in- subsequent requests+ - Direct access to tags and release fields on observations- to retrieve the next page of results.+ - Backwards-compatible: traceName, traceRelease, traceVersion dimensions+ are still available on observations view+ - High cardinality dimensions are not supported and will return a 400+ error (see below)- ## Field Selection- Use the `fields` parameter to control which observation fields are- returned:+ For more details, see the [Metrics API+ documentation](https://langfuse.com/docs/metrics/features/metrics-api).- - `core` - Always included: id, traceId, startTime, endTime, projectId,- parentObservationId, type- - `basic` - name, level, statusMessage, version, environment,- bookmarked, public, userId, sessionId+ ## Available Views+++ ### observations++ Query observation-level data (spans, generations, events).+++ **Dimensions:**++ - `environment` - Deployment environment (e.g., production, staging)++ - `type` - Type of observation (SPAN, GENERATION, EVENT)++ - `name` - Name of the observation++ - `level` - Logging level of the observation++ - `version` - Version of the observation++ - `tags` - User-defined tags++ - `release` - Release version++ - `traceName` - Name of the parent trace (backwards-compatible)++ - `traceRelease` - Release version of the parent trace+ (backwards-compatible, maps to release)++ - `traceVersion` - Version of the parent trace (backwards-compatible,+ maps to version)++ - `providedModelName` - Name of the model used++ - `promptName` - Name of the prompt used++ - `promptVersion` - Version of the prompt used++ - `startTimeMonth` - Month of start_time in YYYY-MM format+++ **Measures:**++ - `count` - Total number of observations- - `time` - completionStartTime, createdAt, updatedAt+ - `latency` - Observation latency (milliseconds)- - `io` - input, output+ - `streamingLatency` - Generation latency from completion start to end+ (milliseconds)- - `metadata` - metadata (truncated to 200 chars by default, use- `expandMetadata` to get full values)+ - `inputTokens` - Sum of input tokens consumed- - `model` - providedModelName, internalModelId, modelParameters+ - `outputTokens` - Sum of output tokens produced- - `usage` - usageDetails, costDetails, totalCost+ - `totalTokens` - Sum of all tokens consumed- - `prompt` - promptId, promptName, promptVersion+ - `outputTokensPerSecond` - Output tokens per second- - `metrics` - latency, timeToFirstToken+ - `tokensPerSecond` - Total tokens per second+ - `inputCost` - Input cost (USD)- If not specified, `core` and `basic` field groups are returned.+ - `outputCost` - Output cost (USD)+ - `totalCost` - Total cost (USD)- ## Filters+ - `timeToFirstToken` - Time to first token (milliseconds)- Multiple filtering options are available via query parameters or the- structured `filter` parameter.+ - `countScores` - Number of scores attached to the observation- When using the `filter` parameter, it takes precedence over individual- query parameter filters.- operationId: observationsV2_getMany- tags:- - ObservationsV2- parameters:- - name: fields- in: query- description: >-- Comma-separated list of field groups to include in the response.- Available groups: core, basic, time, io, metadata, model, usage,- prompt, metrics.+ ### scores-numeric- If not specified, `core` and `basic` field groups are returned.+ Query numeric and boolean score data.- Example: "basic,usage,model"- required: false- schema:- type: string- nullable: true- - name: expandMetadata- in: query- description: |-- Comma-separated list of metadata keys to return non-truncated.- By default, metadata values over 200 characters are truncated.- Use this parameter to retrieve full values for specific keys.- Example: "key1,key2"- required: false- schema:- type: string- nullable: true- - name: limit- in: query- description: Number of items to return per page. Maximum 1000, default 50.- required: false- schema:- type: integer- nullable: true- - name: cursor- in: query- description: >-- Base64-encoded cursor for pagination. Use the cursor from the- previous response to get the next page.- required: false- schema:- type: string- nullable: true- - name: parseIoAsJson- in: query- description: |-- **Deprecated.** Setting this to `true` will return a 400 error.- Input/output fields are always returned as raw strings.- Remove this parameter or set it to `false`.- required: false- schema:- type: boolean- nullable: true- - name: name- in: query- required: false- schema:- type: string- nullable: true- - name: userId- in: query- required: false- schema:- type: string- nullable: true- - name: type- in: query- description: >-- Filter by observation type (e.g., "GENERATION", "SPAN", "EVENT",- "AGENT", "TOOL", "CHAIN", "RETRIEVER", "EVALUATOR", "EMBEDDING",- "GUARDRAIL")- required: false- schema:- type: string- nullable: true- - name: traceId- in: query- required: false- schema:- type: string- nullable: true- - name: level- in: query- description: >-- Optional filter for observations with a specific level (e.g.- "DEBUG", "DEFAULT", "WARNING", "ERROR").- required: false- schema:- $ref: '#/components/schemas/ObservationLevel'- nullable: true- - name: parentObservationId- in: query- required: false- schema:- type: string- nullable: true- - name: environment- in: query- description: >-- Optional filter for observations where the environment is one of the- provided values.- required: false- schema:- type: array- items:- type: string- nullable: true- - name: fromStartTime- in: query- description: >-- Retrieve only observations with a start_time on or after this- datetime (ISO 8601).- required: false- schema:- type: string- format: date-time- nullable: true- - name: toStartTime- in: query- description: >-- Retrieve only observations with a start_time before this datetime- (ISO 8601).- required: false- schema:- type: string- format: date-time- nullable: true- - name: version- in: query- description: Optional filter to only include observations with a certain version.- required: false- schema:- type: string- nullable: true- - name: filter- in: query- description: >-- JSON string containing an array of filter conditions. When provided,- this takes precedence over query parameter filters (userId, name,- type, level, environment, fromStartTime, ...).+ **Dimensions:**- ## Filter Structure+ - `environment` - Deployment environment- Each filter condition has the following structure:+ - `name` - Name of the score (e.g., accuracy, toxicity)- ```json+ - `source` - Origin of the score (API, ANNOTATION, EVAL)- [- {- "type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"- "column": string, // Required. Column to filter on (see available columns below)- "operator": string, // Required. Operator based on type:- // - datetime: ">", "<", ">=", "<="- // - string: "=", "contains", "does not contain", "starts with", "ends with"- // - stringOptions: "any of", "none of"- // - categoryOptions: "any of", "none of"- // - arrayOptions: "any of", "none of", "all of"- // - number: "=", ">", "<", ">=", "<="- // - stringObject: "=", "contains", "does not contain", "starts with", "ends with"- // - numberObject: "=", ">", "<", ">=", "<="- // - boolean: "=", "<>"- // - null: "is null", "is not null"- "value": any, // Required (except for null type). Value to compare against. Type depends on filter type- "key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata- }- ]+ - `dataType` - Data type (NUMERIC, BOOLEAN)- ```+ - `configId` - Identifier of the score config+ - `timestampMonth` - Month in YYYY-MM format- ## Available Columns+ - `timestampDay` - Day in YYYY-MM-DD format+ - `value` - Numeric value of the score- ### Core Observation Fields+ - `traceName` - Name of the parent trace- - `id` (string) - Observation ID+ - `tags` - Tags- - `type` (string) - Observation type (SPAN, GENERATION, EVENT)+ - `traceRelease` - Release version- - `name` (string) - Observation name+ - `traceVersion` - Version- - `traceId` (string) - Associated trace ID+ - `observationName` - Name of the associated observation- - `startTime` (datetime) - Observation start time+ - `observationModelName` - Model name of the associated observation- - `endTime` (datetime) - Observation end time+ - `observationPromptName` - Prompt name of the associated observation- - `environment` (string) - Environment tag+ - `observationPromptVersion` - Prompt version of the associated+ observation- - `level` (string) - Log level (DEBUG, DEFAULT, WARNING, ERROR)- - `statusMessage` (string) - Status message+ **Measures:**- - `version` (string) - Version tag+ - `count` - Total number of scores- - `userId` (string) - User ID+ - `value` - Score value (for aggregations)- - `sessionId` (string) - Session ID+ ### scores-categorical- ### Trace-Related Fields+ Query categorical score data. Same dimensions as scores-numeric except+ uses `stringValue` instead of `value`.- - `traceName` (string) - Name of the parent trace- - `traceTags` (arrayOptions) - Tags from the parent trace+ **Measures:**- - `tags` (arrayOptions) - Alias for traceTags+ - `count` - Total number of scores- ### Performance Metrics+ ## High Cardinality Dimensions- - `latency` (number) - Latency in seconds (calculated: end_time -- start_time)+ The following dimensions cannot be used as grouping dimensions in v2+ metrics API as they can cause performance issues.- - `timeToFirstToken` (number) - Time to first token in seconds+ Use them in filters instead.- - `tokensPerSecond` (number) - Output tokens per second+ **observations view:**- ### Token Usage+ - `id` - Use traceId filter to narrow down results- - `inputTokens` (number) - Number of input tokens+ - `traceId` - Use traceId filter instead- - `outputTokens` (number) - Number of output tokens+ - `userId` - Use userId filter instead- - `totalTokens` (number) - Total tokens (alias: `tokens`)+ - `sessionId` - Use sessionId filter instead+ - `parentObservationId` - Use parentObservationId filter instead- ### Cost Metrics- - `inputCost` (number) - Input cost in USD+ **scores-numeric / scores-categorical views:**- - `outputCost` (number) - Output cost in USD+ - `id` - Use specific filters to narrow down results- - `totalCost` (number) - Total cost in USD+ - `traceId` - Use traceId filter instead+ - `userId` - Use userId filter instead- ### Model Information+ - `sessionId` - Use sessionId filter instead- - `model` (string) - Provided model name (alias:- `providedModelName`)+ - `observationId` - Use observationId filter instead- - `promptName` (string) - Associated prompt name- - `promptVersion` (number) - Associated prompt version+ ## Aggregations+ Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`,+ `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`- ### Structured Data- - `metadata` (stringObject/numberObject/categoryOptions) - Metadata- key-value pairs. Use `key` parameter to filter on specific metadata- keys.+ ## Time Granularities+ Available granularities for timeDimension: `auto`, `minute`, `hour`,+ `day`, `week`, `month`- ## Filter Examples+ - `auto` bins the data into approximately 50 buckets based on the time+ range+ operationId: metrics_metrics+ tags:+ - Metrics+ parameters:+ - name: query+ in: query+ description: >-+ JSON string containing the query parameters with the following+ structure:```json- [- {- "type": "string",- "column": "type",- "operator": "=",- "value": "GENERATION"- },- {- "type": "number",- "column": "latency",- "operator": ">=",- "value": 2.5+ {+ "view": string, // Required. One of "observations", "scores-numeric", "scores-categorical"+ "dimensions": [ // Optional. Default: []+ {+ "field": string // Field to group by (see available dimensions above)+ }+ ],+ "metrics": [ // Required. At least one metric must be provided+ {+ "measure": string, // What to measure (see available measures above)+ "aggregation": string // How to aggregate: "sum", "avg", "count", "max", "min", "p50", "p75", "p90", "p95", "p99", "histogram"+ }+ ],+ "filters": [ // Optional. Default: []+ {+ "column": string, // Column to filter on (any dimension field)+ "operator": string, // Operator based on type:+ // - datetime: ">", "<", ">=", "<="+ // - string: "=", "contains", "does not contain", "starts with", "ends with"+ // - stringOptions: "any of", "none of"+ // - arrayOptions: "any of", "none of", "all of"+ // - number: "=", ">", "<", ">=", "<="+ // - stringObject/numberObject: same as string/number with required "key"+ // - boolean: "=", "<>"+ // - null: "is null", "is not null"+ "value": any, // Value to compare against+ "type": string, // Data type: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"+ "key": string // Required only for stringObject/numberObject types (e.g., metadata filtering)+ }+ ],+ "timeDimension": { // Optional. Default: null. If provided, results will be grouped by time+ "granularity": string // One of "auto", "minute", "hour", "day", "week", "month"},- {- "type": "stringObject",- "column": "metadata",- "key": "environment",- "operator": "=",- "value": "production"+ "fromTimestamp": string, // Required. ISO datetime string for start of time range+ "toTimestamp": string, // Required. ISO datetime string for end of time range (must be after fromTimestamp)+ "orderBy": [ // Optional. Default: null+ {+ "field": string, // Field to order by (dimension or metric alias)+ "direction": string // "asc" or "desc"+ }+ ],+ "config": { // Optional. Query-specific configuration+ "bins": number, // Optional. Number of bins for histogram aggregation (1-100), default: 10+ "row_limit": number // Optional. Maximum number of rows to return (1-1000), default: 100}- ]+ }```- required: false+ required: trueschema:type: string+ responses:+ '200':+ description: ''+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/MetricsV2Response'+ '400':+ description: ''+ content:+ application/json:+ schema: {}+ '401':+ description: ''+ content:+ application/json:+ schema: {}+ '403':+ description: ''+ content:+ application/json:+ schema: {}+ '404':+ description: ''+ content:+ application/json:+ schema: {}+ '405':+ description: ''+ content:+ application/json:+ schema: {}+ security:+ - BasicAuth: []+ /api/public/models:+ post:+ description: Create a model+ operationId: models_create+ tags:+ - Models+ parameters: []+ responses:+ '200':+ description: ''+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Model'+ '400':+ description: ''+ content:+ application/json:+ schema: {}+ '401':+ description: ''+ content:+ application/json:+ schema: {}+ '403':+ description: ''+ content:+ application/json:+ schema: {}+ '404':+ description: ''+ content:+ application/json:+ schema: {}+ '405':+ description: ''+ content:+ application/json:+ schema: {}+ security:+ - BasicAuth: []+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/CreateModelRequest'+ get:+ description: Get all models+ operationId: models_list+ tags:+ - Models+ parameters:+ - name: page+ in: query+ description: page number, starts at 1+ required: false+ schema:+ type: integer+ nullable: true+ - name: limit+ in: query+ description: limit of items per page+ required: false+ schema:+ type: integernullable: trueresponses:'200':@@ -2916,7 +2876,7 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/ObservationsV2Response'+ $ref: '#/components/schemas/PaginatedModels''400':description: ''content:@@ -2944,28 +2904,69 @@ paths:schema: {}security:- BasicAuth: []- /api/public/observations/{observationId}:+ /api/public/models/{id}:get:- description: Get a observation- operationId: observations_get+ description: Get a model+ operationId: models_get+ tags:+ - Models+ parameters:+ - name: id+ in: path+ required: true+ schema:+ type: string+ responses:+ '200':+ description: ''+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Model'+ '400':+ description: ''+ content:+ application/json:+ schema: {}+ '401':+ description: ''+ content:+ application/json:+ schema: {}+ '403':+ description: ''+ content:+ application/json:+ schema: {}+ '404':+ description: ''+ content:+ application/json:+ schema: {}+ '405':+ description: ''+ content:+ application/json:+ schema: {}+ security:+ - BasicAuth: []+ delete:+ description: >-+ Delete a model. Cannot delete models managed by Langfuse. You can create+ your own definition with the same modelName to override the definition+ though.+ operationId: models_deletetags:- - Observations+ - Modelsparameters:- - name: observationId+ - name: idin: path- description: >-- The unique langfuse identifier of an observation, can be an event,- span or generationrequired: trueschema:type: stringresponses:- '200':+ '204':description: ''- content:- application/json:- schema:- $ref: '#/components/schemas/ObservationsView''400':description: ''content:@@ -2993,35 +2994,117 @@ paths:schema: {}security:- BasicAuth: []- /api/public/observations:+ /api/public/v2/observations:get:description: >-- Get a list of observations.+ Get a list of observations with cursor-based pagination and flexible+ field selection.- Consider using the [v2 observations- endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations)- for cursor-based pagination and field selection.+ ## Cursor-based Pagination++ This endpoint uses cursor-based pagination for efficient traversal of+ large datasets.++ The cursor is returned in the response metadata and should be passed in+ subsequent requests++ to retrieve the next page of results.+++ ## Field Selection++ Use the `fields` parameter to control which observation fields are+ returned:++ - `core` - Always included: id, traceId, startTime, endTime, projectId,+ parentObservationId, type++ - `basic` - name, level, statusMessage, version, environment,+ bookmarked, public, userId, sessionId++ - `time` - completionStartTime, createdAt, updatedAt++ - `io` - input, output++ - `metadata` - metadata (truncated to 200 chars by default, use+ `expandMetadata` to get full values)++ - `model` - providedModelName, internalModelId, modelParameters++ - `usage` - usageDetails, costDetails, totalCost++ - `prompt` - promptId, promptName, promptVersion++ - `metrics` - latency, timeToFirstToken+++ If not specified, `core` and `basic` field groups are returned.+++ ## Filters++ Multiple filtering options are available via query parameters or the+ structured `filter` parameter.++ When using the `filter` parameter, it takes precedence over individual+ query parameter filters.operationId: observations_getManytags:- Observationsparameters:- - name: page+ - name: fieldsin: query- description: Page number, starts at 1.+ description: >-+ Comma-separated list of field groups to include in the response.++ Available groups: core, basic, time, io, metadata, model, usage,+ prompt, metrics.++ If not specified, `core` and `basic` field groups are returned.++ Example: "basic,usage,model"required: falseschema:- type: integer+ type: string+ nullable: true+ - name: expandMetadata+ in: query+ description: |-+ Comma-separated list of metadata keys to return non-truncated.+ By default, metadata values over 200 characters are truncated.+ Use this parameter to retrieve full values for specific keys.+ Example: "key1,key2"+ required: false+ schema:+ type: stringnullable: true- name: limitin: query- description: >-- Limit of items per page. If you encounter api issues due to too- large page sizes, try to reduce the limit.+ description: Number of items to return per page. Maximum 1000, default 50.required: falseschema:type: integernullable: true+ - name: cursor+ in: query+ description: >-+ Base64-encoded cursor for pagination. Use the cursor from the+ previous response to get the next page.+ required: false+ schema:+ type: string+ nullable: true+ - name: parseIoAsJson+ in: query+ description: |-+ **Deprecated.** Setting this to `true` will return a 400 error.+ Input/output fields are always returned as raw strings.+ Remove this parameter or set it to `false`.+ required: false+ schema:+ type: boolean+ nullable: true- name: namein: queryrequired: false@@ -3036,6 +3119,10 @@ paths:nullable: true- name: typein: query+ description: >-+ Filter by observation type (e.g., "GENERATION", "SPAN", "EVENT",+ "AGENT", "TOOL", "CHAIN", "RETRIEVER", "EVALUATOR", "EMBEDDING",+ "GUARDRAIL")required: falseschema:type: string@@ -3161,6 +3248,19 @@ paths:- `version` (string) - Version tag+ - `userId` (string) - User ID++ - `sessionId` (string) - Session ID+++ ### Trace-Related Fields++ - `traceName` (string) - Name of the parent trace++ - `traceTags` (arrayOptions) - Tags from the parent trace++ - `tags` (arrayOptions) - Alias for traceTags+### Performance Metrics@@ -3192,7 +3292,8 @@ paths:### Model Information- - `model` (string) - Provided model name+ - `model` (string) - Provided model name (alias:+ `providedModelName`)- `promptName` (string) - Associated prompt name@@ -3206,17 +3307,6 @@ paths:keys.- ### Associated Trace Fields (requires join with traces table)-- - `userId` (string) - User ID from associated trace-- - `traceName` (string) - Name from associated trace-- - `traceEnvironment` (string) - Environment from associated trace-- - `traceTags` (arrayOptions) - Tags from associated trace--## Filter Examples```json@@ -3254,7 +3344,7 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/ObservationsViews'+ $ref: '#/components/schemas/ObservationsV2Response''400':description: ''content:@@ -5075,9 +5165,9 @@ paths:/api/public/v2/scores:get:description: Get a list of scores (supports both trace and session scores)- operationId: scoreV2_get+ operationId: scores_get-manytags:- - ScoreV2+ - Scoresparameters:- name: pagein: query@@ -5237,123 +5327,35 @@ paths:properties: userId, tags, environment, sessionId). If not specified,both 'score' and 'trace' are returned by default. Example: 'score'to exclude trace data, 'score,trace' to include both. Note: When- filtering by trace properties (using userId or traceTags- parameters), the 'trace' field group must be included, otherwise a- 400 error will be returned.- required: false- schema:- type: string- nullable: true- - name: filter- in: query- description: >-- A JSON stringified array of filter objects. Each object requires- type, column, operator, and value. Supports filtering by score- metadata using the stringObject type. Example:- [{"type":"stringObject","column":"metadata","key":"user_id","operator":"=","value":"abc123"}].- Supported types: stringObject (metadata key-value filtering),- string, number, datetime, stringOptions, arrayOptions. Supported- operators for stringObject: =, contains, does not contain, starts- with, ends with.- required: false- schema:- type: string- nullable: true- responses:- '200':- description: ''- content:- application/json:- schema:- $ref: '#/components/schemas/GetScoresResponse'- '400':- description: ''- content:- application/json:- schema: {}- '401':- description: ''- content:- application/json:- schema: {}- '403':- description: ''- content:- application/json:- schema: {}- '404':- description: ''- content:- application/json:- schema: {}- '405':- description: ''- content:- application/json:- schema: {}- security:- - BasicAuth: []- /api/public/v2/scores/{scoreId}:- get:- description: Get a score (supports both trace and session scores)- operationId: scoreV2_get-by-id- tags:- - ScoreV2- parameters:- - name: scoreId- in: path- description: The unique langfuse identifier of a score- required: true- schema:- type: string- responses:- '200':- description: ''- content:- application/json:- schema:- $ref: '#/components/schemas/Score'- '400':- description: ''- content:- application/json:- schema: {}- '401':- description: ''- content:- application/json:- schema: {}- '403':- description: ''- content:- application/json:- schema: {}- '404':- description: ''- content:- application/json:- schema: {}- '405':- description: ''- content:- application/json:- schema: {}- security:- - BasicAuth: []- /api/public/scores:- post:- description: Create a score (supports both trace and session scores)- operationId: score_create- tags:- - Score- parameters: []+ filtering by trace properties (using userId or traceTags+ parameters), the 'trace' field group must be included, otherwise a+ 400 error will be returned.+ required: false+ schema:+ type: string+ nullable: true+ - name: filter+ in: query+ description: >-+ A JSON stringified array of filter objects. Each object requires+ type, column, operator, and value. Supports filtering by score+ metadata using the stringObject type. Example:+ [{"type":"stringObject","column":"metadata","key":"user_id","operator":"=","value":"abc123"}].+ Supported types: stringObject (metadata key-value filtering),+ string, number, datetime, stringOptions, arrayOptions. Supported+ operators for stringObject: =, contains, does not contain, starts+ with, ends with.+ required: false+ schema:+ type: string+ nullable: trueresponses:'200':description: ''content:application/json:schema:- $ref: '#/components/schemas/CreateScoreResponse'+ $ref: '#/components/schemas/GetScoresResponse''400':description: ''content:@@ -5381,18 +5383,12 @@ paths:schema: {}security:- BasicAuth: []- requestBody:- required: true- content:- application/json:- schema:- $ref: '#/components/schemas/CreateScoreRequest'- /api/public/scores/{scoreId}:- delete:- description: Delete a score (supports both trace and session scores)- operationId: score_delete+ /api/public/v2/scores/{scoreId}:+ get:+ description: Get a score (supports both trace and session scores)+ operationId: scores_get-by-idtags:- - Score+ - Scoresparameters:- name: scoreIdin: path@@ -5401,8 +5397,12 @@ paths:schema:type: stringresponses:- '204':+ '200':description: ''+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/Score''400':description: ''content:@@ -6640,131 +6640,290 @@ components:version:type: stringnullable: true- description: The version of the observation+ description: The version of the observation+ metadata:+ description: Additional metadata of the observation+ output:+ description: The output data of the observation+ usage:+ $ref: '#/components/schemas/Usage'+ description: >-+ (Deprecated. Use usageDetails and costDetails instead.) The usage+ data of the observation+ level:+ $ref: '#/components/schemas/ObservationLevel'+ description: The level of the observation+ statusMessage:+ type: string+ nullable: true+ description: The status message of the observation+ parentObservationId:+ type: string+ nullable: true+ description: The parent observation ID+ promptId:+ type: string+ nullable: true+ description: The prompt ID associated with the observation+ usageDetails:+ type: object+ additionalProperties:+ type: integer+ description: >-+ The usage details of the observation. Key is the name of the usage+ metric, value is the number of units consumed. The total key is the+ sum of all (non-total) usage metrics or the total value ingested.+ costDetails:+ type: object+ additionalProperties:+ type: number+ format: double+ description: >-+ The cost details of the observation. Key is the name of the cost+ metric, value is the cost in USD. The total key is the sum of all+ (non-total) cost metrics or the total value ingested.+ environment:+ type: string+ description: >-+ The environment from which this observation originated. Can be any+ lowercase alphanumeric string with hyphens and underscores that does+ not start with 'langfuse'.+ required:+ - id+ - type+ - startTime+ - modelParameters+ - input+ - metadata+ - output+ - usage+ - level+ - usageDetails+ - costDetails+ - environment+ ObservationsView:+ title: ObservationsView+ type: object+ properties:+ promptName:+ type: string+ nullable: true+ description: The name of the prompt associated with the observation+ promptVersion:+ type: integer+ nullable: true+ description: The version of the prompt associated with the observation+ modelId:+ type: string+ nullable: true+ description: The unique identifier of the model+ inputPrice:+ type: number+ format: double+ nullable: true+ description: The price of the input in USD+ outputPrice:+ type: number+ format: double+ nullable: true+ description: The price of the output in USD.+ totalPrice:+ type: number+ format: double+ nullable: true+ description: The total price in USD.+ calculatedInputCost:+ type: number+ format: double+ nullable: true+ description: >-+ (Deprecated. Use usageDetails and costDetails instead.) The+ calculated cost of the input in USD+ calculatedOutputCost:+ type: number+ format: double+ nullable: true+ description: >-+ (Deprecated. Use usageDetails and costDetails instead.) The+ calculated cost of the output in USD+ calculatedTotalCost:+ type: number+ format: double+ nullable: true+ description: >-+ (Deprecated. Use usageDetails and costDetails instead.) The+ calculated total cost in USD+ latency:+ type: number+ format: double+ nullable: true+ description: The latency in seconds.+ timeToFirstToken:+ type: number+ format: double+ nullable: true+ description: The time to the first token in seconds+ allOf:+ - $ref: '#/components/schemas/Observation'+ ObservationV2:+ title: ObservationV2+ type: object+ description: >-+ An observation from the v2 API with field-group-based selection.++ Core fields are always present. Other fields are included only when+ their field group is requested.+ properties:+ id:+ type: string+ description: The unique identifier of the observation+ traceId:+ type: string+ nullable: true+ description: The trace ID associated with the observation+ startTime:+ type: string+ format: date-time+ description: The start time of the observation+ endTime:+ type: string+ format: date-time+ nullable: true+ description: The end time of the observation+ projectId:+ type: string+ description: The project ID this observation belongs to+ parentObservationId:+ type: string+ nullable: true+ description: The parent observation ID+ type:+ type: string+ description: The type of the observation (e.g. GENERATION, SPAN, EVENT)+ name:+ type: string+ nullable: true+ description: The name of the observation+ level:+ $ref: '#/components/schemas/ObservationLevel'+ nullable: true+ description: The level of the observation+ statusMessage:+ type: string+ nullable: true+ description: The status message of the observation+ version:+ type: string+ nullable: true+ description: The version of the observation+ environment:+ type: string+ nullable: true+ description: The environment from which this observation originated+ bookmarked:+ type: boolean+ nullable: true+ description: Whether the observation is bookmarked+ public:+ type: boolean+ nullable: true+ description: Whether the observation is public+ userId:+ type: string+ nullable: true+ description: The user ID associated with the observation+ sessionId:+ type: string+ nullable: true+ description: The session ID associated with the observation+ completionStartTime:+ type: string+ format: date-time+ nullable: true+ description: The completion start time of the observation+ createdAt:+ type: string+ format: date-time+ nullable: true+ description: The creation timestamp of the observation+ updatedAt:+ type: string+ format: date-time+ nullable: true+ description: The last update timestamp of the observation+ input:+ nullable: true+ description: The input data of the observation+ output:+ nullable: true+ description: The output data of the observationmetadata:+ nullable: truedescription: Additional metadata of the observation- output:- description: The output data of the observation- usage:- $ref: '#/components/schemas/Usage'- description: >-- (Deprecated. Use usageDetails and costDetails instead.) The usage- data of the observation- level:- $ref: '#/components/schemas/ObservationLevel'- description: The level of the observation- statusMessage:+ providedModelName:type: stringnullable: true- description: The status message of the observation- parentObservationId:+ description: The model name as provided by the user+ internalModelId:type: stringnullable: true- description: The parent observation ID- promptId:- type: string+ description: The internal model ID matched by Langfuse+ modelParameters:nullable: true- description: The prompt ID associated with the observation+ description: The parameters of the model used for the observationusageDetails:type: objectadditionalProperties:type: integer+ nullable: truedescription: >-- The usage details of the observation. Key is the name of the usage- metric, value is the number of units consumed. The total key is the- sum of all (non-total) usage metrics or the total value ingested.+ The usage details of the observation. Key is the usage metric name,+ value is the number of units consumed.costDetails:type: objectadditionalProperties:type: numberformat: double+ nullable: truedescription: >-- The cost details of the observation. Key is the name of the cost- metric, value is the cost in USD. The total key is the sum of all- (non-total) cost metrics or the total value ingested.- environment:+ The cost details of the observation. Key is the cost metric name,+ value is the cost in USD.+ totalCost:+ type: number+ format: double+ nullable: true+ description: The total cost of the observation in USD+ promptId:type: string- description: >-- The environment from which this observation originated. Can be any- lowercase alphanumeric string with hyphens and underscores that does- not start with 'langfuse'.- required:- - id- - type- - startTime- - modelParameters- - input- - metadata- - output- - usage- - level- - usageDetails- - costDetails- - environment- ObservationsView:- title: ObservationsView- type: object- properties:+ nullable: true+ description: The prompt ID associated with the observationpromptName:type: stringnullable: true- description: The name of the prompt associated with the observation+ description: The prompt name associated with the observationpromptVersion:type: integernullable: true- description: The version of the prompt associated with the observation- modelId:- type: string- nullable: true- description: The unique identifier of the model- inputPrice:- type: number- format: double- nullable: true- description: The price of the input in USD- outputPrice:- type: number- format: double- nullable: true- description: The price of the output in USD.- totalPrice:- type: number- format: double- nullable: true- description: The total price in USD.- calculatedInputCost:- type: number- format: double- nullable: true- description: >-- (Deprecated. Use usageDetails and costDetails instead.) The- calculated cost of the input in USD- calculatedOutputCost:- type: number- format: double- nullable: true- description: >-- (Deprecated. Use usageDetails and costDetails instead.) The- calculated cost of the output in USD- calculatedTotalCost:- type: number- format: double- nullable: true- description: >-- (Deprecated. Use usageDetails and costDetails instead.) The- calculated total cost in USD+ description: The prompt version associated with the observationlatency:type: numberformat: doublenullable: true- description: The latency in seconds.+ description: The latency in secondstimeToFirstToken:type: numberformat: doublenullable: true- description: The time to the first token in seconds- allOf:- - $ref: '#/components/schemas/Observation'+ description: The time to first token in seconds+ modelId:+ type: string+ nullable: true+ description: The matched model ID+ required:+ - id+ - startTime+ - projectId+ - typeUsage:title: Usagetype: object@@ -8815,6 +8974,124 @@ components:type: integer- $ref: '#/components/schemas/OpenAICompletionUsageSchema'- $ref: '#/components/schemas/OpenAIResponseUsageSchema'+ legacyMetricsResponse:+ title: legacyMetricsResponse+ type: object+ properties:+ data:+ type: array+ items:+ type: object+ additionalProperties: true+ description: >-+ The metrics data. Each item in the list contains the metric values+ and dimensions requested in the query.++ Format varies based on the query parameters.++ Histograms will return an array with [lower, upper, height] tuples.+ required:+ - data+ legacyObservations:+ title: legacyObservations+ type: object+ properties:+ data:+ type: array+ items:+ $ref: '#/components/schemas/Observation'+ meta:+ $ref: '#/components/schemas/utilsMetaResponse'+ required:+ - data+ - meta+ legacyObservationsViews:+ title: legacyObservationsViews+ type: object+ properties:+ data:+ type: array+ items:+ $ref: '#/components/schemas/ObservationsView'+ meta:+ $ref: '#/components/schemas/utilsMetaResponse'+ required:+ - data+ - meta+ legacyCreateScoreRequest:+ title: legacyCreateScoreRequest+ type: object+ properties:+ id:+ type: string+ nullable: true+ traceId:+ type: string+ nullable: true+ sessionId:+ type: string+ nullable: true+ observationId:+ type: string+ nullable: true+ datasetRunId:+ type: string+ nullable: true+ name:+ type: string+ example: novelty+ value:+ $ref: '#/components/schemas/CreateScoreValue'+ description: >-+ The value of the score. Must be passed as string for categorical+ scores, and numeric for boolean and numeric scores. Boolean score+ values must equal either 1 or 0 (true or false)+ comment:+ type: string+ nullable: true+ metadata:+ type: object+ additionalProperties: true+ nullable: true+ environment:+ type: string+ nullable: true+ description: >-+ The environment of the score. Can be any lowercase alphanumeric+ string with hyphens and underscores that does not start with+ 'langfuse'.+ queueId:+ type: string+ nullable: true+ description: >-+ The annotation queue referenced by the score. Indicates if score was+ initially created while processing annotation queue.+ dataType:+ $ref: '#/components/schemas/ScoreDataType'+ nullable: true+ description: >-+ The data type of the score. When passing a configId this field is+ inferred. Otherwise, this field must be passed or will default to+ numeric.+ configId:+ type: string+ nullable: true+ description: >-+ Reference a score config on a score. The unique langfuse identifier+ of a score config. When passing this field, the dataType and+ stringValue fields are automatically populated.+ required:+ - name+ - value+ legacyCreateScoreResponse:+ title: legacyCreateScoreResponse+ type: object+ properties:+ id:+ type: string+ description: The id of the created object in Langfuse+ required:+ - idLlmConnection:title: LlmConnectiontype: object@@ -9105,29 +9382,11 @@ components:- application/x-ndjson- application/vnd.apache.parquet- application/gzip- - application/x-tar- - application/x-7z-compressed- description: The MIME type of the media record- MetricsV2Response:- title: MetricsV2Response- type: object- properties:- data:- type: array- items:- type: object- additionalProperties: true- description: >-- The metrics data. Each item in the list contains the metric values- and dimensions requested in the query.-- Format varies based on the query parameters.-- Histograms will return an array with [lower, upper, height] tuples.- required:- - data- MetricsResponse:- title: MetricsResponse+ - application/x-tar+ - application/x-7z-compressed+ description: The MIME type of the media record+ MetricsV2Response:+ title: MetricsV2Responsetype: objectproperties:data:@@ -9258,165 +9517,6 @@ components:required:- modelName- matchPattern- ObservationV2:- title: ObservationV2- type: object- description: >-- An observation from the v2 API with field-group-based selection.-- Core fields are always present. Other fields are included only when- their field group is requested.- properties:- id:- type: string- description: The unique identifier of the observation- traceId:- type: string- nullable: true- description: The trace ID associated with the observation- startTime:- type: string- format: date-time- description: The start time of the observation- endTime:- type: string- format: date-time- nullable: true- description: The end time of the observation- projectId:- type: string- description: The project ID this observation belongs to- parentObservationId:- type: string- nullable: true- description: The parent observation ID- type:- type: string- description: The type of the observation (e.g. GENERATION, SPAN, EVENT)- name:- type: string- nullable: true- description: The name of the observation- level:- $ref: '#/components/schemas/ObservationLevel'- nullable: true- description: The level of the observation- statusMessage:- type: string- nullable: true- description: The status message of the observation- version:- type: string- nullable: true- description: The version of the observation- environment:- type: string- nullable: true- description: The environment from which this observation originated- bookmarked:- type: boolean- nullable: true- description: Whether the observation is bookmarked- public:- type: boolean- nullable: true- description: Whether the observation is public- userId:- type: string- nullable: true- description: The user ID associated with the observation- sessionId:- type: string- nullable: true- description: The session ID associated with the observation- completionStartTime:- type: string- format: date-time- nullable: true- description: The completion start time of the observation- createdAt:- type: string- format: date-time- nullable: true- description: The creation timestamp of the observation- updatedAt:- type: string- format: date-time- nullable: true- description: The last update timestamp of the observation- input:- nullable: true- description: The input data of the observation- output:- nullable: true- description: The output data of the observation- metadata:- nullable: true- description: Additional metadata of the observation- providedModelName:- type: string- nullable: true- description: The model name as provided by the user- internalModelId:- type: string- nullable: true- description: The internal model ID matched by Langfuse- modelParameters:- nullable: true- description: The parameters of the model used for the observation- usageDetails:- type: object- additionalProperties:- type: integer- nullable: true- description: >-- The usage details of the observation. Key is the usage metric name,- value is the number of units consumed.- costDetails:- type: object- additionalProperties:- type: number- format: double- nullable: true- description: >-- The cost details of the observation. Key is the cost metric name,- value is the cost in USD.- totalCost:- type: number- format: double- nullable: true- description: The total cost of the observation in USD- promptId:- type: string- nullable: true- description: The prompt ID associated with the observation- promptName:- type: string- nullable: true- description: The prompt name associated with the observation- promptVersion:- type: integer- nullable: true- description: The prompt version associated with the observation- latency:- type: number- format: double- nullable: true- description: The latency in seconds- timeToFirstToken:- type: number- format: double- nullable: true- description: The time to first token in seconds- modelId:- type: string- nullable: true- description: The matched model ID- required:- - id- - startTime- - projectId- - typeObservationsV2Response:title: ObservationsV2Responsetype: object@@ -9453,32 +9553,6 @@ components:description: >-Base64-encoded cursor to use for retrieving the next page. If notpresent, there are no more results.- Observations:- title: Observations- type: object- properties:- data:- type: array- items:- $ref: '#/components/schemas/Observation'- meta:- $ref: '#/components/schemas/utilsMetaResponse'- required:- - data- - meta- ObservationsViews:- title: ObservationsViews- type: object- properties:- data:- type: array- items:- $ref: '#/components/schemas/ObservationsView'- meta:- $ref: '#/components/schemas/utilsMetaResponse'- required:- - data- - metaOtelResourceSpan:title: OtelResourceSpantype: object@@ -10662,80 +10736,6 @@ components:required:- data- meta- CreateScoreRequest:- title: CreateScoreRequest- type: object- properties:- id:- type: string- nullable: true- traceId:- type: string- nullable: true- sessionId:- type: string- nullable: true- observationId:- type: string- nullable: true- datasetRunId:- type: string- nullable: true- name:- type: string- example: novelty- value:- $ref: '#/components/schemas/CreateScoreValue'- description: >-- The value of the score. Must be passed as string for categorical- scores, and numeric for boolean and numeric scores. Boolean score- values must equal either 1 or 0 (true or false)- comment:- type: string- nullable: true- metadata:- type: object- additionalProperties: true- nullable: true- environment:- type: string- nullable: true- description: >-- The environment of the score. Can be any lowercase alphanumeric- string with hyphens and underscores that does not start with- 'langfuse'.- queueId:- type: string- nullable: true- description: >-- The annotation queue referenced by the score. Indicates if score was- initially created while processing annotation queue.- dataType:- $ref: '#/components/schemas/ScoreDataType'- nullable: true- description: >-- The data type of the score. When passing a configId this field is- inferred. Otherwise, this field must be passed or will default to- numeric.- configId:- type: string- nullable: true- description: >-- Reference a score config on a score. The unique langfuse identifier- of a score config. When passing this field, the dataType and- stringValue fields are automatically populated.- required:- - name- - value- CreateScoreResponse:- title: CreateScoreResponse- type: object- properties:- id:- type: string- description: The id of the created object in Langfuse- required:- - idPaginatedSessions:title: PaginatedSessionstype: object