The Get Statement Mail Content API is a diagnostic and preparation tool. It returns the rendered HTML and Subject line of a customer statement email based on the date range you provide. This is essential for developers building "Review & Send" features in custom admin dashboards.
At Kalki LLP, we use this endpoint to allow accounts teams to review the exact message a customer will see before triggering the final "Send" command, preventing branding or data errors.
To fetch the email content, you perform a GET request. Since statements are period-based, you must include a start and end date in the query string.
Endpoint: GET /contacts/{contact_id}/statements/mail?organization_id={organization_id}
| Parameter | Type | Description |
start_date | Date | Required. The beginning of the statement period (YYYY-MM-DD). |
end_date | Date | Required. The end of the statement period (YYYY-MM-DD). |
The response returns a data object containing the subject and the body (in HTML) that Zoho Books has generated using your default email template.
Sample JSON Response:
{
"code": 0,
"message": "success",
"data": {
"subject": "Statement of Account for Kalki LLP Solutions",
"body": "Dear Customer, <br><br>Please find attached your account statement for the period 01 Oct 2023 to 31 Oct 2023. <br><br>Regards,<br>Kalki LLP Team",
"customer_name": "Kalki LLP Solutions"
}
}
This script fetches the content and displays it in a Zoho Creator or CRM popup for manual verification.
// Set dates for the last month
startDate = "2023-10-01";
endDate = "2023-10-31";
contactID = "460000000026049";
// Construct the URL
urlPath = "https://www.zohoapis.in/books/v3/contacts/" + contactID + "/statements/mail?organization_id=123456&start_date=" + startDate + "&end_date=" + endDate;
// Execute the GET request
response = invokeurl
[
url :urlPath
type :GET
connection :"kalki_books_connection"
];
if(response.get("code") == 0)
{
emailPreview = response.get("data");
info "Subject: " + emailPreview.get("subject");
info "Body HTML: " + emailPreview.get("body");
}
else
{
info "Kalki Error: Could not fetch preview. " + response.get("message");
}
| Error Code | Meaning | Fix for Kalki LLP Developers |
| 2 | Invalid ID | The contact_id provided is incorrect. |
| 1005 | Missing Date | You forgot to include start_date or end_date in the URL. |
| 57 | Unauthorized | Your OAuth token lacks the ZohoBooks.contacts.READ scope. |
| 1002 | No Transactions | There is no data to generate a statement for this specific date range. |
For kalkillp.com clients, we recommend the "Preview-First" workflow for:
Template Verification: Ensuring that custom CSS or HTML in your Zoho Books email templates looks correct across different devices.
Placeholders: Confirming that the %{CustomerName} or %{TotalAmount} placeholders are pulling the correct data from the ledger.
Audit Logs: Storing a copy of the exact HTML sent to the customer in an external audit database or CRM Note.
Precision in communication builds trust. Kalki LLP specializes in creating advanced email automation workflows that combine the power of Zoho Books with custom logic to ensure your customers always receive perfectly formatted, accurate communications.