REST API and MCP code examples
Initialize MCP or use the linked REST examples to verify and discover the tenant-bound integration.
- Scope
- Filtered by token scopes
- Authentication
- Bearer private integration
- Token type
- Sub-account token
Use secure cURL, Node.js, and Python patterns for Lead360 status checks, REST operation discovery, reviewed read execution, MCP initialization, tool listing, and tool calls.
How this fits into Lead360Explore the Lead360 platformConnect API and MCP access with the agency, tenant, scope, and risk model.- 01
Secret handling
- 02
REST connection check
- 03
REST operation search and execution
- 04
MCP initialization
Secret handling
The examples read the credential from LEAD360_TOKEN. Configure that value through a trusted secret manager or approved local environment mechanism. Do not replace the environment lookup with a committed string, browser variable, query parameter, log statement, or prompt.
LEAD360_TOKEN=<one-time private integration credential>REST connection check
cURL
curl -sS 'https://app.lead360.io/v2/subaccount-api/status' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer $LEAD360_TOKEN'Node.js
const response = await fetch('https://app.lead360.io/v2/subaccount-api/status', {
headers: {
Accept: 'application/json',
Authorization: `Bearer ${process.env.LEAD360_TOKEN}`,
},
})
if (!response.ok) throw new Error(`Lead360 returned ${response.status}`)
console.log(await response.json())Python
import os
import requests
response = requests.get(
'https://app.lead360.io/v2/subaccount-api/status',
headers={
'Accept': 'application/json',
'Authorization': f"Bearer {os.environ['LEAD360_TOKEN']}",
},
timeout=30,
)
response.raise_for_status()
print(response.json())REST operation search and execution
Search before executing, then fetch the selected operation contract. The example execution uses contacts.profile.read only after the credential has contacts.readonly and the contract reports direct_read.
Search with cURL
curl -sS 'https://app.lead360.io/v2/subaccount-api/operations?query=contacts&risk_tier=green&limit=20' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer $LEAD360_TOKEN'Execute with Python
import os
import requests
response = requests.post(
'https://app.lead360.io/v2/subaccount-api/operations/contacts.profile.read/execute',
headers={'Authorization': f"Bearer {os.environ['LEAD360_TOKEN']}"},
json={'arguments': {'contact_id': 12345}},
timeout=30,
)
response.raise_for_status()
print(response.json())MCP initialization
cURL
curl -sS 'https://app.lead360.io/mcp/lead360/v2' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $LEAD360_TOKEN' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {},
"clientInfo": {
"name": "lead360-client",
"version": "1.0.0"
}
}
}'Node.js
const response = await fetch('https://app.lead360.io/mcp/lead360/v2', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${process.env.LEAD360_TOKEN}`,
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'initialize',
params: {
protocolVersion: '2025-03-26',
capabilities: {},
clientInfo: { name: 'lead360-client', version: '1.0.0' },
},
}),
})
console.log(await response.json())Python
import os
import requests
response = requests.post(
'https://app.lead360.io/mcp/lead360/v2',
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': f"Bearer {os.environ['LEAD360_TOKEN']}",
},
json={
'jsonrpc': '2.0',
'id': 1,
'method': 'initialize',
'params': {
'protocolVersion': '2025-03-26',
'capabilities': {},
'clientInfo': {'name': 'lead360-client', 'version': '1.0.0'},
},
},
timeout=30,
)
response.raise_for_status()
print(response.json())Production checklist
- Use the official app.lead360.io origin and HTTPS.
- Keep the token server-side and redact Authorization headers.
- Set connection and response timeouts.
- Verify the tenant and scopes with status.
- Fetch typed contracts rather than guessing arguments.
- Honor rate headers and use bounded retries.
- Stop on approval_required and use the Lead360 review workflow.
- Minimize, protect, retain, and delete returned data according to the approved purpose.
Frequently asked questions
Can these examples run in a public web page?
No. Private integration credentials must not be exposed to browser users or included in public frontend bundles.
Why do the examples use environment variables?
Environment-based lookup keeps the placeholder separate from source code. Production systems should use a dedicated secret manager and runtime identity controls.
Can I change contacts.profile.read to a write operation?
Discovery may describe write contracts, but direct execution returns approval_required. Use the supported Lead360 draft and approval workflow.
Continue with Lead360
Use this workflow in Lead360
Put this guide into practice with a 14-day free trial of Lead360 Pro early access, or continue learning through the related collection.
Support