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

# Create Query

> Creates a new saved query with custom filter conditions. Queries enable complex, reusable searches across scan attributes using logical AND combinations of filters.



## OpenAPI

````yaml POST /v1/query
openapi: 3.1.0
info:
  title: urlDNA API
  description: >-
    urlDNA API documentation. This API allows you to scan, analyze, and retrieve
    insights about URLs, helping to detect potential threats such as phishing,
    malware, and scams.
  version: 1.0.0
servers:
  - url: https://api.urldna.io
security: []
paths:
  /v1/query:
    post:
      tags:
        - My Queries
      summary: Create Query
      description: >-
        Creates a new saved query with custom filter conditions. Queries enable
        complex, reusable searches across scan attributes using logical AND
        combinations of filters.
      operationId: create_query_v1_query_post
      parameters:
        - name: authorization
          in: header
          required: true
          schema:
            type: string
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewQueryRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query'
        '401':
          description: 'Unauthorized: API Key is missing or invalid.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '405':
          description: >-
            Method Not Allowed: The requested HTTP method is not supported for
            this endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '422':
          description: 'Unprocessable Entity: The request body or parameters are invalid.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '429':
          description: 'Too Many Requests: Rate limit exceeded.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '500':
          description: 'Internal Server Error: An unexpected error occurred.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
components:
  schemas:
    NewQueryRequest:
      properties:
        name:
          type: string
          title: Name
          description: Descriptive name for identifying the query.
        query_filters:
          items:
            $ref: '#/components/schemas/QueryFilter'
          type: array
          title: Query Filters
          description: >-
            Array of filter conditions. All filters are combined with logical
            AND.
      type: object
      required:
        - name
        - query_filters
      title: NewQueryRequest
    Query:
      properties:
        id:
          type: string
          title: Id
          description: Unique query identifier.
        name:
          type: string
          title: Name
          description: User-defined query name for easy identification.
        query_filters:
          items:
            $ref: '#/components/schemas/QueryFilter'
          type: array
          title: Query Filters
          description: Array of filter conditions combined with logical AND.
      type: object
      required:
        - id
        - name
        - query_filters
      title: Query
    APIError:
      properties:
        detail:
          type: string
          title: Detail
          example: Error description message
      type: object
      required:
        - detail
      title: APIError
    QueryFilter:
      properties:
        attribute:
          type: string
          title: Attribute
          description: >-
            Searchable attribute field (e.g., domain, ip, country_code,
            technology).
        operator:
          $ref: '#/components/schemas/QueryOperatorEnum'
          description: >-
            Comparison operator: '=' and '!=' for exact matching; 'LIKE' and
            '!LIKE' for partial/wildcard matching.
        value:
          type: string
          title: Value
          description: Value to match against the specified attribute.
        logical_operator:
          anyOf:
            - $ref: '#/components/schemas/QueryLogicalOperatorEnum'
            - type: 'null'
          description: Logical operator for combining filter conditions.
      type: object
      required:
        - attribute
        - operator
        - value
      title: QueryFilter
    QueryOperatorEnum:
      type: string
      enum:
        - '='
        - '!='
        - LIKE
        - '!LIKE'
      title: QueryOperatorEnum
    QueryLogicalOperatorEnum:
      type: string
      enum:
        - AND
        - OR
      title: QueryLogicalOperatorEnum

````