Analyze Notes
curl --request POST \
--url https://api.example.com/v1/ai/analyze-notes \
--header 'Content-Type: application/json' \
--data '
{
"contact_id": "<string>",
"deal_id": "<string>",
"focus": "<string>",
"max_notes": 123
}
'import requests
url = "https://api.example.com/v1/ai/analyze-notes"
payload = {
"contact_id": "<string>",
"deal_id": "<string>",
"focus": "<string>",
"max_notes": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({contact_id: '<string>', deal_id: '<string>', focus: '<string>', max_notes: 123})
};
fetch('https://api.example.com/v1/ai/analyze-notes', 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.example.com/v1/ai/analyze-notes",
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([
'contact_id' => '<string>',
'deal_id' => '<string>',
'focus' => '<string>',
'max_notes' => 123
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/ai/analyze-notes"
payload := strings.NewReader("{\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"focus\": \"<string>\",\n \"max_notes\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/ai/analyze-notes")
.header("Content-Type", "application/json")
.body("{\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"focus\": \"<string>\",\n \"max_notes\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ai/analyze-notes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"focus\": \"<string>\",\n \"max_notes\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"summary": "<string>",
"key_points": [
{}
],
"risks": [
{}
],
"opportunities": [
{}
],
"sentiment": {},
"timeline": [
{}
],
"note_ids": [
{}
],
"credits_remaining": 123
}
}AI Analysis
Analyze Notes
Summarize and extract insights from all notes attached to a contact or deal
POST
/
v1
/
ai
/
analyze-notes
Analyze Notes
curl --request POST \
--url https://api.example.com/v1/ai/analyze-notes \
--header 'Content-Type: application/json' \
--data '
{
"contact_id": "<string>",
"deal_id": "<string>",
"focus": "<string>",
"max_notes": 123
}
'import requests
url = "https://api.example.com/v1/ai/analyze-notes"
payload = {
"contact_id": "<string>",
"deal_id": "<string>",
"focus": "<string>",
"max_notes": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({contact_id: '<string>', deal_id: '<string>', focus: '<string>', max_notes: 123})
};
fetch('https://api.example.com/v1/ai/analyze-notes', 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.example.com/v1/ai/analyze-notes",
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([
'contact_id' => '<string>',
'deal_id' => '<string>',
'focus' => '<string>',
'max_notes' => 123
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/ai/analyze-notes"
payload := strings.NewReader("{\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"focus\": \"<string>\",\n \"max_notes\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/ai/analyze-notes")
.header("Content-Type", "application/json")
.body("{\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"focus\": \"<string>\",\n \"max_notes\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ai/analyze-notes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"focus\": \"<string>\",\n \"max_notes\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"summary": "<string>",
"key_points": [
{}
],
"risks": [
{}
],
"opportunities": [
{}
],
"sentiment": {},
"timeline": [
{}
],
"note_ids": [
{}
],
"credits_remaining": 123
}
}This endpoint consumes AI credits. Each analysis costs 2 credits regardless of note count. If the workspace balance is insufficient, the API returns
402 insufficient_credits.Request
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
string
Optional UUID. Deduplicates retries within 24 hours.
Body Parameters
string
UUID of a contact whose notes should be analyzed. Provide either
contact_id or deal_id.string
UUID of a deal whose notes should be analyzed.
string
Optional focus area:
summary, risks, opportunities, sentiment, timeline, or all. Defaults to all.integer
default:"50"
Maximum number of notes to include (most recent first). Maximum 200.
Response
object
Show properties
Show properties
string
High-level narrative summary of all considered notes
array
Bulleted list of extracted key points
array
Identified risks, each with
description and severityarray
Extracted opportunities
object
label (positive/neutral/negative) and score (-1.0 to 1.0)array
Chronological events pulled from notes
array
IDs of notes included in the analysis
integer
Balance after this call
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID.
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/ai/analyze-notes \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"contact_id": "123e4567-e89b-12d3-a456-426614174000", "focus": "all"}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
r = requests.post(
f"{BASE_URL}/v1/ai/analyze-notes",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={"contact_id": "123e4567-e89b-12d3-a456-426614174000"},
)
print(r.json()["data"]["summary"])
const res = await fetch(
'https://data.leadlex.com/functions/v1/api-gateway/v1/ai/analyze-notes',
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({ contact_id: '123e4567-e89b-12d3-a456-426614174000' }),
}
);
const { data } = await res.json();
console.log(data.summary);
Example Response
{
"data": {
"summary": "Jane is actively exploring outside counsel for a Series B round. She has requested standard engagement terms and timelines.",
"key_points": [
"Looking for counsel to support Series B fundraise",
"Prefers flat-fee engagement over hourly",
"Expects kick-off in early Q3"
],
"risks": [
{ "description": "Competing proposals from two other firms", "severity": "medium" }
],
"opportunities": [
{ "description": "Potential ongoing general counsel retainer" }
],
"sentiment": { "label": "positive", "score": 0.62 },
"timeline": [
{ "date": "2026-04-10", "event": "Initial intro email" },
{ "date": "2026-04-15", "event": "Discovery call" }
],
"note_ids": ["note_001", "note_002", "note_003"],
"credits_remaining": 4866
}
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Missing contact_id or deal_id |
| 401 | invalid_key | Invalid or expired API key |
| 402 | insufficient_credits | Workspace credit balance is exhausted |
| 403 | insufficient_permissions | Missing write:ai permission |
| 404 | not_found | Target entity does not exist |
| 409 | no_notes | No notes are attached to the target entity |
| 429 | rate_limited | Rate limit exceeded |