openapi: 3.0.0
info:
  title: NewsomaticAPI ChatGPT Plugin
  version: 1.0.0
  description: The NewsomaticAPI ChatGPT plugin allows you to fetch news articles based on various parameters such as keywords, sources, domains, date ranges, language, country, and categories. Users can also sort the articles by relevancy, popularity, published date, or randomly. This plugin supports advanced search, including exact match phrases and the inclusion or exclusion of specific words. With API key-based authentication, you can access news data and integrate it into your ChatGPT application effortlessly.
servers:
  - url: https://www.newsomaticapi.com
paths:
  /apis/news/v1/ai:
    post:
      summary: List latest news from around the world
      operationId: getLatestNews
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                q:
                  type: string
                  description: >
                    Keywords or phrases to search for in the article title and body. Advanced search is supported here:Surround phrases with quotes (“) for exact match.Prepend words or phrases that must appear with a + symbol. Eg: +bitcoinPrepend words that must not appear with a – symbol. Eg: -bitcoinThe complete value for q must be URL-encoded.
                qInTitle:
                  type: string
                  description: >
                    Keywords or phrases to search for in the article title only. Advanced search is supported here:Surround phrases with quotes (“) for exact match.Prepend words or phrases that must appear with a + symbol. Eg: +bitcoinPrepend words that must not appear with a – symbol. Eg: -bitcoinThe complete value for qInTitle must be URL-encoded.
                sources:
                  type: string
                  description: A comma separated string of identifiers (maximum 10) for the news sources or blogs you want headlines from. Use the /sources endpoint to locate these programmatically or look at the sources index.
                domains:
                  type: string
                  description: A comma separated string of domains (eg bbc.co.uk, techcrunch.com, engadget.com) to restrict the search to.
                excludeDomains:
                  type: string
                  description: A comma separated string of domains (eg bbc.co.uk, techcrunch.com, engadget.com) to remove from the results.
                from:
                  type: string
                  format: date-time
                  description: >
                    A date and optional time for the oldest article allowed. This should be in ISO 8601 format (e.g. 2021-04-11 or 2021-04-11T19:40:08). Default: the oldest according to your plan.
                to:
                  type: string
                  format: date-time
                  description: >
                    A date and optional time for the newest article allowed. This should be in ISO 8601 format (e.g. 2021-04-11 or 2021-04-11T19:40:08). Default: the newest according to your plan.
                language:
                  type: string
                  description: >
                    The 2-letter ISO-639-1 code of the language you want to get headlines for. Possible options: ar bg cr cz de en es fr gr hd he hu id it jp kr lt lv nl no pl pt ro rs ru se si sk sx th tr ua ud zh. Default: all languages returned.
                country:
                  type: string
                  description: >
                    The 2-letter ISO-639-1 code of the country you want to get headlines for. Possible options: ae ar at au be bg cr ca ch co cu cz de eg en es fr gb gr hk hu id ie in is it jp kr lt lv ma mx my ng nl np nz pe ph pk pl pt ro rs ru sa se sg si sk th tr tt tw ua uk us ve za zh
                excludeCountry:
                  type: string
                  description: >
                    The 2-letter ISO-639-1 code of the country you want to exclude from results. You can add a comma separated list of maximum 5 countries. Possible options: ae ar at au be bg cr ca ch co cu cz de eg en es fr gb gr hk hu id ie in is it jp kr lt lv ma mx my ng nl np nz pe ph pk pl pt ro rs ru sa se sg si sk th tr tt tw ua uk us ve za zh
                category:
                  type: string
                  format: string
                  description: >
                    Find sources that display news of this category. Possible options: business, entertainment, general, health, science, sports, technology. Default: all categories.
                sortBy:
                  type: string
                  format: string
                  description: >
                    The order to sort the articles in. Possible options: relevancy, popularity, publishedAt, random. Values: relevancy = articles more closely related to q come first. popularity = articles from popular sources and publishers come first. publishedAt = newest articles come first. random = random articles.
      responses:
        "200":
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
        "422":
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HTTPValidationError"
      security:
        - HTTPBearer: []
components:
  schemas:
    ApiResponse:
      type: object
      properties:
        articles:
          type: array
          items:
            $ref: '#/components/schemas/Article'
        callcount:
          type: integer
          description: The number of API calls remaining for your API key
    Article:
      type: object
      properties:
        source:
          $ref: '#/components/schemas/Source'
        author:
          type: string
          description: The author of the article
        title:
          type: string
          description: The headline or title of the article
        description:
          type: string
          description: A description or snippet from the article
        url:
          type: string
          format: uri
          description: The direct URL to the article
        urlToImage:
          type: string
          format: uri
          description: The URL to a relevant image for the article
        publishedAt:
          type: string
          format: date-time
          description: The date and time that the article was published
        content:
          type: string
          description: The unformatted content of the article
    Source:
      type: object
      properties:
        id:
          type: string
          description: The identifier for the source
        name:
          type: string
          description: The display name for the source
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer