MARKETING RADAR API MANUAL For Grok / sales-lead bots API version: 1.1.0 Document date: 2026-08-28 Product: DynaLake Marketing Radar This file is the contract. Prefer it over guessing. Cookie session routes under /api/... are for the human UI only. Bots use /v1 and /mcp only. ======================================================================== 1. PURPOSE ======================================================================== Marketing Radar finds local businesses, scores them as sales targets, looks up public decision-makers, and writes personalized pitches in the seller's voice. Pitches are written as the campaign seller, not as DynaLake, unless the campaign copy is actually about DynaLake. ======================================================================== 2. BASE URLS ======================================================================== Public host: https://radar.dynalake.net REST: https://radar.dynalake.net/v1 OpenAPI (auth): https://radar.dynalake.net/v1/openapi.json MCP: https://radar.dynalake.net/mcp HTTPS is required. HTTP is rejected with 403 error=https_required. Send JSON. Content-Type: application/json. ======================================================================== 3. AUTHENTICATION ======================================================================== Every /v1 and /mcp call needs a per-user API key. Authorization: Bearer mradar__ Also accepted: X-Api-Key: mradar__ Keys start with "mradar_". They are shown once when created. Radar stores a hash, not the token. How a human creates a key (not a bot step): 1. Sign in at https://radar.dynalake.net (Authentik SSO). 2. Turn ON "API access for Grok / bots". Default is OFF. 3. Create a key. Copy it immediately. 4. At most 5 live keys per account. Revoke one to make room. API access stays off until that checkbox is on. Turning it off later blocks every key for that user immediately (403 error=api_access_disabled). Authentik attribute radar_api_access=false is an ops kill switch even if the local toggle is on. Do not put keys in git, screenshots, or chat logs. Treat as a password. ======================================================================== 4. HARD LIMITS BOTS MUST OBEY ======================================================================== Radius: 0.05 to 5.0 miles. Larger values are capped at 5. Scan/research: research job accepts 1-40 businesses. leads/run pick: max_businesses 1-40, default 10. Lookup name: limit 1-50, default 25. Campaign text: min 20 chars, max 200000. Campaign brief: max 8000 chars. Website URL: max 500 chars. Rate limit: 60 requests per minute per key (429 error=rate_limited). Failed auths: 30 bad attempts per IP per 5 minutes then 429. MCP tool payload: JSON text truncated at 80000 characters. Job visibility: a key only sees campaigns and jobs owned by that user. Daily quotas still apply (see section 10). Call GET /v1/me first. ======================================================================== 5. RECOMMENDED BOT WORKFLOW ======================================================================== Use the one-shot lead call unless you need to inspect the map list first. A. GET /v1/me Check radar.access, radar.reports_remaining, radar.generations_remaining. If remaining is 0, stop and tell the human. Do not retry the same day. B. POST /v1/leads/run Give seller campaign context PLUS either an area or a business name. research=true (default) starts an async job and consumes one "report". C. Poll GET /v1/jobs/{job_id} every 5-10 seconds. Terminal statuses: done, error, cancelled. Running statuses: running, cancelling. Jobs take minutes (research + contacts + pitch, 1-2 businesses in parallel). Stop polling after ~15 minutes and report the last status. D. From each results[] item, use: business listing (name, address, phone, website, lat, lon) favorability.score 1-100 on the business object (scan) or research prime_target true if public news matches the seller's offer contacts.decision_makers pitch.subject_line, flyer_headline, short_pitch, long_pitch, key_hooks, cta E. If you only need the map list, set research=false. That does not consume a report quota. Do not start overlapping research jobs for the same area unless the human asked. ======================================================================== 6. REST ENDPOINTS ======================================================================== Auth header on every call. Success bodies usually include "ok": true. ------------------------------------------------------------------------ GET /v1 ------------------------------------------------------------------------ Index: who you are, remaining quota, route list, mcp_url, openapi_url. ------------------------------------------------------------------------ GET /v1/me ------------------------------------------------------------------------ Identity + quota snapshot. Response fields: ok, user, email, name, role, groups, auth="api_key", api_key_id api_access.enabled radar.staff true for DynaLake staff (unlimited) radar.access paid/staff access currently live radar.tier "basic" | "premium" | "max" | null (staff) radar.status "staff" | "active" | "expired" | ... radar.period_end ISO datetime or null radar.reports_today radar.reports_limit integer or null (null = unlimited) radar.reports_remaining integer or null radar.generations_today radar.generations_limit radar.generations_remaining radar.saved_pitches_limit radar.saved_pitches_used radar.saved_pitches_remaining radar.shop_url radar.shop_account_url ------------------------------------------------------------------------ POST /v1/campaigns ------------------------------------------------------------------------ Create a seller campaign the pipeline will pitch FROM. Send exactly one of: { "text": "full campaign / offer copy, at least 20 characters" } { "brief": "short brief", "tone": "professional", "length": "standard" } Consumes 1 generation quota. AI expands the brief. { "website_url": "https://seller.example", "extra_brief": "optional notes" } Consumes 1 generation quota. Scrapes homepage/about/services. tone default professional. length default standard. Response: ok, campaign_id, filename, char_count, preview, text, style, brand, meta style is "paste" | "ai" | "website" Keep campaign_id. Pass it into scan / lookup / research / leads/run. ------------------------------------------------------------------------ POST /v1/places/scan ------------------------------------------------------------------------ Find businesses in a radius around a point. Max 5 miles. Request: { "lat": 35.9606, "lon": -83.9207, "radius_miles": 1.0, "campaign_id": "optional-uuid" } campaign_id is optional. When present, Radar scores favorability against that seller campaign. Response: ok, lat, lon, radius_miles, count, warning, businesses[], meta meta.provider, meta.sources_used warning is a string or null (radius cap, source issues). ------------------------------------------------------------------------ POST /v1/places/lookup ------------------------------------------------------------------------ Find a business by name. Chains may return multiple locations. Request: { "name": "Acme Auto", "city": "Knoxville", "state": "TN", "address": "", "category": "", "lat": null, "lon": null, "limit": 25, "campaign_id": "optional-uuid" } name is required (2-200 chars). city/state/address help disambiguate. Response: ok, name, count, businesses[], empty_reason, meta ------------------------------------------------------------------------ POST /v1/contacts/find ------------------------------------------------------------------------ Find a public owner / on-site manager / sales decision-maker for ONE business. Consumes 1 generation quota. Partial results are success (ok=true) even when email or phone is missing. Request: { "name": "Acme Auto", "address": "123 Main St, Knoxville, TN 37919", "phone": "", "website": "", "role": "auto", "category": "" } name and address are required. role: auto on_site_manager aliases: manager, gm, site_manager, onsite_manager sales_decision_maker owner Response (selected fields): ok, cached, role, query, person, alternates[], confidence, sources[], missing[], notes, entity.hits[], contacts.decision_makers[] person may be null. missing may include "person", "email", "phone". Do not invent contact details. Use only returned fields. ------------------------------------------------------------------------ POST /v1/research/jobs ------------------------------------------------------------------------ Start async research + decision-maker lookup + pitch generation. Consumes 1 report quota. Request: { "campaign_id": "uuid-from-POST-/v1/campaigns", "contact_role": "auto", "businesses": [ { ...business objects from scan or lookup... } ] } businesses: 1-40 objects. Pass the objects Radar already returned (keep id, name, address, lat, lon, phone, website, category). Response: ok, job_id, status, total, done, progress, message, ... Then poll GET /v1/jobs/{job_id}. ------------------------------------------------------------------------ GET /v1/jobs/{job_id} GET /v1/research/jobs/{job_id} (alias) ------------------------------------------------------------------------ Poll a research job you started. Response: ok job_id status running | cancelling | cancelled | done | error phase queued | start | research | contacts | pitch | business_done | done | cancelled | error progress 0-100 float total businesses in the job done finished count message human status line current business currently in progress, or null errors string list campaign_id results[] completed items (grows while running) Terminal: done, error, cancelled. Keep any results already in results[]. ------------------------------------------------------------------------ POST /v1/jobs/{job_id}/stop ------------------------------------------------------------------------ Ask a running job to stop after the current business. Returns the public job body. Already-terminal jobs are returned unchanged. ------------------------------------------------------------------------ POST /v1/leads/run ------------------------------------------------------------------------ PRIMARY SALES-LEAD TOOL. Provide campaign context plus either an area or a business name. Radar finds businesses, optionally ranks them, and optionally starts research. Campaign (one of): campaign_id campaign_text paste, min 20 chars (no generation quota) campaign_brief AI expand (consumes 1 generation) website_url scrape (consumes 1 generation) extra_brief extra notes when using website_url Area mode (default mode="area"): lat, lon required radius_miles default 1.0, max 5 Name mode (mode="name"): name required (min 2 chars) city, state, address, category, lat, lon, limit optional Selection: max_businesses default 10, max 40 (highest favorability first) prime_only if true, keep only prime_target businesses when any exist research default true. false = return list only, no report quota contact_role default auto Example — area, research on: POST /v1/leads/run { "campaign_text": "Acme HVAC sells commercial rooftop units and preventative maintenance to Knoxville businesses.", "mode": "area", "lat": 35.9606, "lon": -83.9207, "radius_miles": 1.5, "max_businesses": 8, "research": true, "contact_role": "auto" } Example — named business, list only: POST /v1/leads/run { "campaign_id": "existing-uuid", "mode": "name", "name": "Sunrise Dental", "city": "Knoxville", "state": "TN", "research": false } Response when research=false: ok, campaign, search, businesses[], count Response when research=true and businesses found: same as above PLUS job_id, status, total, message message tells you to poll GET /v1/jobs/{job_id} Response when research=true but zero matches: ok, businesses=[], message="No businesses matched — nothing to research." No job_id is returned and no report quota is consumed. ------------------------------------------------------------------------ GET /v1/openapi.json ------------------------------------------------------------------------ OpenAPI 3 spec for these /v1 routes. Same Bearer key required. ======================================================================== 7. MCP (GROK BOT TEAMS) ======================================================================== Transport: Streamable HTTP JSON-RPC 2.0 URL: POST https://radar.dynalake.net/mcp Auth: same Bearer key Protocol: 2024-11-05 Server: marketing-radar GET /mcp (authenticated) returns a short hint. Use POST for tools. Grok Build MCP snippet (paste the key locally, never commit it): [mcp_servers.marketing-radar] url = "https://radar.dynalake.net/mcp" headers = { Authorization = "Bearer mradar_…" } enabled = true Handshake: POST /mcp { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {} } Then tools/list, then tools/call. notifications/initialized needs no response. Batch arrays of RPC messages are accepted. tools/call params: { "name": "radar_run_leads", "arguments": { ... } } Tool result is JSON text in content[0].text plus structuredContent. Tools (same behavior as REST): radar_whoami no args = GET /v1/me quota snapshot radar_set_campaign text | brief | website_url (one of) extra_brief, tone, length = POST /v1/campaigns radar_search_area lat, lon required radius_miles default 1.0 campaign_id optional = POST /v1/places/scan radar_find_business name required city, state, address, category, lat, lon, campaign_id = POST /v1/places/lookup radar_find_decision_maker name, address required phone, website, role, category = POST /v1/contacts/find radar_start_research campaign_id, businesses[] required contact_role default auto = POST /v1/research/jobs radar_get_job job_id required = GET /v1/jobs/{job_id} radar_run_leads PRIMARY TOOL. Same fields as POST /v1/leads/run: campaign_id, campaign_text, campaign_brief, website_url mode = "area" | "name" lat, lon, radius_miles name, city, state, address max_businesses, research, prime_only, contact_role HTTP errors from tools come back as isError=true content, not always JSON-RPC error codes. Read the text. ======================================================================== 8. OBJECT SHAPES ======================================================================== BUSINESS (scan / lookup / leads.businesses[]) id string, keep and pass through (osm node, fsq, gmaps/...) name category address phone website email often null lat, lon source foursquare | osm | google | ... rating number or null tags object (provider extras) distance_m from scan center found_via "radius" | lookup traffic FHWA HPMS AADT on the adjacent road: vehicles_day, vehicles_week, vehicles_month, vehicles_year road, year, trucks_day, empty_reason prime_target bool prime_target_reason favorability object: score 1-100 (100 = most likely to buy) reason short why summary prime_target stage "scan" | "news" scale "1-100, 100 = most likely to buy from the seller" JOB RESULT ITEM (job.results[]) business the listing above business_id business_name research structured notes on the TARGET (not the seller): overview review_sentiment { positive_themes[], negative_themes[], summary } news_events[] { headline, url, date, summary, relevance, opportunity, severity } prime_target, prime_target_reason offer_hooks[] logo_url, photo_urls[] confidence "low"|"medium"|"high" contacts (same as contacts below) favorability search public-web snippets used contacts: decision_makers[] not_found_reason location_identity search pitch: subject_line flyer_headline do not prepend the business name short_pitch flyer body, ~70-100 words long_pitch email body, ~150-220 words key_hooks up to 3 short bullets cta brand seller brand blob when the campaign had one error present only if that business failed DECISION-MAKER PERSON (contacts/find person, or decision_makers[]) name, title role_type owner | gm | store_manager | district_manager | other email, phone, linkedin_url only if publicly evidenced, else null confidence "low"|"medium"|"high" or numeric on finder person sources / provenance evidence_notes / location_match CAMPAIGN campaign_id, filename, char_count, preview, text, style, brand, meta brand may include company_name, tagline, industry, about, offerings[], audience, website_url. ======================================================================== 9. ERRORS ======================================================================== HTTP JSON is usually: { "detail": { "error": "code", "message": "..." } } or FastAPI string detail: { "detail": "Campaign text must be at least 20 characters." } Codes: 401 missing_api_key no Authorization header 401 invalid_api_key bad, unknown, or revoked key 403 https_required call was not HTTPS 403 api_access_disabled user toggle off or Authentik kill switch 403 radar_access_denied no staff/paid Radar access; shop URL in message 404 Campaign not found / Job not found 400 validation missing lat/lon, name, campaign fields, etc. 400 too_many_keys (key create, UI only) 429 rate_limited 60/min per key, or too many failed auths 429 quota_exceeded daily reports or generations used up kind = "report" | "generation" reset_at = that UTC day's 23:59:59 502 upstream places, research, or finder backend failed On quota_exceeded: do not retry until reset_at. Tell the human to wait until 00:00 UTC or upgrade at radar.shop_account_url. ======================================================================== 10. QUOTAS (what consumes what) ======================================================================== Staff (dynalake-admins, dynalake-staff, or role admin/staff/local/employee): unlimited reports and generations. Paid tiers (UTC day): basic 5 reports, 5 generations, 0 saved pitches premium 20 reports, 20 generations, 10 saved pitches max unlimited reports/generations, 100 saved pitches A REPORT is consumed when a research job actually starts (POST /v1/research/jobs, or POST /v1/leads/run with research=true and at least one picked business). A GENERATION is consumed by: POST /v1/campaigns with brief or website_url POST /v1/contacts/find MCP radar_set_campaign (brief/website) and radar_find_decision_maker NOT consumed: pasted campaign_text / radar_set_campaign text places scan / lookup leads/run with research=false polling jobs whoami / index Saved pitches are a UI feature. Bots do not save pitches via /v1. ======================================================================== 11. CURL EXAMPLES ======================================================================== Export the key in the shell. Do not echo it into tickets. export RADAR_KEY='mradar_...' export RADAR='https://radar.dynalake.net' Who am I: curl -sS -H "Authorization: Bearer $RADAR_KEY" "$RADAR/v1/me" Run leads in a 1-mile ring, then poll: curl -sS -H "Authorization: Bearer $RADAR_KEY" \ -H "Content-Type: application/json" \ -d '{ "campaign_text": "We install commercial access control and cameras for local shops.", "mode": "area", "lat": 35.9606, "lon": -83.9207, "radius_miles": 1.0, "max_businesses": 5, "research": true }' \ "$RADAR/v1/leads/run" curl -sS -H "Authorization: Bearer $RADAR_KEY" \ "$RADAR/v1/jobs/JOB_ID_FROM_PREVIOUS_CALL" MCP initialize + list tools: curl -sS -H "Authorization: Bearer $RADAR_KEY" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \ "$RADAR/mcp" curl -sS -H "Authorization: Bearer $RADAR_KEY" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \ "$RADAR/mcp" ======================================================================== 12. RULES FOR PITCHES AND CONTACTS ======================================================================== - Pitch as the campaign seller. Do not rebrand the offer as DynaLake unless the campaign text is about DynaLake. - Stay inside the campaign catalog (products, industry, offer). Do not invent UniFi / multi-WAN / DynaLake services that are not in the campaign. - If research.prime_target is true, you may lead with that public event as a reason they may need the seller's real offering. Do not be exploitative. - Never invent emails, phones, LinkedIn URLs, or officer names. If missing[], say the public record did not list them. - flyer_headline must not include the business name (exports add Name: itself). - Prefer short_pitch for a flyer, long_pitch for email, subject_line for email subject, cta as the next step. ======================================================================== 13. WHAT NOT TO CALL ======================================================================== Do not use: /api/login, /api/account/..., cookie session APIs /docs (disabled) scraping radar.dynalake.net HTML LinkedIn HTML scraping (Radar will not do this either) Do not send: files/multipart on /v1 (campaign upload is a UI path) more than 40 businesses per research job radius over 5 miles expecting it to work (it will be capped) Do not assume: a scan returns decision-makers (only research or contacts/find does) research is instant (always poll) keys work after the user turns API access off ======================================================================== 14. QUICK REFERENCE ======================================================================== GET /v1 index GET /v1/me identity + quota POST /v1/campaigns create campaign POST /v1/places/scan area search (max 5 mi) POST /v1/places/lookup name search POST /v1/contacts/find one decision-maker (generation quota) POST /v1/research/jobs start research (report quota) GET /v1/jobs/{job_id} poll job POST /v1/jobs/{job_id}/stop stop job POST /v1/leads/run primary: find + optional research GET /v1/openapi.json schema POST /mcp JSON-RPC tools Default bot path: GET /v1/me -> POST /v1/leads/run -> poll GET /v1/jobs/{id}.