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

# Launch a job

> Runs the selected queries, or all of them, on the chosen models, and charges the credits. A second launch within 10 minutes answers 409 RECENT_JOB_EXISTS unless `force` is true.



## OpenAPI

````yaml https://api.mentionlab.io/api/docs/v2-json post /api/v2/projects/{projectId}/jobs
openapi: 3.0.0
info:
  title: MentionLab Public API v2
  description: ''
  version: 0.6.48
  contact: {}
servers:
  - url: https://api.mentionlab.io
security: []
tags: []
paths:
  /api/v2/projects/{projectId}/jobs:
    post:
      tags:
        - Jobs
      summary: Launch a job
      description: >-
        Runs the selected queries, or all of them, on the chosen models, and
        charges the credits. A second launch within 10 minutes answers 409
        RECENT_JOB_EXISTS unless `force` is true.
      operationId: JobsV2Controller_launch_v2
      parameters:
        - name: x-project-id
          in: header
          description: Project ID to specify the project context
          required: true
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LaunchJobV2Dto'
      responses:
        '201':
          description: >-
            The job. The body is empty when the selection, or the project, holds
            no query: nothing runs and nothing is charged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobV2Response'
        '400':
          description: >-
            The request failed validation: the body, query or path parameters
            are malformed or out of range.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '401':
          description: The request is missing valid authentication credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '403':
          description: >-
            The authenticated principal lacks the required permission, or access
            to the requested organisation/project.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '409':
          description: >-
            RECENT_JOB_EXISTS: the project launched a job in the last 10
            minutes. Send `force: true` to launch anyway.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecentJobConflictV2Response'
        '422':
          description: >-
            INSUFFICIENT_PROJECT_BALANCE: the project's credits do not cover the
            launch. Nothing runs and nothing is charged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InsufficientBalanceV2Response'
components:
  schemas:
    LaunchJobV2Dto:
      type: object
      properties:
        models:
          description: Models that answer every selected query, by id or rolling alias
          example:
            - scp-ml-chatgpt
            - claude-haiku-latest
          uniqueItems: true
          type: array
          items:
            type: string
        executionCount:
          type: integer
          minimum: 1
          maximum: 100
          description: How many times each query runs on each model
          example: 3
        selection:
          description: 'Absent: every query of the project'
          allOf:
            - $ref: '#/components/schemas/QuerySelectionV2Dto'
        force:
          type: boolean
          description: Launch even if a job started in the last 10 minutes
          example: true
      required:
        - models
        - executionCount
    JobV2Response:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Id of the job, used to poll it and to list its executions
        status:
          type: string
          enum:
            - pending
            - processing
            - syncing
            - completed
            - failed
            - partial_failed
          description: >-
            Where the job stands. `syncing`: every execution is over and the
            results are not all readable yet
        createdBy:
          nullable: true
          description: Who launched the job; null for a scheduled job or an API key
          type: object
          allOf:
            - $ref: '#/components/schemas/JobCreatorV2'
        scheduleId:
          type: string
          format: uuid
          nullable: true
          description: >-
            The schedule that launched the job; null for a manual launch or a
            deleted schedule
        spentCredits:
          type: integer
          nullable: true
          description: Credits charged at launch, before any refund; null when not recorded
        totalExecutionCount:
          type: integer
          description: 'Executions the job holds: one per query, model and repeat'
        pendingExecutionCount:
          type: integer
          description: Executions with no answer yet
        retryingExecutionCount:
          type: integer
          description: Executions that failed an attempt and wait for another
        succeededExecutionCount:
          type: integer
          description: Executions that came back with an answer
        failedExecutionCount:
          type: integer
          description: Executions that gave up, their attempts spent
        themeAnalysis:
          type: string
          enum:
            - pending
            - processing
            - done
          nullable: true
          description: >-
            Where the theme analysis of the job's answers stands; null when the
            project runs none
          example: done
        createdAt:
          type: string
          format: date-time
          description: When the job was launched
        updatedAt:
          type: string
          format: date-time
          description: When a counter or the status last moved; a poller watches this
      required:
        - id
        - status
        - createdBy
        - scheduleId
        - spentCredits
        - totalExecutionCount
        - pendingExecutionCount
        - retryingExecutionCount
        - succeededExecutionCount
        - failedExecutionCount
        - themeAnalysis
        - createdAt
        - updatedAt
    ApiErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP status code of the error.
          example: 400
        message:
          type: string
          description: >-
            Human-readable description of the error. Validation failures return
            an array of per-field validation errors instead of a single string.
          example: Validation failed
        error:
          type: string
          description: Short name of the HTTP error.
          example: Bad Request
      required:
        - statusCode
    RecentJobConflictV2Response:
      type: object
      properties:
        code:
          type: string
          enum:
            - RECENT_JOB_EXISTS
          description: Refusal code
        message:
          type: string
          description: What was refused, in a sentence
        jobId:
          type: string
          format: uuid
          description: Id of the recent job
        lastTriggeredAt:
          type: string
          format: date-time
          description: When the recent job was launched
        windowMinutes:
          type: integer
          description: Minutes a launch waits for unless `force` is true
          example: 10
      required:
        - code
        - message
        - jobId
        - lastTriggeredAt
        - windowMinutes
    InsufficientBalanceV2Response:
      type: object
      properties:
        code:
          type: string
          enum:
            - INSUFFICIENT_PROJECT_BALANCE
          description: Refusal code
        message:
          type: string
          description: What was refused, in a sentence
        requested:
          type: integer
          description: Credits the launch costs
        shortfall:
          type: integer
          description: Credits missing to cover the launch
      required:
        - code
        - message
        - requested
        - shortfall
    QuerySelectionV2Dto:
      type: object
      properties:
        mode:
          type: string
          enum:
            - include
            - all
          description: >-
            How the target set is defined. "include" acts on the given ids;
            "all" acts on everything matching the filter except the excluded
            ids.
        ids:
          description: Uuids of the rows to act on, required when mode is "include"
          example:
            - 018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42
          type: array
          items:
            type: string
            format: uuid
        excludedIds:
          description: Uuids to subtract from the matched set, only used when mode is "all"
          example:
            - 018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42
          type: array
          items:
            type: string
            format: uuid
        filter:
          description: Used when mode is "all"
          allOf:
            - $ref: '#/components/schemas/ListQueriesV2Dto'
      required:
        - mode
    JobCreatorV2:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Id of the user who launched the job
          example: 9f1c2d3e-4a5b-4c6d-8e7f-0a1b2c3d4e5f
        firstName:
          type: string
          description: Given name on that user's profile
          example: Ada
        lastName:
          type: string
          description: Family name on that user's profile
          example: Lovelace
        email:
          type: string
          description: Address that user signs in with
          example: ada.lovelace@example.com
      required:
        - id
        - firstName
        - lastName
        - email
    ListQueriesV2Dto:
      type: object
      properties:
        page:
          type: integer
          description: >-
            Which slice of the matched rows to return, counted from 1. Rows
            skipped are (page - 1) * limit.
          default: 1
          minimum: 1
          maximum: 1000000
          example: 2
        limit:
          type: integer
          description: >-
            How many rows one page holds, capped at 100 to keep a single
            response bounded.
          default: 25
          minimum: 1
          maximum: 100
          example: 50
        search:
          type: string
          description: Substring of the query text, accents and apostrophes folded
          example: running shoes
        languages:
          description: >-
            Queries in any of these languages, as reference locale language
            codes
          example:
            - en
            - fr
          type: array
          items:
            type: string
        countries:
          description: >-
            Queries run for any of these markets, as country codes of the
            reference locales
          example:
            - US
            - GB
          type: array
          items:
            type: string
        types:
          type: array
          description: Queries of any of these types; an untyped query matches none
          items:
            $ref: '#/components/schemas/QueryType'
        tagIds:
          description: Queries carrying these tags, by tag id. See tagMode
          example:
            - 12
            - 34
          type: array
          items:
            type: number
        tagGroupIds:
          description: Queries with a tag of these groups. See tagMode
          example:
            - 018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42
          type: array
          items:
            type: string
            format: uuid
        tagMode:
          type: string
          enum:
            - and
            - or
          description: >-
            "and" (default): every tag, and a tag of each group. "or": any tag,
            or a tag of any group
        recurrenceSettingIds:
          description: Queries on any of these schedules
          example:
            - 018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42
          type: array
          items:
            type: string
            format: uuid
        hasRecurrenceSetting:
          type: boolean
          description: Whether a schedule runs them
          example: true
        sort:
          type: string
          description: 'Comma-separated field:asc|desc pairs. Sortable: query, updatedAt.'
          example: query:asc
    QueryType:
      type: string
      enum:
        - comparative
        - informative
        - perception
      description: >-
        The type of question the query asks: "comparative" (compares options),
        "informative" (seeks facts or how-to information) or "perception"
        (probes opinions about a brand).

````

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