Create lead connection
curl --request POST \
--url https://api.contractorscloud.com/api/v1/lead-connections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"company_id": 6,
"lead_source_id": 44,
"rep_primary_id": 1159,
"data_type": "json",
"name": "Website Contact Form",
"description": "Leads submitted from the marketing site's contact form."
}
EOFimport requests
url = "https://api.contractorscloud.com/api/v1/lead-connections"
payload = {
"company_id": 6,
"lead_source_id": 44,
"rep_primary_id": 1159,
"data_type": "json",
"name": "Website Contact Form",
"description": "Leads submitted from the marketing site's contact form."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
company_id: 6,
lead_source_id: 44,
rep_primary_id: 1159,
data_type: 'json',
name: 'Website Contact Form',
description: 'Leads submitted from the marketing site\'s contact form.'
})
};
fetch('https://api.contractorscloud.com/api/v1/lead-connections', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.contractorscloud.com/api/v1/lead-connections",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'company_id' => 6,
'lead_source_id' => 44,
'rep_primary_id' => 1159,
'data_type' => 'json',
'name' => 'Website Contact Form',
'description' => 'Leads submitted from the marketing site\'s contact form.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.contractorscloud.com/api/v1/lead-connections"
payload := strings.NewReader("{\n \"company_id\": 6,\n \"lead_source_id\": 44,\n \"rep_primary_id\": 1159,\n \"data_type\": \"json\",\n \"name\": \"Website Contact Form\",\n \"description\": \"Leads submitted from the marketing site's contact form.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.contractorscloud.com/api/v1/lead-connections")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"company_id\": 6,\n \"lead_source_id\": 44,\n \"rep_primary_id\": 1159,\n \"data_type\": \"json\",\n \"name\": \"Website Contact Form\",\n \"description\": \"Leads submitted from the marketing site's contact form.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/lead-connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"company_id\": 6,\n \"lead_source_id\": 44,\n \"rep_primary_id\": 1159,\n \"data_type\": \"json\",\n \"name\": \"Website Contact Form\",\n \"description\": \"Leads submitted from the marketing site's contact form.\"\n}"
response = http.request(request)
puts response.read_body{
"id": "5b8e3f2a-9c41-4d6b-8a2e-3f7c1d9b6e50",
"tenant_id": 12,
"company_id": 6,
"event_id": null,
"lead_source_id": 44,
"workflow_id": null,
"rep_primary_id": 1159,
"site_type_id": null,
"status_id": null,
"is_active": true,
"data_type": "json",
"name": "Website Contact Form",
"description": "Leads submitted from the marketing site's contact form.",
"created_at": "2025-02-10 10:00:00",
"updated_at": "2025-02-10 10:00:00",
"last_lead_received_at": null
}{
"message": "Unauthenticated."
}{
"message": "The first name field is required.",
"errors": {
"first_name": [
"The first name field is required."
]
}
}Lead Connections
Create lead connection
Creates a new lead connection for a company in your organization and returns the created resource.
POST
/
lead-connections
Create lead connection
curl --request POST \
--url https://api.contractorscloud.com/api/v1/lead-connections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"company_id": 6,
"lead_source_id": 44,
"rep_primary_id": 1159,
"data_type": "json",
"name": "Website Contact Form",
"description": "Leads submitted from the marketing site's contact form."
}
EOFimport requests
url = "https://api.contractorscloud.com/api/v1/lead-connections"
payload = {
"company_id": 6,
"lead_source_id": 44,
"rep_primary_id": 1159,
"data_type": "json",
"name": "Website Contact Form",
"description": "Leads submitted from the marketing site's contact form."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
company_id: 6,
lead_source_id: 44,
rep_primary_id: 1159,
data_type: 'json',
name: 'Website Contact Form',
description: 'Leads submitted from the marketing site\'s contact form.'
})
};
fetch('https://api.contractorscloud.com/api/v1/lead-connections', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.contractorscloud.com/api/v1/lead-connections",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'company_id' => 6,
'lead_source_id' => 44,
'rep_primary_id' => 1159,
'data_type' => 'json',
'name' => 'Website Contact Form',
'description' => 'Leads submitted from the marketing site\'s contact form.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.contractorscloud.com/api/v1/lead-connections"
payload := strings.NewReader("{\n \"company_id\": 6,\n \"lead_source_id\": 44,\n \"rep_primary_id\": 1159,\n \"data_type\": \"json\",\n \"name\": \"Website Contact Form\",\n \"description\": \"Leads submitted from the marketing site's contact form.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.contractorscloud.com/api/v1/lead-connections")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"company_id\": 6,\n \"lead_source_id\": 44,\n \"rep_primary_id\": 1159,\n \"data_type\": \"json\",\n \"name\": \"Website Contact Form\",\n \"description\": \"Leads submitted from the marketing site's contact form.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/lead-connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"company_id\": 6,\n \"lead_source_id\": 44,\n \"rep_primary_id\": 1159,\n \"data_type\": \"json\",\n \"name\": \"Website Contact Form\",\n \"description\": \"Leads submitted from the marketing site's contact form.\"\n}"
response = http.request(request)
puts response.read_body{
"id": "5b8e3f2a-9c41-4d6b-8a2e-3f7c1d9b6e50",
"tenant_id": 12,
"company_id": 6,
"event_id": null,
"lead_source_id": 44,
"workflow_id": null,
"rep_primary_id": 1159,
"site_type_id": null,
"status_id": null,
"is_active": true,
"data_type": "json",
"name": "Website Contact Form",
"description": "Leads submitted from the marketing site's contact form.",
"created_at": "2025-02-10 10:00:00",
"updated_at": "2025-02-10 10:00:00",
"last_lead_received_at": null
}{
"message": "Unauthenticated."
}{
"message": "The first name field is required.",
"errors": {
"first_name": [
"The first name field is required."
]
}
}Authorizations
Body
application/json
Response
The created lead connection.
The id of the company within your organization that owns this connection. See Company.
Example:
6
The id of the marketing event this connection is associated with. Null if not set. See Event.
The id of the lead source configured for the company that leads from this connection are attributed to. Null if not set. A lead source is a marketing channel configuration in Contractors Cloud — distinct from the Lead resource returned by this API. See Lead Source.
Example:
44
The id of the workflow assigned to projects created from leads through this connection. Null if not set. See Workflow.