Create rep assignment
curl --request POST \
--url https://api.contractorscloud.com/api/v1/lead-connections/{leadConnectionId}/rep-assignments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"rep_id": 1159
}'import requests
url = "https://api.contractorscloud.com/api/v1/lead-connections/{leadConnectionId}/rep-assignments"
payload = { "rep_id": 1159 }
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({rep_id: 1159})
};
fetch('https://api.contractorscloud.com/api/v1/lead-connections/{leadConnectionId}/rep-assignments', 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/{leadConnectionId}/rep-assignments",
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([
'rep_id' => 1159
]),
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/{leadConnectionId}/rep-assignments"
payload := strings.NewReader("{\n \"rep_id\": 1159\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/{leadConnectionId}/rep-assignments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rep_id\": 1159\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/lead-connections/{leadConnectionId}/rep-assignments")
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 \"rep_id\": 1159\n}"
response = http.request(request)
puts response.read_body{
"id": "6f3a9c1e-4b7d-4e2a-8f5c-1d9b3a6e7c20",
"tenant_id": 12,
"lead_connection_id": "3f9a2b6c-1d4e-4a8b-9c2f-7e5d6a1b8c30",
"rep_id": 1159,
"last_lead_assigned_at": null,
"created_at": "2025-02-11 09:00:00",
"updated_at": "2025-02-11 09:00:00"
}{
"message": "Unauthenticated."
}{
"message": "The requested resource could not be found."
}{
"message": "This rep is already assigned to this lead connection.",
"errors": {
"rep_id": [
"This rep is already assigned to this lead connection."
]
}
}Rep Assignments
Create rep assignment
Adds a rep to a lead connection’s round-robin rotation. rep_id must be a user assigned to the connection’s company, and can only be assigned to the same connection once.
POST
/
lead-connections
/
{leadConnectionId}
/
rep-assignments
Create rep assignment
curl --request POST \
--url https://api.contractorscloud.com/api/v1/lead-connections/{leadConnectionId}/rep-assignments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"rep_id": 1159
}'import requests
url = "https://api.contractorscloud.com/api/v1/lead-connections/{leadConnectionId}/rep-assignments"
payload = { "rep_id": 1159 }
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({rep_id: 1159})
};
fetch('https://api.contractorscloud.com/api/v1/lead-connections/{leadConnectionId}/rep-assignments', 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/{leadConnectionId}/rep-assignments",
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([
'rep_id' => 1159
]),
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/{leadConnectionId}/rep-assignments"
payload := strings.NewReader("{\n \"rep_id\": 1159\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/{leadConnectionId}/rep-assignments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rep_id\": 1159\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/lead-connections/{leadConnectionId}/rep-assignments")
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 \"rep_id\": 1159\n}"
response = http.request(request)
puts response.read_body{
"id": "6f3a9c1e-4b7d-4e2a-8f5c-1d9b3a6e7c20",
"tenant_id": 12,
"lead_connection_id": "3f9a2b6c-1d4e-4a8b-9c2f-7e5d6a1b8c30",
"rep_id": 1159,
"last_lead_assigned_at": null,
"created_at": "2025-02-11 09:00:00",
"updated_at": "2025-02-11 09:00:00"
}{
"message": "Unauthenticated."
}{
"message": "The requested resource could not be found."
}{
"message": "This rep is already assigned to this lead connection.",
"errors": {
"rep_id": [
"This rep is already assigned to this lead connection."
]
}
}Authorizations
Body
application/json
Response
The created rep assignment.
Timestamp when this rep was last assigned a lead, formatted as YYYY-MM-DD HH:MM:SS. Null if this rep hasn't been assigned a lead yet, which puts them first in line for the next one. The rotation always assigns to whichever assigned rep has waited longest.
Example:
"2025-02-09 16:40:12"