---
title: "get_billing"
canonical_url: "https://tweetstream.io/zh-cn/docs/api/agent-action-get-billing"
last_updated: 2026-11-05
---

# get_billing

读取每个订阅的套餐、价格、状态、续费信息和可做的变更，未完成及近期的稳定币付款，以及未完成的结账。read 级：只需 API key。同名 MCP 工具需要 tweetstream:account 权限范围。

Canonical URL: https://tweetstream.io/zh-cn/docs/api/agent-action-get-billing

## `POST /api/agent/actions/get_billing`

`https://tweetstream.io/api/agent/actions/get_billing`

## 授权

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `Authorization` | `string`, 必填 | 使用 TweetStream API 密钥进行 Bearer 认证：`Bearer <key>`。 |

## 请求体

### 请求体示例

```json
{}
```

## 响应字段

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `openCheckouts` | `object[]`, 必填 |  |
| `openCheckouts.canCancel` | `boolean`, 必填 |  |
| `openCheckouts.expiresAt` | `string`, 必填 | a string to be decoded into a Date |
| `openCheckouts.family` | `enum<string>`, 必填 |  |
| `openCheckouts.rail` | `enum<string>`, 必填 |  |
| `openCheckouts.state` | `enum<string>`, 必填 |  |
| `openPayments` | `object[]`, 必填 |  |
| `openPayments.amount` | `string`, 必填 |  |
| `openPayments.canCancel` | `boolean`, 必填 |  |
| `openPayments.cancelEndsSubscription` | `boolean`, 必填 |  |
| `openPayments.canPayByCard` | `boolean`, 必填 |  |
| `openPayments.expiresAt` | `string`, 必填 | a string to be decoded into a Date |
| `openPayments.family` | `enum<string>`, 必填 |  |
| `openPayments.kind` | `enum<string>`, 必填 |  |
| `openPayments.state` | `enum<string>`, 必填 |  |
| `openPayments.underReview` | `boolean`, 必填 |  |
| `recentPayments` | `object[]`, 必填 |  |
| `recentPayments.amount` | `string`, 必填 |  |
| `recentPayments.createdAt` | `string`, 必填 | a string to be decoded into a Date |
| `recentPayments.family` | `enum<string>`, 必填 |  |
| `recentPayments.kind` | `enum<string>`, 必填 |  |
| `recentPayments.method` | `string`, 必填 |  |
| `recentPayments.status` | `enum<string>`, 必填 |  |
| `recentPayments.statusLabel` | `string`, 必填 |  |
| `subscriptions` | `object[]`, 必填 |  |
| `subscriptions.autoRenew` | `enum<string>`, 必填 |  |
| `subscriptions.availableChanges` | `enum<string>[]`, 必填 |  |
| `subscriptions.cancelAtPeriodEnd` | `boolean`, 必填 |  |
| `subscriptions.family` | `enum<string>`, 必填 |  |
| `subscriptions.openPayment` | `object`, 必填 |  |
| `subscriptions.openPayment.amountCents` | `number`, 必填 |  |
| `subscriptions.openPayment.dueAt` | `string`, 必填 |  |
| `subscriptions.openPayment.kind` | `enum<string>`, 必填 |  |
| `subscriptions.paidThrough` | `string`, 必填 |  |
| `subscriptions.pause` | `object`, 必填 |  |
| `subscriptions.pause.resumesAt` | `string`, 必填 | a string to be decoded into a Date |
| `subscriptions.pause.startsAt` | `string`, 必填 |  |
| `subscriptions.pause.state` | `enum<string>`, 必填 |  |
| `subscriptions.periodEnd` | `string`, 必填 |  |
| `subscriptions.plan` | `string`, 必填 |  |
| `subscriptions.priceCents` | `number`, 必填 |  |
| `subscriptions.rail` | `enum<string>`, 必填 |  |
| `subscriptions.renewalPaymentPreparable` | `boolean`, 必填 |  |
| `subscriptions.scheduledTermChange` | `object`, 必填 |  |
| `subscriptions.scheduledTermChange.effectiveAt` | `string`, 必填 | a string to be decoded into a Date |
| `subscriptions.scheduledTermChange.termMonths` | `number`, 必填 |  |
| `subscriptions.state` | `enum<string>`, 必填 |  |
| `subscriptions.status` | `enum<string>`, 必填 |  |
| `subscriptions.statusDetail` | `object`, 必填 |  |
| `subscriptions.statusDetail.amountCents` | `number`, 必填 |  |
| `subscriptions.statusDetail.at` | `string`, 必填 |  |
| `subscriptions.statusDetail.kind` | `enum<string>`, 必填 |  |
| `subscriptions.termMonths` | `number`, 必填 |  |

## 响应

| 状态 | 说明 | 请求头 |
| --- | --- | --- |
| `200` | 成功 |  |
| `400` | 输入不符合该操作的 schema（INVALID_REQUEST） |  |
| `401` | API key 缺失或无效 |  |
| `403` | 请求带有外部 Origin |  |
| `429` | 已达到速率限制（RATE_LIMITED），请在 retryAfterSeconds 秒后重试 |  |
| `503` | 暂时不可用，请稍后重试 |  |

### 200

```json
{
  "openCheckouts": [],
  "openPayments": [],
  "recentPayments": [],
  "subscriptions": [
    {
      "autoRenew": "on",
      "availableChanges": [],
      "cancelAtPeriodEnd": false,
      "family": "BASE",
      "openPayment": null,
      "paidThrough": "2026-11-29T12:00:00.000Z",
      "pause": null,
      "periodEnd": "2026-11-29T12:00:00.000Z",
      "plan": "Pro",
      "priceCents": 49900,
      "rail": "CARD",
      "renewalPaymentPreparable": false,
      "scheduledTermChange": null,
      "state": "card_active",
      "status": "active",
      "statusDetail": {
        "amountCents": 49900,
        "at": "2026-11-29T12:00:00.000Z",
        "kind": "renews"
      },
      "termMonths": 1
    }
  ]
}
```

### 400

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 401

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 403

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 429

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 503

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

## 代码示例

### cURL

```bash
curl --request POST \
  --url https://tweetstream.io/api/agent/actions/get_billing \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### JavaScript

```javascript
const response = await fetch("https://tweetstream.io/api/agent/actions/get_billing", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});

console.log(response.status, await response.json());
```

### Python

```python
import os
import requests

response = requests.post(
    "https://tweetstream.io/api/agent/actions/get_billing",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}"},
    json={},
)

print(response.status_code, response.json())
```
