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

# Create queries

> Creates (upserts) several queries at once along with their tag associations; all referenced tag IDs are validated against the project first.



## OpenAPI

````yaml https://api.mentionlab.io/api/docs-json post /api/queries/many
openapi: 3.0.0
info:
  title: MentionLab Public API v0.3.4-rc
  description: ''
  version: 0.3.4-rc
  contact: {}
servers:
  - url: https://api.mentionlab.io
security: []
tags: []
paths:
  /api/queries/many:
    post:
      tags:
        - Queries
      summary: Create queries
      description: >-
        Creates (upserts) several queries at once along with their tag
        associations; all referenced tag IDs are validated against the project
        first.
      operationId: QueriesController_createMany
      parameters:
        - name: x-project-id
          in: header
          description: Project ID to specify the project context
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateManyQueriesDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/QueryResponse'
        '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'
components:
  schemas:
    CreateManyQueriesDto:
      type: object
      properties:
        queries:
          description: >-
            List of queries to create in a single batch. Must contain at least
            one query, and each item is validated against the CreateQueryDto
            schema.
          example:
            - query: machine learning trends
              language: en
              country: US
              type: informative
          type: array
          items:
            $ref: '#/components/schemas/CreateQueryDto'
      required:
        - queries
    QueryResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier (UUID) of the query.
          example: a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6
          format: uuid
        project:
          type: object
          description: The project this query belongs to
          example: a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6
        tags:
          type: object
          example:
            - 1
            - 2
            - 3
          description: The tags IDs this query belongs to
        query:
          type: string
          description: The search query text tracked for this entry.
          example: mentionlab
        language:
          type: string
          description: ISO 639-1 language code used to scope the query results.
          example: en
        country:
          type: string
          description: ISO 3166-1 alpha-2 country code used to scope the query results.
          example: US
        type:
          description: >-
            The type of question the query asks. Null for queries that have not
            been classified.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/QueryType'
        recurrenceSetting:
          nullable: true
          description: >-
            The recurrence setting this query is linked to, or null when the
            query does not recur.
          type: object
          allOf:
            - $ref: '#/components/schemas/RecurrenceSettingRefDto'
        updatedAt:
          format: date-time
          type: string
          description: Timestamp of the last time the query was updated.
          example: '2023-08-22T10:00:00.000Z'
      required:
        - id
        - project
        - tags
        - query
        - language
        - country
        - 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
    CreateQueryDto:
      type: object
      properties:
        query:
          type: string
          description: The search query
          example: machine learning trends
        language:
          type: string
          description: >-
            Language code (BCP-47-style, from the supported allowlist).
            Examples: "en", "fr", "zh-cn", "ro-MD", "yue".
          example: en
          enum:
            - en
            - es
            - fr
            - pt
            - de
            - it
            - tr
            - nl
            - pl
            - sq
            - ar
            - hy
            - az
            - ba
            - eu
            - be
            - bn
            - bho
            - bs
            - bg
            - yue
            - ca
            - zh-cn
            - hr
            - cs
            - da
            - et
            - fo
            - fi
            - gl
            - ka
            - el
            - gu
            - hi
            - hu
            - id
            - ga
            - ja
            - jv
            - kn
            - ks
            - kk
            - kok
            - ko
            - ky
            - lv
            - lt
            - ru
            - mk
            - mai
            - ms
            - mt
            - cmn
            - mr
            - mwr
            - nan
            - ro-MD
            - mn
            - cnr
            - ne
            - 'no'
            - or
            - ps
            - fa
            - pa
            - raj
            - ro
            - sa
            - sat
            - sr
            - sd
            - si
            - sk
            - sl
            - sv
            - uk
            - ur
            - uz
            - vi
            - cy
            - wuu
            - th
        country:
          type: string
          description: >-
            Country code (ISO 3166-1 alpha-2, uppercase, from the supported
            allowlist).
          example: US
          enum:
            - AD
            - AE
            - AF
            - AG
            - AL
            - AM
            - AO
            - AR
            - AT
            - AU
            - AZ
            - BA
            - BB
            - BD
            - BE
            - BF
            - BG
            - BH
            - BI
            - BJ
            - BN
            - BO
            - BR
            - BS
            - BT
            - BW
            - BZ
            - CA
            - CD
            - CF
            - CG
            - CH
            - CI
            - CL
            - CN
            - CM
            - CO
            - CR
            - CV
            - CY
            - CZ
            - DE
            - DJ
            - DK
            - DM
            - DO
            - DZ
            - EC
            - EE
            - EG
            - ER
            - ES
            - ET
            - FI
            - FJ
            - FM
            - FR
            - GA
            - GB
            - GD
            - GE
            - GH
            - GM
            - GN
            - GQ
            - GR
            - GT
            - GW
            - GY
            - HK
            - HN
            - HR
            - HT
            - HU
            - ID
            - IE
            - IL
            - IN
            - IQ
            - IS
            - IT
            - JM
            - JO
            - JP
            - KE
            - KG
            - KH
            - KI
            - KM
            - KR
            - KW
            - KZ
            - LA
            - LB
            - LC
            - LI
            - LK
            - LR
            - LS
            - LT
            - LU
            - LV
            - LY
            - MA
            - MC
            - MD
            - ME
            - MG
            - MH
            - MK
            - ML
            - MM
            - MN
            - MR
            - MT
            - MU
            - MV
            - MW
            - MX
            - MY
            - MZ
            - NA
            - NE
            - NG
            - NI
            - NL
            - 'NO'
            - NP
            - NR
            - NZ
            - OM
            - PA
            - PE
            - PG
            - PH
            - PK
            - PL
            - PS
            - PT
            - PW
            - PY
            - QA
            - RO
            - RS
            - RW
            - SA
            - SB
            - SC
            - SD
            - SE
            - SG
            - SI
            - SK
            - SL
            - SM
            - SN
            - SO
            - SR
            - SS
            - SV
            - SZ
            - TD
            - TG
            - TH
            - TJ
            - TL
            - TM
            - TN
            - TO
            - TR
            - TT
            - TV
            - TW
            - TZ
            - UA
            - UG
            - US
            - UY
            - UZ
            - VA
            - VN
            - VU
            - WS
            - YE
            - ZA
            - ZM
            - ZW
        type:
          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).
          allOf:
            - $ref: '#/components/schemas/QueryType'
        tagIds:
          description: List of tag IDs to associate with this query
          example:
            - 1
            - 2
            - 3
          type: array
          items:
            type: number
      required:
        - query
        - language
        - country
    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).
    RecurrenceSettingRefDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the recurrence setting
          example: 018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c
        name:
          type: string
          description: Display name of the recurrence setting
          example: Daily core queries
      required:
        - id
        - name

````