Skip to main content
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
}
'
{
  "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
Idempotency-Key
string
Optional UUID. Deduplicates retries within 24 hours.

Body Parameters

contact_id
string
UUID of a contact whose notes should be analyzed. Provide either contact_id or deal_id.
deal_id
string
UUID of a deal whose notes should be analyzed.
focus
string
Optional focus area: summary, risks, opportunities, sentiment, timeline, or all. Defaults to all.
max_notes
integer
default:"50"
Maximum number of notes to include (most recent first). Maximum 200.

Response

data
object
Responses include 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"}'

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

StatusCodeDescription
400validation_errorMissing contact_id or deal_id
401invalid_keyInvalid or expired API key
402insufficient_creditsWorkspace credit balance is exhausted
403insufficient_permissionsMissing write:ai permission
404not_foundTarget entity does not exist
409no_notesNo notes are attached to the target entity
429rate_limitedRate limit exceeded