Leads
Update Lead by ID
Update one lead by its Octanist ID with PATCH /api/leads/: status, value, note, lost reason, contact details in set and the won conversion, without identifier matching.
PATCH
/
api
/
leads
/
{id}
Update Lead by ID
curl --request PATCH \
--url https://octanist.com/api/leads/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"status": "won",
"changedTo": "won",
"value": 5000,
"note": "<string>",
"lossReason": "<string>",
"set": {
"externalId": "CRM-88412",
"name": "John Doe",
"email": "new@example.com",
"phone": "+31612345678",
"custom": {
"company": "Acme Inc",
"fax": null
},
"labelId": "label_xyz"
},
"conversionEventId": "conv_won_subscription"
}
'import requests
url = "https://octanist.com/api/leads/{id}"
payload = {
"status": "won",
"changedTo": "won",
"value": 5000,
"note": "<string>",
"lossReason": "<string>",
"set": {
"externalId": "CRM-88412",
"name": "John Doe",
"email": "new@example.com",
"phone": "+31612345678",
"custom": {
"company": "Acme Inc",
"fax": None
},
"labelId": "label_xyz"
},
"conversionEventId": "conv_won_subscription"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
status: 'won',
changedTo: 'won',
value: 5000,
note: '<string>',
lossReason: '<string>',
set: {
externalId: 'CRM-88412',
name: 'John Doe',
email: 'new@example.com',
phone: '+31612345678',
custom: {company: 'Acme Inc', fax: null},
labelId: 'label_xyz'
},
conversionEventId: 'conv_won_subscription'
})
};
fetch('https://octanist.com/api/leads/{id}', 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://octanist.com/api/leads/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'won',
'changedTo' => 'won',
'value' => 5000,
'note' => '<string>',
'lossReason' => '<string>',
'set' => [
'externalId' => 'CRM-88412',
'name' => 'John Doe',
'email' => 'new@example.com',
'phone' => '+31612345678',
'custom' => [
'company' => 'Acme Inc',
'fax' => null
],
'labelId' => 'label_xyz'
],
'conversionEventId' => 'conv_won_subscription'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://octanist.com/api/leads/{id}"
payload := strings.NewReader("{\n \"status\": \"won\",\n \"changedTo\": \"won\",\n \"value\": 5000,\n \"note\": \"<string>\",\n \"lossReason\": \"<string>\",\n \"set\": {\n \"externalId\": \"CRM-88412\",\n \"name\": \"John Doe\",\n \"email\": \"new@example.com\",\n \"phone\": \"+31612345678\",\n \"custom\": {\n \"company\": \"Acme Inc\",\n \"fax\": null\n },\n \"labelId\": \"label_xyz\"\n },\n \"conversionEventId\": \"conv_won_subscription\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.patch("https://octanist.com/api/leads/{id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"won\",\n \"changedTo\": \"won\",\n \"value\": 5000,\n \"note\": \"<string>\",\n \"lossReason\": \"<string>\",\n \"set\": {\n \"externalId\": \"CRM-88412\",\n \"name\": \"John Doe\",\n \"email\": \"new@example.com\",\n \"phone\": \"+31612345678\",\n \"custom\": {\n \"company\": \"Acme Inc\",\n \"fax\": null\n },\n \"labelId\": \"label_xyz\"\n },\n \"conversionEventId\": \"conv_won_subscription\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://octanist.com/api/leads/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"won\",\n \"changedTo\": \"won\",\n \"value\": 5000,\n \"note\": \"<string>\",\n \"lossReason\": \"<string>\",\n \"set\": {\n \"externalId\": \"CRM-88412\",\n \"name\": \"John Doe\",\n \"email\": \"new@example.com\",\n \"phone\": \"+31612345678\",\n \"custom\": {\n \"company\": \"Acme Inc\",\n \"fax\": null\n },\n \"labelId\": \"label_xyz\"\n },\n \"conversionEventId\": \"conv_won_subscription\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"matched": true,
"leadId": "lead_abc123",
"externalId": "QUOTE-2026-0042",
"leadsUpdated": 1,
"leads": [
{
"id": "lead_abc123",
"externalId": "QUOTE-2026-0042",
"status": "won",
"value": 5000,
"labelId": null,
"conversionEventId": null,
"locked": false
}
],
"warnings": [
"Status not changed on lead lead_abc123: it is already won. Send \"status\": \"open\" first to reopen it."
],
"message": "Lead updated successfully"
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}Update one lead that you name by its Octanist ID in the URL. The body takes the same changes as
The status rules are the same as for
The response fields and
PATCH /api/leads, without the identifiers.
Use this endpoint when you stored the Octanist lead ID, for example from the response of POST /api/leads. Use PATCH /api/leads when you only know the email, phone or your own external ID.
Differences with PATCH /api/leads:
- The URL names the lead. Sending
id,externalId,emailorphonein the body returns400 VALIDATION_ERROR. To change contact details or the external ID, send them inset. - An unknown ID returns
404 NOT_FOUND. It is not kept as a pending update and not logged as a missed update. - There is no matching, so the Multiple Match Behavior and Same-Company Lead Matching settings do not apply.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Octanist lead ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
status | string | No | New status: open, qualified, won, or lost. open reopens a lead. |
changedTo | string | No | Legacy alias for status: qualified, won, or lost |
value | number | string | No | Lead value. Strings such as "1.234,56" or "1,234.56" are converted to numbers. Negative values return 400. |
note | string | No | Note to attach to the lead |
lossReason | string | No | Reason for loss (only used when status is lost) |
set | object | No | New values for externalId, name, email, phone, custom and labelId. null clears a field. See Changing lead fields with set. |
conversionEventId | string | No | Won conversion to send when the lead is won, now or later. See Choosing the won conversion. |
PATCH /api/leads.
Example Request
curl -X PATCH \
-H "X-API-KEY: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"status": "won",
"value": "1.250,50",
"set": {
"externalId": "CRM-88412",
"labelId": "label_xyz"
}
}' \
"https://octanist.com/api/leads/lead_abc123"
Example Response
{
"success": true,
"data": {
"matched": true,
"leadId": "lead_abc123",
"externalId": "CRM-88412",
"leadsUpdated": 1,
"leads": [
{
"id": "lead_abc123",
"externalId": "CRM-88412",
"status": "won",
"value": 1250.5,
"labelId": "label_xyz",
"conversionEventId": null,
"locked": false
}
],
"message": "Lead updated successfully"
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}
warnings are the same as for PATCH /api/leads.
Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid JSON, identifiers in the body, invalid value or status, unknown keys in set, an unknown labelId or conversionEventId, or a won update without a value above 0 |
| 401 | UNAUTHORIZED | Missing or invalid API key |
| 403 | FORBIDDEN | A read-only API key, or the organization is a read-only demo |
| 404 | NOT_FOUND | No lead with this ID in your organization |
| 409 | CONFLICT | set.externalId belongs to another lead, or the lead was changed by another update at the same time (retry the request) |
| 500 | INTERNAL_ERROR | Unexpected server error. Retry the request, or contact support with the requestId. |
Body
application/json
The changes of PATCH /api/leads without identifiers: the URL names the lead. Sending id, externalId, email or phone returns 400.
⌘I
Update Lead by ID
curl --request PATCH \
--url https://octanist.com/api/leads/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"status": "won",
"changedTo": "won",
"value": 5000,
"note": "<string>",
"lossReason": "<string>",
"set": {
"externalId": "CRM-88412",
"name": "John Doe",
"email": "new@example.com",
"phone": "+31612345678",
"custom": {
"company": "Acme Inc",
"fax": null
},
"labelId": "label_xyz"
},
"conversionEventId": "conv_won_subscription"
}
'import requests
url = "https://octanist.com/api/leads/{id}"
payload = {
"status": "won",
"changedTo": "won",
"value": 5000,
"note": "<string>",
"lossReason": "<string>",
"set": {
"externalId": "CRM-88412",
"name": "John Doe",
"email": "new@example.com",
"phone": "+31612345678",
"custom": {
"company": "Acme Inc",
"fax": None
},
"labelId": "label_xyz"
},
"conversionEventId": "conv_won_subscription"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
status: 'won',
changedTo: 'won',
value: 5000,
note: '<string>',
lossReason: '<string>',
set: {
externalId: 'CRM-88412',
name: 'John Doe',
email: 'new@example.com',
phone: '+31612345678',
custom: {company: 'Acme Inc', fax: null},
labelId: 'label_xyz'
},
conversionEventId: 'conv_won_subscription'
})
};
fetch('https://octanist.com/api/leads/{id}', 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://octanist.com/api/leads/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'won',
'changedTo' => 'won',
'value' => 5000,
'note' => '<string>',
'lossReason' => '<string>',
'set' => [
'externalId' => 'CRM-88412',
'name' => 'John Doe',
'email' => 'new@example.com',
'phone' => '+31612345678',
'custom' => [
'company' => 'Acme Inc',
'fax' => null
],
'labelId' => 'label_xyz'
],
'conversionEventId' => 'conv_won_subscription'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://octanist.com/api/leads/{id}"
payload := strings.NewReader("{\n \"status\": \"won\",\n \"changedTo\": \"won\",\n \"value\": 5000,\n \"note\": \"<string>\",\n \"lossReason\": \"<string>\",\n \"set\": {\n \"externalId\": \"CRM-88412\",\n \"name\": \"John Doe\",\n \"email\": \"new@example.com\",\n \"phone\": \"+31612345678\",\n \"custom\": {\n \"company\": \"Acme Inc\",\n \"fax\": null\n },\n \"labelId\": \"label_xyz\"\n },\n \"conversionEventId\": \"conv_won_subscription\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.patch("https://octanist.com/api/leads/{id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"won\",\n \"changedTo\": \"won\",\n \"value\": 5000,\n \"note\": \"<string>\",\n \"lossReason\": \"<string>\",\n \"set\": {\n \"externalId\": \"CRM-88412\",\n \"name\": \"John Doe\",\n \"email\": \"new@example.com\",\n \"phone\": \"+31612345678\",\n \"custom\": {\n \"company\": \"Acme Inc\",\n \"fax\": null\n },\n \"labelId\": \"label_xyz\"\n },\n \"conversionEventId\": \"conv_won_subscription\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://octanist.com/api/leads/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"won\",\n \"changedTo\": \"won\",\n \"value\": 5000,\n \"note\": \"<string>\",\n \"lossReason\": \"<string>\",\n \"set\": {\n \"externalId\": \"CRM-88412\",\n \"name\": \"John Doe\",\n \"email\": \"new@example.com\",\n \"phone\": \"+31612345678\",\n \"custom\": {\n \"company\": \"Acme Inc\",\n \"fax\": null\n },\n \"labelId\": \"label_xyz\"\n },\n \"conversionEventId\": \"conv_won_subscription\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"matched": true,
"leadId": "lead_abc123",
"externalId": "QUOTE-2026-0042",
"leadsUpdated": 1,
"leads": [
{
"id": "lead_abc123",
"externalId": "QUOTE-2026-0042",
"status": "won",
"value": 5000,
"labelId": null,
"conversionEventId": null,
"locked": false
}
],
"warnings": [
"Status not changed on lead lead_abc123: it is already won. Send \"status\": \"open\" first to reopen it."
],
"message": "Lead updated successfully"
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable error message",
"details": {}
},
"meta": {
"requestId": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-10T12:00:00.000Z"
}
}