News API Headlines API

The Headlines API from News API — 1 operation(s) for headlines.

OpenAPI Specification

news-api-headlines-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: News Articles Headlines API
  description: Locate articles and breaking news headlines from news sources and blogs across the web with a JSON API.
  version: 2.0.0
  contact:
    name: News API
    url: https://newsapi.org/
servers:
- url: https://newsapi.org/v2
  description: News API production server
security:
- ApiKeyAuth: []
- ApiKeyHeader: []
tags:
- name: Headlines
paths:
  /top-headlines:
    get:
      summary: Get top breaking news headlines
      description: Provides live top and breaking headlines for a country, specific category in a country, single source, or multiple sources.
      operationId: getTopHeadlines
      tags:
      - Headlines
      parameters:
      - name: country
        in: query
        description: The 2-letter ISO 3166-1 code of the country to get headlines for.
        schema:
          type: string
      - name: category
        in: query
        description: The category to get headlines for.
        schema:
          type: string
          enum:
          - business
          - entertainment
          - general
          - health
          - science
          - sports
          - technology
      - name: sources
        in: query
        description: Comma-separated string of identifiers for news sources or blogs.
        schema:
          type: string
      - name: q
        in: query
        description: Keywords or phrases to search for in article title and body.
        schema:
          type: string
      - name: pageSize
        in: query
        description: The number of results to return per page (max 100).
        schema:
          type: integer
          default: 20
          maximum: 100
      - name: page
        in: query
        description: Use this to page through the results.
        schema:
          type: integer
          default: 1
      responses:
        '200':
          description: Top headlines results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ArticlesResponse'
components:
  schemas:
    Article:
      type: object
      properties:
        source:
          type: object
          properties:
            id:
              type: string
              nullable: true
            name:
              type: string
        author:
          type: string
          nullable: true
        title:
          type: string
        description:
          type: string
          nullable: true
        url:
          type: string
        urlToImage:
          type: string
          nullable: true
        publishedAt:
          type: string
          format: date-time
        content:
          type: string
          nullable: true
    ArticlesResponse:
      type: object
      properties:
        status:
          type: string
        totalResults:
          type: integer
        articles:
          type: array
          items:
            $ref: '#/components/schemas/Article'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: query
      name: apiKey
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-Api-Key