Langfuse Opentelemetry API

The Opentelemetry API from Langfuse — 1 operation(s) for opentelemetry.

OpenAPI Specification

langfuse-opentelemetry-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: langfuse AnnotationQueues Opentelemetry API
  version: ''
  description: '## Authentication


    Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:


    - username: Langfuse Public Key

    - password: Langfuse Secret Key


    ## Exports


    - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml'
tags:
- name: Opentelemetry
paths:
  /api/public/otel/v1/traces:
    post:
      description: '**OpenTelemetry Traces Ingestion Endpoint**


        This endpoint implements the OTLP/HTTP specification for trace ingestion, providing native OpenTelemetry integration for Langfuse Observability.


        **Supported Formats:**

        - Binary Protobuf: `Content-Type: application/x-protobuf`

        - JSON Protobuf: `Content-Type: application/json`

        - Supports gzip compression via `Content-Encoding: gzip` header


        **Specification Compliance:**

        - Conforms to [OTLP/HTTP Trace Export](https://opentelemetry.io/docs/specs/otlp/#otlphttp)

        - Implements `ExportTraceServiceRequest` message format


        **Documentation:**

        - Integration guide: https://langfuse.com/integrations/native/opentelemetry

        - Data model: https://langfuse.com/docs/observability/data-model'
      operationId: opentelemetry_exportTraces
      tags:
      - Opentelemetry
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OtelTraceResponse'
              examples:
                BasicTraceExport:
                  value: {}
        '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:
              type: object
              properties:
                resourceSpans:
                  type: array
                  items:
                    $ref: '#/components/schemas/OtelResourceSpan'
                  description: Array of resource spans containing trace data as defined in the OTLP specification
              required:
              - resourceSpans
            examples:
              BasicTraceExport:
                value:
                  resourceSpans:
                  - resource:
                      attributes:
                      - key: service.name
                        value:
                          stringValue: my-service
                      - key: service.version
                        value:
                          stringValue: 1.0.0
                    scopeSpans:
                    - scope:
                        name: langfuse-sdk
                        version: 2.60.3
                      spans:
                      - traceId: 0123456789abcdef0123456789abcdef
                        spanId: 0123456789abcdef
                        name: my-operation
                        kind: 1
                        startTimeUnixNano: '1747872000000000000'
                        endTimeUnixNano: '1747872001000000000'
                        attributes:
                        - key: langfuse.observation.type
                          value:
                            stringValue: generation
                        status: {}
components:
  schemas:
    OtelResourceSpan:
      title: OtelResourceSpan
      type: object
      description: Represents a collection of spans from a single resource as per OTLP specification
      properties:
        resource:
          $ref: '#/components/schemas/OtelResource'
          nullable: true
          description: Resource information
        scopeSpans:
          type: array
          items:
            $ref: '#/components/schemas/OtelScopeSpan'
          nullable: true
          description: Array of scope spans
    OtelTraceResponse:
      title: OtelTraceResponse
      type: object
      description: Response from trace export request. Empty object indicates success.
      properties: {}
    OtelAttributeValue:
      title: OtelAttributeValue
      type: object
      description: Attribute value wrapper supporting different value types
      properties:
        stringValue:
          type: string
          nullable: true
          description: String value
        intValue:
          type: integer
          nullable: true
          description: Integer value
        doubleValue:
          type: number
          format: double
          nullable: true
          description: Double value
        boolValue:
          type: boolean
          nullable: true
          description: Boolean value
    OtelScopeSpan:
      title: OtelScopeSpan
      type: object
      description: Collection of spans from a single instrumentation scope
      properties:
        scope:
          $ref: '#/components/schemas/OtelScope'
          nullable: true
          description: Instrumentation scope information
        spans:
          type: array
          items:
            $ref: '#/components/schemas/OtelSpan'
          nullable: true
          description: Array of spans
    OtelResource:
      title: OtelResource
      type: object
      description: Resource attributes identifying the source of telemetry
      properties:
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/OtelAttribute'
          nullable: true
          description: Resource attributes like service.name, service.version, etc.
    OtelAttribute:
      title: OtelAttribute
      type: object
      description: Key-value attribute pair for resources, scopes, or spans
      properties:
        key:
          type: string
          nullable: true
          description: Attribute key (e.g., "service.name", "langfuse.observation.type")
        value:
          $ref: '#/components/schemas/OtelAttributeValue'
          nullable: true
          description: Attribute value
    OtelScope:
      title: OtelScope
      type: object
      description: Instrumentation scope information
      properties:
        name:
          type: string
          nullable: true
          description: Instrumentation scope name
        version:
          type: string
          nullable: true
          description: Instrumentation scope version
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/OtelAttribute'
          nullable: true
          description: Additional scope attributes
    OtelSpan:
      title: OtelSpan
      type: object
      description: Individual span representing a unit of work or operation
      properties:
        traceId:
          nullable: true
          description: Trace ID (16 bytes, hex-encoded string in JSON or Buffer in binary)
        spanId:
          nullable: true
          description: Span ID (8 bytes, hex-encoded string in JSON or Buffer in binary)
        parentSpanId:
          nullable: true
          description: Parent span ID if this is a child span
        name:
          type: string
          nullable: true
          description: Span name describing the operation
        kind:
          type: integer
          nullable: true
          description: Span kind (1=INTERNAL, 2=SERVER, 3=CLIENT, 4=PRODUCER, 5=CONSUMER)
        startTimeUnixNano:
          nullable: true
          description: Start time in nanoseconds since Unix epoch
        endTimeUnixNano:
          nullable: true
          description: End time in nanoseconds since Unix epoch
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/OtelAttribute'
          nullable: true
          description: Span attributes including Langfuse-specific attributes (langfuse.observation.*)
        status:
          nullable: true
          description: Span status object
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic