# Billing

Review billing summaries, invoices, transactions, and plan operations.

The examples use A2A code mode. MCP exposes the same code mode through its `execute` tool.

## Functions

### `billing.current_plan.get`

```text
billing.current_plan.get(account_id: str) -> BillingResult
```

Get the current billing plan.

| Property | Value | Property | Value |
| --- | --- | --- | --- |
| Requires permission | `billing.view` | Auth required | `yes` |
| Execution mode | `sync` | Capability | `billing.view` |
| Resource type | `account` | Resource ID field | `account_id` |
| Public API route | `GET /v1/public/accounts/{account_id}/billing/current-plan` |  |  |

  

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | `str` | yes | Account UUID from the route path |

  
  

### Returns

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `billing_period` | `str` | yes | Billing period for the current plan |
| `currency` | `str` | yes | Billing currency code |
| `plan_id` | `str` | yes | Current billing plan ID |
| `plan_name` | `str` | yes | Current billing plan name |
| `price` | `str` | yes | Current plan price |
| `status` | `str` | yes | Current plan status |
| `can_cancel_plan` | `bool` | no | Whether the plan can be cancelled |
| `can_change_plan` | `bool` | no | Whether the plan can be changed |

  
  

### A2A example

Request:

```json
{
  "request_id": "example",
  "session_id": "session_123",
  "code": "billing.current_plan.get(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
}
```

Response:

```json
{
  "request_id": "example",
  "status": "completed",
  "result": {
    "last_value": true
  },
  "responses": [
    {
      "index": 0,
      "function": "billing.current_plan.get",
      "status": "completed",
      "result": true
    }
  ],
  "complexity_score": 1
}
```

  
  

### MCP example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "method": "tools/call",
  "params": {
    "name": "hybridbox_execute",
    "arguments": {
      "code": "billing.current_plan.get(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
    }
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": true\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"billing.current_plan.get\",\n      \"status\": \"completed\",\n      \"result\": true\n    }\n  ],\n  \"complexity_score\": 1\n}"
      }
    ],
    "isError": false
  }
}
```

  

### `billing.invoices.list`

```text
billing.invoices.list(account_id: str, page?: int, page_size?: int) -> Page[BillingResult]
```

List billing invoices.

| Property | Value | Property | Value |
| --- | --- | --- | --- |
| Requires permission | `billing.view` | Auth required | `yes` |
| Execution mode | `sync` | Capability | `billing.view` |
| Resource type | `account` | Resource ID field | `account_id` |
| Public API route | `GET /v1/public/accounts/{account_id}/billing/invoices` |  |  |

  

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | `str` | yes | Account UUID from the route path |
| `page` | `int` | no | One-based billing page number |
| `page_size` | `int` | no | Maximum billing records per page |

  
  

### Returns

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | `[{"amount": str, "currency": str, "date": str, "download_url": str \| null, "id": str, "status": str}]` | yes | Invoices on this page |
| `page` | `int` | yes | Current one-based page number |
| `page_size` | `int` | yes | Maximum items per page |
| `total` | `int` | yes | Total matching invoices |

  
  

### A2A example

Request:

```json
{
  "request_id": "example",
  "session_id": "session_123",
  "code": "billing.invoices.list(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", page=123, page_size=123)"
}
```

Response:

```json
{
  "request_id": "example",
  "status": "completed",
  "result": {
    "last_value": "<string>"
  },
  "responses": [
    {
      "index": 0,
      "function": "billing.invoices.list",
      "status": "completed",
      "result": "<string>"
    }
  ],
  "complexity_score": 1
}
```

  
  

### MCP example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "method": "tools/call",
  "params": {
    "name": "hybridbox_execute",
    "arguments": {
      "code": "billing.invoices.list(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", page=123, page_size=123)"
    }
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": \"<string>\"\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"billing.invoices.list\",\n      \"status\": \"completed\",\n      \"result\": \"<string>\"\n    }\n  ],\n  \"complexity_score\": 1\n}"
      }
    ],
    "isError": false
  }
}
```

  

### `billing.plan.cancel`

```text
billing.plan.cancel(account_id: str, cancel_at_period_end?: bool, cancel_immediately?: bool) -> BillingResult
```

Cancel billing plan.

| Property | Value | Property | Value |
| --- | --- | --- | --- |
| Requires permission | `billing.manage` | Auth required | `yes` |
| Execution mode | `sync` | Capability | `billing.manage` |
| Resource type | `account` | Resource ID field | `account_id` |
| Public API route | `POST /v1/public/accounts/{account_id}/billing/cancel-plan` |  |  |

  

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | `str` | yes | Account UUID from the route path |
| `cancel_at_period_end` | `bool` | no | Cancel the plan at the end of the billing period |
| `cancel_immediately` | `bool` | no | Cancel the plan immediately |

  
  

### Returns

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `str` | yes | Billing operation status |
| `account_status` | `str \| null` | no | Account status after the operation |
| `effective_at` | `str \| null` | no | When the billing change took effect |
| `eligible` | `bool \| null` | no | Whether the account was eligible for the operation |
| `previous_plan_id` | `str \| null` | no | Previous billing plan ID |
| `target_plan_id` | `str \| null` | no | Target billing plan ID |

  
  

### A2A example

Request:

```json
{
  "request_id": "example",
  "session_id": "session_123",
  "code": "billing.plan.cancel(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", cancel_at_period_end=true, cancel_immediately=true)"
}
```

Response:

```json
{
  "request_id": "example",
  "status": "completed",
  "result": {
    "last_value": "<string>"
  },
  "responses": [
    {
      "index": 0,
      "function": "billing.plan.cancel",
      "status": "completed",
      "result": "<string>"
    }
  ],
  "complexity_score": 1
}
```

  
  

### MCP example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "method": "tools/call",
  "params": {
    "name": "hybridbox_execute",
    "arguments": {
      "code": "billing.plan.cancel(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", cancel_at_period_end=true, cancel_immediately=true)"
    }
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": \"<string>\"\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"billing.plan.cancel\",\n      \"status\": \"completed\",\n      \"result\": \"<string>\"\n    }\n  ],\n  \"complexity_score\": 1\n}"
      }
    ],
    "isError": false
  }
}
```

  

### `billing.plan.change`

```text
billing.plan.change(account_id: str, plan_id: "smtp_per_mailbox" | "smtp_per_proxy", effective_date?: str | null) -> BillingResult
```

Change billing plan.

| Property | Value | Property | Value |
| --- | --- | --- | --- |
| Requires permission | `billing.manage` | Auth required | `yes` |
| Execution mode | `sync` | Capability | `billing.manage` |
| Resource type | `account` | Resource ID field | `account_id` |
| Public API route | `POST /v1/public/accounts/{account_id}/billing/change-plan` |  |  |

  

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | `str` | yes | Account UUID from the route path |
| `plan_id` | `"smtp_per_mailbox" \| "smtp_per_proxy"` | yes | Target billing plan ID |
| `effective_date` | `str \| null` | no | Requested effective date for the plan change |

  
  

### Returns

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `str` | yes | Billing operation status |
| `account_status` | `str \| null` | no | Account status after the operation |
| `effective_at` | `str \| null` | no | When the billing change took effect |
| `eligible` | `bool \| null` | no | Whether the account was eligible for the operation |
| `previous_plan_id` | `str \| null` | no | Previous billing plan ID |
| `target_plan_id` | `str \| null` | no | Target billing plan ID |

  
  

### A2A example

Request:

```json
{
  "request_id": "example",
  "session_id": "session_123",
  "code": "billing.plan.change(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", plan_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", effective_date=\"<string>\")"
}
```

Response:

```json
{
  "request_id": "example",
  "status": "completed",
  "result": {
    "last_value": "<string>"
  },
  "responses": [
    {
      "index": 0,
      "function": "billing.plan.change",
      "status": "completed",
      "result": "<string>"
    }
  ],
  "complexity_score": 1
}
```

  
  

### MCP example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "method": "tools/call",
  "params": {
    "name": "hybridbox_execute",
    "arguments": {
      "code": "billing.plan.change(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", plan_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", effective_date=\"<string>\")"
    }
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": \"<string>\"\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"billing.plan.change\",\n      \"status\": \"completed\",\n      \"result\": \"<string>\"\n    }\n  ],\n  \"complexity_score\": 1\n}"
      }
    ],
    "isError": false
  }
}
```

  

### `billing.transactions.list`

```text
billing.transactions.list(account_id: str, page?: int, page_size?: int) -> Page[BillingResult]
```

List billing transactions.

| Property | Value | Property | Value |
| --- | --- | --- | --- |
| Requires permission | `billing.view` | Auth required | `yes` |
| Execution mode | `sync` | Capability | `billing.view` |
| Resource type | `account` | Resource ID field | `account_id` |
| Public API route | `GET /v1/public/accounts/{account_id}/billing/transactions` |  |  |

  

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | `str` | yes | Account UUID from the route path |
| `page` | `int` | no | One-based billing page number |
| `page_size` | `int` | no | Maximum billing records per page |

  
  

### Returns

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | `int` | yes | Current one-based page number |
| `page_size` | `int` | yes | Maximum items per page |
| `total` | `int` | yes | Total matching wallet transactions |
| `items` | `[{"amount": str, "currency": str, "direction": str, "effective_at": str, "status": str, "transaction_id": str, "type": str, "balance_after"?: str \| null, "description"?: str \| null, "line_items"?: [{"amount_cents": int, "component_type": str, "currency": str, "description": str, "quantity": str, "source": str, "unit": str, "unit_price_cents": str, "metadata"?: {}, "period_end"?: str \| null, "period_start"?: str \| null}]}]` | no | Wallet transactions on this page |

  
  

### A2A example

Request:

```json
{
  "request_id": "example",
  "session_id": "session_123",
  "code": "billing.transactions.list(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", page=123, page_size=123)"
}
```

Response:

```json
{
  "request_id": "example",
  "status": "completed",
  "result": {
    "last_value": 123
  },
  "responses": [
    {
      "index": 0,
      "function": "billing.transactions.list",
      "status": "completed",
      "result": 123
    }
  ],
  "complexity_score": 1
}
```

  
  

### MCP example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "method": "tools/call",
  "params": {
    "name": "hybridbox_execute",
    "arguments": {
      "code": "billing.transactions.list(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\", page=123, page_size=123)"
    }
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": 123\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"billing.transactions.list\",\n      \"status\": \"completed\",\n      \"result\": 123\n    }\n  ],\n  \"complexity_score\": 1\n}"
      }
    ],
    "isError": false
  }
}
```

  

### `billing.wallet_balance.get`

```text
billing.wallet_balance.get(account_id: str) -> BillingResult
```

Get the billing wallet balance.

| Property | Value | Property | Value |
| --- | --- | --- | --- |
| Requires permission | `billing.view` | Auth required | `yes` |
| Execution mode | `sync` | Capability | `billing.view` |
| Resource type | `account` | Resource ID field | `account_id` |
| Public API route | `GET /v1/public/accounts/{account_id}/billing/wallet-balance` |  |  |

  

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | `str` | yes | Account UUID from the route path |

  
  

### Returns

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accrued_charges` | `str` | yes | Unbilled accrued charges |
| `balance` | `str` | yes | Current wallet balance |
| `currency` | `str` | yes | Wallet currency code |
| `net_balance` | `str` | yes | Wallet balance after accrued charges |

  
  

### A2A example

Request:

```json
{
  "request_id": "example",
  "session_id": "session_123",
  "code": "billing.wallet_balance.get(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
}
```

Response:

```json
{
  "request_id": "example",
  "status": "completed",
  "result": {
    "last_value": {
      "accrued_charges": "<string>",
      "balance": "<string>",
      "currency": "<string>",
      "net_balance": "<string>"
    }
  },
  "responses": [
    {
      "index": 0,
      "function": "billing.wallet_balance.get",
      "status": "completed",
      "result": {
        "accrued_charges": "<string>",
        "balance": "<string>",
        "currency": "<string>",
        "net_balance": "<string>"
      }
    }
  ],
  "complexity_score": 1
}
```

  
  

### MCP example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "method": "tools/call",
  "params": {
    "name": "hybridbox_execute",
    "arguments": {
      "code": "billing.wallet_balance.get(account_id=\"3c90c3cc-0d44-4b50-8888-8dd25736052a\")"
    }
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": "example",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\n  \"request_id\": \"example\",\n  \"status\": \"completed\",\n  \"result\": {\n    \"last_value\": {\n      \"accrued_charges\": \"<string>\",\n      \"balance\": \"<string>\",\n      \"currency\": \"<string>\",\n      \"net_balance\": \"<string>\"\n    }\n  },\n  \"responses\": [\n    {\n      \"index\": 0,\n      \"function\": \"billing.wallet_balance.get\",\n      \"status\": \"completed\",\n      \"result\": {\n        \"accrued_charges\": \"<string>\",\n        \"balance\": \"<string>\",\n        \"currency\": \"<string>\",\n        \"net_balance\": \"<string>\"\n      }\n    }\n  ],\n  \"complexity_score\": 1\n}"
      }
    ],
    "isError": false
  }
}
```
