openapi: 3.0.3 info: title: News 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: [] paths: /everything: get: summary: Search all articles description: >- Search through millions of articles from over 150,000 large and small news sources and blogs. operationId: getEverything tags: - Articles parameters: - name: q in: query description: Keywords or phrases to search for in article title and body. schema: type: string - name: searchIn in: query description: Fields to restrict the q search to. Comma-separated list of title, description, content. schema: type: string - name: sources in: query description: Comma-separated string of identifiers for the news sources or blogs (max 20). schema: type: string - name: domains in: query description: Comma-separated string of domains to restrict the search to. schema: type: string - name: excludeDomains in: query description: Comma-separated string of domains to remove from results. schema: type: string - name: from in: query description: A date and optional time for the oldest article allowed (ISO 8601). schema: type: string format: date-time - name: to in: query description: A date and optional time for the newest article allowed (ISO 8601). schema: type: string format: date-time - name: language in: query description: The 2-letter ISO-639-1 code of the language. schema: type: string - name: sortBy in: query description: The order to sort articles in. schema: type: string enum: - relevancy - popularity - publishedAt - name: pageSize in: query description: The number of results to return per page. schema: type: integer default: 100 maximum: 100 - name: page in: query description: Use this to page through the results. schema: type: integer default: 1 responses: '200': description: Articles search results content: application/json: schema: $ref: '#/components/schemas/ArticlesResponse' /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' /top-headlines/sources: get: summary: Get available news sources description: >- Returns the subset of news publishers that top headlines are available from. operationId: getSources tags: - Sources parameters: - name: category in: query description: Filter sources by category. schema: type: string enum: - business - entertainment - general - health - science - sports - technology - name: language in: query description: Filter sources by language (2-letter ISO-639-1 code). schema: type: string - name: country in: query description: Filter sources by country (2-letter ISO 3166-1 code). schema: type: string responses: '200': description: Sources list content: application/json: schema: $ref: '#/components/schemas/SourcesResponse' components: securitySchemes: ApiKeyAuth: type: apiKey in: query name: apiKey ApiKeyHeader: type: apiKey in: header name: X-Api-Key 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' Source: type: object properties: id: type: string name: type: string description: type: string url: type: string category: type: string language: type: string country: type: string SourcesResponse: type: object properties: status: type: string sources: type: array items: $ref: '#/components/schemas/Source'