SwiftCRM

API reference

What you'll achieve: Send leads to SwiftCRM from any server or frontend using the Lead API. Correct headers and body format.

Endpoint

POST https://swiftcrm.in/api/public/lead

Authentication: project API key. Pass it via one of:

  • X-Api-Key: YOUR_PROJECT_API_KEY
  • Authorization: Bearer YOUR_PROJECT_API_KEY
  • Query: ?api_key=YOUR_PROJECT_API_KEY (less secure; prefer headers)

Request body (JSON)

All fields are optional, but send at least one of name, email, or phone for a useful lead.

FieldTypeDescription
namestringMax 255
emailstring (email)Max 255
phonestringMax 50
attributesobjectCustom key-value data
source_urlstringPage URL (max 2048)
referrerstringReferrer URL (max 2048)
utmobjectUTM params (e.g. utm_source, utm_medium)
page_trailarray of stringsPage view history

Responses

201 Created

{
  "code": "LEAD_CREATED",
  "message": "Lead captured.",
  "request_id": "req_...",
  "lead_id": 123
}

401 Unauthorized — Invalid or missing API key

{
  "code": "INVALID_API_KEY",
  "message": "Invalid or missing project API key.",
  "request_id": "..."
}

403 Forbidden — Domain not allowed

{
  "code": "DOMAIN_NOT_ALLOWED",
  "message": "Origin or Referer not in project allowlist.",
  "request_id": "..."
}

429 Too Many Requests — Monthly lead limit reached

{
  "code": "PLAN_LIMIT_REACHED",
  "message": "Monthly lead limit reached. Please upgrade.",
  "request_id": "..."
}

WhatsApp webhook

When you connect a WhatsApp Business number, Meta calls these endpoints automatically — you don't need to call them yourself.

MethodPathDescription
GET/api/whatsapp/webhookMeta challenge-response verification (one-time setup)
POST/api/whatsapp/webhookReceive incoming messages → create leads

Both require ?api_key=YOUR_PROJECT_API_KEY. The webhook URL and verify token are shown in Project → Settings → WhatsApp.

Health endpoints

Infrastructure probes — no authentication required.

EndpointDescription
GET /api/healthReturns {"status":"ok"} when the app process is running. Use for liveness probes.
GET /api/readyReturns {"status":"ready"} only when DB and Redis are reachable. Use for readiness probes.

See Examples for curl, JavaScript, and PHP.