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

# Bulk Create Test Cases

> Create one single test case per question, all with the same checks. All or nothing.



## OpenAPI

````yaml post /v2/api/projects/{projectId}/workspaces/{workspaceId}/test-cases/bulk
openapi: 3.1.0
info:
  title: Upsolve API
  version: 1.5.0
servers:
  - url: https://api.upsolve.ai
security: []
tags: []
paths:
  /v2/api/projects/{projectId}/workspaces/{workspaceId}/test-cases/bulk:
    post:
      summary: Create one single test case per question, all wit…
      description: >-
        Create one single test case per question, all with the same checks. All
        or nothing.
      operationId: PostV2ApiProjectsProjectIdWorkspacesWorkspaceIdTestCasesBulk
      parameters:
        - name: projectId
          in: path
          required: true
          description: The project the workspace belongs to.
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            description: The project the workspace belongs to.
        - name: workspaceId
          in: path
          required: true
          description: The workspace.
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            description: The workspace.
      requestBody:
        description: >-
          POST
          /v2/api/projects/:projectId/workspaces/:workspaceId/test-cases/bulk
          Request body
        content:
          application/json:
            schema:
              type: object
              properties:
                apiKey:
                  type: string
                  minLength: 1
                  description: >-
                    Upsolve API key, generated under Account → Developer
                    settings in the Upsolve Hub. Keys are user-scoped: pass
                    organizationId alongside the key to select which org to act
                    on.
                  examples:
                    - up_embed_************
                organizationId:
                  description: >-
                    Your Upsolve organization's UUID — the org that owns the API
                    key and project. This is NOT a project organization: do not
                    pass a value registered via /projects/register-organization,
                    and do not pass an `externalId` (only
                    `projectOrganizationId` accepts those). Omit it when using
                    an org-bound API key — the org is read from the key and any
                    value sent here is ignored. Required only for user-scoped
                    API keys (created under Account → Developer settings) and
                    for the Supabase JWT path, where the org is ambiguous and
                    membership is verified against it.
                  examples:
                    - 123e4567-e89b-12d3-a456-426614174000
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                verifiedQuestionIds:
                  minItems: 1
                  maxItems: 100
                  type: array
                  items:
                    type: string
                    format: uuid
                    pattern: >-
                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                  description: >-
                    The verified questions to make single cases of, at most 100.
                    One case each.
                template:
                  description: >-
                    What every created case gets. Omitted: no checks, default
                    flags.
                  type: object
                  properties:
                    checks:
                      description: The checks every case's step gets.
                      type: array
                      items:
                        oneOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                const: data
                                description: >-
                                  Compare the result rows with the question's
                                  reference SQL.
                              blocking:
                                description: >-
                                  Whether a failing check fails the step
                                  (default true). False makes it informational.
                                  A case needs at least one blocking check other
                                  than SQL compare
                                  (TEST_CASE_NO_BLOCKING_CHECK).
                                type: boolean
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: sql
                                description: >-
                                  Compare the agent's SQL with the question's
                                  reference SQL. Always informational: it can
                                  confirm the agent reproduced the reference
                                  query, never that it is wrong, so it never
                                  decides a step. Use it to detect drift from
                                  your exact query; use a data compare to judge
                                  correctness. A case needs at least one
                                  blocking check besides it
                                  (TEST_CASE_SQL_COMPARE_ALONE).
                              blocking:
                                description: >-
                                  Ignored: SQL compare is always stored as
                                  informational (false).
                                type: boolean
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: llm
                                description: Judge the answer with an eval.
                              evalId:
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                                description: The eval that judges the answer.
                              blocking:
                                description: >-
                                  Whether a failing check fails the step
                                  (default true). False makes it informational.
                                  A case needs at least one blocking check other
                                  than SQL compare
                                  (TEST_CASE_NO_BLOCKING_CHECK).
                                type: boolean
                            required:
                              - type
                              - evalId
                        description: 'A check: data compare, SQL compare or an LLM eval.'
                        discriminator:
                          propertyName: type
                    dataCompare:
                      description: >-
                        Data-compare settings every case's step gets. Omitted
                        fields take the Flexible preset's values.
                      type: object
                      properties:
                        rowOrder:
                          default: unordered
                          description: >-
                            Whether row order matters. `auto` compares in order
                            only when the reference query's OUTERMOST query has
                            an ORDER BY; `ordered` always compares position by
                            position; `unordered` (the default) compares the
                            rows as a multiset (duplicates count).
                          type: string
                          enum:
                            - auto
                            - ordered
                            - unordered
                        floatTolerance:
                          default:
                            relative: 0.000001
                            absolute: 1.e-9
                          description: >-
                            Tolerance applied to every number. Two numbers are
                            equal when EITHER bound holds. Null compares numbers
                            exactly. Defaults to { relative: 1e-6, absolute:
                            1e-9 } (Flexible).
                          type:
                            - object
                            - 'null'
                          properties:
                            relative:
                              description: >-
                                Two numbers are equal when |a - b| <= relative *
                                max(|a|, |b|). 0.01 accepts a 1% difference.
                              type: number
                              minimum: 0
                            absolute:
                              description: Two numbers are equal when |a - b| <= absolute.
                              type: number
                              minimum: 0
                        keyColumns:
                          default: []
                          description: >-
                            Reference columns that identify a row. When set, the
                            comparison reports missing, extra and changed rows
                            by key instead of one row-set verdict. No preset
                            sets any: settings with key columns are Custom.
                          maxItems: 20
                          type: array
                          items:
                            type: string
                            minLength: 1
                        columnMode:
                          default: superset
                          description: >-
                            `exact` fails when the agent returns columns the
                            reference does not; `superset` (the default) ignores
                            the agent's extra columns.
                          type: string
                          enum:
                            - exact
                            - superset
                        dateMode:
                          default: date_only
                          description: >-
                            `instant` compares dates and timestamps as UTC
                            instants (a date is midnight UTC); `date_only` (the
                            default) compares only their UTC calendar day.
                          type: string
                          enum:
                            - instant
                            - date_only
                    inCi:
                      description: >-
                        Run on publish: whether the publish/deploy gate runs
                        this case, so a failure blocks the publish (default
                        false: a case runs on publish only when opted in).
                      type: boolean
                    repeatRuns:
                      description: >-
                        Stability check: how many times every run asks this
                        case, 1–5 (default 1, which turns the check off). Each
                        attempt is a full, independent execution in a fresh
                        thread, and multiplies the case's cost.
                      type: integer
                      minimum: -9007199254740991
                      maximum: 9007199254740991
                    repeatPassRule:
                      description: >-
                        When a repeated case passes the publish gate: `all`
                        (default) every attempt must pass; `majority` more than
                        half. A mixed result is labelled flaky either way.
                      type: string
                      enum:
                        - all
                        - majority
              required:
                - verifiedQuestionIds
            examples:
              example1:
                value:
                  apiKey: up_embed_************
                  organizationId: 123e4567-e89b-12d3-a456-426614174000
        required: true
      responses:
        '201':
          description: >-
            POST
            /v2/api/projects/:projectId/workspaces/:workspaceId/test-cases/bulk
            Positive response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    type: object
                    properties:
                      testCases:
                        type: array
                        items:
                          type: object
                          properties:
                            usesAgentContextQuestion:
                              type: boolean
                              description: >-
                                True when any step asks a verified question that
                                is in the draft's agent context: the case is
                                less meaningful, since the agent can see the
                                answer.
                            id:
                              type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                              description: >-
                                The test case's id: its key, stable across
                                versions.
                            versionId:
                              type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                              description: The content id of the version shown.
                            version:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                              description: That version's number, counted per case from 1.
                            published:
                              type: boolean
                              description: >-
                                Whether this version has been published. A
                                published version never changes: an edit saves a
                                new one.
                            hasUnpublishedChanges:
                              type: boolean
                              description: >-
                                Whether the draft's version differs from what
                                was last published.
                            lockVersion:
                              type:
                                - integer
                                - 'null'
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                            workspaceId:
                              type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                              description: The workspace it belongs to.
                            name:
                              type: string
                              description: The case's name.
                            kind:
                              type: string
                              enum:
                                - single
                                - scenario
                              description: single or scenario.
                            inCi:
                              type: boolean
                              description: >-
                                Run on publish: whether the publish/deploy gate
                                runs it, so a failure blocks the publish.
                            repeatRuns:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                              description: >-
                                Stability check: how many times every run asks
                                this case (1: off).
                            repeatPassRule:
                              type: string
                              enum:
                                - all
                                - majority
                              description: >-
                                When a repeated case passes the publish gate:
                                `all` attempts, or a `majority` (more than
                                half). Only meaningful when repeatRuns > 1.
                            steps:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                    pattern: >-
                                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                                    description: The step's id.
                                  position:
                                    type: integer
                                    minimum: -9007199254740991
                                    maximum: 9007199254740991
                                    description: Zero-based order within the case.
                                  source:
                                    type: string
                                    enum:
                                      - question
                                      - message
                                    description: >-
                                      question: a verified question. message: a
                                      free-form turn.
                                  verifiedQuestionId:
                                    type:
                                      - string
                                      - 'null'
                                    format: uuid
                                    pattern: >-
                                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                                  verifiedQuestionVersionId:
                                    type:
                                      - string
                                      - 'null'
                                  verifiedQuestionVersion:
                                    type:
                                      - integer
                                      - 'null'
                                    minimum: -9007199254740991
                                    maximum: 9007199254740991
                                  question:
                                    type:
                                      - string
                                      - 'null'
                                  expectedSql:
                                    type:
                                      - string
                                      - 'null'
                                  chartDefinition:
                                    type:
                                      - string
                                      - 'null'
                                  message:
                                    type:
                                      - string
                                      - 'null'
                                  useAsAgentContext:
                                    type: boolean
                                    description: >-
                                      True when the step's verified question is
                                      in the draft's agent context: the agent
                                      can see this very question and its answer,
                                      so the step measures recall more than
                                      skill.
                                  dataCompare:
                                    type: object
                                    properties:
                                      rowOrder:
                                        default: unordered
                                        description: >-
                                          Whether row order matters. `auto`
                                          compares in order only when the
                                          reference query's OUTERMOST query has an
                                          ORDER BY; `ordered` always compares
                                          position by position; `unordered` (the
                                          default) compares the rows as a multiset
                                          (duplicates count).
                                        type: string
                                        enum:
                                          - auto
                                          - ordered
                                          - unordered
                                      floatTolerance:
                                        default:
                                          relative: 0.000001
                                          absolute: 1.e-9
                                        description: >-
                                          Tolerance applied to every number. Two
                                          numbers are equal when EITHER bound
                                          holds. Null compares numbers exactly.
                                          Defaults to { relative: 1e-6, absolute:
                                          1e-9 } (Flexible).
                                        type:
                                          - object
                                          - 'null'
                                        properties:
                                          relative:
                                            description: >-
                                              Two numbers are equal when |a - b| <=
                                              relative * max(|a|, |b|). 0.01 accepts a
                                              1% difference.
                                            type: number
                                            minimum: 0
                                          absolute:
                                            description: >-
                                              Two numbers are equal when |a - b| <=
                                              absolute.
                                            type: number
                                            minimum: 0
                                        additionalProperties: false
                                      keyColumns:
                                        default: []
                                        description: >-
                                          Reference columns that identify a row.
                                          When set, the comparison reports
                                          missing, extra and changed rows by key
                                          instead of one row-set verdict. No
                                          preset sets any: settings with key
                                          columns are Custom.
                                        maxItems: 20
                                        type: array
                                        items:
                                          type: string
                                          minLength: 1
                                      columnMode:
                                        default: superset
                                        description: >-
                                          `exact` fails when the agent returns
                                          columns the reference does not;
                                          `superset` (the default) ignores the
                                          agent's extra columns.
                                        type: string
                                        enum:
                                          - exact
                                          - superset
                                      dateMode:
                                        default: date_only
                                        description: >-
                                          `instant` compares dates and timestamps
                                          as UTC instants (a date is midnight
                                          UTC); `date_only` (the default) compares
                                          only their UTC calendar day.
                                        type: string
                                        enum:
                                          - instant
                                          - date_only
                                    required:
                                      - rowOrder
                                      - floatTolerance
                                      - keyColumns
                                      - columnMode
                                      - dateMode
                                    additionalProperties: false
                                    description: The step's data-compare settings.
                                  dataComparePreset:
                                    type: string
                                    enum:
                                      - flexible
                                      - strict
                                      - exact
                                      - custom
                                    description: >-
                                      The preset dataCompare amounts to
                                      (flexible, strict or exact), or custom
                                      when it matches none. Read off the
                                      settings, never stored: send the preset's
                                      values in dataCompare to apply one.
                                  checks:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          format: uuid
                                          pattern: >-
                                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                                          description: The check's id.
                                        type:
                                          type: string
                                          enum:
                                            - data
                                            - sql
                                            - llm
                                          description: data, sql or llm.
                                        blocking:
                                          type: boolean
                                          description: >-
                                            Whether a failure fails the step (or
                                            scenario).
                                        evalId:
                                          type:
                                            - string
                                            - 'null'
                                          format: uuid
                                          pattern: >-
                                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                                        evalName:
                                          type:
                                            - string
                                            - 'null'
                                      required:
                                        - id
                                        - type
                                        - blocking
                                        - evalId
                                        - evalName
                                      additionalProperties: false
                                    description: What decides this step.
                                required:
                                  - id
                                  - position
                                  - source
                                  - verifiedQuestionId
                                  - verifiedQuestionVersionId
                                  - verifiedQuestionVersion
                                  - question
                                  - expectedSql
                                  - chartDefinition
                                  - message
                                  - useAsAgentContext
                                  - dataCompare
                                  - dataComparePreset
                                  - checks
                                additionalProperties: false
                              description: The steps, in order.
                            checks:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                    pattern: >-
                                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                                    description: The check's id.
                                  type:
                                    type: string
                                    enum:
                                      - data
                                      - sql
                                      - llm
                                    description: data, sql or llm.
                                  blocking:
                                    type: boolean
                                    description: >-
                                      Whether a failure fails the step (or
                                      scenario).
                                  evalId:
                                    type:
                                      - string
                                      - 'null'
                                    format: uuid
                                    pattern: >-
                                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                                  evalName:
                                    type:
                                      - string
                                      - 'null'
                                required:
                                  - id
                                  - type
                                  - blocking
                                  - evalId
                                  - evalName
                                additionalProperties: false
                              description: >-
                                Scenario-level checks (LLM evals that judge the
                                conversation).
                            createdAt:
                              type: string
                              description: When the case was created (ISO 8601).
                            updatedAt:
                              type: string
                              description: When this version was last changed (ISO 8601).
                          required:
                            - usesAgentContextQuestion
                            - id
                            - versionId
                            - version
                            - published
                            - hasUnpublishedChanges
                            - lockVersion
                            - workspaceId
                            - name
                            - kind
                            - inCi
                            - repeatRuns
                            - repeatPassRule
                            - steps
                            - checks
                            - createdAt
                            - updatedAt
                          additionalProperties: false
                        description: The created cases, in verifiedQuestionIds order.
                    required:
                      - testCases
                    additionalProperties: false
                required:
                  - status
                  - data
                additionalProperties: false
        '400':
          description: >-
            POST
            /v2/api/projects/:projectId/workspaces/:workspaceId/test-cases/bulk
            Negative response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                    required:
                      - message
                    additionalProperties: false
                required:
                  - status
                  - error
                additionalProperties: false
      security:
        - APIKEY_1: []
components:
  securitySchemes:
    APIKEY_1:
      type: apiKey
      in: query
      name: apiKey
      x-in-actual: body
      description: apiKey MUST be supplied within the request body instead of query

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.