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

# Create Test Case

> Creates a simulation test case for the specified agent. Define the scenario using user persona, goals, and evaluation criteria. Returns the created test case, including its testCaseId for subsequent get, update, delete, and batch-run calls.



## OpenAPI

````yaml post /v1/test-cases
openapi: 3.0.1
info:
  title: SigmaMind APIs
  description: OpenAPI documentation SigmaMind Agent Builder APIs
  version: '1.0'
servers:
  - url: https://api.sigmamind.ai
    description: SigmaMind AI Agent Builder APIs
security:
  - apiKeyAuth: []
tags:
  - name: Chats
    description: >-
      Endpoints for creating and managing text-based chat sessions with an
      agent. A session is started by specifying an agent and an opening message.
      Returns a chatId used in all subsequent get, update, completion, and
      end-session calls.
  - name: Calls
    description: >-
      Endpoints for creating and managing outbound phone calls. A call is
      initiated by specifying an agent, caller number, and destination number —
      dynamic variables can be included to personalise the agent's behaviour.
      Returns a callId used in all subsequent get and delete operations.
  - name: Phone Numbers
    description: >-
      Endpoints for managing phone numbers used in outbound and inbound calls.
      Supports purchasing a new number through SigmaMind or importing an
      existing number via SIP trunking (BYO). Each number can be assigned
      separate inbound and outbound agents.
  - name: Campaigns
    description: >-
      Endpoints for creating and managing outbound call campaigns. A campaign
      dials a CSV-uploaded contact list using a selected agent and caller
      number, with support for immediate or scheduled launch. Returns a
      campaignId used in all subsequent get, update, and delete operations.
  - name: Agents
    description: >-
      Endpoints for creating and managing single prompt agents. An agent is
      configured with a system prompt, voice settings, and optional tools.
      Returns an agentId used in all subsequent update, call, and simulation
      operations.
  - name: Integrations
    description: >-
      Endpoints for creating and managing third-party integrations (e.g.
      Shopify, Cal.com). An integration links your account to an external
      service and acts as the parent resource for auth credentials and API
      tools. Returns an integrationId used in all subsequent auth and tool
      operations.
  - name: Integration Auth
    description: >-
      Endpoints for managing authentication credentials for a third-party
      integration. Supports API Key, Basic, and Bearer token credential types —
      scoped to an integration and injected automatically by tools when
      executing. Returns an authId used in all subsequent get, update, and
      delete operations.
  - name: Integration Tools
    description: >-
      Endpoints for creating and managing API tools backed by a third-party
      integration. Each tool defines an HTTP endpoint, method, and parameter
      schema — scoped to an integration and using its stored auth credentials
      when executing. Returns a toolId used in all subsequent get, update,
      delete, and execute operations.
  - name: Webhooks
    description: >-
      Endpoints for registering and managing webhooks. A webhook delivers
      real-time event notifications via HTTP POST when selected events occur on
      a specific agent — each webhook is scoped to one agent and one or more
      event types. Payloads are signed with an HMAC secret — verify the
      signature on your server to confirm authenticity.
  - name: Test Cases
    description: >-
      Endpoints for creating and managing simulation test cases for an agent. A
      test case defines a conversation scenario — including user persona, goals,
      and expected behaviour — used to generate a synthetic conversation with
      the agent. Returns a testCaseId used in all subsequent get, update,
      delete, and batch-run operations.
  - name: Batch Runs
    description: >-
      Endpoints for creating and managing batch runs of simulation test cases. A
      batch run executes multiple test cases in parallel against a selected
      agent and aggregates the results for review. Returns a batchId used in all
      subsequent get and list test-run operations.
  - name: Test Runs
    description: >-
      Endpoints for retrieving test run results within a batch. Each test run
      represents a single test case execution within a batch run, identified by
      a jobId. Use batchId and agentId to scope results to the correct batch.
  - name: API Keys
    description: >-
      Endpoints for creating and managing API keys used to authenticate public
      API requests. Each key must be included in the X-API-Key request header.
      Returns a keyId used in all subsequent get, revoke, and delete operations.
  - name: QA Rules
    description: >-
      Endpoints for creating and managing quality assurance rules applied to
      agent conversations. A QA rule defines evaluation criteria used to
      automatically assess conversation quality. Returns a qaRuleId used in all
      subsequent get, update,  and delete operations.
  - name: QA Issues
    description: >-
      Endpoints for retrieving and managing quality assurance issues flagged
      across agent conversations. A QA issue is created with status 'Fail' when
      a conversation violates one or more QA rules — capturing the offending
      rule reference. It is created with status 'Success' when the conversation
      passes the evaluation criteria of QA rule(s). Returns a qaIssueId used in
      all subsequent get operations.
paths:
  /v1/test-cases:
    post:
      tags:
        - Test Cases
      summary: Create Test Case
      description: >-
        Creates a simulation test case for the specified agent. Define the
        scenario using user persona, goals, and evaluation criteria. Returns the
        created test case, including its testCaseId for subsequent get, update,
        delete, and batch-run calls.
      operationId: createTestCase
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTestCaseRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestCaseResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Bad Request
                    message: Invalid request parameters
                    path: /v1/test-cases
                    status: 400
                    timestamp: '2026-05-05T10:06:45.690Z'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Unauthorized
                    message: X-API-Key is missing or invalid
                    path: /v1/test-cases
                    status: 401
                    timestamp: '2026-05-05T10:06:45.690Z'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Forbidden
                    message: Access denied for this resource
                    path: /v1/test-cases
                    status: 403
                    timestamp: '2026-05-05T10:06:45.690Z'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Not Found
                    message: The requested resource was not found
                    path: /v1/test-cases
                    status: 404
                    timestamp: '2026-05-05T10:06:45.690Z'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Internal Server Error
                    message: Unexpected server error
                    path: /v1/test-cases
                    status: 500
                    timestamp: '2026-05-05T10:06:45.690Z'
components:
  schemas:
    CreateTestCaseRequest:
      required:
        - agentId
        - successCriteria
        - userPrompt
      type: object
      properties:
        label:
          type: string
          description: >-
            A human-readable name or label for the test case, used to identify
            it in reports and dashboards.
          example: Angry Customer - Cancellation Flow
        agentId:
          type: string
          description: >-
            The unique identifier of the Agent that will respond during the chat
            simulation.
          example: D5D0p7TUs66TTAEAx
        llmModel:
          type: string
          description: >-
            The LLM model used to generate Agent responses during the
            simulation. To use OpenAI priority tier models, append '-fast-tier'
            to the model name (e.g., 'gpt-4o-mini-fast-tier').
          example: gpt-4o-mini
          enum:
            - gpt-5.2
            - gpt-5.2-fast-tier
            - gpt-5.1
            - gpt-5.1-fast-tier
            - gpt-5
            - gpt-5-fast-tier
            - gpt-5-mini
            - gpt-5-mini-fast-tier
            - gpt-5-nano
            - gpt-4.1
            - gpt-4.1-fast-tier
            - gpt-4.1-mini
            - gpt-4.1-mini-fast-tier
            - gpt-4.1-nano
            - gpt-4.1-nano-fast-tier
            - gpt-4o
            - gpt-4o-fast-tier
            - gpt-4o-mini
            - gpt-4o-mini-fast-tier
            - claude-haiku-4-5-20251001
            - claude-sonnet-4-5-20250929
            - claude-sonnet-4-20250514
            - gemini-3.1-flash-lite-preview
            - gemini-3-flash-preview
            - gemini-2.5-flash-lite
            - gemini-2.5-flash
        mockData:
          type: array
          description: >-
            A list of mock variables that substitute for real external data
            sources during the simulation. Each entry defines a variable name
            and its simulated value.
          example:
            - variableName: customer_name
              value: John Doe
            - variableName: account_status
              value: active
          items:
            $ref: '#/components/schemas/MockDataRequest'
        userPrompt:
          type: string
          description: >-
            A prompt that defines the persona and intent of the simulated user.
            This drives the user-side messages throughout the conversation.
          example: You are an angry customer who wants to cancel their subscription.
        attempt:
          type: integer
          description: >-
            The number of times this test case should be executed. Each run is
            an independent simulation. Defaults to 1.
          format: int64
          example: 5
        successCriteria:
          type: string
          description: >-
            A plain-language description of what a successful agent response
            looks like. Used to evaluate the agent's performance after each
            simulation run.
          example: >-
            The agent should acknowledge the cancellation request, present
            retention alternatives, and confirm the cancellation if the customer
            insists.
    TestCaseResponse:
      type: object
      properties:
        testCaseId:
          type: string
          description: The unique identifier of the test case.
          example: tc_d17T6uReChpyfFeP
        label:
          type: string
          description: >-
            A human-readable name or label for the test case, used to identify
            it in reports and dashboards.
          example: Angry Customer - Cancellation Flow
        agent:
          $ref: '#/components/schemas/AgentResponse'
        workspaceId:
          type: string
          description: >-
            The unique identifier of the workspace under which this test case
            was created.
          example: org_V6eZ2zg8ziDx5pft
        llmModel:
          type: string
          description: >-
            The LLM model used to generate Agent responses during the
            simulation.
          example: gpt-4o-mini
        mockData:
          type: array
          description: >-
            The list of mock variables and their simulated values that were used
            to substitute for real external data sources during the simulation.
          example:
            - variableName: customer_name
              value: John Doe
            - variableName: account_status
              value: active
          items:
            $ref: '#/components/schemas/MockDataResponse'
        userPrompt:
          type: string
          description: >-
            The prompt that defined the persona and intent of the simulated
            user, driving the user-side messages throughout the conversation.
          example: You are an angry customer who wants to cancel your subscription.
        attempt:
          type: integer
          description: >-
            The number of times this test case was configured to run as
            independent simulation attempts.
          format: int64
          example: 5
        successCriteria:
          type: string
          description: >-
            The plain-language description of what a successful agent response
            looks like, used to evaluate the agent's performance after each
            simulation run.
          example: >-
            The agent should acknowledge the cancellation request, present
            retention alternatives, and confirm the cancellation if the customer
            insists.
    Error:
      type: object
      properties:
        timestamp:
          type: string
          description: Error timestamp in ISO format
          format: date-time
        status:
          type: integer
          description: HTTP status code
          example: 400
        error:
          type: string
          description: Error type or HTTP status message
          example: Bad Request
        message:
          type: string
          description: Detailed error message
          example: Email is required
        path:
          type: string
          description: Request path where error occurred
          example: /v1/users
        validationErrors:
          type: object
          description: Field validation errors (if any)
          example: |-
            {
              "email": "Email is required",
              "name": "Name is too short"
            }
      description: Standard error response
    MockDataRequest:
      type: object
      properties:
        variableName:
          type: string
          description: >-
            The name of the variable to be substituted with mock data during the
            simulation. Must match the variable name defined in the Agent's
            configuration.
          example: user_name
        value:
          type: string
          description: >-
            The simulated value assigned to the variable for the duration of the
            test run.
          example: John Doe
      description: >-
        A list of mock variables that substitute for real external data sources
        during the simulation. Each entry defines a variable name and its
        simulated value.
      example:
        - variableName: customer_name
          value: John Doe
        - variableName: account_status
          value: active
    AgentResponse:
      type: object
      properties:
        name:
          type: string
          description: The display name of the assigned agent.
          example: New AI Agent
        agentId:
          type: string
          description: The unique identifier of the agent within the system.
          example: agent_D5D0p7TUs66TTAEAx
        status:
          type: string
          description: The current operational status of the agent.
          example: Live
          enum:
            - Live
            - Testing
            - Disabled
      description: >-
        Agent assigned to handle all calls in this campaign. Contains the
        agent's ID, name, and current status. All contacts in the campaign's
        contact list will be called using this agent.
    MockDataResponse:
      type: object
      properties:
        variableName:
          type: string
          description: >-
            The name of the variable that was substituted with mock data during
            the simulation.
          example: user_name
        value:
          type: string
          description: >-
            The simulated value that was assigned to the variable for the
            duration of the test run.
          example: John Doe
      description: >-
        The list of mock variables and their simulated values that were used to
        substitute for real external data sources during the simulation.
      example:
        - variableName: customer_name
          value: John Doe
        - variableName: account_status
          value: active
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      description: >-
        Authenticate every request by passing your API key in the `X-API-Key`
        header. To get your key, go to Dashboard → API Keys and create or copy
        your Production API key.
      name: X-API-Key
      in: header

````