> ## 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 (upsert) system

> Create a new system. If one with the same name in the project exists, it updates it instead.



## OpenAPI

````yaml post /projects/{projectId}/systems
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:
  /projects/{projectId}/systems:
    post:
      summary: Create (upsert) system
      description: >-
        Create a new system. If one with the same name in the project exists, it
        updates it instead.
      operationId: upsertSystem
      parameters:
        - in: path
          name: projectId
          description: The ID of the system's Project.
          schema:
            type: string
            example: '314'
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                description:
                  type: string
                  default: ''
                  description: The description of the system.
                name:
                  type: string
                  default: Default system
                  description: >-
                    The name of the system. Should be unique within the project.
                    Default is "Default system"
                config:
                  type: object
                  additionalProperties: true
                  description: The configuration of the system.
              required:
                - config
            examples:
              Create chatbot system:
                value:
                  name: GPT-4 Chatbot
                  description: Production chatbot powered by GPT-4
                  config:
                    temperature: 0.1
                    maxTokens: 1024
                summary: Create chatbot system
                description: Create a system for a GPT-4 powered chatbot.
              Create RAG system:
                value:
                  name: RAG System
                  description: >-
                    Retrieval-augmented generation system for company knowledge
                    base
                  config:
                    top_k: 5
                    chunk_size: 1024
                summary: Create RAG system
                description: Create a system for a retrieval-augmented generation system.
      responses:
        '201':
          description: System created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/System'
              examples:
                Created system response:
                  value:
                    id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                    name: GPT-4 Chatbot
                    description: Production chatbot powered by GPT-4
                    productionVersion:
                      id: 87654321-4d3b-4ae4-8c7a-4b6e2a19ccf0
                      systemId: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                      name: Version 1
                      config:
                        temperature: 0.1
                        maxTokens: 1024
                    versions:
                      - id: 87654321-4d3b-4ae4-8c7a-4b6e2a19ccf0
                        name: Version 1
                  summary: Created system response
                  description: >-
                    Response after successfully creating a system for a GPT-4
                    chatbot.
        '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 system = await client.systems.upsert('314', {
              config: { temperature: 0.1, maxTokens: 1024 },
              description: 'Production chatbot powered by GPT-4',
              name: 'GPT-4 Chatbot',
            });

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

            client = Scorecard(
                api_key="My API Key",
            )
            system = client.systems.upsert(
                project_id="314",
                config={
                    "temperature": 0.1,
                    "maxTokens": 1024,
                },
                description="Production chatbot powered by GPT-4",
                name="GPT-4 Chatbot",
            )
            print(system.id)
        - lang: cURL
          source: |-
            curl https://api2.scorecard.io/api/v2/projects/$PROJECT_ID/systems \
                -H 'Content-Type: application/json' \
                -H "Authorization: Bearer $SCORECARD_API_KEY" \
                -d '{
                      "config": {
                        "temperature": "bar",
                        "maxTokens": "bar"
                      }
                    }'
components:
  schemas:
    System:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The ID of the system.
        name:
          type: string
          description: The name of the system. Unique within the project.
        description:
          type: string
          default: ''
          description: The description of the system.
        productionVersion:
          $ref: '#/components/schemas/SystemVersion'
          description: The production version of the system.
        versions:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
                description: The ID of the system version.
              name:
                type: string
                description: The name of the system version.
            required:
              - id
              - name
            description: >-
              A SystemVersion defines the specific settings for a System Under
              Test.


              System versions contain parameter values that determine system
              behavior during evaluation.

              They are immutable snapshots - once created, they never change.


              When running evaluations, you reference a specific systemVersionId
              to establish which system version to test.
          description: The versions of the system.
      required:
        - id
        - name
        - description
        - productionVersion
        - versions
      description: >-
        A System Under Test (SUT).


        Systems are templates - to run evaluations, pair them with a
        SystemVersion that provides specific

        parameter values.
    SystemVersion:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The ID of the system version.
        systemId:
          type: string
          format: uuid
          description: The ID of the system the system version belongs to.
        name:
          type: string
          description: The name of the system version.
        config:
          type: object
          additionalProperties: true
          description: The configuration of the system version.
      required:
        - id
        - systemId
        - name
        - config
      description: >-
        A SystemVersion defines the specific settings for a System Under Test.


        System versions contain parameter values that determine system behavior
        during evaluation.

        They are immutable snapshots - once created, they never change.


        When running evaluations, you reference a specific systemVersionId to
        establish which system version to test.
    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_

````