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

# Search articles

> Search for news articles with various filters



## OpenAPI

````yaml /openapi/bonai-news-api.json get /search/articles
openapi: 3.0.3
info:
  title: Bonai News API
  version: '2024-01-01'
  description: >-
    A comprehensive news aggregation and search API providing access to
    articles, publishers, and trending topics across multiple languages and
    countries.
servers:
  - url: https://api.bonai.io/news
    description: Production
security: []
paths:
  /search/articles:
    get:
      summary: Search articles
      description: Search for news articles with various filters
      operationId: searchArticles
      parameters:
        - name: query
          in: query
          required: true
          description: Search query string
          schema:
            type: string
            minLength: 1
        - name: language
          in: query
          description: Language code (e.g., 'en', 'es')
          schema:
            type: string
        - name: country
          in: query
          description: Country code (e.g., 'us', 'uk')
          schema:
            type: string
        - name: publisher
          in: query
          description: Publisher URL to filter by
          schema:
            type: string
            format: uri
        - name: paywall
          in: query
          description: Filter by paywall status
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
        - name: from
          in: query
          description: Start date for date range filter
          schema:
            type: string
        - name: to
          in: query
          description: End date for date range filter
          schema:
            type: string
        - name: page
          in: query
          description: Page number
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: limit
          in: query
          description: Number of results per page
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 25
        - name: sort
          in: query
          description: Sort order
          schema:
            type: string
            enum:
              - relevance
              - date
        - $ref: '#/components/parameters/ApiVersionHeader'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchArticlesResponse'
        '400':
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKey: []
components:
  parameters:
    ApiVersionHeader:
      name: api-version
      in: header
      required: false
      schema:
        type: string
        enum:
          - '2024-01-01'
      description: API version to consume. Defaults to the latest version (2024-01-01).
  schemas:
    SearchArticlesResponse:
      type: object
      required:
        - success
        - size
        - totalHits
        - hitsPerPage
        - page
        - totalPages
        - timeMs
        - data
      properties:
        success:
          type: boolean
          enum:
            - true
        size:
          type: integer
          description: Number of items in the current page
        totalHits:
          type: integer
          description: Total number of matching items
        hitsPerPage:
          type: integer
          description: Maximum items per page applied for this request
        page:
          type: integer
          description: Current page number
        totalPages:
          type: integer
          description: Total number of pages
        timeMs:
          type: number
          description: Query execution time in milliseconds
        data:
          type: array
          items:
            $ref: '#/components/schemas/Article'
    ErrorResponse:
      type: object
      required:
        - success
        - code
        - message
      properties:
        success:
          type: boolean
          enum:
            - false
        code:
          type: integer
          description: HTTP status code
        message:
          type: string
        fields:
          type: array
          description: Validation details. Empty for non-validation errors.
          items:
            type: object
            required:
              - name
              - type
              - description
            properties:
              name:
                type: string
              type:
                type: string
                description: body, params, query, or headers
              description:
                type: string
    Article:
      type: object
      required:
        - title
        - url
        - excerpt
        - thumbnail
        - language
        - paywall
        - contentLength
        - date
        - authors
        - keywords
        - publisher
      properties:
        title:
          type: string
        url:
          type: string
          format: uri
        excerpt:
          type: string
        thumbnail:
          type: string
          format: uri
          nullable: true
        language:
          type: string
          description: Language code, for example en
        paywall:
          type: boolean
        content:
          type: string
          description: >-
            Full article content. Only returned by GET /article when your plan
            includes it.
        contentLength:
          type: integer
        date:
          type: string
          format: date-time
          description: Publish date (ISO 8601)
        authors:
          type: array
          items:
            type: string
        keywords:
          type: array
          items:
            type: string
        publisher:
          $ref: '#/components/schemas/ArticlePublisher'
    ArticlePublisher:
      type: object
      required:
        - name
        - url
        - favicon
      properties:
        name:
          type: string
          description: Publisher name. May be empty when the publisher is not recognized.
        url:
          type: string
          description: Publisher origin (scheme and host).
        favicon:
          type: string
          description: Publisher favicon, or a {origin}/favicon.ico fallback.
  securitySchemes:
    apiKey:
      type: apiKey
      name: api-key
      in: header
      description: >-
        Your Bonai API key. Create one in the Bonai console
        (https://console.bonai.io).

````