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

# Migrate Legacy Score to Scorecard

> Convert legacy sheet score configuration into scorecard criteria.

Convert legacy sheet scoring into scorecard criteria.

Use `delete_legacy_score: false` during migration. Turn on `delete_legacy_score` only after all `/score` consumers have moved.


## OpenAPI

````yaml POST /api/public/v2/tables/{table_id}/sheets/{sheet_id}/scorecard/migrate-legacy-score
openapi: 3.1.0
info:
  title: PromptLayer API
  description: >-
    REST API for PromptLayer: prompt template management, request logging,
    observability, evaluations, and workflows.
  version: 1.0.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/tables/{table_id}/sheets/{sheet_id}/scorecard/migrate-legacy-score:
    post:
      tags:
        - tables
      summary: Migrate Legacy Score to Scorecard
      description: Convert legacy sheet score configuration into scorecard criteria.
      operationId: migrateLegacyTableSheetScoreToScorecard
      parameters:
        - name: X-API-KEY
          in: header
          required: true
          schema:
            type: string
          description: >-
            Your PromptLayer API key. The key's workspace scopes table resources
            for this request.
        - name: table_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Table ID.
        - name: sheet_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Table sheet ID.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MigrateLegacyTableSheetScoreRequest'
      responses:
        '200':
          description: Migration completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MigrateLegacyTableSheetScoreResponse'
        '400':
          description: Migration failed for this sheet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Table or sheet not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    MigrateLegacyTableSheetScoreRequest:
      type: object
      properties:
        delete_legacy_score:
          type: boolean
          default: false
      additionalProperties: false
    MigrateLegacyTableSheetScoreResponse:
      type: object
      required:
        - success
        - scorecard
        - converted_count
        - skipped
        - legacy_score_deleted
        - version
      properties:
        success:
          type: boolean
        scorecard:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/TableSheetScorecard'
        converted_count:
          type: integer
        skipped:
          type: array
          items:
            type: object
            properties:
              reason:
                type: string
              score_type:
                type: string
                nullable: true
            additionalProperties: true
        legacy_score_deleted:
          type: boolean
        version:
          type: integer
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
          description: Indicates that the request failed.
        message:
          type: string
          description: Human-readable error message.
        error:
          type: string
          description: Machine-readable or fallback error message.
      additionalProperties: true
      description: >-
        Standard error response. Some legacy endpoints may return either message
        or error.
    TableSheetScorecard:
      type: object
      required:
        - id
        - workspace_id
        - smart_table_id
        - sheet_id
        - name
        - evaluated_column_ids
        - aggregation
        - status
        - stale_state
        - steps
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        workspace_id:
          type: integer
        smart_table_id:
          type: string
          format: uuid
        sheet_id:
          type: string
          format: uuid
        name:
          type: string
        evaluated_column_ids:
          type: array
          items:
            type: string
        aggregation:
          $ref: '#/components/schemas/TableSheetScorecardAggregation'
        display_config:
          type: object
          nullable: true
          additionalProperties: true
        baseline_config:
          type: object
          nullable: true
          additionalProperties: true
        status:
          type: string
          enum:
            - needs_setup
            - ready
            - queued
            - running
            - completed
            - stale
            - failed
        stale_state:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/TableSheetScorecardStaleState'
        latest_calculation_id:
          type: string
          format: uuid
          nullable: true
        config_hash:
          type: string
          nullable: true
        steps:
          type: array
          items:
            $ref: '#/components/schemas/TableSheetScorecardStep'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      additionalProperties: true
    TableSheetScorecardAggregation:
      type: object
      required:
        - method
        - required_step_failure_behavior
        - pass_threshold
        - warn_threshold
      properties:
        method:
          type: string
        required_step_failure_behavior:
          type: string
          enum:
            - fail
            - warn
            - error
        pass_threshold:
          type: number
        warn_threshold:
          type: number
      additionalProperties: true
    TableSheetScorecardStaleState:
      type: object
      required:
        - is_stale
        - reasons
      properties:
        is_stale:
          type: boolean
        reasons:
          type: array
          items:
            type: string
        stale_step_ids:
          type: array
          items:
            type: string
            format: uuid
        stale_row_indices:
          type: array
          items:
            type: integer
            minimum: 0
      additionalProperties: true
    TableSheetScorecardStep:
      type: object
      required:
        - title
        - primitive_type
      properties:
        id:
          type: string
          format: uuid
          nullable: true
        title:
          type: string
        primitive_type:
          type: string
          enum:
            - COLUMN_AGGREGATE
            - CONTAINS
            - REGEX
            - ASSERT_VALID
            - COMPARE
            - LLM_ASSERTION
            - TOOL_EVALUATOR
            - CODE_EXECUTION
            - STRUCTURE
            - MAX_TOOL_CALLS
            - NO_INVALID_TOOL_CALLS
        source_column_ids:
          type: array
          items:
            type: string
        weight:
          type: number
        required:
          type: boolean
        thresholds:
          type: object
          additionalProperties:
            type: number
        primitive_config:
          additionalProperties: true
          type: object
        score_adapter:
          type: object
          nullable: true
          additionalProperties: true
        description:
          type: string
          nullable: true
        target_column_id:
          type: string
          format: uuid
          nullable: true
        evidence_mode:
          type: string
          nullable: true
          enum:
            - summary
            - raw
            - hidden
            - null
        order_index:
          type: integer
        backing_column_id:
          type: string
          format: uuid
          nullable: true
        config_hash:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
          nullable: true
        updated_at:
          type: string
          format: date-time
          nullable: true
      additionalProperties: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````