Widget API Documentation

Embed customizable forms and widgets on your website to capture leads directly into GHL. The Widget API automatically creates contacts and can optionally generate opportunities based on form submissions.

Widget Submission Form

Lead Information

Request Preview

Method: POST

URL: /api/widget/test-location-123

Headers:

{
  "Content-Type": "application/json",
  "m4-connect-key": "[your-api-key]"
}

Body:

API Reference

Request Body Schema

firstName

string (required) - First name of the lead

lastName

string (optional) - Last name of the lead

email

string (optional) - Email address of the lead

phone

string (optional) - Phone number of the lead

message

string (optional) - Message or inquiry from the lead

Response Schema

{
  "success": true,
  "data": {
    "id": "contact-id",
    "contactId": "contact-id",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@example.com",
    "phone": "+1234567890"
  }
}

Error Responses

400 Bad Request

Missing required fields or invalid data format

401 Unauthorized

Invalid or missing API key header

500 Server Error

Internal server error while processing request