{"openapi":"3.0.0","info":{"title":"MotorsDynamic API","version":"1.0.0","description":"Programmatic access to dealer inventory, competitive intelligence, dealer analytics,\nsmart feeds (Google VLA, Facebook, custom), GA4-powered engagement scoring, and webhooks.\n\n**Base URLs:** Both `https://api.motorsdynamic.com/api/...` and\n`https://api.motorsdynamic.com/v1/...` route to the same handler, pick either.\n\n**Auth:** Send `X-API-Key: <your key>` on every request. The dashboard UI uses a Bearer\nJWT instead; both auth schemes work on the same endpoints.\n\nSee the [Integration Guide](/api/docs/getting-started) for end-to-end examples.","contact":{"email":"api@motorsdynamic.com"},"license":{"name":"Commercial"}},"servers":[{"url":"/api","description":"Original path (works everywhere)"},{"url":"/api/v1","description":"Versioned alias, recommended for new code"}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key from Settings → API Tokens. Recommended for all server-to-server use."},"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Short-lived JWT from POST /api/auth/login. Used by the dashboard UI."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"object"}},"example":{"error":"Domain not found"}},"Pagination":{"type":"object","properties":{"total":{"type":"integer"},"page":{"type":"integer"},"limit":{"type":"integer"},"pages":{"type":"integer"}}},"Vehicle":{"type":"object","properties":{"id":{"type":"integer"},"vin":{"type":"string","example":"1HGCV1F34LA123456"},"year":{"type":"integer","example":2022},"make":{"type":"string","example":"Honda"},"model":{"type":"string","example":"Accord"},"trim":{"type":"string","example":"EX-L"},"condition":{"type":"string","enum":["New","Used","Certified"]},"is_cpo":{"type":"boolean"},"vehicle_type":{"type":"string","enum":["car","motorcycle","rv","heavy_equipment"]},"price":{"type":"string","example":"28995.00"},"msrp":{"type":"string","nullable":true},"mileage":{"type":"integer","example":28000},"exterior_color":{"type":"string","nullable":true},"interior_color":{"type":"string","nullable":true},"body_type":{"type":"string","nullable":true},"fuel_type":{"type":"string","nullable":true},"transmission":{"type":"string","nullable":true},"drivetrain":{"type":"string","nullable":true},"engine":{"type":"string","nullable":true},"stock_number":{"type":"string","nullable":true},"url":{"type":"string"},"images":{"type":"array","items":{"type":"string"}},"image_count":{"type":"integer"},"primary_image":{"type":"string","nullable":true},"is_active":{"type":"boolean"},"first_seen_at":{"type":"string","format":"date-time"},"last_seen_at":{"type":"string","format":"date-time"},"removed_at":{"type":"string","format":"date-time","nullable":true},"domain_id":{"type":"integer"},"clean_domain":{"type":"string"}}},"Domain":{"type":"object","properties":{"id":{"type":"integer"},"url":{"type":"string"},"clean_domain":{"type":"string"},"cms_type":{"type":"string","nullable":true,"example":"dealeron"},"is_active":{"type":"boolean"},"last_scraped_at":{"type":"string","format":"date-time","nullable":true},"vehicle_count":{"type":"integer"},"vehicle_counts":{"type":"object","properties":{"new":{"type":"integer"},"used":{"type":"integer"},"cpo":{"type":"integer"},"total":{"type":"integer"}}}}},"Webhook":{"type":"object","properties":{"id":{"type":"integer"},"dealer_id":{"type":"integer"},"agency_id":{"type":"integer"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"description":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"}}}}},"security":[{"apiKey":[]},{"bearerAuth":[]}],"tags":[{"name":"System","description":"Health, stats, status"},{"name":"Domains","description":"Tracked dealer websites"},{"name":"Vehicles","description":"Inventory data"},{"name":"Jobs","description":"Async scrape job status"},{"name":"Feeds","description":"CSV / XML / JSON feed generation"},{"name":"VLA","description":"Google Vehicle Listing Ads feeds"},{"name":"GA4","description":"Google Analytics 4 integration"},{"name":"Competitive","description":"Competitor tracking + market analysis"},{"name":"Dealer Analytics","description":"Aging, scores, market position, gaps"},{"name":"Listing Quality","description":"VDP quality auditor"},{"name":"Trade-In","description":"Trade-in valuation"},{"name":"Market Signals","description":"Pricing recommendations, seasonal, F&I, supply/demand"},{"name":"Trade Match","description":"Inter-dealer trade matching"},{"name":"Webhooks","description":"Event subscriptions with HMAC signing"},{"name":"Portfolio","description":"Agency-wide rollups"},{"name":"Reports","description":"Scheduled + on-demand reports"},{"name":"Scraper Health","description":"Scraping fleet health"},{"name":"API Tokens","description":"Programmatic key management"},{"name":"Agencies","description":"Org membership"},{"name":"Users","description":"User management"},{"name":"My Dealers","description":"Your primary dealers"},{"name":"Billing","description":"Usage-metered billing"},{"name":"Auth","description":"Login, sessions, 2FA"}],"paths":{"/health":{"get":{"summary":"Health check","tags":["System"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stats":{"get":{"summary":"Public system stats","tags":["System"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"domains":{"type":"integer"},"vehicles":{"type":"integer"},"pendingJobs":{"type":"integer"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/status":{"get":{"summary":"Status page data","tags":["System"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains":{"get":{"summary":"List tracked domains","tags":["Domains"],"security":[],"parameters":[{"name":"is_active","in":"query","required":false,"schema":{"type":"boolean"},"description":"Filter by active status"},{"name":"cms_type","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by detected CMS"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100},"description":"Page size"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0},"description":"Pagination offset"}],"responses":{"200":{"description":"List of domains","content":{"application/json":{"schema":{"type":"object","properties":{"domains":{"type":"array","items":{"$ref":"#/components/schemas/Domain"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}}}}}}},"post":{"summary":"Add a domain","tags":["Domains"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","example":"https://www.example-dealer.com"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"domain":{"$ref":"#/components/schemas/Domain"}}}}}},"409":{"description":"Already exists","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"domain":{"$ref":"#/components/schemas/Domain"}}}}}}}}},"/domains/bulk":{"post":{"summary":"Bulk add up to 500 domains","tags":["Domains"],"requestBody":{"required":true,"content":{"text/csv":{"schema":{"type":"string","example":"site1.com\nsite2.com\nsite3.com"}},"application/json":{"schema":{"type":"object","properties":{"urls":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"207":{"description":"Multi-status","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"total":{"type":"integer"},"added":{"type":"integer"},"skipped":{"type":"integer"},"errors":{"type":"integer"}}},"results":{"type":"array","items":{"type":"object"}}}}}}}}}},"/domains/{clean_domain}/vehicles":{"get":{"summary":"List vehicles for a domain (by clean domain name)","tags":["Domains"],"security":[],"parameters":[{"name":"clean_domain","in":"path","required":true,"schema":{"type":"string"},"description":"e.g., cochrantoyota.com"},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"active"},"description":"active | removed | all"},{"name":"condition","in":"query","required":false,"schema":{"type":"string"},"description":"new | used | cpo"},{"name":"make","in":"query","required":false,"schema":{"type":"string"}},{"name":"model","in":"query","required":false,"schema":{"type":"string"}},{"name":"min_price","in":"query","required":false,"schema":{"type":"number"}},{"name":"max_price","in":"query","required":false,"schema":{"type":"number"}},{"name":"min_year","in":"query","required":false,"schema":{"type":"integer"}},{"name":"max_year","in":"query","required":false,"schema":{"type":"integer"}},{"name":"has_images","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"has_price","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Default 100, max 1000"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/id/{id}":{"get":{"summary":"Get a domain by numeric ID","tags":["Domains"],"security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{id}":{"delete":{"summary":"Deactivate a domain (soft-delete, vehicles preserved)","tags":["Domains"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"Deactivated"}}}},"/domains/{id}/reactivate":{"post":{"summary":"Reactivate a deactivated domain","tags":["Domains"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{id}/scan":{"post":{"summary":"Trigger a manual scrape","tags":["Domains"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"jobId":{"type":"integer"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/cms-distribution":{"get":{"summary":"Domain count per detected CMS","tags":["Domains"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vehicles":{"get":{"summary":"List vehicles with filters","tags":["Vehicles"],"security":[],"parameters":[{"name":"domain","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by clean domain"},{"name":"domain_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Filter by domain ID"},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"active"},"description":"active | removed | all"},{"name":"active_from","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date"},{"name":"active_to","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date"},{"name":"condition","in":"query","required":false,"schema":{"type":"string"},"description":"new | used | cpo"},{"name":"vehicle_type","in":"query","required":false,"schema":{"type":"string"},"description":"car | motorcycle | rv | heavy_equipment"},{"name":"make","in":"query","required":false,"schema":{"type":"string"}},{"name":"model","in":"query","required":false,"schema":{"type":"string"}},{"name":"year_min","in":"query","required":false,"schema":{"type":"integer"}},{"name":"year_max","in":"query","required":false,"schema":{"type":"integer"}},{"name":"price_min","in":"query","required":false,"schema":{"type":"number"}},{"name":"price_max","in":"query","required":false,"schema":{"type":"number"}},{"name":"mileage_min","in":"query","required":false,"schema":{"type":"integer"}},{"name":"mileage_max","in":"query","required":false,"schema":{"type":"integer"}},{"name":"has_images","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"has_price","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Full-text on VIN, make, model, stock_number"},{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"last_seen_at"},"description":"last_seen_at | first_seen_at | price | year | make"},{"name":"order","in":"query","required":false,"schema":{"type":"string","default":"desc"},"description":"asc | desc"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Default 50, max 500"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}},{"name":"dedupe","in":"query","required":false,"schema":{"type":"boolean"},"description":"Dedupe by VIN (default true unless filtering by single domain)"}],"responses":{"200":{"description":"List of vehicles","content":{"application/json":{"schema":{"type":"object","properties":{"vehicles":{"type":"array","items":{"$ref":"#/components/schemas/Vehicle"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"dedupe":{"type":"boolean"}}}}}}}}},"/vehicles/stats":{"get":{"summary":"Aggregate counts for dashboards","tags":["Vehicles"],"security":[],"parameters":[{"name":"domain_id","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vehicles/field-quality":{"get":{"summary":"Per-field population rate across active vehicles","tags":["Vehicles"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vehicles/{vin}":{"get":{"summary":"Get every listing for a VIN (cross-domain) + decode + market position","tags":["Vehicles"],"security":[],"parameters":[{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":"17-character VIN"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vehicles/{vin}/{domain}":{"get":{"summary":"Get a single listing for a VIN at a domain","tags":["Vehicles"],"security":[],"parameters":[{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""},{"name":"domain","in":"path","required":true,"schema":{"type":"string"},"description":"Clean domain"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vehicles/{vin}/price-history":{"get":{"summary":"Price history timeline for a VIN","tags":["Vehicles"],"security":[],"parameters":[{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"vin":{"type":"string"},"history":{"type":"array","items":{"type":"object","properties":{"observed_at":{"type":"string","format":"date-time"},"price":{"type":"string"}}}}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vehicles/domain/{domainId}":{"get":{"summary":"List vehicles for a domain by numeric ID","tags":["Vehicles"],"security":[],"parameters":[{"name":"domainId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs":{"get":{"summary":"List recent jobs","tags":["Jobs"],"security":[],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"pending | running | completed | failed"},{"name":"job_type","in":"query","required":false,"schema":{"type":"string"},"description":"cms_detect | scrape | vin_decode"},{"name":"domain_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/cadence":{"get":{"summary":"7-day job cadence breakdown","tags":["Jobs"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/queues/stats":{"get":{"summary":"Live queue depths per worker","tags":["Jobs"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}":{"get":{"summary":"Single job detail","tags":["Jobs"],"security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}/cancel":{"post":{"summary":"Cancel a queued or running job","tags":["Jobs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/scrape/priority":{"post":{"summary":"Push a domain to the front of the queue","tags":["Jobs"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/scrape/status/{jobId}":{"get":{"summary":"Lightweight job status","tags":["Jobs"],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/feeds":{"get":{"summary":"List feed instances","tags":["Feeds"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create a feed","tags":["Feeds"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["app_id","domain_ids"],"properties":{"app_id":{"type":"integer"},"domain_ids":{"type":"array","items":{"type":"integer"}},"name":{"type":"string"},"filters":{"type":"object"}}}}}},"responses":{"201":{"description":"Created"}}}},"/feeds/{id}":{"get":{"summary":"Feed detail","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"Updated"}}},"delete":{"summary":"Delete","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"Deleted"}}}},"/feeds/{id}/regenerate":{"post":{"summary":"Regenerate the download token + content","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/feeds/{id}/vehicles":{"get":{"summary":"Preview vehicles included in the feed","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/feeds/fields":{"get":{"summary":"Available source fields for column mapping","tags":["Feeds"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/feeds/apps":{"get":{"summary":"List feed app templates","tags":["Feeds"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create a custom app","tags":["Feeds"],"responses":{"201":{"description":"Created"}}}},"/feeds/apps/{id}":{"get":{"summary":"App detail with columns","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update app","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete app","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/feeds/apps/{id}/columns":{"post":{"summary":"Add a column","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"201":{"description":"Created"}}}},"/feeds/apps/{appId}/columns/{columnId}":{"put":{"summary":"Update column","tags":["Feeds"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"columnId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete column","tags":["Feeds"],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"columnId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/feeds/apps/{id}/columns/reorder":{"put":{"summary":"Reorder columns","tags":["Feeds"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/feeds/preview":{"post":{"summary":"Preview a feed config without saving","tags":["Feeds"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/feeds/download/{token}":{"get":{"summary":"Public feed download (token in path)","tags":["Feeds"],"security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vla/dealers/{dealerId}/feeds/vla":{"get":{"summary":"VLA feed metadata","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vla/dealers/{dealerId}/feeds/vla/content":{"get":{"summary":"Public VLA feed content (XML)","tags":["VLA"],"security":[],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"feed_token","in":"query","required":true,"schema":{"type":"string"},"description":"Signed token"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vla/dealers/{dealerId}/feeds/vla/history":{"get":{"summary":"Generation history","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vla/dealers/{dealerId}/feeds/vla/config":{"get":{"summary":"Get VLA config","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update VLA config","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"feed_name":{"type":"string"},"include_stars":{"type":"boolean"},"include_fix_it":{"type":"boolean"},"include_boost":{"type":"boolean"},"include_push_or_cut":{"type":"boolean"},"exclude_above_market":{"type":"boolean"},"refresh_interval_hours":{"type":"integer"},"is_active":{"type":"boolean"},"payment_config":{"type":"object","description":"IMPORTANT: required for installment payments to render in feed"}}}}}},"responses":{"200":{"description":"OK"}}}},"/vla/dealers/{dealerId}/feeds/vla/generate":{"post":{"summary":"Force regenerate","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vla/dealers/{dealerId}/feeds/vla/overrides":{"get":{"summary":"List manual VIN overrides","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Upsert override","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["vin","force_include"],"properties":{"vin":{"type":"string"},"force_include":{"type":"boolean"},"override_reason":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}}},"/vla/dealers/{dealerId}/feeds/vla/overrides/{vin}":{"delete":{"summary":"Remove override","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"204":{"description":"Deleted"}}}},"/vla/dealers/{dealerId}/inventory/labels":{"get":{"summary":"Label distributions","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vla/dealers/{dealerId}/inventory/{vin}/labels":{"get":{"summary":"Labels + history for a VIN","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vla/dealers/{dealerId}/inventory/{vin}/labels/custom":{"put":{"summary":"Set custom label_4 for a VIN","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/feeds/time-decay/config":{"get":{"summary":"Get time-decay bid curve","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Replace time-decay curve","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/dealers/{dealerId}/feeds/reactive-boost/config":{"get":{"summary":"Get reactive boost config","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update reactive boost config","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/dealers/{dealerId}/inventory/boosts":{"get":{"summary":"Per-VIN reactive boost multipliers","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/feeds/search-terms":{"get":{"summary":"Search-term optimization suggestions","tags":["VLA"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ga4/connect/{dealerId}":{"get":{"summary":"Begin GA4 OAuth flow","tags":["GA4"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ga4/callback":{"get":{"summary":"OAuth redirect handler","tags":["GA4"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ga4/status/{dealerId}":{"get":{"summary":"Connection status + properties","tags":["GA4"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ga4/disconnect/{dealerId}/{connectionId}":{"post":{"summary":"Disconnect a GA4 property","tags":["GA4"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"connectionId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ga4/sync/{dealerId}/{connectionId}":{"post":{"summary":"Trigger a GA4 sync (async)","tags":["GA4"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"connectionId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ga4/analytics/{dealerId}":{"get":{"summary":"Aggregated analytics + per-VIN engagement","tags":["GA4"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"from","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date"},{"name":"to","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date"},{"name":"vin","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/places/autocomplete":{"get":{"summary":"Google Places autocomplete","tags":["Competitive"],"parameters":[{"name":"input","in":"query","required":true,"schema":{"type":"string"},"description":"Min 2 chars"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/places/{place_id}":{"get":{"summary":"Place detail + OEM detection","tags":["Competitive"],"parameters":[{"name":"place_id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/dealers":{"get":{"summary":"List tracked dealers","tags":["Competitive"],"parameters":[{"name":"is_primary","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Add a tracked dealer","tags":["Competitive"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"google_place_id":{"type":"string"},"name":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"postal_code":{"type":"string"},"lat":{"type":"number"},"lon":{"type":"number"},"website":{"type":"string"},"clean_domain":{"type":"string"},"oem_brand":{"type":"string"},"dealer_type":{"type":"string","enum":["new","used","new_and_used"]},"is_primary":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Created"}}}},"/competitive/dealers/{id}":{"get":{"summary":"Dealer detail","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Remove","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/competitive/groups":{"get":{"summary":"List competitor groups","tags":["Competitive"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create group (auto-runs discovery)","tags":["Competitive"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["primary_dealer_id"],"properties":{"primary_dealer_id":{"type":"integer"},"oem_brand":{"type":"string"},"radius_miles":{"type":"integer","default":30},"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Created"}}}},"/competitive/groups/{id}":{"get":{"summary":"Group detail + members + inventory stats","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/discover":{"post":{"summary":"Re-run auto-discovery","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/members":{"post":{"summary":"Add a dealer to the group","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/members/{memberId}":{"delete":{"summary":"Remove member","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"memberId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/competitive/groups/{id}/map-data":{"get":{"summary":"Map overlay data","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/market-share":{"get":{"summary":"Per-dealer market share","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"make","in":"query","required":false,"schema":{"type":"string"}},{"name":"model","in":"query","required":false,"schema":{"type":"string"}},{"name":"body_type","in":"query","required":false,"schema":{"type":"string"}},{"name":"condition","in":"query","required":false,"schema":{"type":"string"}},{"name":"window","in":"query","required":false,"schema":{"type":"string"},"description":"current | 30d | 90d | 365d"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/pricing":{"get":{"summary":"Price comparison by make/model","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"make","in":"query","required":true,"schema":{"type":"string"},"description":""},{"name":"model","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/heatmap":{"get":{"summary":"Inventory heatmap by ZIP","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/activity":{"get":{"summary":"New / removed / price-changed vehicles","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":7},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/timeline":{"get":{"summary":"Daily inventory timeline","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/market-intelligence":{"get":{"summary":"Primary inventory w/ market pricing + competitor matches","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"condition","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":1000},"description":""},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/groups/{id}/listings":{"get":{"summary":"Own + competitor listings for a make/model","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"make","in":"query","required":true,"schema":{"type":"string"},"description":""},{"name":"model","in":"query","required":false,"schema":{"type":"string"}},{"name":"trim","in":"query","required":false,"schema":{"type":"string"}},{"name":"year_min","in":"query","required":false,"schema":{"type":"integer"}},{"name":"year_max","in":"query","required":false,"schema":{"type":"integer"}},{"name":"condition","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/alerts":{"get":{"summary":"List alerts","tags":["Competitive"],"parameters":[{"name":"group_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"unread","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/alerts/{id}/read":{"put":{"summary":"Mark alert read","tags":["Competitive"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/alerts/read-all":{"put":{"summary":"Mark all alerts read","tags":["Competitive"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/competitive/alerts/preferences":{"get":{"summary":"Get alert preferences","tags":["Competitive"],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update alert preferences","tags":["Competitive"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email_enabled":{"type":"boolean"},"new_competitor_alert":{"type":"boolean"},"inventory_change_alert":{"type":"boolean"},"inventory_change_threshold":{"type":"integer"},"price_change_alert":{"type":"boolean"},"price_change_threshold":{"type":"number"},"daily_digest":{"type":"boolean"},"weekly_digest":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK"}}}},"/dealers/aging":{"get":{"summary":"Agency-wide aging summary","tags":["Dealer Analytics"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/aging-alerts":{"get":{"summary":"All undismissed aging alerts","tags":["Dealer Analytics"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/top":{"get":{"summary":"Top dealers by inventory size","tags":["Dealer Analytics"],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/aging":{"get":{"summary":"Per-dealer aging report (paginated)","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"threshold","in":"query","required":false,"schema":{"type":"integer"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Max 100"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/aging/config":{"get":{"summary":"Get aging thresholds","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Replace aging thresholds","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/dealers/{dealerId}/aging/alerts/{alertId}/dismiss":{"post":{"summary":"Dismiss an aging alert","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"alertId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/alerts/price-changes":{"get":{"summary":"Competitor price-change alerts (paginated)","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"from","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date"},{"name":"to","in":"query","required":false,"schema":{"type":"string"},"description":"ISO date"},{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/alerts/price-changes/{id}/read":{"post":{"summary":"Mark price alert read","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/alerts/price-changes/config":{"get":{"summary":"Get price-alert config","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update price-alert config","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/dealers/{dealerId}/inventory/scores":{"get":{"summary":"Engagement scores (GA4-derived)","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"min_score","in":"query","required":false,"schema":{"type":"number"}},{"name":"max_score","in":"query","required":false,"schema":{"type":"number"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/{vin}/engagement":{"get":{"summary":"Engagement detail + history for a VIN","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/quadrants":{"get":{"summary":"Stars / Fix-It / Boost / Push-or-Cut matrix","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"quadrant","in":"query","required":false,"schema":{"type":"string"},"description":"stars | fix_it | boost | push_or_cut"},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/positions":{"get":{"summary":"Market positions for all VINs","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"position_label","in":"query","required":false,"schema":{"type":"string"},"description":"below_market | at_market | above_market"},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/{vin}/market-position":{"get":{"summary":"Market position + comparables + insight","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/gaps":{"get":{"summary":"Inventory gap opportunities","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"condition","in":"query","required":false,"schema":{"type":"string"}},{"name":"min_score","in":"query","required":false,"schema":{"type":"number"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/reports/ad-efficiency":{"get":{"summary":"List ad efficiency reports","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Generate new ad efficiency report","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/dealers/{dealerId}/reports/ad-efficiency/{reportId}":{"get":{"summary":"Ad efficiency report detail (HTML or JSON)","tags":["Dealer Analytics"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"reportId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"format","in":"query","required":false,"schema":{"type":"string"},"description":"html"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/quality":{"get":{"summary":"Listing quality distribution + top issues","tags":["Listing Quality"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/quality/vehicles":{"get":{"summary":"Per-VIN quality list (paginated)","tags":["Listing Quality"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"asc | desc"},{"name":"max_score","in":"query","required":false,"schema":{"type":"number"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/{vin}/quality":{"get":{"summary":"Single-VIN quality score + issues","tags":["Listing Quality"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/quality/audit":{"post":{"summary":"Trigger a manual audit","tags":["Listing Quality"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/{vin}/optimized-title":{"get":{"summary":"AI-optimized vehicle title","tags":["Listing Quality"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/trade-in/valuation":{"post":{"summary":"Trade-in value estimate (low/mid/high)","tags":["Trade-In"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["year","make","model","mileage","condition"],"properties":{"year":{"type":"integer"},"make":{"type":"string"},"model":{"type":"string"},"trim":{"type":"string"},"mileage":{"type":"integer"},"condition":{"type":"string","enum":["excellent","good","fair","poor"]}}}}}},"responses":{"200":{"description":"Valuation","content":{"application/json":{"schema":{"type":"object","properties":{"vehicle":{"type":"object"},"valuation":{"type":"object","properties":{"low":{"type":"number"},"mid":{"type":"number"},"high":{"type":"number"}}},"market_context":{"type":"object"}}}}}},"422":{"description":"Insufficient market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/pricing-recommendations":{"get":{"summary":"Per-VIN pricing recommendations (sell-fast/margin/equilibrium)","tags":["Market Signals"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/inventory/{vin}/pricing-recommendation":{"get":{"summary":"Single-VIN recommendation","tags":["Market Signals"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/market/imbalances":{"get":{"summary":"Supply/demand imbalances per segment","tags":["Market Signals"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"pricing_power","in":"query","required":false,"schema":{"type":"string"},"description":"high | medium | low | none"},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/market/seasonal":{"get":{"summary":"Seasonal demand patterns","tags":["Market Signals"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/market/seasonal/{make}/{model}":{"get":{"summary":"Seasonal pattern for one make/model","tags":["Market Signals"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"make","in":"path","required":true,"schema":{"type":"string"},"description":""},{"name":"model","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/fi/benchmarks":{"get":{"summary":"F&I payment benchmarks per segment","tags":["Market Signals"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/fi/benchmarks/{make}/{model}":{"get":{"summary":"F&I benchmarks for one segment","tags":["Market Signals"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"make","in":"path","required":true,"schema":{"type":"string"},"description":""},{"name":"model","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/trade/preferences":{"get":{"summary":"Get trade preferences","tags":["Trade Match"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update trade preferences","tags":["Trade Match"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"opt_in":{"type":"boolean"},"wants_makes":{"type":"array","items":{"type":"string"}},"wants_models":{"type":"array","items":{"type":"string"}},"geographic_radius_miles":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK"}}}},"/dealers/{dealerId}/trade/matches":{"get":{"summary":"List trade matches","tags":["Trade Match"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"pending | contacted | completed | declined"},{"name":"role","in":"query","required":false,"schema":{"type":"string"},"description":"buyer | seller"},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/trade/matches/{id}/contact":{"post":{"summary":"Mark match contacted","tags":["Trade Match"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dealers/{dealerId}/trade/matches/{id}/decline":{"post":{"summary":"Decline a match","tags":["Trade Match"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"get":{"summary":"List webhook subscriptions","tags":["Webhooks"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}},"supported_events":{"type":"array","items":{"type":"string"}}}}}}}}},"post":{"summary":"Create a webhook (returns secret once)","tags":["Webhooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["dealer_id","url","events"],"properties":{"dealer_id":{"type":"integer"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"description":{"type":"string"}}}}}},"responses":{"201":{"description":"Created"}}}},"/webhooks/{id}":{"get":{"summary":"Webhook detail + recent deliveries","tags":["Webhooks"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update","tags":["Webhooks"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete","tags":["Webhooks"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/webhooks/{id}/test":{"post":{"summary":"Queue a test delivery","tags":["Webhooks"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/deliveries":{"get":{"summary":"Delivery history","tags":["Webhooks"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"page","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"pending | delivered | failed"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/portfolio/summary":{"get":{"summary":"Agency-wide aggregate stats","tags":["Portfolio"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/portfolio/dealers":{"get":{"summary":"Per-dealer rollup","tags":["Portfolio"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/portfolio/conflicts":{"get":{"summary":"Intra-agency VIN/pricing conflicts","tags":["Portfolio"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/portfolio/benchmarks":{"get":{"summary":"Cross-dealer benchmarks","tags":["Portfolio"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reports/schedules":{"get":{"summary":"List schedules","tags":["Reports"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create schedule","tags":["Reports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["dealer_id","cadence","recipients"],"properties":{"dealer_id":{"type":"integer"},"cadence":{"type":"string","enum":["weekly","monthly"]},"day_of_week":{"type":"integer"},"day_of_month":{"type":"integer"},"send_hour":{"type":"integer"},"recipients":{"type":"array","items":{"type":"string"}},"include_summary":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Created"}}}},"/reports/schedules/{id}":{"put":{"summary":"Update schedule","tags":["Reports"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete schedule","tags":["Reports"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/reports/schedules/{id}/send-now":{"post":{"summary":"Send schedule immediately","tags":["Reports"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reports/{dealerId}/generate":{"post":{"summary":"Generate a one-off report","tags":["Reports"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reports/{dealerId}/latest":{"get":{"summary":"Latest report for a dealer","tags":["Reports"],"parameters":[{"name":"dealerId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/scraper-health/platforms":{"get":{"summary":"Per-CMS health","tags":["Scraper Health"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/scraper-health/domains":{"get":{"summary":"Per-domain health","tags":["Scraper Health"],"parameters":[{"name":"cms_type","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"healthy | degraded | failed"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/scraper-health/domains/{domainId}":{"get":{"summary":"Domain detail with job history","tags":["Scraper Health"],"parameters":[{"name":"domainId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/scraper-health/domains/{domainId}/clear-sitemap-source":{"post":{"summary":"Reset persisted sitemap source","tags":["Scraper Health"],"parameters":[{"name":"domainId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/scraper-health/alerts":{"get":{"summary":"Active scraper alerts","tags":["Scraper Health"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/scraper-health/alerts/{domainId}/dismiss":{"post":{"summary":"Dismiss a scraper alert","tags":["Scraper Health"],"parameters":[{"name":"domainId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tokens":{"get":{"summary":"List your API tokens (secrets redacted)","tags":["API Tokens"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create an API token, plaintext returned ONCE","tags":["API Tokens"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"expires_in_days":{"type":"integer","nullable":true}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"token":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"token":{"type":"string","description":"Plaintext, store immediately"},"expires_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"warning":{"type":"string"}}}}}}}}},"/tokens/{id}":{"delete":{"summary":"Revoke a token","tags":["API Tokens"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/tokens/{id}/usage":{"get":{"summary":"Daily usage sparkline for a token","tags":["API Tokens"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"days","in":"query","required":false,"schema":{"type":"integer"},"description":"Default 30, max 90"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agencies/current":{"get":{"summary":"Current agency + counts","tags":["Agencies"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agencies":{"get":{"summary":"List agencies (super-admin)","tags":["Agencies"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create (super-admin)","tags":["Agencies"],"responses":{"201":{"description":"Created"}}}},"/agencies/{id}":{"get":{"summary":"Agency detail + users","tags":["Agencies"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update","tags":["Agencies"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Deactivate (super-admin)","tags":["Agencies"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/agencies/{id}/usage":{"get":{"summary":"Usage stats + audit log","tags":["Agencies"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agencies/{id}/domain-groups":{"get":{"summary":"List domain groups","tags":["Agencies"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create group","tags":["Agencies"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"201":{"description":"Created"}}}},"/agencies/{agencyId}/domain-groups/{groupId}":{"put":{"summary":"Update","tags":["Agencies"],"parameters":[{"name":"agencyId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"groupId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete","tags":["Agencies"],"parameters":[{"name":"agencyId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"groupId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/agencies/{agencyId}/domain-groups/{groupId}/domains":{"post":{"summary":"Add domains to group","tags":["Agencies"],"parameters":[{"name":"agencyId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"groupId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/agencies/{agencyId}/domain-groups/{groupId}/domains/{domainId}":{"delete":{"summary":"Remove domain from group","tags":["Agencies"],"parameters":[{"name":"agencyId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"groupId","in":"path","required":true,"schema":{"type":"integer"},"description":""},{"name":"domainId","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/users":{"get":{"summary":"List agency users","tags":["Users"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Invite a user","tags":["Users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","user_role"],"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"user_role":{"type":"string","enum":["viewer","manager","admin"]}}}}}},"responses":{"201":{"description":"Invited"}}}},"/users/{id}":{"get":{"summary":"User detail","tags":["Users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update","tags":["Users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Deactivate","tags":["Users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/users/{id}/reactivate":{"post":{"summary":"Reactivate user","tags":["Users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/users/{id}/resend-invite":{"post":{"summary":"Resend invite email","tags":["Users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/users/{id}/domain-access":{"put":{"summary":"Restrict user to specific domains","tags":["Users"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/users/me/notification-prefs":{"get":{"summary":"Get notification prefs","tags":["Users"],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update notification prefs","tags":["Users"],"responses":{"200":{"description":"OK"}}}},"/my-dealers":{"get":{"summary":"List primary dealers","tags":["My Dealers"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create a primary dealer","tags":["My Dealers"],"responses":{"201":{"description":"Created"}}}},"/my-dealers/{id}":{"put":{"summary":"Update","tags":["My Dealers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete","tags":["My Dealers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/billing/summary":{"get":{"summary":"Plan, trial, domain counts, Stripe readiness","tags":["Billing"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/start-checkout":{"post":{"summary":"Begin Stripe Checkout","tags":["Billing"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/portal":{"post":{"summary":"Open Stripe Customer Portal","tags":["Billing"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/cancel":{"post":{"summary":"Schedule cancel at period end","tags":["Billing"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/domains/{id}/pause":{"post":{"summary":"Pause billing for a domain","tags":["Billing"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/domains/{id}/resume":{"post":{"summary":"Resume billing for a domain","tags":["Billing"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/usage/current":{"get":{"summary":"Current-period usage + quota","tags":["Billing"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/usage/history":{"get":{"summary":"Prior-month rollups","tags":["Billing"],"parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer"},"description":"Default 6, max 24"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/usage/daily":{"get":{"summary":"Daily usage sparkline","tags":["Billing"],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer"},"description":"Default 30, max 90"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/usage/config":{"put":{"summary":"Update hard cap + alerts","tags":["Billing"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/login":{"post":{"summary":"Login (returns JWT pair)","tags":["Auth"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"refresh_token":{"type":"string"},"user":{"type":"object"}}}}}}}}},"/auth/refresh":{"post":{"summary":"Refresh access token","tags":["Auth"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/logout":{"post":{"summary":"Logout (invalidate session)","tags":["Auth"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/me":{"get":{"summary":"Current user","tags":["Auth"],"responses":{"200":{"description":"OK"}}},"put":{"summary":"Update profile","tags":["Auth"],"responses":{"200":{"description":"OK"}}}},"/auth/change-password":{"post":{"summary":"Change password","tags":["Auth"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/forgot-password":{"post":{"summary":"Request a reset email","tags":["Auth"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/reset-password":{"post":{"summary":"Reset password from email link","tags":["Auth"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/sessions":{"get":{"summary":"Active sessions","tags":["Auth"],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Revoke all sessions","tags":["Auth"],"responses":{"200":{"description":"OK"}}}},"/auth/sessions/{id}":{"delete":{"summary":"Revoke a session","tags":["Auth"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":""}],"responses":{"200":{"description":"OK"}}}},"/auth/2fa/totp/setup":{"post":{"summary":"Begin TOTP enrollment","tags":["Auth"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/2fa/totp/confirm":{"post":{"summary":"Confirm TOTP enrollment with code","tags":["Auth"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/2fa/totp/disable":{"post":{"summary":"Disable TOTP","tags":["Auth"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/2fa/totp/verify":{"post":{"summary":"Verify TOTP code during login","tags":["Auth"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/magic-link/request":{"post":{"summary":"Request a magic-link email","tags":["Auth"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/magic-link/verify":{"post":{"summary":"Exchange magic link for tokens","tags":["Auth"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}