{"openapi":"3.1.0","info":{"title":"Local Business Lead Operations API","version":"1.0.0","description":"Read supplied lead exports, call logs, and quote records to spot unanswered enquiries and prioritize follow-ups without accessing a CRM. Paid with x402 exact USDC on Base. No account is required.","contact":{"email":"support@brainiac.software"},"x-guidance":"BRAINIAC.software is a pay-per-call API for software agents. No account or API key is required.\nPayment uses the x402 protocol with exact USDC on Base (chain id 8453). Each POST operation has a fixed USD price.\nHow to call an operation:\n1. POST a JSON body matching the operation's requestBody schema to the operation path. Include an Idempotency-Key header (64 hex characters, 32 random bytes).\n2. If you have not paid, the server responds 402 with payment requirements in the body. Pay the exact amount to the payTo address on Base.\n3. Retry the identical request with the same Idempotency-Key and add a payment-signature header containing the x402 payment payload. On success (200) the operation result is returned.\n4. Reuse the same Idempotency-Key only for retries of the same operation and request body; it will not be charged twice.\nAll outputs are compliance prechecks, drafts, or data lookups for human review. They are not official determinations, legal advice, identity confirmation, or certified filings. Verify time-sensitive or official data with the cited source before acting."},"servers":[{"url":"https://www.brainiac.software"}],"paths":{"/api/v1/local-lead-operations/record-normalize":{"post":{"operationId":"normalize_lead_records","summary":"Normalize lead records","description":"Copy supplied leads, calls, quotes, responses, and enquiries into a consistent inventory. Counts come from the request only. No CRM account is accessed.","tags":["local-lead-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"leads":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"email":{"type":"string","maxLength":160},"source":{"type":"string","maxLength":120},"received":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"value":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"calls":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"direction":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"duration":{"type":"number","minimum":0,"maximum":86400},"missed":{"type":"boolean"}},"additionalProperties":false}},"quotes":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"amount":{"type":"number","minimum":0,"maximum":1000000000},"sent":{"type":"string","maxLength":40},"outcome":{"type":"string","maxLength":80},"outcomeAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"responses":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"enquiries":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":2000},"received":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"sources":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"leads":{"type":"number","minimum":0,"maximum":1000000000},"converted":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"asOf":{"type":"string","maxLength":40},"responseLimitHours":{"type":"number","minimum":0,"maximum":720},"quoteLimitDays":{"type":"number","minimum":0,"maximum":365},"minSample":{"type":"integer","minimum":1,"maximum":100000}},"additionalProperties":false},"example":{"text":"Lead: L-1 | Sam | 555-0100 | sam@example.com | google | 2026-11-01T09:00:00.000Z | open | 450\nCall: C-1 | L-1 | inbound | missed | 2026-11-01T09:05:00.000Z | 0 | true\nResponse: R-1 | L-1 | 2026-11-01T12:00:00.000Z | sms\nThis customer will convert.\n"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"leads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"source":{"type":"string"},"received":{"type":"string"},"status":{"type":"string"},"value":{"type":"number"},"valueSupplied":{"type":"boolean"},"callCount":{"type":"number"},"quoteCount":{"type":"number"},"responseCount":{"type":"number"},"enquiryCount":{"type":"number"}},"additionalProperties":true}},"calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"direction":{"type":"string"},"status":{"type":"string"},"at":{"type":"string"},"duration":{"type":"number"},"durationSupplied":{"type":"boolean"},"missed":{"type":"boolean"}},"additionalProperties":true}},"quotes":{"type":"array","items":{}},"responses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"at":{"type":"string"},"channel":{"type":"string"}},"additionalProperties":true}},"enquiries":{"type":"array","items":{}},"crmAccessed":{"type":"boolean"},"messageSent":{"type":"boolean"},"callMade":{"type":"boolean"},"conversionClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T17:00:00.000Z","status":"normalized","leads":[{"id":"L-1","name":"Sam","phone":"555-0100","email":"sam@example.com","source":"google","received":"2026-11-01T09:00:00.000Z","status":"open","value":450,"valueSupplied":true,"callCount":1,"quoteCount":0,"responseCount":1,"enquiryCount":0}],"calls":[{"id":"C-1","leadId":"L-1","direction":"inbound","status":"missed","at":"2026-11-01T09:05:00.000Z","duration":0,"durationSupplied":true,"missed":true}],"quotes":[],"responses":[{"id":"R-1","leadId":"L-1","at":"2026-11-01T12:00:00.000Z","channel":"sms"}],"enquiries":[],"crmAccessed":false,"messageSent":false,"callMade":false,"conversionClaimed":false,"findings":[{"kind":"ignored","code":"unlabeled_line","subject":"","detail":"Lines without a recognized label were not read and their text was not copied."}],"limitations":["Leads, calls, quotes, responses, and enquiries are copied only from labeled fields supplied by the caller.","Response delays and quote ages use only supplied timestamps. Missing times are not invented.","Priority uses transparent rules on those records. It does not predict conversion.","No message is sent, no call is placed, and no CRM account is accessed.","An unconverted quote means no outcome was recorded in the request, not that the job is lost forever."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/local-lead-operations/missed-call-analyze":{"post":{"operationId":"analyze_missed_call_leads","summary":"Analyze missed-call leads","description":"Identify missed calls and whether a later response was recorded for the same lead. Delays use supplied timestamps only.","tags":["local-lead-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"leads":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"email":{"type":"string","maxLength":160},"source":{"type":"string","maxLength":120},"received":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"value":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"calls":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"direction":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"duration":{"type":"number","minimum":0,"maximum":86400},"missed":{"type":"boolean"}},"additionalProperties":false}},"quotes":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"amount":{"type":"number","minimum":0,"maximum":1000000000},"sent":{"type":"string","maxLength":40},"outcome":{"type":"string","maxLength":80},"outcomeAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"responses":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"enquiries":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":2000},"received":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"sources":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"leads":{"type":"number","minimum":0,"maximum":1000000000},"converted":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"asOf":{"type":"string","maxLength":40},"responseLimitHours":{"type":"number","minimum":0,"maximum":720},"quoteLimitDays":{"type":"number","minimum":0,"maximum":365},"minSample":{"type":"integer","minimum":1,"maximum":100000}},"additionalProperties":false},"example":{"calls":[{"id":"C-1","leadId":"L-1","direction":"inbound","status":"missed","at":"2026-11-01T09:00:00.000Z","duration":0,"missed":true},{"id":"C-2","leadId":"L-2","direction":"inbound","status":"missed","at":"2026-11-01T10:00:00.000Z","missed":true}],"responses":[{"id":"R-1","leadId":"L-1","at":"2026-11-01T10:30:00.000Z","channel":"phone"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"missedCount":{"type":"number"},"unansweredCount":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"at":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"responded":{"type":"boolean"},"responseAt":{"type":"string"},"responseChannel":{"type":"string"},"delayHours":{"type":"number"},"delayHoursSupplied":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"crmAccessed":{"type":"boolean"},"messageSent":{"type":"boolean"},"callMade":{"type":"boolean"},"conversionClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T17:00:00.000Z","status":"analyzed","missedCount":2,"unansweredCount":1,"items":[{"id":"C-1","leadId":"L-1","at":"2026-11-01T09:00:00.000Z","status":"missed","direction":"inbound","responded":true,"responseAt":"2026-11-01T10:30:00.000Z","responseChannel":"phone","delayHours":1.5,"delayHoursSupplied":true,"conversionClaimed":false},{"id":"C-2","leadId":"L-2","at":"2026-11-01T10:00:00.000Z","status":"missed","direction":"inbound","responded":false,"responseAt":"","responseChannel":"","delayHours":0,"delayHoursSupplied":false,"conversionClaimed":false}],"crmAccessed":false,"messageSent":false,"callMade":false,"conversionClaimed":false,"findings":[{"kind":"observation","code":"missed_without_response","subject":"C-2","detail":"A missed call has no recorded response for its lead id."}],"limitations":["Leads, calls, quotes, responses, and enquiries are copied only from labeled fields supplied by the caller.","Response delays and quote ages use only supplied timestamps. Missing times are not invented.","Priority uses transparent rules on those records. It does not predict conversion.","No message is sent, no call is placed, and no CRM account is accessed.","An unconverted quote means no outcome was recorded in the request, not that the job is lost forever."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/local-lead-operations/response-delay-detect":{"post":{"operationId":"detect_lead_response_delays","summary":"Detect lead response delays","description":"Calculate hours from enquiry received time to the first recorded response. Overdue uses the disclosed hour limit and does not claim conversion.","tags":["local-lead-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"leads":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"email":{"type":"string","maxLength":160},"source":{"type":"string","maxLength":120},"received":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"value":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"calls":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"direction":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"duration":{"type":"number","minimum":0,"maximum":86400},"missed":{"type":"boolean"}},"additionalProperties":false}},"quotes":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"amount":{"type":"number","minimum":0,"maximum":1000000000},"sent":{"type":"string","maxLength":40},"outcome":{"type":"string","maxLength":80},"outcomeAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"responses":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"enquiries":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":2000},"received":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"sources":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"leads":{"type":"number","minimum":0,"maximum":1000000000},"converted":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"asOf":{"type":"string","maxLength":40},"responseLimitHours":{"type":"number","minimum":0,"maximum":720},"quoteLimitDays":{"type":"number","minimum":0,"maximum":365},"minSample":{"type":"integer","minimum":1,"maximum":100000}},"additionalProperties":false},"example":{"asOf":"2026-11-04T12:00:00.000Z","responseLimitHours":24,"leads":[{"id":"L-1","name":"Sam","received":"2026-11-01T09:00:00.000Z"},{"id":"L-2","name":"Alex","received":"2026-11-03T09:00:00.000Z"},{"id":"L-3","name":"Jo","received":"2026-11-04T08:00:00.000Z"}],"responses":[{"id":"R-1","leadId":"L-1","at":"2026-11-02T12:00:00.000Z","channel":"email"},{"id":"R-2","leadId":"L-3","at":"2026-11-04T08:30:00.000Z","channel":"sms"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"limitHours":{"type":"number"},"asOf":{"type":"string"},"overdueCount":{"type":"number"},"unansweredCount":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"received":{"type":"string"},"responseAt":{"type":"string"},"responseChannel":{"type":"string"},"responded":{"type":"boolean"},"delayHours":{"type":"number"},"delayHoursSupplied":{"type":"boolean"},"limitHours":{"type":"number"},"overdue":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"crmAccessed":{"type":"boolean"},"messageSent":{"type":"boolean"},"callMade":{"type":"boolean"},"conversionClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T17:00:00.000Z","status":"detected","limitHours":24,"asOf":"2026-11-04T12:00:00.000Z","overdueCount":2,"unansweredCount":1,"items":[{"id":"L-1","name":"Sam","received":"2026-11-01T09:00:00.000Z","responseAt":"2026-11-02T12:00:00.000Z","responseChannel":"email","responded":true,"delayHours":27,"delayHoursSupplied":true,"limitHours":24,"overdue":true,"conversionClaimed":false},{"id":"L-2","name":"Alex","received":"2026-11-03T09:00:00.000Z","responseAt":"","responseChannel":"","responded":false,"delayHours":27,"delayHoursSupplied":true,"limitHours":24,"overdue":true,"conversionClaimed":false},{"id":"L-3","name":"Jo","received":"2026-11-04T08:00:00.000Z","responseAt":"2026-11-04T08:30:00.000Z","responseChannel":"sms","responded":true,"delayHours":0.5,"delayHoursSupplied":true,"limitHours":24,"overdue":false,"conversionClaimed":false}],"crmAccessed":false,"messageSent":false,"callMade":false,"conversionClaimed":false,"findings":[{"kind":"observation","code":"enquiry_without_response","subject":"L-2","detail":"An enquiry lead has no recorded response."}],"limitations":["Leads, calls, quotes, responses, and enquiries are copied only from labeled fields supplied by the caller.","Response delays and quote ages use only supplied timestamps. Missing times are not invented.","Priority uses transparent rules on those records. It does not predict conversion.","No message is sent, no call is placed, and no CRM account is accessed.","An unconverted quote means no outcome was recorded in the request, not that the job is lost forever."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/local-lead-operations/quote-followup-priority":{"post":{"operationId":"prioritize_quote_follow_ups","summary":"Prioritize quote follow-ups","description":"Rank leads with transparent rules for missed calls, response delays, and quotes without outcomes. Priority is not a prediction that a customer will convert.","tags":["local-lead-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"leads":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"email":{"type":"string","maxLength":160},"source":{"type":"string","maxLength":120},"received":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"value":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"calls":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"direction":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"duration":{"type":"number","minimum":0,"maximum":86400},"missed":{"type":"boolean"}},"additionalProperties":false}},"quotes":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"amount":{"type":"number","minimum":0,"maximum":1000000000},"sent":{"type":"string","maxLength":40},"outcome":{"type":"string","maxLength":80},"outcomeAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"responses":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"enquiries":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":2000},"received":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"sources":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"leads":{"type":"number","minimum":0,"maximum":1000000000},"converted":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"asOf":{"type":"string","maxLength":40},"responseLimitHours":{"type":"number","minimum":0,"maximum":720},"quoteLimitDays":{"type":"number","minimum":0,"maximum":365},"minSample":{"type":"integer","minimum":1,"maximum":100000}},"additionalProperties":false},"example":{"asOf":"2026-11-04T12:00:00.000Z","responseLimitHours":24,"quoteLimitDays":7,"leads":[{"id":"L-1","name":"Sam","received":"2026-11-01T09:00:00.000Z","value":800},{"id":"L-2","name":"Alex","received":"2026-11-02T09:00:00.000Z","value":200},{"id":"L-3","name":"Jo","received":"2026-11-03T09:00:00.000Z","value":50}],"calls":[{"id":"C-1","leadId":"L-1","status":"missed","at":"2026-11-01T09:05:00.000Z","missed":true}],"quotes":[{"id":"Q-1","leadId":"L-2","amount":200,"sent":"2026-10-20T09:00:00.000Z"},{"id":"Q-2","leadId":"L-3","amount":50,"sent":"2026-11-03T10:00:00.000Z","outcome":"won","outcomeAt":"2026-11-03T18:00:00.000Z"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"rules":{"type":"array","items":{"type":"string"}},"responseLimitHours":{"type":"number"},"quoteLimitDays":{"type":"number"},"asOf":{"type":"string"},"highCount":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"level":{"type":"string"},"reasons":{"type":"array","items":{"type":"string"}},"value":{"type":"number"},"valueSupplied":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"crmAccessed":{"type":"boolean"},"messageSent":{"type":"boolean"},"callMade":{"type":"boolean"},"conversionClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T17:00:00.000Z","status":"prioritized","rules":["missed_call_without_response → high","response_delay_over_24h → high","unconverted_quote_over_7d → high","unconverted_quote_with_amount → medium","enquiry_without_response → medium","open_lead_with_value → low"],"responseLimitHours":24,"quoteLimitDays":7,"asOf":"2026-11-04T12:00:00.000Z","highCount":2,"items":[{"id":"L-1","name":"Sam","level":"high","reasons":["missed_call_without_response","enquiry_without_response"],"value":800,"valueSupplied":true,"conversionClaimed":false},{"id":"L-2","name":"Alex","level":"high","reasons":["enquiry_without_response","unconverted_quote_over_7d"],"value":200,"valueSupplied":true,"conversionClaimed":false},{"id":"L-3","name":"Jo","level":"medium","reasons":["enquiry_without_response"],"value":50,"valueSupplied":true,"conversionClaimed":false}],"crmAccessed":false,"messageSent":false,"callMade":false,"conversionClaimed":false,"findings":[{"kind":"observation","code":"missed_without_response","subject":"C-1","detail":"A missed call has no recorded response for its lead id."},{"kind":"observation","code":"enquiry_without_response","subject":"L-1","detail":"An enquiry lead has no recorded response."},{"kind":"observation","code":"enquiry_without_response","subject":"L-2","detail":"An enquiry lead has no recorded response."},{"kind":"observation","code":"enquiry_without_response","subject":"L-3","detail":"An enquiry lead has no recorded response."},{"kind":"observation","code":"quote_without_outcome","subject":"Q-1","detail":"A quote has no recorded outcome such as won, lost, accepted, or rejected."},{"kind":"observation","code":"priority_rules","subject":"","detail":"Priority used these rules: missed_call_without_response → high; response_delay_over_24h → high; unconverted_quote_over_7d → high; unconverted_quote_with_amount → medium; enquiry_without_response → medium; open_lead_with_value → low."}],"limitations":["Leads, calls, quotes, responses, and enquiries are copied only from labeled fields supplied by the caller.","Response delays and quote ages use only supplied timestamps. Missing times are not invented.","Priority uses transparent rules on those records. It does not predict conversion.","No message is sent, no call is placed, and no CRM account is accessed.","An unconverted quote means no outcome was recorded in the request, not that the job is lost forever."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{}}]}}},"/api/v1/local-lead-operations/unconverted-quote-detect":{"post":{"operationId":"detect_unconverted_quotes","summary":"Detect unconverted quotes","description":"Find quotes with no recorded outcome and age them from the sent timestamp. A missing outcome is not treated as a final loss.","tags":["local-lead-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"leads":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"email":{"type":"string","maxLength":160},"source":{"type":"string","maxLength":120},"received":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"value":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"calls":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"direction":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"duration":{"type":"number","minimum":0,"maximum":86400},"missed":{"type":"boolean"}},"additionalProperties":false}},"quotes":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"amount":{"type":"number","minimum":0,"maximum":1000000000},"sent":{"type":"string","maxLength":40},"outcome":{"type":"string","maxLength":80},"outcomeAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"responses":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"enquiries":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":2000},"received":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"sources":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"leads":{"type":"number","minimum":0,"maximum":1000000000},"converted":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"asOf":{"type":"string","maxLength":40},"responseLimitHours":{"type":"number","minimum":0,"maximum":720},"quoteLimitDays":{"type":"number","minimum":0,"maximum":365},"minSample":{"type":"integer","minimum":1,"maximum":100000}},"additionalProperties":false},"example":{"asOf":"2026-11-04T12:00:00.000Z","quoteLimitDays":7,"quotes":[{"id":"Q-1","leadId":"L-1","amount":900,"sent":"2026-10-20T09:00:00.000Z"},{"id":"Q-2","leadId":"L-2","amount":300,"sent":"2026-11-03T09:00:00.000Z"},{"id":"Q-3","leadId":"L-3","amount":150,"sent":"2026-11-01T09:00:00.000Z","outcome":"lost","outcomeAt":"2026-11-02T09:00:00.000Z"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"limitDays":{"type":"number"},"asOf":{"type":"string"},"unconvertedCount":{"type":"number"},"overdueCount":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"amount":{"type":"number"},"amountSupplied":{"type":"boolean"},"sent":{"type":"string"},"outcome":{"type":"string"},"outcomeAt":{"type":"string"},"outcomeRecorded":{"type":"boolean"},"ageDays":{"type":"number"},"ageDaysSupplied":{"type":"boolean"},"limitDays":{"type":"number"},"overdue":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"crmAccessed":{"type":"boolean"},"messageSent":{"type":"boolean"},"callMade":{"type":"boolean"},"conversionClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T17:00:00.000Z","status":"detected","limitDays":7,"asOf":"2026-11-04T12:00:00.000Z","unconvertedCount":2,"overdueCount":1,"items":[{"id":"Q-1","leadId":"L-1","amount":900,"amountSupplied":true,"sent":"2026-10-20T09:00:00.000Z","outcome":"","outcomeAt":"","outcomeRecorded":false,"ageDays":15.13,"ageDaysSupplied":true,"limitDays":7,"overdue":true,"conversionClaimed":false},{"id":"Q-2","leadId":"L-2","amount":300,"amountSupplied":true,"sent":"2026-11-03T09:00:00.000Z","outcome":"","outcomeAt":"","outcomeRecorded":false,"ageDays":1.13,"ageDaysSupplied":true,"limitDays":7,"overdue":false,"conversionClaimed":false},{"id":"Q-3","leadId":"L-3","amount":150,"amountSupplied":true,"sent":"2026-11-01T09:00:00.000Z","outcome":"lost","outcomeAt":"2026-11-02T09:00:00.000Z","outcomeRecorded":true,"ageDays":3.13,"ageDaysSupplied":true,"limitDays":7,"overdue":false,"conversionClaimed":false}],"crmAccessed":false,"messageSent":false,"callMade":false,"conversionClaimed":false,"findings":[{"kind":"observation","code":"quote_without_outcome","subject":"Q-1","detail":"A quote has no recorded outcome such as won, lost, accepted, or rejected."},{"kind":"observation","code":"quote_without_outcome","subject":"Q-2","detail":"A quote has no recorded outcome such as won, lost, accepted, or rejected."}],"limitations":["Leads, calls, quotes, responses, and enquiries are copied only from labeled fields supplied by the caller.","Response delays and quote ages use only supplied timestamps. Missing times are not invented.","Priority uses transparent rules on those records. It does not predict conversion.","No message is sent, no call is placed, and no CRM account is accessed.","An unconverted quote means no outcome was recorded in the request, not that the job is lost forever."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/local-lead-operations/source-performance-analyze":{"post":{"operationId":"analyze_lead_source_performance","summary":"Analyze lead source performance","description":"Calculate conversion rates from supplied source lead and converted counts. Ranking uses only sources that meet the disclosed sample minimum.","tags":["local-lead-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"leads":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"email":{"type":"string","maxLength":160},"source":{"type":"string","maxLength":120},"received":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"value":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"calls":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"direction":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"duration":{"type":"number","minimum":0,"maximum":86400},"missed":{"type":"boolean"}},"additionalProperties":false}},"quotes":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"amount":{"type":"number","minimum":0,"maximum":1000000000},"sent":{"type":"string","maxLength":40},"outcome":{"type":"string","maxLength":80},"outcomeAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"responses":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"enquiries":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":2000},"received":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"sources":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"leads":{"type":"number","minimum":0,"maximum":1000000000},"converted":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"asOf":{"type":"string","maxLength":40},"responseLimitHours":{"type":"number","minimum":0,"maximum":720},"quoteLimitDays":{"type":"number","minimum":0,"maximum":365},"minSample":{"type":"integer","minimum":1,"maximum":100000}},"additionalProperties":false},"example":{"minSample":20,"sources":[{"id":"google","name":"Google","leads":40,"converted":8},{"id":"referral","name":"Referral","leads":25,"converted":10},{"id":"flyer","name":"Flyer","leads":5,"converted":2}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"minSample":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"leads":{"type":"number"},"leadsSupplied":{"type":"boolean"},"converted":{"type":"number"},"convertedSupplied":{"type":"boolean"},"conversionRate":{"type":"number"},"conversionRateSupplied":{"type":"boolean"},"sampleSufficient":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"highestRateSourceId":{"type":"string"},"highestRate":{"type":"number"},"highestRateSupplied":{"type":"boolean"},"crmAccessed":{"type":"boolean"},"messageSent":{"type":"boolean"},"callMade":{"type":"boolean"},"conversionClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T17:00:00.000Z","status":"analyzed","minSample":20,"sources":[{"id":"google","name":"Google","leads":40,"leadsSupplied":true,"converted":8,"convertedSupplied":true,"conversionRate":0.2,"conversionRateSupplied":true,"sampleSufficient":true,"conversionClaimed":false},{"id":"referral","name":"Referral","leads":25,"leadsSupplied":true,"converted":10,"convertedSupplied":true,"conversionRate":0.4,"conversionRateSupplied":true,"sampleSufficient":true,"conversionClaimed":false},{"id":"flyer","name":"Flyer","leads":5,"leadsSupplied":true,"converted":2,"convertedSupplied":true,"conversionRate":0.4,"conversionRateSupplied":true,"sampleSufficient":false,"conversionClaimed":false}],"highestRateSourceId":"referral","highestRate":0.4,"highestRateSupplied":true,"crmAccessed":false,"messageSent":false,"callMade":false,"conversionClaimed":false,"findings":[{"kind":"observation","code":"source_sample_small","subject":"flyer","detail":"A source rate is shown, but the sample is below the disclosed minimum of 20 leads. It is not used for ranking."}],"limitations":["Leads, calls, quotes, responses, and enquiries are copied only from labeled fields supplied by the caller.","Response delays and quote ages use only supplied timestamps. Missing times are not invented.","Priority uses transparent rules on those records. It does not predict conversion.","No message is sent, no call is placed, and no CRM account is accessed.","An unconverted quote means no outcome was recorded in the request, not that the job is lost forever."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{}}]}}},"/api/v1/local-lead-operations/customer-enquiry-classify":{"post":{"operationId":"classify_customer_enquiries","summary":"Classify customer enquiries","description":"Classify enquiry text with transparent token rules such as emergency, quote, booking, or complaint. Classification is not a conversion prediction.","tags":["local-lead-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"leads":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"email":{"type":"string","maxLength":160},"source":{"type":"string","maxLength":120},"received":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"value":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"calls":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"direction":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"duration":{"type":"number","minimum":0,"maximum":86400},"missed":{"type":"boolean"}},"additionalProperties":false}},"quotes":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"amount":{"type":"number","minimum":0,"maximum":1000000000},"sent":{"type":"string","maxLength":40},"outcome":{"type":"string","maxLength":80},"outcomeAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"responses":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"enquiries":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":2000},"received":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"sources":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"leads":{"type":"number","minimum":0,"maximum":1000000000},"converted":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"asOf":{"type":"string","maxLength":40},"responseLimitHours":{"type":"number","minimum":0,"maximum":720},"quoteLimitDays":{"type":"number","minimum":0,"maximum":365},"minSample":{"type":"integer","minimum":1,"maximum":100000}},"additionalProperties":false},"example":{"enquiries":[{"id":"E-1","leadId":"L-1","text":"Urgent boiler leak, no hot water","channel":"web","received":"2026-11-04T08:00:00.000Z"},{"id":"E-2","leadId":"L-2","text":"Can I get a quote for a new bathroom?","channel":"email"},{"id":"E-3","leadId":"L-3","text":"Please book an appointment next week","channel":"phone"}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"counts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"count":{"type":"number"}},"additionalProperties":true}},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"channel":{"type":"string"},"received":{"type":"string"},"kind":{"type":"string"},"matched":{"type":"string"},"confidence":{"type":"string"},"text":{"type":"string"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"crmAccessed":{"type":"boolean"},"messageSent":{"type":"boolean"},"callMade":{"type":"boolean"},"conversionClaimed":{"type":"boolean"},"findings":{"type":"array","items":{}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T17:00:00.000Z","status":"classified","counts":[{"kind":"emergency","count":1},{"kind":"quote","count":1},{"kind":"booking","count":1}],"items":[{"id":"E-1","leadId":"L-1","channel":"web","received":"2026-11-04T08:00:00.000Z","kind":"emergency","matched":"urgent","confidence":"token","text":"Urgent boiler leak, no hot water","conversionClaimed":false},{"id":"E-2","leadId":"L-2","channel":"email","received":"","kind":"quote","matched":"quote","confidence":"token","text":"Can I get a quote for a new bathroom?","conversionClaimed":false},{"id":"E-3","leadId":"L-3","channel":"phone","received":"","kind":"booking","matched":"book","confidence":"token","text":"Please book an appointment next week","conversionClaimed":false}],"crmAccessed":false,"messageSent":false,"callMade":false,"conversionClaimed":false,"findings":[],"limitations":["Leads, calls, quotes, responses, and enquiries are copied only from labeled fields supplied by the caller.","Response delays and quote ages use only supplied timestamps. Missing times are not invented.","Priority uses transparent rules on those records. It does not predict conversion.","No message is sent, no call is placed, and no CRM account is accessed.","An unconverted quote means no outcome was recorded in the request, not that the job is lost forever."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{}}]}}},"/api/v1/local-lead-operations/conversion-opportunity-report":{"post":{"operationId":"report_lead_conversion_opportunities","summary":"Report lead conversion opportunities","description":"Combine unanswered missed calls, response delays, unconverted quotes, source rates, and enquiry classes from supplied records. No messages are sent and conversion is not claimed.","tags":["local-lead-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","maxLength":200000},"json":{"type":"string","maxLength":200000},"csv":{"type":"string","maxLength":200000},"file":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":180},"mediaType":{"type":"string","enum":["text/plain","text/csv","application/json"]},"fileBase64":{"type":"string","minLength":1,"maxLength":12000000}},"required":["mediaType","fileBase64"],"additionalProperties":false},"leads":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"email":{"type":"string","maxLength":160},"source":{"type":"string","maxLength":120},"received":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"value":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"calls":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"direction":{"type":"string","maxLength":40},"status":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"duration":{"type":"number","minimum":0,"maximum":86400},"missed":{"type":"boolean"}},"additionalProperties":false}},"quotes":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"amount":{"type":"number","minimum":0,"maximum":1000000000},"sent":{"type":"string","maxLength":40},"outcome":{"type":"string","maxLength":80},"outcomeAt":{"type":"string","maxLength":40}},"additionalProperties":false}},"responses":{"maxItems":400,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"at":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"enquiries":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"leadId":{"type":"string","maxLength":80},"text":{"type":"string","maxLength":2000},"received":{"type":"string","maxLength":40},"channel":{"type":"string","maxLength":80}},"additionalProperties":false}},"sources":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":80},"name":{"type":"string","maxLength":160},"leads":{"type":"number","minimum":0,"maximum":1000000000},"converted":{"type":"number","minimum":0,"maximum":1000000000}},"additionalProperties":false}},"asOf":{"type":"string","maxLength":40},"responseLimitHours":{"type":"number","minimum":0,"maximum":720},"quoteLimitDays":{"type":"number","minimum":0,"maximum":365},"minSample":{"type":"integer","minimum":1,"maximum":100000}},"additionalProperties":false},"example":{"asOf":"2026-11-04T12:00:00.000Z","responseLimitHours":24,"quoteLimitDays":7,"minSample":20,"leads":[{"id":"L-1","name":"Sam","source":"google","received":"2026-11-01T09:00:00.000Z","status":"open","value":800},{"id":"L-2","name":"Alex","source":"referral","received":"2026-11-02T09:00:00.000Z","status":"open","value":200}],"calls":[{"id":"C-1","leadId":"L-1","status":"missed","at":"2026-11-01T09:05:00.000Z","missed":true}],"quotes":[{"id":"Q-1","leadId":"L-2","amount":200,"sent":"2026-10-20T09:00:00.000Z"}],"responses":[{"id":"R-1","leadId":"L-2","at":"2026-11-02T10:00:00.000Z","channel":"phone"}],"enquiries":[{"id":"E-1","leadId":"L-1","text":"Please call back about an urgent repair","channel":"web"}],"sources":[{"id":"google","name":"Google","leads":40,"converted":8},{"id":"referral","name":"Referral","leads":25,"converted":10}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"string"},"asOf":{"type":"string"},"responseLimitHours":{"type":"number"},"quoteLimitDays":{"type":"number"},"leadCount":{"type":"number"},"missedUnansweredCount":{"type":"number"},"overdueResponseCount":{"type":"number"},"unconvertedQuoteCount":{"type":"number"},"highPriorityCount":{"type":"number"},"leads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"source":{"type":"string"},"received":{"type":"string"},"status":{"type":"string"},"value":{"type":"number"},"valueSupplied":{"type":"boolean"},"callCount":{"type":"number"},"quoteCount":{"type":"number"},"responseCount":{"type":"number"},"enquiryCount":{"type":"number"}},"additionalProperties":true}},"missed":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"at":{"type":"string"},"status":{"type":"string"},"direction":{"type":"string"},"responded":{"type":"boolean"},"responseAt":{"type":"string"},"responseChannel":{"type":"string"},"delayHours":{"type":"number"},"delayHoursSupplied":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"delays":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"received":{"type":"string"},"responseAt":{"type":"string"},"responseChannel":{"type":"string"},"responded":{"type":"boolean"},"delayHours":{"type":"number"},"delayHoursSupplied":{"type":"boolean"},"limitHours":{"type":"number"},"overdue":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"priorities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"level":{"type":"string"},"reasons":{"type":"array","items":{"type":"string"}},"value":{"type":"number"},"valueSupplied":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"quotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"amount":{"type":"number"},"amountSupplied":{"type":"boolean"},"sent":{"type":"string"},"outcome":{"type":"string"},"outcomeAt":{"type":"string"},"outcomeRecorded":{"type":"boolean"},"ageDays":{"type":"number"},"ageDaysSupplied":{"type":"boolean"},"limitDays":{"type":"number"},"overdue":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"leads":{"type":"number"},"leadsSupplied":{"type":"boolean"},"converted":{"type":"number"},"convertedSupplied":{"type":"boolean"},"conversionRate":{"type":"number"},"conversionRateSupplied":{"type":"boolean"},"sampleSufficient":{"type":"boolean"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"enquiries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"channel":{"type":"string"},"received":{"type":"string"},"kind":{"type":"string"},"matched":{"type":"string"},"confidence":{"type":"string"},"text":{"type":"string"},"conversionClaimed":{"type":"boolean"}},"additionalProperties":true}},"rules":{"type":"array","items":{"type":"string"}},"crmAccessed":{"type":"boolean"},"messageSent":{"type":"boolean"},"callMade":{"type":"boolean"},"conversionClaimed":{"type":"boolean"},"findings":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"code":{"type":"string"},"subject":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"checkedAt":"2026-11-04T17:00:00.000Z","status":"reported","asOf":"2026-11-04T12:00:00.000Z","responseLimitHours":24,"quoteLimitDays":7,"leadCount":2,"missedUnansweredCount":1,"overdueResponseCount":1,"unconvertedQuoteCount":1,"highPriorityCount":2,"leads":[{"id":"L-1","name":"Sam","phone":"","email":"","source":"google","received":"2026-11-01T09:00:00.000Z","status":"open","value":800,"valueSupplied":true,"callCount":1,"quoteCount":0,"responseCount":0,"enquiryCount":1},{"id":"L-2","name":"Alex","phone":"","email":"","source":"referral","received":"2026-11-02T09:00:00.000Z","status":"open","value":200,"valueSupplied":true,"callCount":0,"quoteCount":1,"responseCount":1,"enquiryCount":0}],"missed":[{"id":"C-1","leadId":"L-1","at":"2026-11-01T09:05:00.000Z","status":"missed","direction":"","responded":false,"responseAt":"","responseChannel":"","delayHours":0,"delayHoursSupplied":false,"conversionClaimed":false}],"delays":[{"id":"L-1","name":"Sam","received":"2026-11-01T09:00:00.000Z","responseAt":"","responseChannel":"","responded":false,"delayHours":75,"delayHoursSupplied":true,"limitHours":24,"overdue":true,"conversionClaimed":false},{"id":"L-2","name":"Alex","received":"2026-11-02T09:00:00.000Z","responseAt":"2026-11-02T10:00:00.000Z","responseChannel":"phone","responded":true,"delayHours":1,"delayHoursSupplied":true,"limitHours":24,"overdue":false,"conversionClaimed":false}],"priorities":[{"id":"L-1","name":"Sam","level":"high","reasons":["missed_call_without_response","enquiry_without_response"],"value":800,"valueSupplied":true,"conversionClaimed":false},{"id":"L-2","name":"Alex","level":"high","reasons":["unconverted_quote_over_7d"],"value":200,"valueSupplied":true,"conversionClaimed":false}],"quotes":[{"id":"Q-1","leadId":"L-2","amount":200,"amountSupplied":true,"sent":"2026-10-20T09:00:00.000Z","outcome":"","outcomeAt":"","outcomeRecorded":false,"ageDays":15.13,"ageDaysSupplied":true,"limitDays":7,"overdue":true,"conversionClaimed":false}],"sources":[{"id":"google","name":"Google","leads":40,"leadsSupplied":true,"converted":8,"convertedSupplied":true,"conversionRate":0.2,"conversionRateSupplied":true,"sampleSufficient":true,"conversionClaimed":false},{"id":"referral","name":"Referral","leads":25,"leadsSupplied":true,"converted":10,"convertedSupplied":true,"conversionRate":0.4,"conversionRateSupplied":true,"sampleSufficient":true,"conversionClaimed":false}],"enquiries":[{"id":"E-1","leadId":"L-1","channel":"web","received":"","kind":"emergency","matched":"urgent","confidence":"token","text":"Please call back about an urgent repair","conversionClaimed":false}],"rules":["missed_call_without_response → high","response_delay_over_24h → high","unconverted_quote_over_7d → high","unconverted_quote_with_amount → medium","enquiry_without_response → medium","open_lead_with_value → low"],"crmAccessed":false,"messageSent":false,"callMade":false,"conversionClaimed":false,"findings":[{"kind":"observation","code":"missed_without_response","subject":"C-1","detail":"A missed call has no recorded response for its lead id."},{"kind":"observation","code":"enquiry_without_response","subject":"L-1","detail":"An enquiry lead has no recorded response."},{"kind":"observation","code":"quote_without_outcome","subject":"Q-1","detail":"A quote has no recorded outcome such as won, lost, accepted, or rejected."},{"kind":"observation","code":"priority_rules","subject":"","detail":"Priority used these rules: missed_call_without_response → high; response_delay_over_24h → high; unconverted_quote_over_7d → high; unconverted_quote_with_amount → medium; enquiry_without_response → medium; open_lead_with_value → low."}],"limitations":["Leads, calls, quotes, responses, and enquiries are copied only from labeled fields supplied by the caller.","Response delays and quote ages use only supplied timestamps. Missing times are not invented.","Priority uses transparent rules on those records. It does not predict conversion.","No message is sent, no call is placed, and no CRM account is accessed.","An unconverted quote means no outcome was recorded in the request, not that the job is lost forever."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment Required"},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed. With upfront settlement this may occur after payment; reuse the same idempotency key to retrieve the stored result."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.12"},"protocols":[{"x402":{}}]}}}},"components":{"schemas":{"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}