curl --request POST \
--url https://api.contractorscloud.com/api/v1/leads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Lead-Connection-Id: <x-lead-connection-id>' \
--data '
[
{
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
"phone": "(555) 201-4477"
},
{
"first_name": "Thomas",
"last_name": "Miller",
"email": "thomas.miller@example.com",
"phone": "(555) 201-8890"
}
]
'import requests
url = "https://api.contractorscloud.com/api/v1/leads"
payload = [
{
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
"phone": "(555) 201-4477"
},
{
"first_name": "Thomas",
"last_name": "Miller",
"email": "thomas.miller@example.com",
"phone": "(555) 201-8890"
}
]
headers = {
"X-Lead-Connection-Id": "<x-lead-connection-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Lead-Connection-Id': '<x-lead-connection-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify([
{
first_name: 'Jane',
last_name: 'Smith',
email: 'jane.smith@example.com',
phone: '(555) 201-4477'
},
{
first_name: 'Thomas',
last_name: 'Miller',
email: 'thomas.miller@example.com',
phone: '(555) 201-8890'
}
])
};
fetch('https://api.contractorscloud.com/api/v1/leads', 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/leads",
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([
[
'first_name' => 'Jane',
'last_name' => 'Smith',
'email' => 'jane.smith@example.com',
'phone' => '(555) 201-4477'
],
[
'first_name' => 'Thomas',
'last_name' => 'Miller',
'email' => 'thomas.miller@example.com',
'phone' => '(555) 201-8890'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Lead-Connection-Id: <x-lead-connection-id>"
],
]);
$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/leads"
payload := strings.NewReader("[\n {\n \"first_name\": \"Jane\",\n \"last_name\": \"Smith\",\n \"email\": \"jane.smith@example.com\",\n \"phone\": \"(555) 201-4477\"\n },\n {\n \"first_name\": \"Thomas\",\n \"last_name\": \"Miller\",\n \"email\": \"thomas.miller@example.com\",\n \"phone\": \"(555) 201-8890\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Lead-Connection-Id", "<x-lead-connection-id>")
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/leads")
.header("X-Lead-Connection-Id", "<x-lead-connection-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"first_name\": \"Jane\",\n \"last_name\": \"Smith\",\n \"email\": \"jane.smith@example.com\",\n \"phone\": \"(555) 201-4477\"\n },\n {\n \"first_name\": \"Thomas\",\n \"last_name\": \"Miller\",\n \"email\": \"thomas.miller@example.com\",\n \"phone\": \"(555) 201-8890\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/leads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Lead-Connection-Id"] = '<x-lead-connection-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"first_name\": \"Jane\",\n \"last_name\": \"Smith\",\n \"email\": \"jane.smith@example.com\",\n \"phone\": \"(555) 201-4477\"\n },\n {\n \"first_name\": \"Thomas\",\n \"last_name\": \"Miller\",\n \"email\": \"thomas.miller@example.com\",\n \"phone\": \"(555) 201-8890\"\n }\n]"
response = http.request(request)
puts response.read_body{
"message": "2 leads detected and queued for processing.",
"transaction_id": "e1a4c9d2-6b7f-4a3e-9c8d-1f2b3a4c5d6e"
}{
"message": "Unauthenticated."
}{
"message": "Lead Connection (3f9a2b6c-1d4e-4a8b-9c2f-7e5d6a1b8c30) is currently not active."
}{
"message": "No leads detected. Please provide at least one lead in json format.",
"errors": {
"leads_exist": [
"No leads detected. Please provide at least one lead in json format."
]
}
}{
"message": "You have reached your limit of 300 leads per minute. You may try again in 42 seconds."
}Submit leads
Submits one or more leads to a lead connection for asynchronous processing. Send the request body in the format your connection’s data_type accepts: a JSON object or array for json connections, an uploaded spreadsheet for excel connections, or a raw text body with a text/plain content type for text connections (parsed automatically). The response returns immediately with a transaction_id, before processing finishes — poll List leads with filter[transaction_id] to check on the leads it created.
curl --request POST \
--url https://api.contractorscloud.com/api/v1/leads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Lead-Connection-Id: <x-lead-connection-id>' \
--data '
[
{
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
"phone": "(555) 201-4477"
},
{
"first_name": "Thomas",
"last_name": "Miller",
"email": "thomas.miller@example.com",
"phone": "(555) 201-8890"
}
]
'import requests
url = "https://api.contractorscloud.com/api/v1/leads"
payload = [
{
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
"phone": "(555) 201-4477"
},
{
"first_name": "Thomas",
"last_name": "Miller",
"email": "thomas.miller@example.com",
"phone": "(555) 201-8890"
}
]
headers = {
"X-Lead-Connection-Id": "<x-lead-connection-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Lead-Connection-Id': '<x-lead-connection-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify([
{
first_name: 'Jane',
last_name: 'Smith',
email: 'jane.smith@example.com',
phone: '(555) 201-4477'
},
{
first_name: 'Thomas',
last_name: 'Miller',
email: 'thomas.miller@example.com',
phone: '(555) 201-8890'
}
])
};
fetch('https://api.contractorscloud.com/api/v1/leads', 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/leads",
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([
[
'first_name' => 'Jane',
'last_name' => 'Smith',
'email' => 'jane.smith@example.com',
'phone' => '(555) 201-4477'
],
[
'first_name' => 'Thomas',
'last_name' => 'Miller',
'email' => 'thomas.miller@example.com',
'phone' => '(555) 201-8890'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Lead-Connection-Id: <x-lead-connection-id>"
],
]);
$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/leads"
payload := strings.NewReader("[\n {\n \"first_name\": \"Jane\",\n \"last_name\": \"Smith\",\n \"email\": \"jane.smith@example.com\",\n \"phone\": \"(555) 201-4477\"\n },\n {\n \"first_name\": \"Thomas\",\n \"last_name\": \"Miller\",\n \"email\": \"thomas.miller@example.com\",\n \"phone\": \"(555) 201-8890\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Lead-Connection-Id", "<x-lead-connection-id>")
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/leads")
.header("X-Lead-Connection-Id", "<x-lead-connection-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"first_name\": \"Jane\",\n \"last_name\": \"Smith\",\n \"email\": \"jane.smith@example.com\",\n \"phone\": \"(555) 201-4477\"\n },\n {\n \"first_name\": \"Thomas\",\n \"last_name\": \"Miller\",\n \"email\": \"thomas.miller@example.com\",\n \"phone\": \"(555) 201-8890\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/leads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Lead-Connection-Id"] = '<x-lead-connection-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"first_name\": \"Jane\",\n \"last_name\": \"Smith\",\n \"email\": \"jane.smith@example.com\",\n \"phone\": \"(555) 201-4477\"\n },\n {\n \"first_name\": \"Thomas\",\n \"last_name\": \"Miller\",\n \"email\": \"thomas.miller@example.com\",\n \"phone\": \"(555) 201-8890\"\n }\n]"
response = http.request(request)
puts response.read_body{
"message": "2 leads detected and queued for processing.",
"transaction_id": "e1a4c9d2-6b7f-4a3e-9c8d-1f2b3a4c5d6e"
}{
"message": "Unauthenticated."
}{
"message": "Lead Connection (3f9a2b6c-1d4e-4a8b-9c2f-7e5d6a1b8c30) is currently not active."
}{
"message": "No leads detected. Please provide at least one lead in json format.",
"errors": {
"leads_exist": [
"No leads detected. Please provide at least one lead in json format."
]
}
}{
"message": "You have reached your limit of 300 leads per minute. You may try again in 42 seconds."
}Authorizations
Headers
Body
- object
- object[]
A single lead as key/value pairs. Field names are defined by your connection's field mapping.
Response
The leads were detected and queued for processing.
Groups every lead created from this submission. Filter List leads by filter[transaction_id] to retrieve them.