> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.conversive.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conversive.ai/_mcp/server.

# Get Available Balance

> Retrieve SMS and MMS credits from the connected Conversive account.

Use `getConversiveBalance()` to retrieve the current SMS and MMS credits available in the connected account.

## When to use this API

This API is useful for:

* validating account capacity before bulk sends
* showing available credits in admin screens
* pre-send checks in workflows or scheduled jobs
* operational monitoring

## Method signature

```apex
public static ConversiveAPI.BalanceResponse getConversiveBalance()
```

## Inputs

This API takes **no input parameters**.

## Response type

```apex
public class BalanceResponse {
    public String response;         // SUCCESS / ERROR
    public String responseMessage;
    public Double SMSCredits;
    public Double MMSCredits;
}
```

## Response fields

| Field             | Type     | Description                  |
| ----------------- | -------- | ---------------------------- |
| `response`        | `String` | Indicates success or failure |
| `responseMessage` | `String` | Human-readable result        |
| `SMSCredits`      | `Double` | Remaining SMS credits        |
| `MMSCredits`      | `Double` | Remaining MMS credits        |

## Example

```apex
ConversiveAPI.BalanceResponse resp =
    ConversiveAPI.getConversiveBalance();

System.debug('response = ' + resp.response);
System.debug('responseMessage = ' + resp.responseMessage);
System.debug('SMSCredits = ' + resp.SMSCredits);
System.debug('MMSCredits = ' + resp.MMSCredits);
```

## Example success response

```apex
response = 'SUCCESS'
responseMessage = 'Balance fetched successfully'
SMSCredits = 1250.0
MMSCredits = 320.0
```

## Example error response

```apex
response = 'ERROR'
responseMessage = 'Unable to fetch account balance'
SMSCredits = null
MMSCredits = null
```

## Error behavior

The Confluence page documents **generic** error behavior for this API:

* `response = 'ERROR'`
* `responseMessage` contains the reason for failure
* `SMSCredits` and `MMSCredits` may be null or empty depending on the failure condition

Because this API takes no inputs, the main implementation concern is handling the returned error response and preventing downstream logic from assuming credits exist.

## Best practices

* call this API before large SMS or MMS sends
* surface the balance in admin or monitoring screens
* guard downstream logic against null credit values
* log `responseMessage` when troubleshooting