postLead
This endpoint allows you to submit a lead. After undergoing a series of checks the lead will either be accepted or rejected. A successful response will return a preliminary acceptance message. if the call back url is set, the final result message will be sent to the call back url. Most rejections will occur before the lead is posted but some may occur after the lead is posted. If the lead is rejected after being posted, the final rejection message will be sent to the call back url. This means while a lead may be accepted initially, it may be rejected later.
postLead
- Name
phone_number- Type
- string
- Required
- Required
- Example
- Ex: 999999999
- Description
Phone number to check.
- Name
customer_name- Type
- string
- Required
- Required
- Example
- Ex: John Doe
- Description
Name of the customer.
- Name
state- Type
- string
- Required
- Required
- Example
- Ex: CA
- Description
2 letter State code of the customer.
- Name
city- Type
- string
- Required
- Required
- Example
- Ex: Los Angeles
- Description
City of the customer.
- Name
zip- Type
- string
- Required
- Required
- Example
- Ex: 90001
- Description
ZIP code of the customer.
- Name
certificate_url- Type
- string
- Required
- Required
- Example
- Ex: https://example.com/certificate.pdf
- Description
URL of the certificate.
- Name
street- Type
- string
- Required
- Required
- Example
- Ex: 123 Main St
- Description
Address of the customer.
- Name
dm_name- Type
- string
- required
- required
- Example
- Ex: Jane Doe
- Description
Name of the decision maker.
- Name
utility- Type
- string
- required
- required
- Example
- Ex: Utility Provider
- Description
Utility provider of the customer.
- Name
call_back_url- Type
- string
- required
- required
- Example
- Ex: https://example.com/callback
- Description
URL for callback.
- Name
mailing_street- Type
- string
- required
- required
- Example
- Ex: 456 Secondary St
- Description
Mailing street address of the customer.
- Name
mailing_city- Type
- string
- required
- required
- Example
- Ex: San Francisco
- Description
Mailing city of the customer.
- Name
mailing_zip- Type
- string
- required
- required
- Example
- Ex: 94101
- Description
Mailing ZIP code of the customer.
- Name
mailing_state- Type
- string
- required
- required
- Example
- Ex: CA
- Description
Mailing state of the customer.
- Name
vendor_campaign_name- Type
- string
- Required
- Required
- Example
- Ex: OHIO_GENERAL_RESIDENTIAL
- Description
Name of the Campaign associated with the submission
- Name
email- Type
- string
- Required
- Required
- Example
- Ex: john.doe@example.com
- Description
Email address of the customer.
- Name
extra_data- Type
- json
- Required
- Required
- Example
- Ex: {"key": "value"} OR [{"key": "value"}]
- Description
required if certificate_url is not provided. Any combination of key-value pairs or arrays is accepted.
Request
const response = await fetch('https://api.ntherm.com/v1/postLead', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(username + ':' + password)}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone_number: '999999999',
customer_name: 'John Doe',
state: 'CA',
city: 'Los Angeles',
zip: '90001',
certificate_url: 'https://example.com/certificate.pdf',
customer_address: '123 Main St',
dm_name: 'Jane Doe',
utility: 'Utility Provider',
call_back_url: 'https://example.com/callback',
mailing_street: '456 Secondary St',
mailing_city: 'San Francisco',
mailing_zip: '94101',
mailing_state: 'CA',
vendor_campaign_name: 'OHIO_GENERAL_RESIDENTIAL',
email: 'john.doe@example.com',
extra_data: [{'questions':['Do you consent to be contacted?','Do you agree to the terms and conditions?']}, {'answers':['Yes','Yes']}],
})
});
const data = await response.json();
Response
HTTP/1.1 200 OK
{
"success_bit": true,
"message": "Lead submitted successfully."
}
Response
HTTP/1.1 422 Unprocessable Entity
{
"success_bit": false,
"message": [{"error": "Phone number can not be sent to postLead at this time."}]
}
Response
HTTP/1.1 400 Bad Request
{
"success_bit": false,
,"message":[{"error":"Invalid Characters: 7271234567x"}]
}
Response
HTTP/1.1 400 Bad Request
{
"success_bit": false,
"message":[{"error":"Invalid State Code (2 characters): C"},{"error":"Certificate URL exceeds 500 characters, or not a valid URL ://example.com/certificate.pdf"},{"error":"Invalid Mailing State Code: CA3"}]}