跳转到主要内容
GET
Domain usage metrics
域名消费 API 按区域和日期分组,返回您的代理向每个目标域名发送的带宽(bw,单位为字节)或请求数(req)。
仅返回用量,从不返回费用。 GET /domains/bw 和 GET /domains/req 仅返回用量,从不返回费用明细。对于按 IP 计费的套餐,POST /costs/export/json 同样无法提供按域名的费用,因为费用明细导出不支持按 IP 计费套餐的费用明细。

应该使用哪个指标?

在请求路径中选择指标。两个指标接受相同的查询参数,并返回相同结构的响应。

如何请求域名用量?

发送 GET 请求,并提供必填的 from 和 to 日期。推荐的日期格式为 YYYY-MM-DD,两个日期均为 UTC 时间。
  • from 包含在内(闭区间)
  • to 不包含在内(开区间)
  • zones 为可选参数。可传入一个区域名称,或以逗号分隔的多个区域名称。省略 zones 则包含账户中的所有区域
将区域名称替换为您的区域名称,并将 BRIGHTDATA_API_KEY 设置为您的 API 密钥。请求成功时返回 200 OK 和一个 JSON 对象。

响应是什么样的?

响应是一个三层嵌套的 JSON 对象:区域名称、日期、目标域名。每个值对于 bw 是字节数,对于 req 是请求数。
在这个 bw 响应中,datacenter_proxy1 区域在键为 2026-11-01T00:00:00.000Z 的那一天向 www.salesforce.com 发送了 18,293,971,414 字节。

为什么响应为空?

域名消费 API 支持所有代理。空对象({})表示以下两种情况之一:
  • 这些区域在 from 与 to 之间没有产生流量
  • 该区域不受域名消费 API 支持
响应不会说明属于哪一种情况。

授权

Authorization
string
header
必填

Use your Bright Data API Key as a Bearer token in the Authorization header.

How to authenticate:

  1. Obtain your API Key from the Bright Data account settings at https://brightdata.com/cp/setting/users
  2. Include the API Key in the Authorization header of your requests
  3. Format: Authorization: Bearer YOUR_API_KEY

Example:

Learn how to get your Bright Data API key: https://docs.brightdata.com/api-reference/authentication

路径参数

metric
enum<string>
必填

Metric type to query:

Available Metrics

  • /bw - Bandwidth consumption
  • /req - Request count
可用选项:
bw,
req

查询参数

from
string<date>
必填

Start date in UTC, inclusive. Preferred format YYYY-MM-DD.

示例:

"2026-11-01"

to
string<date>
必填

End date in UTC, exclusive. Preferred format YYYY-MM-DD.

示例:

"2026-11-06"

zones
string

One zone name or a comma-separated list of zone names. Omit to include all zones.

示例:

"datacenter_proxy1,isp_proxy1"

响应

Usage keyed by zone name, then by day (ISO 8601 timestamp at midnight UTC), then by target domain. Values are bytes for bw and requests for req. An empty object means no traffic in the range or a zone that is not supported.

{key}
object