所有文章 > 学习各类API > 如何获取 Gnews 新闻 API 密钥(分步指南)
如何获取 Gnews 新闻 API 密钥(分步指南)

如何获取 Gnews 新闻 API 密钥(分步指南)

在数字信息快速迭代的时代,获取权威、实时的新闻内容对开发者和企业至关重要。Gnews 新闻 API 提供了强大的新闻数据访问功能,包括全球新闻搜索、按类别或地区筛选、关键词订阅以及多语言支持等。通过使用 Gnews API,开发者可以轻松整合全球最新资讯到应用或网站中,实现实时更新和智能推荐。本文将指导你如何获取Gnews 新闻API密钥,并进行初步的可用性测试,同时探讨在使用过程中需要考虑的其他关键因素。

1. 获取Gnews 新闻 API密钥步骤

获取Gnews 新闻 API密钥的过程相对简单,只需几个步骤即可完成:

1.访问 幂简平台中 Gnews 服务商:

2.点击右侧访问官网,点击官网右上角注册或登录。

3.注意:注册的用户需要在填写的邮箱中去验证。

4.登录以后就会自动到仪表盘页面,在右侧可以看到自己的 API密钥。(再次提醒:必须在注册的邮箱中点击验证才能使用API密钥)

2. Gnews 新闻 API密钥可用性测试

在获取API密钥后,进行可用性测试是确保其正常工作的重要步骤。以下是使用curl进行测试的一个案例

以下接口为Gnews 接口中 搜索新闻文章 接口。

输入:

curl --location --request GET 'https://gnews.io/api/v4/search?q=trump&apikey=You App Key' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Accept: */*' \
--header 'Host: gnews.io' \
--header 'Connection: keep-alive'

输出:

结果以 JSON 格式返回,内容包含新闻文章数据的完整信息,包括文章总数、每篇文章的唯一 ID、标题、摘要、正文内容长度提示、原文链接、配图 URL、发布时间、语言标识及来源信息(包括来源 ID、名称、网站链接和所属国家),全面展示了本次新闻数据请求的核心内容与结构,便于开发者快速获取文章基本属性、内容概览及来源管理。

{
  "totalArticles": 726127,
  "articles": [
      {
          "id": "ab3305b272a8707e7d9155ed3c2f20c7",
          "title": "Bayrou vole la vedette à Trump et Nvidia",
          "description": "Chouette, on va pouvoir parler d'autre chose que de Trump, de la Fed et de Nvidia. Ben oui, parce qu'en Europe, on sait aussi fabriquer des stars. Notre star, c'est François Bayrou. Oui, cette phrase...\n-Le 26 août 2025 à 08:01\n- Zonebourse",
          "content": "Chouette, on va pouvoir parler d'autre chose que de Trump, de la Fed et de Nvidia. Ben oui, parce qu'en Europe, on sait aussi fabriquer des stars. Notre star, c'est François Bayrou. Oui, cette phrase est assez choquante. Mais c'est la réalité du mome... [7725 chars]",
          "url": "https://www.zonebourse.com/actualite-bourse/bayrou-vole-la-vedette-a-trump-et-nvidia-ce7c50d8de8df227",
          "image": "https://cdn.zonebourse.com/static/resize/0/0//images//reuters/2025-01-16T173145Z_1_LYNXMPEL0F0S8_RTROPTP_3_FRANCE-POLITICS.JPG",
          "publishedAt": "2025-08-26T06:01:34Z",
          "lang": "fr",
          "source": {
              "id": "751f3c368b1f812b6dcd550e65c6dd79",
              "name": "Zonebourse.com",
              "url": "https://www.zonebourse.com",
              "country": "fr"
          }
      },
      {
          "id": "7dfafeab9735b802b858354a83392823",
          "title": "What is the South Korean church raid that Trump mentioned before meeting Lee Jae-myung?",
          "description": "South Korean prosecutors have raided Sarang Jeil Church, the Unification Church, Yeouido’s Full Gospel Church, and even sections of Osan Air Base as part of probes linked to ousted president Yoon Suk Yeol and former first lady Kim Keon-hee. Allegations include bribery, political lobbying and obstruction of justice, prompting Trump’s remarks before meeting Lee Jae-myung",
          "content": "Ahead of his White House meeting with South Korean President Lee Jae-myung, Donald Trump warned of a ‘Purge or Revolution’ in Seoul, citing raids on churches and even a military base. The controversy stems from sweeping investigations into former pre... [10715 chars]",
          "url": "https://www.firstpost.com/explainers/trump-south-korea-church-raid-lee-jae-myung-meeting-explained-13928008.html",
          "image": "https://images.firstpost.com/uploads/2025/08/Trump-Aug-25-2025-Reuters-2025-08-7f58a2175a98aa76be73a500539c1634.jpg?im=FitAndFill=(1200,675)",
          "publishedAt": "2025-08-26T06:00:56Z",
          "lang": "en",
          "source": {
              "id": "a7ae5ecb2b2c41a3addf1d2e51ceb032",
              "name": "Firstpost",
              "url": "https://www.firstpost.com",
              "country": "in"
          }
      },
      {
          "id": "934cc21c3553fd8983c48845ac22d9a8",
          "title": "US to allow entry of 600,000 students from China: Trump",
          "description": "US to allow entry of 600,000 students from China: Trump",
          "content": "US to allow entry of 600,000 students from China: Trump\nLast Updated: August 26, 2025, 11:30 IST\nRepresentational image (Image: News18)\nWashington DC [US], August 26 (ANI): US President Donald Trump on Tuesday said that the US will allow the entry of... [2364 chars]",
          "url": "https://www.news18.com/agency-feeds/us-to-allow-entry-of-600000-students-from-china-trump-9528526.html",
          "image": "https://images.news18.com/ibnlive/uploads/2025/05/News18_India_Section_Default_Image_1600x900-2025-05-b4faf46d67a95708181b01e36cf20c4b.jpg",
          "publishedAt": "2025-08-26T06:00:03Z",
          "lang": "en",
          "source": {
              "id": "ca84296ef941bfa461f4239a2290cb99",
              "name": "News18",
              "url": "https://www.news18.com",
              "country": "in"
          }
      },
      {
          "id": "ecd64d451ccd0e1ee521541c5bc7f944",
          "title": "Trump-Regierung blockiert Windpark - Analysten sprechen von „politischer Geiselnahme“",
          "description": "Die US-Regierung legt ein großes Windparkprojekt auf Eis. Betroffen ist ein dänischer Staatskonzern. Analysten kritisieren das Verfahren scharf.",
          "content": "Trump-Regierung blockiert Windpark – Analysten sprechen von „politischer Geiselnahme“\nVon: Robert Wallenhauer\nDrucken Teilen\nDie US-Regierung legt ein großes Windparkprojekt auf Eis. Betroffen ist ein dänischer Staatskonzern. Analysten kritisieren da... [2543 chars]",
          "url": "https://www.merkur.de/wirtschaft/trump-regierung-blockiert-windpark-analysten-sprechen-von-politischer-geiselnahme-zr-93900440.html",
          "image": "https://www.merkur.de/assets/images/39/451/39451807-windpark-vor-der-kueste-vom-bundesstaat-rhode-island-der-ausbau-des-projekts-wird-gestoppt-2wp8anfwgaef.jpg",
          "publishedAt": "2025-08-26T06:00:02Z",
          "lang": "de",
          "source": {
              "id": "731c9cc896e96b3f67c433717ad611c1",
              "name": "merkur.de",
              "url": "https://www.merkur.de",
              "country": "de"
          }
      },
      {
          "id": "e1a5ee5e070663bb55415d7a917f3d67",
          "title": "Trump-Regierung blockiert Windpark - Analysten sprechen von „politischer Geiselnahme“",
          "description": "Die US-Regierung legt ein großes Windparkprojekt auf Eis. Betroffen ist ein dänischer Staatskonzern. Analysten kritisieren das Verfahren scharf.",
          "content": "Trump-Regierung blockiert Windpark – Analysten sprechen von „politischer Geiselnahme“\nVon: Robert Wallenhauer\nDrucken Teilen\nDie US-Regierung legt ein großes Windparkprojekt auf Eis. Betroffen ist ein dänischer Staatskonzern. Analysten kritisieren da... [2543 chars]",
          "url": "https://www.fr.de/wirtschaft/trump-regierung-blockiert-windpark-analysten-sprechen-von-politischer-geiselnahme-zr-93900440.html",
          "image": "https://www.fr.de/assets/images/39/451/39451807-windpark-vor-der-kueste-vom-bundesstaat-rhode-island-der-ausbau-des-projekts-wird-gestoppt-2wp8anfwgaef.jpg",
          "publishedAt": "2025-08-26T06:00:02Z",
          "lang": "de",
          "source": {
              "id": "aed43e2746dafcc2cad3c33872c30035",
              "name": "fr.de",
              "url": "https://www.fr.de",
              "country": "de"
          }
      },
      {
          "id": "9c127a4bac991a9a77bc990c2621cdf7",
          "title": "Mortgage loan charge: Trump says he has ‘cause’ to oust Lisa Cook; first-ever move against Fed governor",
          "description": "US News: Donald Trump tried to remove Lisa Cook from the Federal Reserve. He accused her of mortgage fraud. Cook refuses to resign and claims Trump lacks the a",
          "content": "US Federal Reserve governor Lisa Cook on Tuesday rejected President Donald Trump’s announcement that he was removing her from the central bank, insisting he has no authority to do so and vowing not to resign.Donald Trump posted a letter on his Truth ... [2310 chars]",
          "url": "https://timesofindia.indiatimes.com/world/us/mortgage-loan-charge-trump-says-he-has-cause-to-oust-lisa-cook-first-ever-move-against-fed-governor/articleshow/123516154.cms",
          "image": "https://static.toiimg.com/thumb/msid-123516289,width-1070,height-580,imgsize-1365256,resizemode-75,overlay-toi_sw,pt-32,y_pad-40/photo.jpg",
          "publishedAt": "2025-08-26T06:00:00Z",
          "lang": "en",
          "source": {
              "id": "9a9a0fb79c70bbf499d39baca94921ae",
              "name": "Times of India",
              "url": "https://timesofindia.indiatimes.com",
              "country": "in"
          }
      },
      {
          "id": "dfe1d065db204bfd128d5f54a3ff0e6b",
          "title": "What major cases is Donald Trump facing before the US Supreme Court?",
          "description": "Some cases focus on how much power the president should have, what judges can do to stop national policies, and how to protect people affected by these new rules.",
          "content": "At the heart of many disputes is the question of how much power the Executive Branch can wield under the Constitution. (AP Photo)\nSince returning to office in January, President Donald Trump has faced a string of legal battles at the US Supreme Court... [546 chars]",
          "url": "https://indianexpress.com/article/world/donald-trump-us-supreme-court-major-cases-10211841/",
          "image": "https://images.indianexpress.com/2025/08/Trump-Supreme-Court.jpg",
          "publishedAt": "2025-08-26T05:59:19Z",
          "lang": "en",
          "source": {
              "id": "6a3aad3dbb44ac873f72b594aaea22c4",
              "name": "The Indian Express",
              "url": "https://indianexpress.com",
              "country": "in"
          }
      },
      {
          "id": "52fb6c7fb3de4d87983035d6aec7e534",
          "title": "Trump: Streit eskaliert komplett",
          "description": "Donald Trump und eine ranghohe Bankenchefin streiten sich um Finanzpolitik. Plötzlich entlässt er sie eiskalt.",
          "content": "US-Präsident Donald Trump sorgt mal wieder für Aufsehen. Um Zinssenkungen durchzudrücken, hat er angekündigt, jemanden aus dem Führungskreis der Notenbank zu entlassen. Kritiker warnen vor Eingriffen in die Unabhängigkeit der Geldpolitik, doch Trump ... [2462 chars]",
          "url": "https://www.derwesten.de/politik/trump-bank-federal-reserve-zinsen-id301780746.html",
          "image": "https://www.derwesten.de/wp-content/uploads/sites/8/2025/08/trump-bank-federal-reserve-zinsen.jpg",
          "publishedAt": "2025-08-26T05:59:15Z",
          "lang": "de",
          "source": {
              "id": "67e5297c6ddafed24c04c795a83d3c7f",
              "name": "Derwesten.de",
              "url": "https://www.derwesten.de",
              "country": "de"
          }
      },
      {
          "id": "89c875bc130df8c83798e287c1037baf",
          "title": "Gold hits 2-week high as dollar dips after Trump fires Fed's Cook",
          "description": "* Focus on US PCE data due on Friday * SPDR Gold Trust holdings rose 0.2% on Monday (Updates for Asia midday session) By Brijesh Patel Aug 26 (Reuters) - Gold rose to a two-week high on Tuesday, as",
          "content": "Gold rose to a two-week high on Tuesday, as the dollar slipped after U.S. President Donald Trump said he was removing Federal Reserve Governor Lisa Cook.\nSpot gold was up 0.2% at $3,373.38 per ounce, as of 0523 GMT, after hitting its highest level si... [1451 chars]",
          "url": "https://www.republicworld.com/business/gold-hits-2-week-high-as-dollar-dips-after-trump-fires-fed-s-cook",
          "image": "https://img.republicworld.com/all_images/gold-prices-in-india-on-june-2-2025-1748847336879-16_9.webp",
          "publishedAt": "2025-08-26T05:59:03Z",
          "lang": "en",
          "source": {
              "id": "e479ce8332aab31d8bac6ba9584cedbb",
              "name": "Republic World",
              "url": "https://www.republicworld.com",
              "country": "in"
          }
      },
      {
          "id": "afcc8b970ff6f31b04e60d1245ccbc8f",
          "title": "This must end, and end NOW! With this TRUTH, I put all Countries with ...: Donald Trump threatens substantial additional Tariffs",
          "description": "Tech News : Donald Trump is threatening \"substantial\" tariffs and export restrictions on countries that maintain digital services taxes (DSTs), which he views as",
          "content": "Donald Trump (AP)\nCanada scrapped Digital Tax in June under US pressure\nDonald Trump is again threatening tariffs. In a post on Truth Social, Donald Trump announced that he would impose new, \"substantial\" tariffs and restrict US chip exports on any c... [1826 chars]",
          "url": "https://timesofindia.indiatimes.com/technology/tech-news/this-must-end-and-end-now-with-this-truth-i-put-all-countries-with-donald-trump-threatens-substantial-additional-tariffs/articleshow/123518321.cms",
          "image": "https://static.toiimg.com/thumb/msid-123518359,width-1070,height-580,imgsize-973242,resizemode-75,overlay-toi_sw,pt-32,y_pad-40/photo.jpg",
          "publishedAt": "2025-08-26T05:57:00Z",
          "lang": "en",
          "source": {
              "id": "9a9a0fb79c70bbf499d39baca94921ae",
              "name": "Times of India",
              "url": "https://timesofindia.indiatimes.com",
              "country": "in"
          }
      }
  ]
}

3. 使用Gnews 新闻API搭建应用的其他关键考虑因素

在使用Gnews 新闻API搭建应用时,除了获取和测试API密钥外,还需考虑以下因素:

API 密钥

注册成功以后,您无需要手动创建API Key,系统自动生成API Key。

如何使用 API 密钥

在请求地址后面拼接&apikey=API_KEY

错误处理

GNews API 使用传统的 HTTP 响应代码来指示 API 请求的成功或失败。2xx 范围内的代码表示成功,4xx 范围内的代码表示客户端错误(例如无效参数、身份验证问题或格式错误的请求),5xx 范围内的代码表示我们的服务器出错。

HTTP 状态代码

状态代码错误类型描述
200成功一切按预期工作
400错误请求请求格式错误,通常是由于缺少或无效参数
401未授权未提供有效的 API 密钥或 API 密钥无效
403禁止您已达到每日配额限制,下次重置时间为 00:00 UTC
429请求过多短时间内发送了过多请求
500内部服务器错误我们这边出了点问题
503服务不可用我们因维护暂时离线

4. Gnews 新闻 API密钥申请和使用中的常见问题

在申请和使用 Gnews 新闻 API密钥过程中,你可能会遇到以下常见问题:

我如何在订阅前测试付费功能?

您有权免费试用 10 天,您可以从这里开始:gnews.io/change-plan。您可以随时取消您的试用期。

如果我想在商业环境中使用 API,可以使用免费套餐吗?

使用免费订阅的 GNews API 不能用于商业项目。免费订阅计划是为非商业项目或开发测试目的而设的。

历史新闻数据追溯到多远?

我们的历史新闻档案可追溯至 2020 年。您可以通过我们的 API 和平台访问和搜索 2020 年及以后的文章、头条和内容。这个全面的历史数据集可用于您的应用程序、研究或分析需求。

为什么我无法验证我的邮箱地址?

如果您无法验证邮箱地址,请联系 contact@gnews.io 寻求帮助。官方团队可以帮助您排查验证问题,并确保您的账户被正确激活。官方将与您合作解决任何阻止邮箱验证的问题。

5. Gnews 新闻 API进阶指引

在获得Gnews 新闻 API密钥之后,即可开启API接口对接,本文整理了多篇使用Gnews 新闻 API的案例,帮助读者更有效地使用Gnews 新闻 API:

搜索新闻文章搜索当前热门文章

6. 常见问题

问题1: 什么是幂简集成平台?

幂简集成是蜜堂有信在2023年打造的一款SAAS产品,建设着国内最全的API平台,为开发者提供全面、高效、易用的API集成管理方案,一站搜索、试用、集成国内和国外API。让用户在AI时代全方位接入互联网,用API连接一切服务和算力,实现价值倍增。

问题2:如何找到Gnews 新闻 API

幂简API平台可以通过以下两种方式找到所需API:通过关键词搜索API(例如,输入’Gnews 新闻 API‘这类品类词,更容易找到结果)、或者从API hub分类页进入寻找。

问题3:Gnews 新闻 API的替代品有哪些?

市场上存在免费、付费两种替代者

例如

全球新闻搜索服务-Rapidapi

Webit新闻搜索

百度今日热点新闻-夏柔

Google实时新闻数据

新闻摘要-百度

更多竞品可以在Gnews 新闻找到。

7. 总结

本文总结了Gnews新闻API密钥的获取、可用性测试及应用使用中的关键注意事项,从使用curl进行接口测试获取新闻数据,到API密钥的使用方法、错误处理及HTTP状态代码说明,再到付费功能试用、历史新闻数据访问及邮箱验证等常见问题,为开发者提供了全面的实用指南。

.

#你可能也喜欢这些API文章!

我们有何不同?

API服务商零注册

多API并行试用

数据驱动选型,提升决策效率

查看全部API→
🔥

热门场景实测,选对API

#AI文本生成大模型API

对比大模型API的内容创意新颖性、情感共鸣力、商业转化潜力

25个渠道
一键对比试用API 限时免费

#AI深度推理大模型API

对比大模型API的逻辑推理准确性、分析深度、可视化建议合理性

10个渠道
一键对比试用API 限时免费