baseNode
API reference

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 URL
https://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:send
POST /v1/messages, POST /v1/media, POST /send
messages:read
GET /v1/messages/{id}, GET /v1/conversations/{id}/messages
contacts:read
GET /v1/contacts, GET /v1/contacts/{id}, GET /v1/me
contacts:write
POST /v1/contacts, PATCH /v1/contacts/{id}
conversations:read
GET /v1/conversations
templates:read
GET /v1/templates
wallet:read
GET /v1/wallet
webhooks:manage
GET, POST, DELETE /v1/webhooks

Messages

POST/v1/messagesscope messages:send

Send 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 }
POST/v1/mediascope messages:send

Upload 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 }
GET/v1/messages/{id}scope messages:read

Delivery status: queued, sent, delivered, read or failed (with an error).

Response
{ "id": 812, "status": "delivered", "type": "template", "cost_inr": 0.115, "error": null }

Contacts

GET/v1/contactsscope contacts:read

List 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 }
POST/v1/contactsscope contacts:write

Create 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"] } }
GET/v1/contacts/{id}scope contacts:read

One contact.

PATCH/v1/contacts/{id}scope contacts:write

Change 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

GET/v1/conversationsscope conversations:read

Newest 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 }
GET/v1/conversations/{id}/messagesscope messages:read

Messages in a conversation, newest first, paginated with cursor.

GET/v1/templatesscope templates:read

Your 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

GET/v1/mescope contacts:read

Check 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" } }
GET/v1/walletscope wallet:read

Prepaid balance used for Meta's message fees.

Response
{ "balance_inr": 842.5, "low": false }

Webhooks

POST/v1/webhooksscope webhooks:manage

Subscribe 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"] }
GET/v1/webhooksscope webhooks:manage

Your endpoints.

GET/v1/webhooks/eventsscope webhooks:manage

Every event name you can subscribe to.

DELETE/v1/webhooks/{id}scope webhooks:manage

Stop 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.received
A customer sends a message
message.status
A sent message is delivered, read or fails
conversation.resolved
A chat is resolved
contact.created
A new contact is added
contact.opted_out
Someone sends STOP
form.submitted
A WhatsApp form is completed
csat.received
A customer rates the chat
campaign.completed
A campaign finishes
deal.stage_changed
A deal moves stage
payment.received
A payment link is paid
appointment.created
A booking is made
template.status
Meta approves, rejects or pauses a template

Verify 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-Key when a retry is possible, such as from a queue or a payment webhook.
  • Record consent. Marketing templates to a new person need consent: true with a consent_source, and we store it as your proof.
  • Use the template's param_count rather than guessing, and check window_open before 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-Delivery id 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.