ClanFee Business API
Deliver messages to ClanFee users from your own systems over HTTP โ order updates, OTPs, alerts and two-way conversations, the way the WhatsApp Business Platform works.
Overview
A message you send lands in the recipient's ClanFee chat exactly like any other 1-to-1 message โ with push notification and unread badge โ from your business's identity, which the user can mute or block like any contact.
Base URL
https://api.clanfee.com
Two people are usually involved: the business owner, who signs up and gets verified, and their developer, who integrates the HTTP API below.
1. Create a business account
Onboarding is self-serve. Go to api.clanfee.com/business and:
- Register โ business name, email, password, website domain, a short description, and a logo.
- Verify email โ enter the 6-digit code sent to your address.
- Verify phone โ enter your mobile number and the SMS code.
Once both are verified your account activates automatically and your API credentials
appear โ a client_id and a client_secret.
Submitting business verification documents (legal entity, display name) is optional and raises your sending tier โ see tiers. You can send at the entry tier without it.
2. Get an access token
Exchange your client credentials for a short-lived, scoped access token using the OAuth 2.0
client_credentials grant.
POST /api/business/oauth/token
# Content-Type: application/json
{
"grant_type": "client_credentials",
"client_id": "cfc_โฆ",
"client_secret": "cfs_โฆ",
"scope": "messages:send templates:read"
}
Response:
{
"access_token": "cfb_โฆ",
"token_type": "Bearer",
"scope": "messages:send templates:read",
"expires_in": 5184000
}
Send it as a bearer token on every API call:
Authorization: Bearer cfb_โฆ
Tokens default to a 60-day life (max 365). You can hold several at once, so rotate by
issuing a new one, deploying it, then revoking the old โ no downtime. Scopes:
messages:send, messages:read, templates:read,
templates:write, optins:write, webhooks:manage.
3. Consent & the 24-hour window
A business may not message just anyone. Every send must satisfy one of these:
- The user messaged you in the last 24 hours โ the "customer-service window" is open, and you can reply free-form (any text).
- Otherwise you need a recorded opt-in for that user and you must send an approved template.
The recipient must already be a ClanFee user (matched by phone number) โ the API never creates accounts. If they've blocked your business, the send is refused.
4. Send a message
Inside an open window โ free-form text:
POST /api/business/v1/messages
# Authorization: Bearer cfb_โฆ
{ "to": "919876543210", "type": "TEXT", "content": "Your order has shipped!" }
Outside the window โ an approved template with its parameters:
POST /api/business/v1/messages
{ "to": "919876543210", "template": "order_shipped", "params": ["AC-1029"] }
Response:
{
"status": "SENT",
"messageId": 998877,
"category": "UTILITY",
"charged": "โน0.16",
"conversationWindow": "CLOSED",
"balance": "โน2,399.84"
}
to accepts any format โ +91 98765 43210, 9198765 43210
and 9876543210 all resolve to the same user. Send to many at once with
POST /api/business/v1/messages/bulk (to as an array, max 100).
Templates
Templates are pre-approved message bodies with {{1}}-style placeholders. They
let us review content before it reaches users, which is why they're required outside the
24-hour window. Submit one for review:
POST /api/business/v1/templates
{
"name": "order_shipped",
"language": "en",
"category": "UTILITY",
"body": "Your order {{1}} has shipped and arrives in 2โ3 days."
}
Categories: MARKETING, UTILITY, AUTHENTICATION,
SERVICE โ these set the price. A template can't be used
until an admin approves it (GET /api/business/v1/templates shows status).
Opt-ins
Record a user's consent before first contact. You're asserting you captured it; the
source is what you'd point to if that were ever questioned.
POST /api/business/v1/optins
{ "phone": "919876543210", "source": "checkout_form" }
Remove it with DELETE /api/business/v1/optins?phone=919876543210. A user
blocking your business also revokes their opt-in automatically.
Webhooks
Receive user replies and delivery-status updates. Point us at an HTTPS endpoint:
PUT /api/business/v1/webhook
{ "url": "https://yourapp.com/clanfee/webhook", "active": true }
We POST two event types โ message.inbound (a user replied) and
message.status (delivery state). Each carries an
X-ClanFee-Signature header: a hex HMAC-SHA256 of the exact request body, keyed
with your webhook secret. Verify it to confirm the call came from us. Deliveries retry with
backoff, so a brief outage on your side won't drop events.
Pricing & tiers
Billing is prepaid and charged per message by the template category:
| Category | Price / message | Typical use |
|---|---|---|
MARKETING | โน0.88 | Promotions, offers |
UTILITY | โน0.16 | Order/account updates |
AUTHENTICATION | โน0.13 | OTPs, verification |
SERVICE | Free | Replies inside the 24h window |
Sending volume is capped by tier โ new accounts start at 50 messages/day and step up automatically as you use your allowance and maintain quality (few blocks or reports). Verifying your business raises the ceiling. A poor quality rating throttles sending until it recovers. Check your standing any time:
GET /api/business/v1/me
All endpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /api/business/oauth/token | Get an access token |
| GET | /api/business/v1/me | Account, tier, quality, balance |
| GET | /api/business/v1/usage | 30-day volume & spend |
| GET | /api/business/v1/pricing | Current per-category prices |
| POST | /api/business/v1/messages | Send one message |
| POST | /api/business/v1/messages/bulk | Send to up to 100 recipients |
| GET | /api/business/v1/templates | List your templates |
| POST | /api/business/v1/templates | Submit a template for review |
| POST | /api/business/v1/optins | Record consent |
| DEL | /api/business/v1/optins | Revoke consent |
| PUT | /api/business/v1/webhook | Configure your webhook |
Status codes
| Code | Meaning |
|---|---|
200 | Sent |
401 | Missing, invalid or expired token |
402 | Insufficient balance โ top up |
403 | Not approved, no opt-in, template not approved, blocked, or missing scope โ don't retry |
404 | No ClanFee user with that phone number, or no such template |
429 | Daily tier limit reached, or throttled โ try later |