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

> A query with the same text, language and country is updated, not duplicated: it keeps its type and takes these tags.



## OpenAPI

````yaml https://api.mentionlab.io/api/docs/v2-json post /api/v2/projects/{projectId}/queries
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}/queries:
    post:
      tags:
        - Queries
      summary: Create queries
      description: >-
        A query with the same text, language and country is updated, not
        duplicated: it keeps its type and takes these tags.
      operationId: QueriesV2Controller_create_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/CreateQueriesV2Dto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/QueryV2Response'
        '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:
    CreateQueriesV2Dto:
      type: object
      properties:
        queries:
          description: Queries to create, at least one; a fully blank row is dropped
          example:
            - query: best running shoes
              language: en
              country: US
          type: array
          items:
            $ref: '#/components/schemas/QueryInputV2'
      required:
        - queries
    QueryV2Response:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Id of the query, as used on every per-query route
        query:
          type: string
          example: best running shoes
          description: The query text sent to the engines, exactly as it is run
        language:
          type: string
          description: >-
            Language the query is written in, as a language code of the
            reference locales
          example: en
        country:
          type: string
          example: US
          description: >-
            Market the query is run for, as a country code of the reference
            locales
        type:
          nullable: true
          description: How the query is classified; null when it is not
          allOf:
            - $ref: '#/components/schemas/QueryType'
        tags:
          description: Tags linked to the query; empty when it carries none
          type: array
          items:
            $ref: '#/components/schemas/QueryTagV2'
        recurrenceSetting:
          nullable: true
          description: The schedule that runs it, if any
          type: object
          allOf:
            - $ref: '#/components/schemas/QueryRecurrenceSettingV2'
        updatedAt:
          type: string
          format: date-time
          description: >-
            When the query or its tags last changed, as an ISO 8601 instant in
            UTC
      required:
        - id
        - query
        - language
        - country
        - type
        - tags
        - recurrenceSetting
        - 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
    QueryInputV2:
      type: object
      properties:
        query:
          type: string
          example: best running shoes
          description: The query text to send to the engines; must not be blank
        language:
          type: string
          description: >-
            Language the query is written in, as a language code of the
            reference locales
          example: en
        country:
          type: string
          description: >-
            Market to run the query for, as a country code of the reference
            locales
          example: US
        type:
          description: How the query is classified; omit to leave it unclassified
          allOf:
            - $ref: '#/components/schemas/QueryType'
        tagIds:
          description: Tags to link on creation, by tag id, each id at most once
          example:
            - 12
            - 34
          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).
    QueryTagV2:
      type: object
      properties:
        id:
          type: number
          description: Id of the tag, used to link or unlink it on a query
          example: 12
        name:
          type: string
          description: Label of the tag, unique within the project
          example: Branded
        color:
          type: string
          description: 'Colour of the tag, as a #rrggbb hex string'
          example: '#3b82f6'
      required:
        - id
        - name
        - color
    QueryRecurrenceSettingV2:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Id of the schedule, as used on the recurrence-settings routes
          example: 018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42
        name:
          type: string
          description: Label the schedule is listed under, usually its cadence
          example: Weekly
      required:
        - id
        - name

````

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