The baseNode v1 API
Send messages, keep contacts in sync and hear about everything that happens. Plain JSON over HTTPS, scoped keys, safe retries.
Basics
Base URLhttps://api.basenode.with.gs (paths start with /v1)
Machine-readable spec
/v1/openapi.json. Import it into Postman, Insomnia or a code generator.
Authentication
Create a key in the app under Settings, Developer API, and send it as X-API-Key. Keys are shown once and can be locked to specific IP addresses.
Pagination
List endpoints return { "data": [...], "next_cursor": 97 }. Pass ?cursor=97&limit=50 for the next page. A null cursor means you are done.
Idempotency
Send Idempotency-Key: your-unique-id on POST /v1/messages. Repeating the same request returns the original result with idempotent_replay: true instead of sending again.
Limits
300 requests per minute per key. Over the limit you get 429 with a Retry-After header in seconds.
curl https://api.basenode.with.gs/v1/me -H "X-API-Key: bn_live_..."
Errors
Errors use standard HTTP codes and a readable message: { "detail": "This template needs 2 value(s) in params, got 1." }. 401 bad or missing key, 403 missing scope or wrong IP, 404 not found (or belongs to another workspace), 409 not allowed right now (for example the 24-hour window is closed or the template isn't approved), 422 invalid input, 429 slow down.
Scopes
Give each key only what it needs. A key made from scopes can only call /v1 and /send, nothing else in the dashboard. Older keys with read and write keep working.
messages:sendmessages:readcontacts:readcontacts:writeconversations:readtemplates:readwallet:readwebhooks:manageMessages
/v1/messagesscope messages:sendSend a text, a template or a media file. Free text and media need the customer to have written in the last 24 hours; templates can start a chat. Send an Idempotency-Key header so a retry never sends twice.
Request
{ "to": "98765 43210", "type": "template", "template": "order_ready", "params": ["Ravi", "#1042"] }Response
{ "message_id": 812, "conversation_id": 44, "contact_id": 97, "status": "sent", "cost_inr": 0.115 }/v1/mediascope messages:sendUpload a JPG, PNG, PDF or MP4 (up to 10 MB). Use the returned id with type=media on POST /v1/messages.
Response
{ "id": 31, "kind": "image", "filename": "invoice.png", "size": 48210 }/v1/messages/{id}scope messages:readDelivery status: queued, sent, delivered, read or failed (with an error).
Response
{ "id": 812, "status": "delivered", "type": "template", "cost_inr": 0.115, "error": null }Contacts
/v1/contactsscope contacts:readList contacts. Filters: phone, tag, opted_in. Paginate with limit (1 to 100) and cursor.
Response
{ "data": [ { "id": 97, "phone": "919876543210", "name": "Ravi", "tags": ["vip"], "opted_in": true } ], "next_cursor": 97 }/v1/contactsscope contacts:writeCreate or update by phone number. Tags are added, custom fields are merged. To record consent, send opted_in: true with opt_in_source saying where the person agreed. Fires the contact.created webhook for new people.
Request
{ "phone": "98765 43210", "name": "Ravi", "tags": ["web-order"], "attributes": { "city": "Vizag" }, "opted_in": true, "opt_in_source": "checkout" }Response
{ "created": true, "contact": { "id": 97, "phone": "919876543210", "tags": ["web-order"] } }/v1/contacts/{id}scope contacts:readOne contact.
/v1/contacts/{id}scope contacts:writeChange name, email, custom fields (a null value removes a key), add_tags, remove_tags, or consent.
Request
{ "add_tags": ["gold"], "remove_tags": ["new"], "attributes": { "plan": "gold", "city": null } }Conversations and templates
/v1/conversationsscope conversations:readNewest first. Filter by status (open, pending, resolved). Each row says whether the 24-hour window is open.
Response
{ "data": [ { "id": 44, "status": "open", "contact": { "id": 97, "phone": "919876543210", "name": "Ravi" }, "window_open": true } ], "next_cursor": 43 }/v1/conversations/{id}/messagesscope messages:readMessages in a conversation, newest first, paginated with cursor.
/v1/templatesscope templates:readYour templates. Filter with status=approved. param_count tells you how many values to send.
Response
{ "data": [ { "id": 5, "name": "order_ready", "category": "utility", "status": "approved", "param_count": 2 } ] }Account
/v1/mescope contacts:readCheck that your key works: workspace, the scopes on the key and whether WhatsApp is connected.
Response
{ "workspace": { "id": 3, "name": "Sri Sai Interiors" }, "auth": "api_key", "scopes": ["contacts:read"], "whatsapp": { "connected": true, "number": "+91 98765 43210" } }/v1/walletscope wallet:readPrepaid balance used for Meta's message fees.
Response
{ "balance_inr": 842.5, "low": false }Webhooks
/v1/webhooksscope webhooks:manageSubscribe an https URL to events (empty list means all). The signing secret is returned once.
Request
{ "url": "https://yourapp.com/hooks/basenode", "events": ["message.received", "payment.received"] }/v1/webhooksscope webhooks:manageYour endpoints.
/v1/webhooks/eventsscope webhooks:manageEvery event name you can subscribe to.
/v1/webhooks/{id}scope webhooks:manageStop sending events to a URL.
Webhooks: events we send you
Each event is a POST with a JSON body { "event": "...", "created_at": "...", "data": {...} }. Reply with any 2xx within 8 seconds. Failures are retried twice, and you can resend any past delivery from Settings.
message.receivedmessage.statusconversation.resolvedcontact.createdcontact.opted_outform.submittedcsat.receivedcampaign.completeddeal.stage_changedpayment.receivedappointment.createdtemplate.statusVerify the signature
Headers: X-Basenode-Signature-V2 looks like t=1760000000,v1=ab12… and is an HMAC-SHA256 (hex) of timestamp + "." + raw body using your endpoint's signing secret. Reject deliveries whose timestamp is more than 5 minutes old, so recorded requests can't be replayed. X-Basenode-Delivery is a unique id you can use to ignore duplicates. The older X-Basenode-Signature (body only) is still sent.
# Python
import hmac, hashlib, time
def valid(secret: str, raw_body: bytes, header: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > 300:
return False
expected = hmac.new(secret.encode(), parts["t"].encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])// Node.js
import crypto from "node:crypto";
export function valid(secret, rawBody, header) {
const p = Object.fromEntries(header.split(",").map((x) => x.split("=")));
if (Math.abs(Date.now() / 1000 - Number(p.t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(p.t + "." + rawBody).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(p.v1));
}Good habits
- Always send an
Idempotency-Keywhen a retry is possible, such as from a queue or a payment webhook. - Record consent. Marketing templates to a new person need
consent: truewith aconsent_source, and we store it as your proof. - Use the template's
param_countrather than guessing, and checkwindow_openbefore sending free text. - Keep keys on your server. Never put one in a browser app or mobile app. If one leaks, revoke it in Settings and create a new one.
- Store the webhook
X-Basenode-Deliveryid and ignore repeats. Delivery is at least once.
Looking for no-code? See Zapier, Make, n8n and inbound lead URLs.
Build something with it
Free to start. Create a key in Settings, Developer API.