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

# Create evaluations from session

> Create evaluations from a session. See [Evaluations](https://docs.galtea.ai/concepts/product/version/session/evaluation).

> [!WARNING]
>
> You are reading the docs of Galtea 5.11. [Read this page in the latest version](https://docs.galtea.ai/api-reference/evaluations/create-evaluations-from-session.md).


## OpenAPI

````yaml /v5.11/openapi.json post /evaluations/fromSession
openapi: 3.0.0
info:
  version: 1.0.0
  title: Product Management Service API
  description: API documentation for Product Management Service
  contact:
    name: Galtea AI
servers:
  - url: https://api.galtea.ai
security:
  - bearerAuth: []
tags: []
externalDocs:
  description: Galtea Platform Documentation
  url: https://docs.galtea.ai
paths:
  /evaluations/fromSession:
    post:
      tags:
        - evaluations
      summary: Create evaluations from session
      description: >-
        Create evaluations from a session. See
        [Evaluations](https://docs.galtea.ai/concepts/product/version/session/evaluation).
      operationId: createEvaluationsFromSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdmitEvaluationBody'
      responses:
        '201':
          description: Evaluations created successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EvaluationCreated'
        '400':
          description: >-
            Bad request: a malformed body (neither or both of `sessionId` and
            `inferenceResultId`, `metrics` not an array of objects,
            `specificationIds` not an array of strings), an unknown metric, a
            self-hosted metric without a score, or a metric of another
            organization than the product's. Also a refused `runId` (not a
            string, deleted, closed, opened by the platform, or of another
            product or version), a deleted endpoint connection on the version
            (checked only when neither `metrics` nor `specificationIds` is
            sent), a duplicate metric, or no metrics to run (none sent and the
            product has no specification with linked metrics). No evaluation is
            written.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The caller may not create evaluations on this product (for example a
            READER). No evaluation is written.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    AdmitEvaluationBody:
      type: object
      properties:
        sessionId:
          type: string
          nullable: true
          example: session_123
        inferenceResultId:
          type: string
          nullable: true
          example: ir_123
          description: The ID of the trace (one conversation turn) to evaluate
        metrics:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                example: id_123
              name:
                type: string
                example: Example Name
              score:
                type: number
                example: 0.95
          description: >-
            Metrics to evaluate. Optional if specificationIds is provided or the
            product has specifications with linked metrics.
        specificationIds:
          type: array
          nullable: true
          items:
            type: string
          description: >-
            Specification IDs whose linked metrics will be evaluated. Can be
            combined with metrics; the API merges and deduplicates.
        runId:
          type: string
          nullable: true
          example: run_123
          description: >-
            Attribute this evaluation to a run you opened with POST /runs, and
            close that run yourself. Without it the API opens its own run and
            closes it when the launch finishes. A run the platform opened is
            refused.
    EvaluationCreated:
      type: object
      properties:
        id:
          type: string
          example: eval_123
        metricId:
          type: string
          example: metric_123
        sessionId:
          type: string
          example: session_123
        productId:
          type: string
          nullable: true
          example: product_123
        userId:
          type: string
          nullable: true
          example: user_123
        status:
          type: string
          enum:
            - PENDING
            - PENDING_HUMAN
            - SUCCESS
            - FAILED
            - SKIPPED
            - CANCELLED
            - OUTDATED
          example: SUCCESS
        inferenceResultId:
          type: string
          nullable: true
          example: ir_123
        score:
          type: number
          nullable: true
          example: 0.95
        reason:
          type: string
          nullable: true
        error:
          type: string
          nullable: true
        canRetry:
          type: boolean
          nullable: true
        creditsUsed:
          type: integer
          nullable: true
        conversationSimulatorVersion:
          type: string
          nullable: true
        humanEvaluatorId:
          type: string
          nullable: true
        humanEvaluatorStartedAt:
          type: string
          format: date-time
          nullable: true
        humanScore:
          type: number
          nullable: true
        humanReason:
          type: string
          nullable: true
        humanEvaluatorFinishedAt:
          type: string
          format: date-time
          nullable: true
        failedTurns:
          type: array
          items:
            type: string
        createdAt:
          type: string
          format: date-time
        deletedAt:
          type: string
          format: date-time
          nullable: true
        evaluatedAt:
          type: string
          format: date-time
          nullable: true
        metricLegacyAt:
          type: string
          format: date-time
          nullable: true
        passed:
          type: boolean
          nullable: true
          description: >-
            Whether the reported score (the reviewer's when set, else the
            judge's) reaches the metric's pass threshold. Null when the
            evaluation has no reported score, is outdated or deleted, is a long
            classifier input, or its metric is not loaded.
        metricPassThreshold:
          type: number
          minimum: 0
          maximum: 1
          description: >-
            The pass threshold that decides `passed`: the metric's, copied onto
            the evaluation when it was created.
        metricDisabledAt:
          type: string
          format: date-time
          nullable: true
        runId:
          type: string
          nullable: true
        metricExcludedFromAnalyticsAt:
          type: string
          format: date-time
          nullable: true
        metricExcludedByUserId:
          type: string
          nullable: true
      required:
        - id
        - metricId
        - sessionId
        - productId
        - userId
        - status
        - inferenceResultId
        - score
        - reason
        - error
        - canRetry
        - creditsUsed
        - conversationSimulatorVersion
        - humanEvaluatorId
        - humanEvaluatorStartedAt
        - humanScore
        - humanReason
        - humanEvaluatorFinishedAt
        - failedTurns
        - deletedAt
        - evaluatedAt
        - metricLegacyAt
        - passed
        - metricPassThreshold
        - metricDisabledAt
        - runId
        - metricExcludedFromAnalyticsAt
        - metricExcludedByUserId
    Error:
      type: object
      properties:
        error:
          type: string
          example: Error type
        message:
          type: string
          example: Error message description
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authorization. Pass your API key in the Authorization header as
        a Bearer token. Both new (`gsk_*`) and legacy (`gsk-`) API keys are
        accepted, e.g. `Authorization: Bearer gsk_...` or `Authorization: Bearer
        gsk-...`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.