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

# Create Record

> Create a new Record in a Run.



## OpenAPI

````yaml post /runs/{runId}/records
openapi: 3.1.0
info:
  title: Scorecard API
  description: REST API for Scorecard
  version: 1.0.0
servers:
  - url: https://api2.scorecard.io/api/v2
security:
  - ApiKeyAuth: []
paths:
  /runs/{runId}/records:
    post:
      summary: Create Record
      description: Create a new Record in a Run.
      operationId: createRecord
      parameters:
        - in: path
          name: runId
          description: The ID of the Run.
          schema:
            type: string
            example: '135'
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                testcaseId:
                  type: string
                  description: The ID of the Testcase.
                inputs:
                  type: object
                  additionalProperties: true
                  description: >-
                    The actual inputs sent to the system, which should match the
                    system's input schema.
                expected:
                  type: object
                  additionalProperties: true
                  description: The expected outputs for the Testcase.
                outputs:
                  type: object
                  additionalProperties: true
                  description: The actual outputs from the system.
              required:
                - inputs
                - expected
                - outputs
            examples:
              Create Record:
                value:
                  testcaseId: '248'
                  inputs:
                    question: What is the capital of France?
                  expected:
                    idealAnswer: Paris is the capital of France
                  outputs:
                    response: The capital of France is Paris.
                summary: Create Record
                description: Request to create a Record.
      responses:
        '201':
          description: Record created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Record'
              examples:
                Created Record:
                  value:
                    id: '864'
                    runId: '135'
                    testcaseId: '248'
                    inputs:
                      question: What is the capital of France?
                    expected:
                      idealAnswer: Paris is the capital of France
                    outputs:
                      response: The capital of France is Paris.
                  summary: Created Record
                  description: Response after successfully creating a Record.
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '500':
          $ref: '#/components/responses/ServiceError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Scorecard from 'scorecard-ai';

            const client = new Scorecard({
              apiKey: 'My API Key',
            });

            const record = await client.records.create('135', {
              expected: { idealAnswer: 'Paris is the capital of France' },
              inputs: { question: 'What is the capital of France?' },
              outputs: { response: 'The capital of France is Paris.' },
              testcaseId: '248',
            });

            console.log(record.id);
        - lang: Python
          source: |-
            from scorecard_ai import Scorecard

            client = Scorecard(
                api_key="My API Key",
            )
            record = client.records.create(
                run_id="135",
                expected={
                    "idealAnswer": "Paris is the capital of France"
                },
                inputs={
                    "question": "What is the capital of France?"
                },
                outputs={
                    "response": "The capital of France is Paris."
                },
                testcase_id="248",
            )
            print(record.id)
        - lang: cURL
          source: |-
            curl https://api2.scorecard.io/api/v2/runs/$RUN_ID/records \
                -H 'Content-Type: application/json' \
                -H "Authorization: Bearer $SCORECARD_API_KEY" \
                -d '{
                      "expected": {
                        "idealAnswer": "bar"
                      },
                      "inputs": {
                        "question": "bar"
                      },
                      "outputs": {
                        "response": "bar"
                      }
                    }'
components:
  schemas:
    Record:
      type: object
      properties:
        id:
          type: string
          description: The ID of the Record.
        runId:
          type: string
          description: The ID of the Run containing this Record.
        testcaseId:
          type: string
          description: The ID of the Testcase.
        inputs:
          type: object
          additionalProperties: true
          description: >-
            The actual inputs sent to the system, which should match the
            system's input schema.
        expected:
          type: object
          additionalProperties: true
          description: The expected outputs for the Testcase.
        outputs:
          type: object
          additionalProperties: true
          description: The actual outputs from the system.
      required:
        - id
        - runId
        - inputs
        - expected
        - outputs
      description: A record of a system execution in the Scorecard system.
    ApiError:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          type: object
          additionalProperties: true
          x-stainless-any: true
      required:
        - code
        - message
        - details
      description: An API error.
  responses:
    UnauthenticatedError:
      description: Error indicating that the request is not authenticated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            Authentication failure:
              value:
                code: UNAUTHORIZED
                message: Invalid or missing authentication token
                details: {}
              summary: Authentication failure
              description: >-
                Error returned when authentication credentials are invalid or
                missing.
    ServiceError:
      description: >-
        An internal service error indicating an issue with the Scorecard
        service.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            Internal error:
              value:
                code: INTERNAL_ERROR
                message: An unexpected error occurred while processing your request.
                details: {}
              summary: Internal error
              description: Generic error when an unexpected internal issue occurs.
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: starts with ak_

````