Generate Competitive Intelligence
curl --request POST \
--url https://api.example.com/deals/{deal_id}/competitive-intelligence/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"force": false
}'import requests
url = "https://api.example.com/deals/{deal_id}/competitive-intelligence/generate"
payload = { "force": False }
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({force: false})
};
fetch('https://api.example.com/deals/{deal_id}/competitive-intelligence/generate', 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/deals/{deal_id}/competitive-intelligence/generate",
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([
'force' => false
]),
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.example.com/deals/{deal_id}/competitive-intelligence/generate"
payload := strings.NewReader("{\n \"force\": false\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.example.com/deals/{deal_id}/competitive-intelligence/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"force\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/deals/{deal_id}/competitive-intelligence/generate")
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 \"force\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Deals
Generate a Competitive Brief
POST
/
deals
/
{deal_id}
/
competitive-intelligence
/
generate
Generate Competitive Intelligence
curl --request POST \
--url https://api.example.com/deals/{deal_id}/competitive-intelligence/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"force": false
}'import requests
url = "https://api.example.com/deals/{deal_id}/competitive-intelligence/generate"
payload = { "force": False }
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({force: false})
};
fetch('https://api.example.com/deals/{deal_id}/competitive-intelligence/generate', 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/deals/{deal_id}/competitive-intelligence/generate",
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([
'force' => false
]),
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.example.com/deals/{deal_id}/competitive-intelligence/generate"
payload := strings.NewReader("{\n \"force\": false\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.example.com/deals/{deal_id}/competitive-intelligence/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"force\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/deals/{deal_id}/competitive-intelligence/generate")
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 \"force\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Gated by the
ai.competitive_intelligence config feature flag — a 403 names the flag when disabled.
The representative async AI-generation endpoint on this router — it writes a placeholder row, kicks off a background job, and returns 202 immediately so the request never blocks on an LLM call. Generate a Deal Brief follows the identical pattern.
Auth
Requires a CRM manage scope and an active organization on the token. Any*:manage scope qualifies — in practice contacts:manage, deals:manage, companies:manage, or activities:manage.
Flow
- Not
forceand a completed brief exists → returns it immediately,200 {success: true, skipped: true, id, payload, generated_at, source}. - Not
forceand a brief is currently generating →202 {accepted: true, already_running: true, id, message}. - Otherwise → (if
force, first deletes any stuckci_generatingplaceholder rows), inserts a placeholder brief row, schedules a background job, and returns immediately:202 {accepted: true, skipped: false, id, payload: <placeholder>, generated_at, source: "ci_generating", message}.
payload and a ci_<source> label, and re-syncs deal_competitors from the resulting battlecard names. A failure mid-job persists an error payload into the same row (source: "ci_error") instead of leaving it stuck generating — poll Get the Latest Competitive Brief until payload.metadata._ci_generating is gone.
Payload shape (once complete)
| Field | Type | Description |
|---|---|---|
schema_version | integer | Always 1. |
executive_overview.porters_five_forces | object | {forces: [{label, level, score, score_label}], summary}. |
executive_overview.swot | object | {strengths, weaknesses, opportunities, threats} (string arrays). |
executive_overview.competitive_positioning | object | Axis labels + points: [{name, x, y, is_us, website?, x_rationale, y_rationale, supporting_stats?, market_share?}]. |
executive_overview.jobs_to_be_done | object | {items: [{title, us_score, benchmark_label, benchmark_score}]}. |
executive_overview.strategic_groups | object | {groups: [{name, description, competitors}]}. |
executive_overview.feature_matrix | object | {features, us_label, scores, score_rationales} — scores are 1–3 per competitor per feature. |
executive_overview.executive_summary | object | {top_competitive_moves, market_narrative, this_weeks_actions}. |
executive_overview.high_impact_signals | array | {competitor, signal_type, period, text, impact_score, severity, evidence_url, affects}. |
executive_overview.recommended_plays | array | {role, effort, reversibility, title, objective, risk, first_24h}. |
executive_overview.watchlist | array | {trigger, where_to_watch, owner_role, condition}. |
battlecards | object | Keyed by exact competitor name: {why_buyers_choose, when_they_win, when_we_win, landmines, talk_track, proof_points}. |
metadata | object | {competitor_count, model, name_detection_source, generated_at, _ci_generating?, _ci_error?, warning?, degraded?}. |
Errors
| Status | Cause |
|---|---|
400 | Deal has no linked account, or the account has no name. |
403 | ai.competitive_intelligence feature disabled. |
404 | Deal not found. |
502 | Failed to write the placeholder brief row. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The deal's id.
Body
application/json
Regenerate even if a completed brief already exists.
Response
Successful Response