LeadSail
Leads

Submit a lead

Submits a lead for processing through the qualification engine. Triggers routing, qualification, and delivery. This is the primary endpoint for external lead submissions.

POST
/api/v1/leads/submit

Authorization

ApiKeyAuth
X-API-Key<token>

API key generated from your Vayaflow dashboard Settings page

In: header

Request Body

application/json

leadId?string

Existing lead ID. When provided, the lead's existing data is used and the lead is re-submitted through the qualification engine. Contact fields become optional

campaignId*string

The campaign code to submit this lead to. This is the short 3-5 character code found on the campaign (e.g. HXZ)

Length1 <= length
firstName?string

Lead's first name. Required for new leads, optional when leadId is provided

lastName?string

Lead's last name. Required for new leads, optional when leadId is provided

email?string

Lead's email address. Required for new leads, optional when leadId is provided

Formatemail
phone?string

Lead's phone number with at least 10 digits. Can include +, dashes, spaces, and parentheses (e.g. +1 (555) 123-4567). Required for new leads, optional when leadId is provided

Length10 <= length
address?

Lead's mailing address

dateOfBirth?string

Date of birth in YYYY-MM-DD format (e.g. 1990-05-15)

country?string

Two-letter ISO country code, uppercase (e.g. US, CA, MX)

files?array<>

Array of file attachments (documents, images, etc.)

questionnaire?|array<>

Questionnaire answers. Accepts object format (keys mapped to questions via field library) or array format with explicit question labels. Defaults to {}

Default{}
attribution?

Marketing attribution and tracking data

compliance?

TCPA consent and compliance verification data

isTest?boolean

Set to true to mark this as a test lead. Test leads skip deduplication and pixel firing

timezone?string

Lead's IANA timezone (e.g. America/New_York, America/Los_Angeles)

notes?string

Internal notes about this lead

customFields?

Arbitrary custom fields as key-value pairs

Response Body

application/json

application/json

application/json

package mainimport (  "fmt"  "net/http"  "io/ioutil"  "strings")func main() {  url := "https://api.leadsail.app/api/v1/leads/submit"  body := strings.NewReader(`{    "campaignId": "HXZ",    "firstName": "Jane",    "lastName": "Smith",    "email": "jane.smith@example.com",    "phone": "+1 (555) 123-4567",    "address": {      "street": "123 Main St",      "city": "Phoenix",      "state": "AZ",      "zip": "85001"    },    "dateOfBirth": "1990-05-15",    "questionnaire": {      "looking_for": "home_insurance",      "homeowner": true    },    "attribution": {      "params": {        "utm_source": "facebook",        "utm_medium": "paid_social",        "utm_campaign": "spring_2024"      },      "fbclid": "fbclid_xyz789",      "captureUrl": "https://example.com/landing"    },    "isTest": false  }`)  req, _ := http.NewRequest("POST", url, body)  req.Header.Add("Content-Type", "application/json")  res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
{
  "success": true,
  "data": {
    "leadId": "string",
    "submissionId": "string",
    "status": "string"
  }
}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid input data",
    "details": [
      "string"
    ]
  }
}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Authentication required"
  }
}