> ## 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 test

> Create a new test. See [Tests](https://docs.galtea.ai/concepts/product/test).

**File uploads.** The `uri`, `groundTruthUri`, and `dataCatalogUri` fields of `TestInput`
each expect a presigned GET URL (S3 `X-Amz-*` or Azure Blob SAS) for a file that was
already uploaded via the storage PUT-presign endpoint. The server strips the signing
query and persists the underlying storage URI (`s3://<bucket>/<key>` for S3, or the
query-less blob URL for Azure) on the created test.

Providing `uri` switches the request into "custom test file" mode: generation is
skipped, the test is created in `SUCCESS` state, and credit checks / `maxTestCases`
/ generator-specific validations are bypassed.

Creation is the only time `specificationId` can be set directly. To attach an
existing test to a specification afterwards, use `specifications link-tests`.




## OpenAPI

````yaml https://api.galtea.ai/openapi.json post /tests
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:
  /tests:
    post:
      tags:
        - tests
      summary: Create test
      description: >
        Create a new test. See
        [Tests](https://docs.galtea.ai/concepts/product/test).


        **File uploads.** The `uri`, `groundTruthUri`, and `dataCatalogUri`
        fields of `TestInput`

        each expect a presigned GET URL (S3 `X-Amz-*` or Azure Blob SAS) for a
        file that was

        already uploaded via the storage PUT-presign endpoint. The server strips
        the signing

        query and persists the underlying storage URI (`s3://<bucket>/<key>` for
        S3, or the

        query-less blob URL for Azure) on the created test.


        Providing `uri` switches the request into "custom test file" mode:
        generation is

        skipped, the test is created in `SUCCESS` state, and credit checks /
        `maxTestCases`

        / generator-specific validations are bypassed.


        Creation is the only time `specificationId` can be set directly. To
        attach an

        existing test to a specification afterwards, use `specifications
        link-tests`.
      operationId: createTest
      requestBody:
        required: true
        description: Test data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestInput'
      responses:
        '201':
          description: Test created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Test'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    TestInput:
      type: object
      required:
        - productId
        - name
        - type
      properties:
        productId:
          type: string
          description: Product ID
          example: prod_123
        name:
          type: string
          description: Test name
          example: Quality Test
        type:
          type: string
          enum:
            - QUALITY
            - RED_TEAMING
            - SCENARIOS
          example: QUALITY
        specificationId:
          type: string
          description: Specification ID (can auto-derive type/variants)
          example: spec_123
        groundTruthUri:
          type: string
          description: >-
            Presigned GET URL (S3 `X-Amz-*` query or Azure Blob SAS) for a
            ground-truth file previously uploaded via the storage PUT-presign
            endpoint. The server strips the signing query and persists the
            underlying storage URI. Cannot be combined with `sourceTestId`.
          example: >-
            https://my-bucket.s3.amazonaws.com/tests/ground-truth.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-Signature=...
        uri:
          type: string
          description: >-
            Presigned GET URL for a fully prepared custom test file previously
            uploaded via the storage PUT-presign endpoint. When provided, no
            test-case generation runs: the file is ingested as-is, the test is
            created in `SUCCESS` state, and `maxTestCases`, generator-related
            fields, and credit checks are skipped. Cannot be combined with
            `sourceTestId` or `dataCatalogUri`. Must be non-empty.
          example: >-
            https://my-bucket.s3.amazonaws.com/tests/test.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-Signature=...
        fewShot:
          type: string
          description: >-
            Optional few-shot examples used to guide test-case generation for
            QUALITY tests.
          example: 'Q: What is 2+2? A: 4'
        languageCode:
          type: string
          example: es-MX
          description: >-
            BCP-47 language tag (e.g. en, es-MX). The region subtag affects
            voice synthesis only.
        backgroundNoiseProfile:
          type: string
          nullable: true
          enum:
            - office
            - street
            - car
            - white
            - pink
          example: street
          description: >-
            Background noise mixed into the simulated caller audio during a
            voice test. Clip-backed (office, street, car) or synthetic (white,
            pink). Null means off; set together with backgroundNoiseLevel.
        backgroundNoiseLevel:
          type: string
          nullable: true
          enum:
            - light
            - medium
            - heavy
          example: medium
          description: >-
            How loud the background noise is relative to the caller speech. Null
            means off; set together with backgroundNoiseProfile.
        variants:
          type: array
          items:
            type: string
          example:
            - rag
          description: >-
            Test variants. QUALITY: rag, entity_extraction, summarization,
            classification, translation, correction, other. RED_TEAMING:
            data_leakage, financial_attacks, illegal_activities, misuse,
            toxicity, custom.
        customVariantDescription:
          type: string
          description: Custom variant description
          example: Custom test variant
        strategies:
          type: array
          items:
            type: string
          example:
            - original
          description: >-
            Generation strategies. "original" is the default for RED_TEAMING. At
            least one strategy is required for SCENARIOS tests.
        customUserPersona:
          type: string
          example: Business analyst
        maxTestCases:
          type: integer
          example: 100
        maxIterations:
          type: integer
          minimum: 1
          description: >-
            SCENARIOS only. Maximum number of conversation turns per generated
            scenario when scenario generation is executed. If omitted, the
            scenario-generator default is used. If `uri` is provided, no
            scenario generation runs, so this field is ignored at test-creation
            time. When generation runs, the value is forwarded to the
            scenario-generator and persisted on each generated test case.
            Ignored for QUALITY and RED_TEAMING tests.
          example: 10
        models:
          type: array
          items:
            type: string
          example:
            - gpt-4
        sourceTestId:
          type: string
          description: >-
            Source QUALITY test ID whose approved test cases seed a SCENARIOS
            test. Only valid when `type = SCENARIOS`. Cannot be combined with
            `uri` or `groundTruthUri`.
          example: test_123
        dataCatalogUri:
          type: string
          description: >-
            Presigned GET URL for a data-catalog file previously uploaded via
            the storage PUT-presign endpoint. Only valid when `type =
            SCENARIOS`. Cannot be combined with `uri`.
          example: >-
            https://my-bucket.s3.amazonaws.com/tests/data-catalog.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-Signature=...
        metadata:
          type: object
          nullable: true
          description: Arbitrary key-value metadata
          example:
            key: value
    Test:
      type: object
      properties:
        id:
          type: string
          example: test_123
        productId:
          type: string
          nullable: true
          example: prod_123
        userId:
          type: string
          nullable: true
          example: user_123
        name:
          type: string
          example: Quality Test
        type:
          type: string
          enum:
            - QUALITY
            - RED_TEAMING
            - SCENARIOS
          example: QUALITY
        groundTruthUri:
          type: string
          nullable: true
          example: s3://my-bucket/tests/test_123/ground-truth.csv
          description: >-
            Canonical storage URI of the ground-truth file, derived from the
            presigned URL supplied at creation. S3: `s3://<bucket>/<key>`. Azure
            Blob: blob URL with the SAS query stripped (e.g.
            `https://<account>.blob.core.windows.net/<container>/<path>`).
        uri:
          type: string
          nullable: true
          example: s3://my-bucket/tests/test_123/test.csv
          description: >-
            Canonical storage URI of the uploaded custom test file. Same format
            rules as `groundTruthUri`.
        error:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - PENDING
            - SUCCESS
            - FAILED
            - AUGMENTING
          example: SUCCESS
        fewShot:
          type: string
          nullable: true
          example: Example few-shot learning data
          description: >-
            Optional few-shot examples (input/output pairs) used to guide
            test-case generation for QUALITY tests.
        languageCode:
          type: string
          nullable: true
          example: es-MX
          description: >-
            BCP-47 language tag (e.g. en, es-MX). The region subtag affects
            voice synthesis only.
        backgroundNoiseProfile:
          type: string
          nullable: true
          enum:
            - office
            - street
            - car
            - white
            - pink
          example: street
          description: >-
            Background noise mixed into the simulated caller audio during a
            voice test. Clip-backed (office, street, car) or synthetic (white,
            pink). Null means off; set together with backgroundNoiseLevel.
        backgroundNoiseLevel:
          type: string
          nullable: true
          enum:
            - light
            - medium
            - heavy
          example: medium
          description: >-
            How loud the background noise is relative to the caller speech. Null
            means off; set together with backgroundNoiseProfile.
        variants:
          type: array
          items:
            type: string
          example:
            - rag
            - summarization
          description: >-
            Test variants. QUALITY: rag, entity_extraction, summarization,
            classification, translation, correction, other. RED_TEAMING:
            data_leakage, financial_attacks, illegal_activities, misuse,
            toxicity, custom.
        customVariantDescription:
          type: string
          nullable: true
          example: Custom variant description
        strategies:
          type: array
          items:
            type: string
          example:
            - original
          description: >-
            Generation strategies. "original" is the default for RED_TEAMING. At
            least one strategy is required for SCENARIOS tests.
        customUserPersona:
          type: string
          nullable: true
          example: Business analyst
        maxTestCases:
          type: integer
          nullable: true
          example: 100
        models:
          type: array
          items:
            type: string
          example:
            - gpt-4
            - claude-3
        sourceTestId:
          type: string
          nullable: true
        dataCatalogUri:
          type: string
          nullable: true
          example: s3://my-bucket/tests/test_123/data-catalog.json
          description: >-
            Canonical storage URI of the data-catalog file (SCENARIOS tests
            only). Same format rules as `groundTruthUri`.
        metadata:
          type: object
          nullable: true
          example:
            key: value
        specificationId:
          type: string
          nullable: true
          example: spec_123
        createdAt:
          type: string
          format: date-time
        deletedAt:
          type: string
          format: date-time
          nullable: true
    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-...`.

````