Sage Business Cloud Accounting Integration
Sage Business Cloud Accounting (formerly Sage One) is Sage's cloud-native accounting platform for small businesses. It does not include a built-in SMS sending capability. This endpoint receives SMS dispatch requests from custom integrations and add-ons that use the Sage Business Cloud API to retrieve contact and invoice data, then trigger SMS notifications via SMSDESK.
- A custom integration authenticates with the Sage Business Cloud API to read contacts, invoices, and payment data
- The integration identifies customers needing SMS notifications (e.g., overdue invoices, payment confirmations)
- The integration sends SMS dispatch requests to this SMSDESK endpoint via JSON POST
Endpoint
POST
https://{host}/api/http/sage/business/main.ashx
https://desk.sms.com.na (SaaS),
https://sms.yourcompany.com (Enterprise OnSite)
Content-Type
Content-Type: application/json
Authentication
The SMSDESK API key can be provided in any of the following ways. These mirror the authentication patterns used by the official Sage Business Cloud APIs:
| Method | Example | Corresponds to |
|---|---|---|
| Query parameter | ?apikey=your-smsdesk-api-key |
Sage SA API (marketplace.sage.co.za) uses
?apikey={key}
|
| Authorization header | Authorization: Bearer your-smsdesk-api-key |
Sage Accounting v3.1 API uses
Authorization: Bearer {oauth_token}
|
| X-API-Key header | X-API-Key: your-smsdesk-api-key |
Generic API key header |
Getting Your SMSDESK API Key
- Log in to the SMSDESK Portal
- Navigate to your SMS Channel settings
- Copy your existing API key or generate a new one
Request Format
Send a JSON POST request with the following fields:
| Field | Aliases | Required | Description |
|---|---|---|---|
to |
recipients, recipient |
Yes | Recipient number(s), comma-separated for multiple |
message |
text, msg |
Yes | SMS message text |
ref |
reference |
No | Optional reference for tracking (e.g., invoice number) |
from |
— | No | Sender ID (ignored, uses default channel) |
Request Example
{
"to": "264811234567",
"message": "Your invoice #INV-001 for N$ 1,250.00 is now ready. Due date: 30 Sep 2026.",
"ref": "INV-001"
}
Response Format
Success Response (200 OK)
{
"status": "ok",
"messages": [
{
"sms_id": 12345,
"recipient": "264811234567",
"status": "PENDING"
}
]
}
Error Response (400 Bad Request)
{
"status": "error",
"error": "missing_recipients",
"message": "Recipient required. Use 'to', 'recipients', or 'recipient' field"
}
Error Response (401 Unauthorized)
{
"status": "error",
"error": "missing_api_key",
"message": "API key required. Use ?apikey={key}, Authorization: Bearer {key}, or X-API-Key: {key}"
}
Integration Architecture
Sage Business Cloud Accounting exposes a REST API for reading accounting data. The integration pattern involves two separate API calls:
┌──────────────────────┐ ┌──────────────────────┐ ┌─────────────────┐
│ Sage Business Cloud │ │ Custom Integration │ │ SMSDESK │
│ Accounting API │ │ (Your App / Add-on) │ │ SMS Gateway │
│ │ │ │ │ │
│ GET /contacts │────▶│ 1. Read contacts │ │ │
│ GET /sales_invoices │ │ 2. Find overdue │ │ │
│ GET /payments │ │ 3. Build SMS msg │────▶│ POST /sage/ │
│ │ │ 4. Send to SMSDESK │ │ business/ │
│ Auth: │ │ │ │ │
│ SA: ?apikey={sage} │ │ Auth: │ │ Auth: │
│ v3.1: Bearer {oauth}│ │ ?apikey={smsdesk} │ │ ?apikey= │
│ │ │ or Bearer {smsdesk} │ │ {smsdesk} │
└──────────────────────┘ └──────────────────────┘ └─────────────────┘
Sage Business Cloud API (for reading data)
Two API versions exist depending on your region:
| Region | API URL | Auth | Docs |
|---|---|---|---|
| South Africa / Namibia | https://accounting.sageone.co.za/api/1.1.2/ |
?apikey={sage_api_key} |
marketplace.sage.co.za |
| International (UK, IE, US, etc.) | https://api.accounting.sage.com/v3.1/ |
OAuth 2.0 (Authorization: Bearer {token}) |
developer.sage.com |
Code Examples
cURL
curl -X POST "https://{host}/api/http/sage/business/main.ashx?apikey=your-smsdesk-api-key" \
-H "Content-Type: application/json" \
-d '{
"to": "264811234567",
"message": "Your invoice INV-001 for N$ 1,250.00 is ready. Due: 30 Sep 2026.",
"ref": "INV-001"
}'
cURL (Authorization Header)
curl -X POST "https://{host}/api/http/sage/business/main.ashx" \
-H "Authorization: Bearer your-smsdesk-api-key" \
-H "Content-Type: application/json" \
-d '{"to": "264811234567", "message": "Payment received. Thank you!", "ref": "RCV-001"}'
Python (Full Integration Example)
import requests
# Step 1: Read customer contacts from Sage Business Cloud SA API
sage_url = "https://accounting.sageone.co.za/api/1.1.2/Customer/Get"
sage_params = {"apikey": "your-sage-api-key", "CompanyId": 1}
sage_response = requests.get(sage_url, params=sage_params)
customers = sage_response.json()
# Step 2: Send SMS to each customer via SMSDESK
smsdesk_url = "https://{host}/api/http/sage/business/main.ashx"
smsdesk_headers = {
"Authorization": "Bearer your-smsdesk-api-key",
"Content-Type": "application/json"
}
for customer in customers:
mobile = customer.get("Mobile")
if not mobile:
continue
data = {
"to": mobile,
"message": f"Dear {customer['Name']}, your statement is ready. "
f"Outstanding: N$ {customer['Outstanding']}.",
"ref": f"STMT-{customer['ID']}"
}
response = requests.post(smsdesk_url, json=data, headers=smsdesk_headers)
print(f"SMS to {mobile}: {response.json()}")
C# (Sage Business Cloud Add-on)
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;
// Step 1: Read contacts from Sage Business Cloud API
var sageClient = new HttpClient();
sageClient.DefaultRequestHeaders.Add("Authorization", "Bearer your-sage-oauth-token");
var sageResponse = await sageClient.GetAsync(
"https://api.accounting.sage.com/v3.1/contacts");
var contacts = JsonConvert.DeserializeObject(
await sageResponse.Content.ReadAsStringAsync());
// Step 2: Send SMS via SMSDESK
var smsdeskClient = new HttpClient();
smsdeskClient.DefaultRequestHeaders.Add("X-API-Key", "your-smsdesk-api-key");
foreach (var contact in contacts["$items"])
{
var mobile = (string)contact["mobile"];
if (string.IsNullOrEmpty(mobile)) continue;
var payload = new
{
to = mobile,
message = $"Dear {(string)contact["name"]}, your invoice is ready.",
ref = $"INV-{(string)contact["id"]}"
};
var content = new StringContent(
JsonConvert.SerializeObject(payload),
Encoding.UTF8, "application/json");
var response = await smsdeskClient.PostAsync(
"https://{host}/api/http/sage/business/main.ashx", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine($"SMS to {mobile}: {result}");
}
JavaScript (Node.js)
const axios = require('axios');
// Send SMS via SMSDESK
const response = await axios.post(
'https://{host}/api/http/sage/business/main.ashx?apikey=your-smsdesk-api-key',
{
to: '264811234567',
message: 'Your invoice INV-001 for N$ 1,250.00 is ready.',
ref: 'INV-001'
},
{ headers: { 'Content-Type': 'application/json' } }
);
console.log(response.data);
// { status: 'ok', messages: [{ sms_id: 12345, recipient: '264811234567', status: 'PENDING' }] }
Power Automate / Zapier
Use this endpoint in an HTTP action:
- Method: POST
- URL:
https://{host}/api/http/sage/business/main.ashx?apikey=your-smsdesk-api-key - Headers:
Content-Type: application/json - Body: JSON with
to,message, and optionalref
Official References
- Sage Business Cloud Accounting API (South Africa):
marketplace.sage.co.za/api-overview —
Uses
apikeyquery parameter, JSON format, 5,000 requests/day limit - Sage Accounting API v3.1 (International): developer.sage.com/accounting — OAuth 2.0, REST JSON, rate limits: 1,296,000 daily, 150 concurrent, 100/min per company
- Sage Accounting API Reference: developer.sage.com/accounting/reference
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
401 missing_api_key |
No SMSDESK API key provided | Pass SMSDESK key via ?apikey=,
Authorization: Bearer, or X-API-Key
|
400 missing_recipients |
No to field in JSON body |
Include to, recipients, or recipient
field |
400 missing_message |
No message field in JSON body |
Include message, text, or msg field |
400 send_error |
Backend rejected the message | Check error message for details (invalid key, insufficient credits, etc.) |
| Sage API returns 401 | Wrong Sage API key or expired OAuth token | For SA API: verify apikey from Sage. For v3.1: refresh OAuth
token (access tokens expire after 5 minutes) |
| Sage API returns 429 | Rate limit exceeded | SA API: 5,000 req/day limit. v3.1: 100 req/min per company. Add delays or cache data |
