搜索文章
用一个请求搜索所有 finlight 文章。把查询与来源、来源类型、股票代码、公司角色、事件和日期等过滤条件组合使用。用 include 选择每篇文章带有哪些数据块,并用游标翻阅结果。
搜索文章
发送 JSON 请求体。所有字段都是可选的。空请求体 {} 会返回您默认来源(以及授予您的自定义来源)中最新的英文文章,每页 20 篇。
每个请求消耗 1 个额度,之后的每一页也一样。请参阅速率限制与额度。
查询与来源
- Name
query- Type
- string
- Description
使用查询语言的搜索查询:词语、短语、
AND/OR/NOT,以及ticker:NVDA或eventType:mna这样的字段。未知字段名会返回400。包含冒号的自由文本必须加引号。
- Name
sources- Type
- string[]
- Description
只返回来自这些来源的文章,以域名表示(例如
www.reuters.com)。域名由GET /v3/sources列出。不能与optInSources同时使用。
- Name
optInSources- Type
- string[]
- Description
在默认来源之外添加的来源。用于不在默认集合中的来源。每个套餐都可以添加。不能与
sources同时使用。
- Name
excludeSources- Type
- string[]
- Description
要排除的来源(域名)。
- Name
sourceTypes- Type
- string[]
- Description
只返回来源属于这些来源类型之一的文章:
newswire、press_release、financial_media、general_media、aggregator、blog、government。来自没有类型的来源的文章永远不会匹配。
- Name
excludeSourceTypes- Type
- string[]
- Description
排除来源属于这些类型之一的文章。取值与
sourceTypes相同。来自没有类型的来源的文章会被保留。
日期与语言
- Name
from- Type
- string
- Description
日期范围的起点,包含该时间。可以是日期(
2026-09-01)或 ISO 8601 时间(2026-09-01T00:00:00.000Z)。它作用于orderBy所选的时间戳。
- Name
to- Type
- string
- Description
日期范围的终点,包含该时间。格式与
from相同。不带时间的日期表示 UTC 00:00:00.000,所以"to": "2026-09-30"在当天开始时结束。要包含整天,请发送2026-09-30T23:59:59.999Z。默认值:当前时间。
- Name
languages- Type
- string[]
- Description
文章语言,使用 ISO 639-1 代码。默认值:
["en"],只返回英文。不能为空:[]会返回400。
文章过滤条件
- Name
tickers- Type
- string[]
- Description
标记了这些公司之一的文章。接受
SYMBOL、SYMBOL@MIC以及000660.KS或NASDAQ:AAPL这样的数据商写法。请参阅股票代码与交易所。
- Name
countries- Type
- string[]
- Description
报道所涉及的国家,使用 ISO 3166-1 alpha-2 代码。这不是公司的所在地(要按所在地过滤,请使用
companyCountries)。请用大写发送代码(US)。小写代码会被接受,但不会匹配任何文章。不是国家代码的取值会返回400。
- Name
categories- Type
- string[]
- Description
文章分类,例如
markets、economy或technology。分类列表可能会增加。取值为小写,必须完全匹配。
公司过滤条件
- Name
roles- Type
- string[]
- Description
被标记公司在报道中的角色:
acquirer、target、seller、defendant、subject、counterparty、supplier、customer、competitor、mentioned。与tickers和minRelevance作用于同一家公司。
- Name
minRelevance- Type
- number
- Description
被标记公司的最低相关度,范围为
0到1。相关度表示文章在多大程度上与该公司有关。与tickers和roles作用于同一家公司。
- Name
sectors- Type
- string[]
- Description
公司的行业板块,与公司记录中的
sector相同,例如Technology。取值必须完全匹配,包括大小写。
- Name
companyCountries- Type
- string[]
- Description
公司所在的国家,使用大写的 ISO 3166-1 alpha-2 代码(
US)。
- Name
exchanges- Type
- string[]
- Description
公司主要上市地所在的交易所,使用 MIC(例如
XNAS)。
当您同时设置了事件过滤条件时,sectors、companyCountries 和 exchanges 描述的是事件中的公司。否则它们描述被标记的公司。请参阅过滤条件如何组合。
事件过滤条件
- Name
eventTypes- Type
- string[]
- Description
事件类型:
earnings、guidance、mna、ipo_listing、capital_action、rating_action、management_change、legal、regulatory、bankruptcy_distress、product_partnership、investment_expansion、operational_incident、labor_restructuring、macro、geopolitics。
- Name
eventDirections- Type
- string[]
- Description
事件的预期方向:
positive、negative、neutral、unclear。
- Name
minImportance- Type
- string
- Description
事件的最低重要性:
low、medium、high或critical。这些取值是有序的,所以high匹配high和critical。
排序、分页与数据块
- Name
orderBy- Type
- string
- Description
用于排序以及应用
from/to的时间戳:publishedAt、firstSeenAt、revisedAt或availableAt。默认值:publishedAt。请参阅日期与排序。
- Name
order- Type
- string
- Description
desc(最新的在前,默认值)或asc。只能用小写。
- Name
limit- Type
- integer
- Description
每页文章数,范围为 1 到 100。默认值:20。
- Name
cursor- Type
- string
- Description
上一页的
pagination.nextCursor。第一页不要传。请参阅分页。
- Name
include- Type
- string[]
- Description
为每篇文章添加的额外数据块:
companies、events。不要重复取值。默认值:无。请参阅用 include 选择数据块。
Request
curl -X POST 'https://api.finlight.me/v3/articles/search' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: YOUR_API_KEY' \
-d '{
"tickers": ["AMD"],
"roles": ["acquirer"],
"eventTypes": ["mna"],
"minImportance": "high",
"sourceTypes": ["newswire", "financial_media"],
"from": "2026-09-01",
"include": ["companies", "events"],
"limit": 10
}'
Response
{
"articles": [
{
"id": "pXhK9f2aQ1mZ0bT7cY3rLw",
"link": "https://www.reuters.com/markets/amd-zt-systems",
"source": { "domain": "www.reuters.com", "type": "newswire" },
"title": "AMD to buy ZT Systems",
"summary": "AMD agreed to buy server maker ZT Systems ...",
"language": "en",
"media": [{ "url": "https://www.reuters.com/resizer/lead.jpg" }],
"publishedAt": "2026-09-18T12:01:03.000Z",
"firstSeenAt": "2026-09-18T12:01:41.000Z",
"revisedAt": null,
"availableAt": "2026-09-18T12:03:05.000Z",
"countries": ["US"],
"categories": ["markets"],
"sentiment": { "label": "positive", "confidence": 0.98 },
"companies": [
{
"companyId": 13,
"name": "Advanced Micro Devices, Inc.",
"isin": "US0079031078",
"primaryListing": { "ticker": "AMD", "mic": "XNAS", "country": "US" },
"confidence": 0.97,
"role": "acquirer",
"relevance": 0.95
},
{
"companyId": 90412,
"name": "ZT Systems",
"isin": null,
"primaryListing": null,
"confidence": 0.88,
"role": "target",
"relevance": 0.9
}
],
"events": [
{
"type": "mna",
"direction": "positive",
"importance": "high",
"confidence": 0.9,
"companyIds": [13, 90412]
}
]
}
],
"pagination": {
"limit": 10,
"returned": 1,
"hasMore": false,
"nextCursor": null
}
}
响应
成功的搜索返回 200 和两个键。
- Name
articles- Type
- Article[]
- Description
本页的文章,按请求的顺序排列。每一篇都是一个文章对象。可以是
[]。
- Name
pagination.limit- Type
- integer
- Description
实际使用的每页大小(您的
limit,或 20)。
- Name
pagination.returned- Type
- integer
- Description
本页包含的文章数。
- Name
pagination.hasMore- Type
- boolean
- Description
还有下一页时为
true。
- Name
pagination.nextCursor- Type
- string | null
- Description
把这个值作为
cursor发送即可获取下一页。最后一页为null。
没有总数。要获取所有结果,请沿着 nextCursor 翻页,直到 hasMore 为 false。请参阅分页。
pagination
{
"limit": 20,
"returned": 20,
"hasMore": true,
"nextCursor": "eyJ2IjoxLCJrIjpbMTc5NTU0MjQzNjAwMCwi..."
}
用 include 选择数据块
每篇文章始终带有相同的基本字段:id、link、source、title、summary、language、media、各个时间戳、countries 和 categories。较大的数据块只在您请求时才会添加:
include 取值 | 添加的内容 | 您的套餐还需要 |
|---|---|---|
companies | companies,即带角色和相关度的被标记公司 | entityAccess |
events | events,即已分类的事件 | eventAccess(Pro Standard 及以上) |
sentiment 不需要 include。只要您的套餐有 sentimentAnalysisAccess,就会添加它。
如果您的套餐不包含某个数据块,文章中就不会有这个键。您不会收到错误。只有当 companies 在同一响应中时,才会出现 events[].companyIds。关于缺失键、null 和 [] 的完整规则,请参阅套餐与权益。
您可以在不同页之间修改 include。它不会改变哪些文章匹配。
过滤条件如何组合
所有过滤条件都用 AND 组合。在同一个列表内,取值用 OR 组合:"eventTypes": ["earnings", "guidance"] 匹配其中任一类型。
有些过滤条件必须对同一家公司或同一个事件成立:
- 公司过滤条件:
tickers、roles和minRelevance必须都匹配同一家被标记的公司。{"tickers": ["AMD"], "roles": ["acquirer"]}会找到 AMD 是收购方的文章,而不是提到 AMD 且另有某个收购方的文章。 - 事件过滤条件:
eventTypes、eventDirections和minImportance必须都匹配同一个事件。{"eventTypes": ["earnings"], "eventDirections": ["negative"]}会找到一个负面的财报事件,而不是带有任意财报事件且另有某个负面事件的文章。 sectors、companyCountries和exchanges在您至少设置了一个事件过滤条件时,会加入事件过滤条件。这时它们描述该事件中的公司。没有事件过滤条件时,它们加入公司过滤条件。
公司过滤条件和事件过滤条件彼此不关联。{"tickers": ["NVDA"], "eventTypes": ["earnings"]} 会匹配标记了 NVIDIA 且有财报事件的文章,即使该财报事件是关于另一家公司的。要求事件必须关于 NVIDIA,请改为在查询中使用组,例如 {ticker:NVDA eventType:earnings}。请参阅公司与事件。事件组内的公司字段只存在于 v3 上线之后索引的文章中,因此这样的组会漏掉较旧的文章。请参阅较新字段的覆盖范围。
query 和过滤条件同样用 AND 组合。简单情况用过滤条件;需要跨字段的 OR、组或比较时,用查询语言。
日期与排序
orderBy 从四个时间戳中选择一个。同一个时间戳既用于排序,也用于应用 from 和 to。
orderBy | 含义 |
|---|---|
publishedAt | 来源声称发布文章的时间。有些来源发布时会使用过去的日期。默认值。 |
firstSeenAt | finlight 首次看到文章的时间。 |
revisedAt | 来源最后一次修订文章的时间。从未修订过的文章在这里按其 publishedAt 排序和过滤,并且仍然显示 revisedAt: null。 |
availableAt | 文章连同所有增强数据一起可用的时间。用它可以按到达顺序获取新文章。 |
需要了解的几点:
- 没有所选时间戳的文章永远不会出现。例如,
orderBy: "availableAt"只返回在引入availableAt之后索引的文章,即使from很早也是如此。 - 结果总是按时间排序。没有按相关性排序。
to默认为当前时间。翻页时,不要为每一页重新计算to。请参阅分页。
来源与来源类型
- 不设置来源字段时,您搜索的是您的默认来源以及授予您的自定义来源。
sources把搜索限制在您列出的域名中。optInSources添加不在默认集合中的来源。每个套餐都可以这样做。非默认来源只是不太常用的来源。query中的optInSources:条件与optInSources字段效果相同,例如optInSources:www.example.com AND ticker:AMD。请参阅查询中的来源。sources和optInSources不能同时使用。同时使用会在字段optInSources上返回400。query中的source:条件也算作来源过滤条件,因此它不能与sources字段或optInSources组合使用。query中的optInSources:条件永远不会导致这个错误。与sources或source:条件同时出现时,它不起作用,因为由来源过滤条件决定。与optInSources字段同时出现时,两个列表都会使用。excludeSources移除域名。sourceTypes和excludeSourceTypes按来源的类型过滤。它们只会缩小您已经在搜索的来源范围。它们从不添加来源。- 文章的来源类型是
source.type。来源还没有类型时为null。这样的文章永远不会匹配sourceTypes,并会被excludeSourceTypes保留。
只有被授予某个自定义来源的订阅,才会搜索该来源。没有授权时,任何来源字段和查询条件都不会返回它们的文章,即使用该域名的 sources 或 source: 条件也不行。请求仍然返回 200。GET /v3/sources 列出您可以使用的所有域名及其类型,并说明了三种来源。
语言
languages 默认为 ["en"]。要搜索更多语言,请把它们全部列出,例如 ["en", "de", "ja"]。代码匹配不区分大小写,所以 "DE" 表示德语。对于中文和英文,地区或文字后缀也会被忽略:"zh-Hant"、"zh-TW" 和 "ZH" 都表示中文,"en-US" 表示英文。对于其他所有语言,请发送纯两字母代码:"de-AT" 什么也匹配不到。
当您搜索中文时,查询文本会被转换为简体中文,因此用繁体字写的查询也能找到匹配结果。
您的套餐会改变什么
- 过滤条件从不受套餐限制。 每个套餐都可以使用每个过滤条件,包括
roles和eventTypes。 - 数据块受套餐限制。 您的套餐决定文章是否带有
sentiment、companies和events。请参阅用 include 选择数据块。 - 日期范围受套餐限制,且不会报错。 如果您的套餐覆盖的历史较短或有延迟,
from和to会被移到允许的窗口内。您会得到更少的结果,而不是错误。
套餐及其功能请参阅套餐与权益和 finlight.me/pricing。
错误
错误为 application/problem+json。请根据 code 进行分支处理。
| 状态码 | code | 典型原因 |
|---|---|---|
| 400 | VALIDATION_FAILED | 取值不在列表中、limit 不在 1 到 100 之间、languages: []、query 中有未知字段,或 sources 与 optInSources 同时使用。errors[] 会指明字段。 |
| 400 | CURSOR_INVALID | cursor 不是本 API 生成的游标。 |
| 400 | CURSOR_MISMATCH | 排序或过滤条件在翻页之间发生了变化。 |
| 401 | UNAUTHORIZED | 缺少 API 密钥或密钥错误。 |
| 429 | RATE_LIMITED | 达到突发限制或每月配额。请检查 limitType。 |
| 500 | INTERNAL_ERROR | 我们这边出了问题。请把 requestId 发给支持团队。 |
对于有固定取值列表的字段,错误会在 allowedValues 中列出允许的取值。
Response (400)
{
"type": "https://docs.finlight.me/errors/validation-failed",
"title": "Validation failed",
"status": 400,
"detail": "1 request field is not valid.",
"code": "VALIDATION_FAILED",
"requestId": "req_d908ff56-2328-4643-a530-ae56b4718f76",
"errors": [
{
"field": "eventTypes",
"issue": "each value in eventTypes must be one of the following values: earnings, guidance, mna, ipo_listing, capital_action, rating_action, management_change, legal, regulatory, bankruptcy_distress, product_partnership, investment_expansion, operational_incident, labor_restructuring, macro, geopolitics",
"allowedValues": [
"earnings", "guidance", "mna", "ipo_listing", "capital_action",
"rating_action", "management_change", "legal", "regulatory",
"bankruptcy_distress", "product_partnership", "investment_expansion",
"operational_incident", "labor_restructuring", "macro", "geopolitics"
]
}
]
}