> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Span

> Update a span with the given ID.



## OpenAPI

````yaml https://api.galileo.ai/public/v2/openapi.json patch /v2/projects/{project_id}/spans/{span_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.galileo.ai
    description: Galileo Public APIs - galileo-v2
security: []
paths:
  /v2/projects/{project_id}/spans/{span_id}:
    patch:
      tags:
        - trace
      summary: Update Span
      description: Update a span with the given ID.
      operationId: update_span_v2_projects__project_id__spans__span_id__patch
      parameters:
        - name: span_id
          in: path
          required: true
          schema:
            type: string
            format: uuid4
            title: Span Id
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            format: uuid4
            title: Project Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LogSpanUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogSpanUpdateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - OAuth2PasswordBearer: []
        - HTTPBasic: []
components:
  schemas:
    LogSpanUpdateRequest:
      properties:
        log_stream_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Log Stream Id
          description: Log stream id associated with the traces.
        experiment_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Experiment Id
          description: Experiment id associated with the traces.
        metrics_testing_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Metrics Testing Id
          description: Metrics testing id associated with the traces.
        logging_method:
          $ref: '#/components/schemas/LoggingMethod'
          default: api_direct
        client_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Version
        reliable:
          type: boolean
          title: Reliable
          description: >-
            Whether or not to use reliable logging.  If set to False, the method
            will respond immediately before verifying that the traces have been
            successfully ingested, and no error message will be returned if
            ingestion fails.  If set to True, the method will wait for the
            traces to be successfully ingested or return an error message if
            there is an ingestion failure.
          default: true
        span_id:
          type: string
          format: uuid4
          title: Span Id
          description: Span id to update.
        input:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - type: 'null'
          title: Input
          description: Input of the span. Overwrites previous value if present.
        output:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/Message'
            - items:
                $ref: '#/components/schemas/Document-Input'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - $ref: '#/components/schemas/ControlResult'
            - type: 'null'
          title: Output
          description: Output of the span. Overwrites previous value if present.
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
          description: Tags to add to the span.
        status_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status Code
          description: Status code of the span. Overwrites previous value if present.
        duration_ns:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ns
          description: Duration in nanoseconds. Overwrites previous value if present.
      type: object
      required:
        - span_id
      title: LogSpanUpdateRequest
      description: Request model for updating a span.
    LogSpanUpdateResponse:
      properties:
        log_stream_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Log Stream Id
          description: Log stream id associated with the traces.
        experiment_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Experiment Id
          description: Experiment id associated with the traces.
        metrics_testing_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Metrics Testing Id
          description: Metrics testing id associated with the traces.
        project_id:
          type: string
          format: uuid4
          title: Project Id
          description: Project id associated with the traces.
        project_name:
          type: string
          title: Project Name
          description: Project name associated with the traces.
        session_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Session Id
          description: Session id associated with the traces.
        records_count:
          type: integer
          title: Records Count
          description: Total number of records ingested
        span_id:
          type: string
          format: uuid4
          title: Span Id
          description: Span id associated with the updated span.
      type: object
      required:
        - project_id
        - project_name
        - records_count
        - span_id
      title: LogSpanUpdateResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LoggingMethod:
      type: string
      enum:
        - playground
        - python_client
        - typescript_client
        - api_direct
      title: LoggingMethod
    Message:
      properties:
        content:
          anyOf:
            - type: string
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
          title: Content
        role:
          $ref: '#/components/schemas/MessageRole'
        tool_call_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Call Id
        tool_calls:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolCall'
              type: array
            - type: 'null'
          title: Tool Calls
      type: object
      required:
        - content
        - role
      title: Message
    TextContentPart:
      properties:
        type:
          type: string
          const: text
          title: Type
          default: text
        text:
          type: string
          title: Text
      type: object
      required:
        - text
      title: TextContentPart
      description: A text segment within a message.
    FileContentPart:
      properties:
        type:
          type: string
          const: file
          title: Type
          default: file
        file_id:
          type: string
          format: uuid4
          title: File Id
      type: object
      required:
        - file_id
      title: FileContentPart
      description: |-
        Reference to a file associated with this message.

        The file_id can be resolved via the ``files`` dict returned on
        trace/span detail responses, which contains metadata such as
        modality, MIME type, and a presigned download URL.
    Document-Input:
      properties:
        page_content:
          type: string
          title: Page Content
          description: Content of the document.
        metadata:
          additionalProperties:
            anyOf:
              - type: boolean
              - type: string
              - type: integer
              - type: number
          type: object
          title: Metadata
      additionalProperties: false
      type: object
      required:
        - page_content
      title: Document
    ControlResult:
      properties:
        action:
          $ref: '#/components/schemas/ControlAction'
          description: Decision/action produced by the control.
        matched:
          type: boolean
          title: Matched
          description: >-
            Whether the control matched. False covers both non-match and error
            cases; use error_message to distinguish errors.
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
          description: Confidence score reported by the control evaluation result.
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: >-
            Error text when control evaluation failed. This should be null for
            normal matches and non-matches.
      type: object
      required:
        - action
        - matched
      title: ControlResult
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    MessageRole:
      type: string
      enum:
        - agent
        - assistant
        - developer
        - function
        - system
        - tool
        - user
      title: MessageRole
    ToolCall:
      properties:
        id:
          type: string
          title: Id
        function:
          $ref: '#/components/schemas/ToolCallFunction'
      type: object
      required:
        - id
        - function
      title: ToolCall
    ControlAction:
      type: string
      enum:
        - deny
        - steer
        - observe
      title: ControlAction
    ToolCallFunction:
      properties:
        name:
          type: string
          title: Name
        arguments:
          type: string
          title: Arguments
      type: object
      required:
        - name
        - arguments
      title: ToolCallFunction
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Galileo-API-Key
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: https://api.galileo.ai/login
    HTTPBasic:
      type: http
      scheme: basic

````