跳到正文
Won.dev

余额和用量

查询余额、key 的预算和每一笔扣费,用于确认预算或对账。

每个付费响应末尾都已带有 usage,列出本次调用的花费和剩余余额。下面两个接口负责其余的事:大批量任务前确认账户还能花多少;事后列出每一笔扣费,用来汇报任务花费,或者向你自己的客户收费。

  • 两个接口都免费,测试 key 也可以调用:读取的是真实账户的数据,但测试 key 本身永远不会扣费。
  • 可以在控制台为每个客户或 agent 单独创建带预算的 key。GET /account 的 key 显示当前 key 的剩余预算;GET /account/charges 传入 this_key: true 时,只列出当前 key 的扣费。
  • 发送活动的邮件不按单次调用扣费,而是按活动和日期汇总,并附带活动 ID。
  • GET /account 的 email 显示账户今天还能发多少封冷邮件,以及距离各个熔断阈值还有多远。熔断会让发信降速或暂停,依据包括退信率、垃圾邮件投诉和退订。
  • MCP 服务 的 account_get_usage 工具提供同样的数据。

余额和用量

GET https://api.won.dev/v1/account

查看账户还能花多少、已经花了多少:余额、当前 key 的预算和剩余额度、最近 days 天按接口汇总的扣费、最近几笔扣费、每种结果的单价,以及冷邮件今天还能发多少封、距离各个熔断阈值还有多远;带上 tenant_id 时,返回的是账户下某个租户的这些数据。适合在大批量任务前确认预算,或在事后汇报一项任务的花费。无需每次调用后都查询:每个付费响应末尾都带有 usage,列出本次花费和剩余余额。完整的扣费明细请用 GET /account/charges。免费。

参数

参数放在查询字符串里。

参数类型必填说明(API 原文)
daysinteger否How many days back to add up, 1 to 90. Default: 30.
tenant_idstring否Show email for this tenant, such as cus_4821, instead of for the account.

响应

字段类型说明(API 原文)
dataobjectThe balance, the key's budget and what was charged.
data.balancenumberWhat the account can spend right now. A call can spend this much, or key.remaining when that is less, in US dollars.
data.keyobjectThe key this call uses.
data.key.testbooleanTrue for a test key: it returns sample data and is never charged.
data.key.budgetnumber | nullThe most this key may spend in total, in US dollars. Null when it has no limit of its own.
data.key.spentnumberWhat this key has spent so far, in US dollars.
data.key.remainingnumber | nullWhat is left of the key's budget, in US dollars. Null when it has no limit.
data.periodobjectThe days that spent, by_operation and recent cover.
data.period.sincestringFirst day, YYYY-MM-DD.
data.period.untilstringLast day, YYYY-MM-DD.
data.spentnumberWhat the account was charged in the period, with all of its keys, in US dollars.
data.by_operationobject[]The charges of the period by operation, the largest first.
data.by_operation[].operationstringThe operation that was charged, such as trade.companies.search.
data.by_operation[].callsintegerHow many calls were charged.
data.by_operation[].costnumberWhat they cost, in US dollars.
data.recentobject[]The 10 latest charges of the period, newest first.
data.recent[].request_idstringThe request ID, to quote to support.
data.recent[].operationstringThe operation that was charged, such as trade.companies.search.
data.recent[].costnumberWhat the call cost, in US dollars.
data.recent[].atstringWhen, as an ISO 8601 timestamp in UTC.
data.pricesobjectWhat one result of each kind costs, in US dollars.
data.emailobjectCold email: what the account can still send today, and how far it is from being slowed down or stopped. The breakers leave test campaigns out.
data.email.tenant_idstring | nullThe tenant this is about, when tenant_id was asked for. Null: the account, whose breakers count its own mail, without a tenant.
data.email.statusok | throttled | suspendedok; throttled when a breaker halved the daily limit; suspended when one stopped all sending until a person looks.
data.email.daily_limitintegerThe most emails the account, or the tenant, sends on one day across its campaigns, today. It rises as it sends without bounces and complaints. A tenant's is within the account's, which holds for all of its tenants together.
data.email.sent_todayintegerEmails sent so far today (UTC), campaign steps and single emails, as they count against daily_limit.
data.email.breakersobjectHow far the account is from each of the breakers that protect the mailboxes.
data.email.breakers.bounce_rateobjectEmails that bounced because the mailbox does not exist.
data.email.breakers.bounce_rate.valuenumberThe share of the last emails that bounced for good.
data.email.breakers.bounce_rate.limitnumberAbove this, sending stops.
data.email.breakers.bounce_rate.measured_overintegerHow many emails the share is of: the last 200 at most.
data.email.breakers.bounce_rate.counts_fromintegerThe breaker only acts from this many emails on.
data.email.breakers.bounce_rate.actionsuspendWhat happens above the limit: all sending stops.
data.email.breakers.complaintsobjectSpam complaints.
data.email.breakers.complaints.valueintegerRecipients who reported the emails as spam.
data.email.breakers.complaints.limitintegerAt this many, sending stops. One already halves the daily limit.
data.email.breakers.complaints.daysintegerThe days the complaints are counted over.
data.email.breakers.complaints.actionsuspendWhat happens at the limit: all sending stops.
data.email.breakers.unsubscribe_rateobjectUnsubscribes.
data.email.breakers.unsubscribe_rate.valuenumberThe share of the people written to in 30 days who unsubscribed.
data.email.breakers.unsubscribe_rate.limitnumberAbove this, the daily limit is halved.
data.email.breakers.unsubscribe_rate.counts_fromintegerThe breaker only acts from this many people on.
data.email.breakers.unsubscribe_rate.actionthrottleWhat happens above the limit: half the speed.
queryobjectThe request as it was understood, with days filled in.
noticestring | nullA plain sentence when there is something to know about this answer. Null otherwise.
usageobjectNothing is charged here. The balance, for reference.
usage.costnumberWhat this call cost, in US dollars.
usage.balancenumberThe balance left after this call, in US dollars.
usage.replayedbooleanTrue when this is a repeat of a request from the last 24 hours. Repeats are free.

示例

curl "https://api.won.dev/v1/account?days=30" \
  -H "Authorization: Bearer $WON_API_KEY"
{
  "data": {
    "balance": 48.08,
    "key": {
      "test": false,
      "budget": 20,
      "spent": 6.42,
      "remaining": 13.58
    },
    "period": {
      "since": "2026-10-23",
      "until": "2026-11-22"
    },
    "spent": 11.92,
    "by_operation": [
      {
        "operation": "email.campaigns.send",
        "calls": 4,
        "cost": 7.17
      },
      {
        "operation": "trade.companies.search",
        "calls": 23,
        "cost": 4.6
      },
      {
        "operation": "email.replies.reply",
        "calls": 5,
        "cost": 0.15
      }
    ],
    "recent": [
      {
        "request_id": "req_7f3k2m9x4p1q8w3e",
        "operation": "email.replies.reply",
        "cost": 0.03,
        "at": "2026-11-22T09:14:03.000Z"
      }
    ],
    "prices": {
      "trade_record": 0.005,
      "trade_company": 0.01,
      "trade_company_profile": 0.04,
      "trade_lookup": 0.02,
      "person_email": 0.03,
      "company_channels": 0.02,
      "trade_stats": 0.1,
      "trade_official_stats": 0.02,
      "email_sent": 0.03,
      "email_sent_dedicated": 0.01,
      "email_capacity": 0.03,
      "email_dedicated_domain": 25,
      "person_record": 0.005,
      "person_profile": 0.02,
      "person_phone": 0.1,
      "email_verification": 0.003,
      "company_record": 0.01,
      "company_listing": 0.002,
      "company_technologies": 0.02,
      "company_funding": 0.03,
      "company_news": 0.03,
      "company_lookalikes": 0.03,
      "job_posting": 0.003,
      "signal_hiring": 0.03,
      "signal_funding": 0.2,
      "signal_import_surge": 0.05
    },
    "email": {
      "tenant_id": null,
      "status": "ok",
      "daily_limit": 150,
      "sent_today": 42,
      "breakers": {
        "bounce_rate": {
          "value": 0.011,
          "limit": 0.03,
          "measured_over": 180,
          "counts_from": 50,
          "action": "suspend"
        },
        "complaints": {
          "value": 0,
          "limit": 2,
          "days": 30,
          "action": "suspend"
        },
        "unsubscribe_rate": {
          "value": 0.02,
          "limit": 0.05,
          "counts_from": 50,
          "action": "throttle"
        }
      }
    }
  },
  "query": {
    "days": 30
  },
  "notice": null,
  "usage": {
    "cost": 0,
    "balance": 48.08,
    "replayed": false
  }
}

扣费记录

GET https://api.won.dev/v1/account/charges

列出账户的每一笔扣费,按时间倒序:每次付费调用返回了什么、花了多少,以及每个发送活动按天汇总的邮件费用。免费调用和测试 key 的调用不在其中。可以用它对账,比如给每个客户分配一个 key,再按客户核对花费。免费。

参数

参数放在查询字符串里。

参数类型必填说明(API 原文)
sincestring否Only charges from this ISO 8601 time on, such as 2026-11-01T00:00:00Z.
operationstring否Only charges of this operation, such as email.campaigns.send.
this_keyboolean否Only the charges of the key this call uses. Default: false.
limitinteger否How many to return, 1 to 100. Default: 25.
cursorstring否To get the next page, pass next_cursor of the previous response back unchanged, with the same parameters.

响应

字段类型说明(API 原文)
dataobject[]The charges of this page.
data[].idstringThe request ID, such as req_7f3k2m9x4p1q8w3e. A campaign's emails are summed up per campaign and day, under an ID of their own.
data[].operationstringThe operation that was charged, such as trade.companies.search.
data[].campaign_idstring | nullFor the emails of a campaign: which campaign. Null for a call.
data[].by_this_keybooleanWhether the key of this call made it.
data[].costnumberWhat it cost, in US dollars.
data[].resultsobject[]What was charged for, by unit.
data[].results[].unitstringWhat was charged for, such as email_sent.
data[].results[].recordsinteger
data[].atstringWhen, as an ISO 8601 timestamp in UTC. For a campaign's day, when it was last added to.
has_morebooleanWhether more follow this page.
next_cursorstring | nullPass it as cursor to get the next page. Null on the last page.
noticestring | nullA plain sentence when there is something to know about this answer. Null otherwise.
usageobjectNothing is charged here. The balance, for reference.
usage.costnumberWhat this call cost, in US dollars.
usage.balancenumberThe balance left after this call, in US dollars.
usage.replayedbooleanTrue when this is a repeat of a request from the last 24 hours. Repeats are free.

示例

curl "https://api.won.dev/v1/account/charges?limit=2" \
  -H "Authorization: Bearer $WON_API_KEY"
{
  "data": [
    {
      "id": "req_7f3k2m9x4p1q8w3e",
      "operation": "email.replies.reply",
      "campaign_id": null,
      "by_this_key": true,
      "cost": 0.03,
      "results": [
        {
          "unit": "email_sent",
          "records": 1
        }
      ],
      "at": "2026-11-22T09:14:03.000Z"
    },
    {
      "id": "eml_7p1q8w3e5r4k2m9x_20261121",
      "operation": "email.campaigns.send",
      "campaign_id": "cmp_7p1q8w3e5r4k2m9x",
      "by_this_key": true,
      "cost": 0.87,
      "results": [
        {
          "unit": "email_sent",
          "records": 29
        }
      ],
      "at": "2026-11-21T21:58:40.000Z"
    }
  ],
  "has_more": true,
  "next_cursor": "cur_Qm9vVGhpc0lzQVNhbXBsZQ",
  "notice": null,
  "usage": {
    "cost": 0,
    "balance": 48.08,
    "replayed": false
  }
}

本页内容