{"openapi":"3.1.0","info":{"title":"BuyAFactory.com REST API","version":"2.0.0","description":"Manufacturing deal sourcing and a tenant-isolated workspace. Local demo requests may use x-tenant-id on loopback. Protected remote requests use a scoped Bearer key."},"servers":[{"url":"/"}],"paths":{"/api/workspace/session":{"post":{"operationId":"openBrowserWorkspace","summary":"Start an isolated same-origin browser workspace","security":[],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":[]}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/register":{"post":{"operationId":"registerBuyerAccount","summary":"Register a buyer account and issue a 6-digit email confirmation code","security":[],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/verify":{"post":{"operationId":"verifyBuyerAccount","summary":"Confirm a 6-digit registration code and open an authenticated buyer workspace","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/login":{"post":{"operationId":"loginBuyerAccount","summary":"Sign in to a buyer account (triggers Google Authenticator 2FA challenge if enabled)","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/2fa/verify-login":{"post":{"operationId":"verifyBuyer2faLogin","summary":"Verify a 6-digit Google Authenticator TOTP code or backup code to finish sign-in","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/logout":{"post":{"operationId":"logoutBuyerAccount","summary":"Sign out and clear the workspace session cookie","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}}}}},"/api/auth/me":{"get":{"operationId":"getBuyerAccount","summary":"Read the active buyer account profile and 2FA status","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/2fa/setup":{"post":{"operationId":"setupBuyer2fa","summary":"Generate a local Google Authenticator QR code and Base32 TOTP secret","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/2fa/enable":{"post":{"operationId":"enableBuyer2fa","summary":"Verify a live 6-digit TOTP code to enable Google Authenticator 2FA and issue 8 backup codes","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/2fa/disable":{"post":{"operationId":"disableBuyer2fa","summary":"Verify a valid TOTP or backup code to disable 2FA","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/health":{"get":{"operationId":"getHealth","summary":"Check service availability","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"app":{"type":"string"}},"required":[]}}}}}}},"/api/media/factory-photo":{"get":{"operationId":"getFactoryPhoto","summary":"Proxy HD Satellite Aerial, Google Street View, or Google Places facility imagery (requires 2-credit imagery unlock; redacted on confidential listings until owner unlock)","security":[],"parameters":[{"name":"targetType","in":"query","schema":{"type":"string","enum":["factory","listing"]}},{"name":"id","in":"query","schema":{"type":"string"}},{"name":"view","in":"query","schema":{"type":"string","enum":["satellite","streetview","place"]}},{"name":"ref","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsufficientCredits"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/media/factory-photos":{"get":{"operationId":"listFactoryPhotos","summary":"List scrollable property & shop-floor facility pictures (requires 2-credit imagery unlock; redacted on confidential listings until owner unlock)","security":[],"parameters":[{"name":"targetType","in":"query","schema":{"type":"string","enum":["factory","listing"]}},{"name":"id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsufficientCredits"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/media/factory-photo/unlock":{"post":{"operationId":"unlockFactoryPhoto","summary":"Spend credits once per facility to unlock Satellite Aerial and Google Street View imagery","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["spend:credits"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"targetType":{"type":"string","enum":["factory","listing"]},"id":{"type":"string"}},"required":["targetType","id"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"unlocked":{"type":"boolean"},"alreadyUnlocked":{"type":"boolean"},"creditsCharged":{"type":"integer"},"balanceAfter":{"type":"integer"}},"required":["unlocked","alreadyUnlocked","creditsCharged","balanceAfter"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsufficientCredits"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/openapi.json":{"get":{"operationId":"getOpenApi","summary":"Get this OpenAPI document","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}}}}},"/api/listings":{"get":{"operationId":"listMarketplaceListings","summary":"Browse verified US factories for sale on BuyAFactory.com","security":[],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"state","in":"query","schema":{"type":"string"}},{"name":"region","in":"query","schema":{"type":"string"}},{"name":"process","in":"query","schema":{"type":"string"}},{"name":"certification","in":"query","schema":{"type":"string"}},{"name":"minPrice","in":"query","schema":{"type":"integer"}},{"name":"maxPrice","in":"query","schema":{"type":"integer"}},{"name":"minRevenue","in":"query","schema":{"type":"integer"}},{"name":"realEstateIncluded","in":"query","schema":{"type":"boolean"}},{"name":"verifiedOnly","in":"query","schema":{"type":"boolean"}},{"name":"sort","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"listings":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"stats":{"type":"object","properties":{},"required":[]}},"required":["listings","stats"]}}}}}},"post":{"operationId":"createMarketplaceListing","summary":"List a US factory for sale 100% free with 0% commission","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"listing":{"type":"object","properties":{},"required":[]},"slug":{"type":"string"},"verification":{"type":"object","properties":{},"required":[]},"commissionFeePct":{"type":"integer"}},"required":["listing","slug","verification","commissionFeePct"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/listings/{slug}":{"get":{"operationId":"getMarketplaceListing","summary":"Read a BuyAFactory.com classified deal sheet","security":[],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"listing":{"type":"object","properties":{},"required":[]},"inquiryCount":{"type":"integer"}},"required":["listing","inquiryCount"]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/listings/{id}/unlock":{"post":{"operationId":"unlockMarketplaceListing","summary":"Unlock verified owner contact for a classified listing (2 credits)","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories","spend:credits"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"listing":{"type":"object","properties":{},"required":[]},"alreadyUnlocked":{"type":"boolean"},"creditsCharged":{"type":"integer","minimum":0},"balanceAfter":{"type":"integer","minimum":0}},"required":["listing","alreadyUnlocked","creditsCharged","balanceAfter"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsufficientCredits"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/listings/{id}/inquire":{"post":{"operationId":"inquireMarketplaceListing","summary":"Send a direct zero-commission inquiry to a factory owner","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"buyerName":{"type":"string"},"buyerEmail":{"type":"string","format":"email"},"buyerFirm":{"type":"string"},"buyerType":{"type":"string"},"proofOfFundsBand":{"type":"string"},"message":{"type":"string"}},"required":["buyerName","buyerEmail","buyerFirm","buyerType","proofOfFundsBand","message"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"inquiry":{"type":"object","properties":{},"required":[]},"listingId":{"type":"string"},"commissionFeePct":{"type":"integer"}},"required":["inquiry","listingId","commissionFeePct"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/owner/register":{"post":{"operationId":"registerOwnerAccount","summary":"Create a free factory owner account to manage listings and buyer inquiries","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fullName":{"type":"string"},"email":{"type":"string","format":"email"},"password":{"type":"string"},"companyName":{"type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["fullName","email","password","companyName"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"type":"object","properties":{},"required":[]},"listings":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"inquiries":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["account"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/owner/login":{"post":{"operationId":"loginOwnerAccount","summary":"Sign in to a factory owner account","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string"}},"required":["email","password"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"type":"object","properties":{},"required":[]},"listings":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"inquiries":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["account"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/owner/demo-login":{"post":{"operationId":"demoLoginOwnerAccount","summary":"Sign in to the local demo factory owner account","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"type":"object","properties":{},"required":[]},"listings":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"inquiries":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["account"]}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}}}}},"/api/owner/logout":{"post":{"operationId":"logoutOwnerAccount","summary":"Sign out of a factory owner account","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"signedOut":{"type":"boolean"}},"required":[]}}}}}}},"/api/owner/me":{"get":{"operationId":"getOwnerPortal","summary":"Read the signed-in factory owner's listings and buyer inquiries","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"anyOf":[{"type":"object","properties":{},"required":[]},{"type":"null"}]},"listings":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"inquiries":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":[]}}}}}}},"/api/owner/listings/{id}":{"patch":{"operationId":"updateOwnerListing","summary":"Update status, visibility, or asking price on an owned factory listing","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","under_loi","sold"]},"visibility":{"type":"string","enum":["named","confidential"]},"askingPriceUsd":{"type":"integer"}},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"listing":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/owner/inquiries/{id}":{"patch":{"operationId":"updateOwnerInquiryStatus","summary":"Update buyer inquiry triage status in the owner inbox","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["new","nda_sent","qualified","declined"]}},"required":["status"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"inquiry":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/owner/inquiries/{id}/reply":{"post":{"operationId":"replyOwnerInquiry","summary":"Send a direct reply to a buyer inquiry from the owner portal","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string"}},"required":["body"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"inquiry":{"type":"object","properties":{},"required":[]},"reply":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/lists":{"get":{"operationId":"listSavedLists","summary":"List private buyer saved lists and working shortlists","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"lists":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["lists"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createSavedList","summary":"Create a new private buyer shortlist","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"color":{"type":"string"},"isDefault":{"type":"boolean"}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"list":{"type":"object","properties":{},"required":[]},"lists":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["list","lists"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/lists/{id}":{"patch":{"operationId":"updateSavedList","summary":"Update a saved list name, color, or default setting","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"color":{"type":"string"},"isDefault":{"type":"boolean"}},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"list":{"type":"object","properties":{},"required":[]},"lists":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["list","lists"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteSavedList","summary":"Delete a custom saved list","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"list":{"type":"object","properties":{},"required":[]},"lists":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["list","lists"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/lists/{id}/items":{"post":{"operationId":"addSavedListItem","summary":"Save a factory or verified classified listing to a working list","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"itemType":{"type":"string","enum":["factory","listing"]},"itemId":{"type":"string"},"name":{"type":"string"},"subtitle":{"type":"string"},"score":{"anyOf":[{"type":"integer"},{"type":"null"}]},"sourceTag":{"type":"string"},"notes":{"type":"string"}},"required":["itemType","itemId","name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"list":{"type":"object","properties":{},"required":[]},"item":{"type":"object","properties":{},"required":[]},"lists":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["list","item","lists"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/lists/{id}/items/{itemId}":{"delete":{"operationId":"removeSavedListItem","summary":"Remove a factory or classified listing from a working list","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"itemId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"list":{"type":"object","properties":{},"required":[]},"lists":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["list","lists"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/factories":{"get":{"operationId":"listFactories","summary":"Search the catalog and workspace candidates","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"state","in":"query","schema":{"type":"string"}},{"name":"certification","in":"query","schema":{"type":"string"}},{"name":"erp","in":"query","schema":{"type":"string"}},{"name":"ownershipType","in":"query","schema":{"type":"string"}},{"name":"minSuccessionScore","in":"query","schema":{"type":"integer"}},{"name":"independentOnly","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"factories":{"type":"array","items":{"$ref":"#/components/schemas/Factory"}}},"required":["factories"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createCandidate","summary":"Create a workspace-private factory candidate","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string"},"website":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"state":{"type":"string"},"city":{"type":"string"},"description":{"type":"string"},"processes":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"factory":{"$ref":"#/components/schemas/Factory"}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/factories/{id}":{"get":{"operationId":"getFactory","summary":"Get a factory dossier by ID or slug","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dossier"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/factories/{id}/deed-enrichment":{"get":{"operationId":"getDeedEnrichment","summary":"Read tenant-only Enterprise deed estimates","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories","write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"enrichment":{"anyOf":[{"$ref":"#/components/schemas/DeedEnrichment"},{"type":"null"}]}},"required":["enrichment"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"generateDeedEnrichment","summary":"Generate and save Enterprise deed estimates","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories","write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"enrichment":{"$ref":"#/components/schemas/DeedEnrichment"}},"required":["enrichment"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/factories/{id}/vault":{"patch":{"operationId":"updateVault","summary":"Update the workspace's private notes on a factory","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dealStage":{"type":"string"},"privateOwnerMobile":{"anyOf":[{"type":"string"},{"type":"null"}]},"privateOwnerEmail":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}]},"notes":{"type":"string"},"relationshipOwnerUserId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"privateNote":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/factories/{id}/reveal":{"post":{"operationId":"revealOwner","summary":"Unlock verified owner contact once per workspace and factory","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories","spend:credits"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"factoryId":{"type":"string"},"owners":{"type":"array","items":{"$ref":"#/components/schemas/Owner"}},"alreadyRevealed":{"type":"boolean"},"creditsCharged":{"type":"integer","minimum":0},"balanceAfter":{"type":"integer","minimum":0}},"required":[]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsufficientCredits"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/scans/card":{"get":{"operationId":"listCardScans","summary":"List private business card scans","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scans":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["scans"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"scanCard","summary":"Import text or OCR a business card image","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rawText":{"type":"string"},"imageBase64":{"type":"string"},"tradeShowId":{"anyOf":[{"type":"string"},{"type":"null"}]},"boothNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":[]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Dossier"},{"type":"object","properties":{"scan":{"type":"object","properties":{},"required":[]}},"required":[]}]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Unsupported content type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Scan text could not be extracted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/scans/voice-memo":{"post":{"operationId":"createVoiceMemo","summary":"Store a transcript and extract deal signals","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"transcript":{"type":"string"},"factoryId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cardScanId":{"anyOf":[{"type":"string"},{"type":"null"}]},"durationSeconds":{"type":"integer"},"audioUri":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["transcript"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"memo":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/mandates":{"get":{"operationId":"listMandates","summary":"List private buyer mandates","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"mandates":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["mandates"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createMandate","summary":"Create a buyer mandate","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"buyerType":{"type":"string"},"targetProcesses":{"type":"array","items":{"type":"string"}},"targetEndMarkets":{"type":"array","items":{"type":"string"}},"preferredStates":{"type":"array","items":{"type":"string"}},"requiredCertifications":{"type":"array","items":{"type":"string"}},"revenueBands":{"type":"array","items":{"type":"string"}},"independentOnly":{"type":"boolean"},"minSuccessionScore":{"type":"integer"},"requireRealEstateOption":{"type":"boolean"},"notes":{"type":"string"},"active":{"type":"boolean"}},"required":["name","buyerType"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"mandate":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/mandates/{id}":{"patch":{"operationId":"updateMandate","summary":"Update a buyer mandate","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"mandate":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/mandates/{id}/matches":{"get":{"operationId":"rankMandate","summary":"Rank factory matches for a private mandate","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault","read:factories"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"mandate":{"type":"object","properties":{},"required":[]},"matches":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":[]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/shows":{"get":{"operationId":"listShows","summary":"List workspace trade shows and exhibitors","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"shows":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["shows"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createShow","summary":"Create a trade show","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"endDate":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"show":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/shows/{id}/exhibitors/import":{"post":{"operationId":"importExhibitors","summary":"Import and score exhibitors from CSV or structured rows","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"csv":{"type":"string"}},"required":["csv"]},{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"companyName":{"type":"string"},"boothNumber":{"type":"string"},"website":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["companyName","boothNumber"]}}},"required":["rows"]}]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"exhibitors":{"type":"array","items":{"type":"object","properties":{},"required":[]}}},"required":["exhibitors"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/shows/{id}/exhibitors/{boothId}":{"patch":{"operationId":"updateExhibitor","summary":"Update exhibitor notes or visit status","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"boothId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"visited":{"type":"boolean"},"notes":{"type":"string"}},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"exhibitor":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/outreach/draft":{"post":{"operationId":"draftOutreach","summary":"Create a draft-only outreach sequence","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"factoryId":{"type":"string"},"mandateId":{"anyOf":[{"type":"string"},{"type":"null"}]},"recipientName":{"type":"string"},"recipientTitle":{"type":"string"},"angle":{"type":"string"}},"required":["factoryId"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"sequence":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/exports/{format}":{"get":{"operationId":"exportTargets","summary":"Download a CRM-ready CSV","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["export:crm"],"parameters":[{"name":"format","in":"path","required":true,"schema":{"type":"string","enum":["ghl","hubspot","affinity","csv"]}},{"name":"mandateId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV download","content":{"text/csv":{"schema":{"type":"string"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/alerts/digest":{"get":{"operationId":"getAlertDigest","summary":"Get a ranked digest for the workspace's active mandates","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["write:vault","read:factories"],"parameters":[{"name":"minFitScore","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"digest":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ingestion/enrich":{"post":{"operationId":"enrichDossier","summary":"Extract dossier signals from supplied company text","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["run:discovery","spend:credits"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"text":{"type":"string"},"website":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]}},"required":["name","text"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"dossier":{"type":"object","properties":{},"required":[]}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ai/query":{"post":{"operationId":"queryFactories","summary":"Interpret a sourcing prompt, refine an earlier plan, or apply edited criteria","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":1200},"previousPlan":{"$ref":"#/components/schemas/QueryPlan"},"criteria":{"$ref":"#/components/schemas/Criteria"}},"required":["query"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"$ref":"#/components/schemas/QueryPlan"},"results":{"type":"array","items":{"$ref":"#/components/schemas/Factory"}},"peFilterLocked":{"type":"boolean"},"estimatedDiscoveryCredits":{"type":"integer","minimum":0}},"required":["plan","results","estimatedDiscoveryCredits"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ai/transcribe":{"post":{"operationId":"transcribeVoiceSearch","summary":"Transcribe a spoken audio search query into plain text","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"audioBase64":{"type":"string"},"mimeType":{"type":"string"}},"required":["audioBase64"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"transcript":{"type":"string"},"provider":{"type":"string","enum":["gemini","openai"]}},"required":["transcript","provider"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Scan text could not be extracted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Upstream service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ai/converse":{"post":{"operationId":"converseWithSourcingAnalyst","summary":"Hold a multi-turn natural conversation to search, refine, and inspect factories","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":1200},"previousPlan":{"$ref":"#/components/schemas/QueryPlan"},"fastVoice":{"type":"boolean"}},"required":["message"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"assistantReply":{"type":"string"},"plan":{"$ref":"#/components/schemas/QueryPlan"},"results":{"type":"array","items":{"$ref":"#/components/schemas/Factory"}},"peFilterLocked":{"type":"boolean"},"estimatedDiscoveryCredits":{"type":"integer","minimum":0}},"required":["assistantReply","plan","results"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ai/converse/stream":{"post":{"operationId":"streamSourcingAnalyst","summary":"Stream instant catalog results and sentence-by-sentence analyst replies over SSE","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":1200},"previousPlan":{"$ref":"#/components/schemas/QueryPlan"},"fastVoice":{"type":"boolean"}},"required":["message"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string"}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ai/speak":{"post":{"operationId":"synthesizeAnalystSpeech","summary":"Synthesize spoken audio for a conversational analyst reply","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":1000}},"required":["text"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"audioBase64":{"anyOf":[{"type":"string"},{"type":"null"}]},"mimeType":{"anyOf":[{"type":"string"},{"type":"null"}]},"provider":{"type":"string","enum":["elevenlabs","openai","browser"]}},"required":["provider"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ai/speak/stream":{"post":{"operationId":"streamAnalystSpeech","summary":"Stream raw low-latency MP3 speech bytes from ElevenLabs Flash v2.5","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":1000}},"required":["text"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"stream":{"type":"string"}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ai/realtime/session":{"post":{"operationId":"createRealtimeVoiceSession","summary":"Mint an ephemeral OpenAI Realtime WebRTC session token for full-duplex voice","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["read:factories"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"clientSecret":{"type":"string"},"expiresAt":{"type":"integer"},"model":{"type":"string"},"voice":{"type":"string"},"callsUrl":{"type":"string","format":"uri"}},"required":["clientSecret","model","voice","callsUrl"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Upstream service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/discovery/run":{"post":{"operationId":"runDiscovery","summary":"Run live multi-source US factory discovery (openFDA, EPA ECHO, Web Crawl, Odoo) and debit five credits per result","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["run:discovery","spend:credits"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"},"plan":{"$ref":"#/components/schemas/QueryPlan"},"source":{"type":"string","enum":["all","verified_classifieds","odoo_directory","openfda","epa_echo","web_enrichment"]},"limit":{"type":"integer","minimum":1,"maximum":50}},"required":[],"anyOf":[{"required":["query"]},{"required":["plan"]}]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/DiscoveryJob"},"factories":{"type":"array","items":{"$ref":"#/components/schemas/Factory"}},"sourceStats":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"status":{"type":"string"},"count":{"type":"integer"},"message":{"type":"string"}},"required":[]}},"balanceAfter":{"type":"integer","minimum":0}},"required":["job","factories","balanceAfter"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsufficientCredits"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Upstream service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/settings":{"get":{"operationId":"getSettings","summary":"Read workspace settings and integration status","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"settings":{"$ref":"#/components/schemas/Settings"},"entitlements":{"$ref":"#/components/schemas/PlanEntitlements"},"usage":{"type":"object","properties":{"seatsUsed":{"type":"integer"},"mandatesUsed":{"type":"integer"},"apiKeysUsed":{"type":"integer"}},"required":["seatsUsed","mandatesUsed","apiKeysUsed"]},"localDemoPlanSwitchEnabled":{"type":"boolean"},"integrations":{"type":"object","properties":{"openRouter":{"type":"boolean"},"gemini":{"type":"boolean"},"stripe":{"type":"boolean"}},"required":["openRouter","gemini","stripe"]},"isolation":{"type":"object","properties":{"tenantId":{"type":"string"},"rlsEnabled":{"type":"boolean"},"dedicatedVault":{"type":"boolean"},"slaTier":{"type":"string"}},"required":["tenantId","rlsEnabled","dedicatedVault","slaTier"]}},"required":["settings","entitlements","usage","localDemoPlanSwitchEnabled","integrations","isolation"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateSettings","summary":"Update editable workspace preferences","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firmName":{"type":"string"},"billingEmail":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}]},"defaultBuyerPersona":{"type":"string","enum":["pe_fund","search_fund","independent_sponsor","strategic_manufacturer","ma_broker"]},"crmDefaultFormat":{"type":"string","enum":["ghl","hubspot","affinity","csv"]},"alertMinFitScore":{"type":"number","minimum":0,"maximum":100},"allowRemoteVision":{"type":"boolean"},"autoEnrichCards":{"type":"boolean"},"webhookUrl":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]}},"required":[],"additionalProperties":false}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"settings":{"$ref":"#/components/schemas/Settings"},"entitlements":{"$ref":"#/components/schemas/PlanEntitlements"},"usage":{"type":"object","properties":{"seatsUsed":{"type":"integer"},"mandatesUsed":{"type":"integer"},"apiKeysUsed":{"type":"integer"}},"required":["seatsUsed","mandatesUsed","apiKeysUsed"]},"localDemoPlanSwitchEnabled":{"type":"boolean"},"integrations":{"type":"object","properties":{"openRouter":{"type":"boolean"},"gemini":{"type":"boolean"},"stripe":{"type":"boolean"}},"required":["openRouter","gemini","stripe"]},"isolation":{"type":"object","properties":{"tenantId":{"type":"string"},"rlsEnabled":{"type":"boolean"},"dedicatedVault":{"type":"boolean"},"slaTier":{"type":"string"}},"required":["tenantId","rlsEnabled","dedicatedVault","slaTier"]}},"required":["settings","entitlements","usage","localDemoPlanSwitchEnabled","integrations","isolation"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/team":{"get":{"operationId":"listTeam","summary":"Read the workspace roster and seat usage","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/TeamMember"}},"seatLimit":{"type":"integer"},"seatsUsed":{"type":"integer"}},"required":["members","seatLimit","seatsUsed"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"addTeamMember","summary":"Add a non-owner team seat","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fullName":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","member","viewer"]}},"required":["fullName","email","role"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"member":{"$ref":"#/components/schemas/TeamMember"}},"required":["member"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/team/{memberId}":{"delete":{"operationId":"removeTeamMember","summary":"Remove a non-owner team seat","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"parameters":[{"name":"memberId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"member":{"$ref":"#/components/schemas/TeamMember"}},"required":["member"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/enterprise/attribution":{"get":{"operationId":"getDealAttribution","summary":"Read tenant deal attribution and recent audit events","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"totalVaultDeals":{"type":"integer"},"attributedDeals":{"type":"integer"},"byStage":{"type":"object","additionalProperties":{"type":"integer"}},"byOwner":{"type":"array","items":{"type":"object","properties":{"ownerUserId":{"type":"string"},"ownerName":{"type":"string"},"dealCount":{"type":"integer"},"highSuccessionCount":{"type":"integer"},"stages":{"type":"object","additionalProperties":{"type":"integer"}}},"required":[]}}},"required":[]},"recentAudit":{"type":"array","items":{"$ref":"#/components/schemas/AuditEvent"}}},"required":["summary","recentAudit"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/enterprise/audit-export":{"get":{"operationId":"exportAudit","summary":"Download the tenant audit log","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"CSV download","content":{"text/csv":{"schema":{"type":"string"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/enterprise/scrapers":{"get":{"operationId":"listScrapers","summary":"List custom ERP and ISO scrapers","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scrapers":{"type":"array","items":{"$ref":"#/components/schemas/CustomScraperConfig"}}},"required":["scrapers"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createScraper","summary":"Create an ERP and ISO scraper","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"source":{"type":"string","enum":["catalog","odoo_directory"]},"erpSystems":{"type":"array","items":{"type":"string"}},"certifications":{"type":"array","items":{"type":"string"}},"limit":{"type":"integer"}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"scraper":{"$ref":"#/components/schemas/CustomScraperConfig"}},"required":["scraper"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/enterprise/scrapers/{id}/run":{"post":{"operationId":"runScraper","summary":"Run a catalog or Odoo scraper","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings","read:factories"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scraper":{"$ref":"#/components/schemas/CustomScraperConfig"},"matchedFactories":{"type":"array","items":{"$ref":"#/components/schemas/Factory"}}},"required":["scraper","matchedFactories"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Upstream service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/enterprise/scrapers/{id}":{"delete":{"operationId":"deleteScraper","summary":"Delete a custom scraper","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scraper":{"$ref":"#/components/schemas/CustomScraperConfig"}},"required":["scraper"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/enterprise/workflows":{"get":{"operationId":"listWorkflows","summary":"List custom agent workflows and Enterprise SLA","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"workflows":{"type":"array","items":{"$ref":"#/components/schemas/CustomAgentWorkflow"}},"sla":{"type":"object","properties":{"uptimeTarget":{"type":"string"},"supportResponseHours":{"type":"integer"},"dedicatedPostgresRls":{"type":"boolean"}},"required":["uptimeTarget","supportResponseHours","dedicatedPostgresRls"]}},"required":["workflows","sla"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createWorkflow","summary":"Create a custom agent workflow","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"trigger":{"type":"string","enum":["manual","new_factory","mandate_match","deal_stage_changed"]},"steps":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"}},"required":["name","steps"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"workflow":{"$ref":"#/components/schemas/CustomAgentWorkflow"}},"required":["workflow"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/enterprise/workflows/{id}":{"patch":{"operationId":"updateWorkflow","summary":"Update workflow config or enabled state","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"trigger":{"type":"string","enum":["manual","new_factory","mandate_match","deal_stage_changed"]},"steps":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"}},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"workflow":{"$ref":"#/components/schemas/CustomAgentWorkflow"}},"required":["workflow"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteWorkflow","summary":"Delete a custom agent workflow","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"workflow":{"$ref":"#/components/schemas/CustomAgentWorkflow"}},"required":["workflow"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/credits/balance":{"get":{"operationId":"getCreditBalance","summary":"Read the workspace's current credit balance","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["spend:credits"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"balance":{"type":"integer","minimum":0}},"required":["balance"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/credits/ledger":{"get":{"operationId":"getCreditLedger","summary":"List the workspace's credit history newest first","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["spend:credits"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ledger":{"type":"array","items":{"$ref":"#/components/schemas/CreditTransaction"}},"balance":{"type":"integer","minimum":0}},"required":["ledger","balance"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing/catalog":{"get":{"operationId":"getBillingCatalog","summary":"List plans, credit packs and per-action prices","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"plans":{"type":"array","items":{"$ref":"#/components/schemas/Plan"}},"creditPacks":{"type":"array","items":{"$ref":"#/components/schemas/CreditPack"}},"creditCosts":{"type":"object","additionalProperties":{"type":"integer","minimum":0}}},"required":[]}}}}}}},"/api/billing/demo-plan":{"post":{"operationId":"switchDemoPlan","summary":"Switch plans using a loopback local demo browser session","security":[{"localDemoSession":[]}],"x-required-scopes":["manage:settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"planTier":{"type":"string","enum":["free_trial","scout","deal_team","enterprise"]}},"required":["planTier"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"settings":{"$ref":"#/components/schemas/Settings"},"entitlements":{"$ref":"#/components/schemas/PlanEntitlements"},"usage":{"type":"object","properties":{"seatsUsed":{"type":"integer"},"mandatesUsed":{"type":"integer"},"apiKeysUsed":{"type":"integer"}},"required":["seatsUsed","mandatesUsed","apiKeysUsed"]},"localDemoPlanSwitchEnabled":{"type":"boolean"},"integrations":{"type":"object","properties":{"openRouter":{"type":"boolean"},"gemini":{"type":"boolean"},"stripe":{"type":"boolean"}},"required":["openRouter","gemini","stripe"]},"isolation":{"type":"object","properties":{"tenantId":{"type":"string"},"rlsEnabled":{"type":"boolean"},"dedicatedVault":{"type":"boolean"},"slaTier":{"type":"string"}},"required":["tenantId","rlsEnabled","dedicatedVault","slaTier"]}},"required":["settings","entitlements","usage","localDemoPlanSwitchEnabled","integrations","isolation"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing/checkout":{"post":{"operationId":"createCheckout","summary":"Start a Stripe or local sandbox checkout","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings","spend:credits"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["subscription","credit_pack"]},"itemId":{"type":"string"},"interval":{"type":"string","enum":["monthly","annual","month","year"]}},"required":["mode","itemId"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["session"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Upstream service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing/checkout/{id}":{"get":{"operationId":"getCheckout","summary":"Read a workspace checkout","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["session"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing/checkout/{id}/complete":{"post":{"operationId":"completeCheckout","summary":"Fulfill a local sandbox checkout once","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings","spend:credits"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/CheckoutSession"},"balanceAfter":{"type":"integer","minimum":0}},"required":["session","balanceAfter"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicting request or order state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing/webhook":{"post":{"operationId":"receiveStripeEvent","summary":"Verify and process Stripe Checkout events","security":[],"parameters":[{"name":"Stripe-Signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"received":{"type":"boolean"}},"required":[]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/keys":{"get":{"operationId":"listApiKeys","summary":"List active and revoked key metadata","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}},"required":["keys"]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createApiKey","summary":"Create a scoped API key and return its plaintext once","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"scopes":{"type":"array","items":{"type":"string","enum":["read:factories","write:vault","run:discovery","spend:credits","export:crm","manage:settings"]},"minItems":1,"uniqueItems":true}},"required":["name","scopes"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/ApiKey"},"plaintextKey":{"type":"string"}},"required":["key","plaintextKey"]}}}},"400":{"description":"Invalid input or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/keys/{id}":{"delete":{"operationId":"revokeApiKey","summary":"Revoke a workspace API key","security":[{"bearerAuth":[]},{"browserSession":[]}],"x-required-scopes":["manage:settings"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/ApiKey"}},"required":[]}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan upgrade required, insufficient scope or workspace mismatch","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanUpgradeRequired"},{"$ref":"#/components/schemas/Error"}]}}}},"404":{"description":"Record or catalog item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service disabled or misconfigured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"fsc_ API key"},"browserSession":{"type":"apiKey","in":"cookie","name":"__Host-factoryscope"},"localDemoSession":{"type":"apiKey","in":"cookie","name":"factoryscope-local-demo"}},"schemas":{"PlanEntitlements":{"type":"object","properties":{"includedCreditsPerMonth":{"type":"integer"},"seatLimit":{"type":"integer"},"mandateLimit":{"anyOf":[{"type":"integer"},{"type":"null"}]},"apiKeyLimit":{"anyOf":[{"type":"integer"},{"type":"null"}]},"allowedApiScopes":{"type":"array","items":{"type":"string","enum":["read:factories","write:vault","run:discovery","spend:credits","export:crm","manage:settings"]}},"liveDiscovery":{"type":"boolean"},"voiceMemos":{"type":"boolean"},"exhibitorHitList":{"type":"boolean"},"peBackedFilter":{"type":"boolean"},"apiKeys":{"type":"boolean"},"matchDigests":{"type":"boolean"},"outreachSequences":{"type":"boolean"},"crmExports":{"type":"boolean"},"alertWebhooks":{"type":"boolean"},"teamSeats":{"type":"boolean"},"dealAttributionAudit":{"type":"boolean"},"deedEnrichment":{"type":"boolean"},"customScrapers":{"type":"boolean"},"customAgentWorkflows":{"type":"boolean"},"dedicatedRlsVault":{"type":"boolean"}},"required":["includedCreditsPerMonth","seatLimit","mandateLimit","apiKeyLimit","allowedApiScopes","liveDiscovery","voiceMemos","exhibitorHitList","peBackedFilter","apiKeys","matchDigests","outreachSequences","crmExports","alertWebhooks","teamSeats","dealAttributionAudit","deedEnrichment","customScrapers","customAgentWorkflows","dedicatedRlsVault"]},"PlanUpgradeRequired":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["PLAN_UPGRADE_REQUIRED"]},"feature":{"type":"string","enum":["liveDiscovery","voiceMemos","exhibitorHitList","peBackedFilter","apiKeys","matchDigests","outreachSequences","crmExports","alertWebhooks","teamSeats","dealAttributionAudit","deedEnrichment","customScrapers","customAgentWorkflows","dedicatedRlsVault","seatLimit","mandateLimit","apiKeyLimit","allowedApiScopes"]},"currentPlan":{"type":"string","enum":["free_trial","scout","deal_team","enterprise"]},"requiredPlan":{"type":"string","enum":["free_trial","scout","deal_team","enterprise"]},"upgradeUrl":{"type":"string"}},"required":["error","code","feature","currentPlan","requiredPlan","upgradeUrl"]},"TeamMember":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"fullName":{"type":"string"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}]},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","tenantId","fullName","email","role","createdAt"]},"DeedEnrichment":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"factoryId":{"type":"string"},"parcelId":{"anyOf":[{"type":"string"},{"type":"null"}]},"situs":{"anyOf":[{"type":"string"},{"type":"null"}]},"ownerOfRecord":{"anyOf":[{"type":"string"},{"type":"null"}]},"ownerOfRecordMatch":{"type":"string","enum":["matched","unconfirmed","not_applicable"]},"assessedValueUsd":{"anyOf":[{"type":"integer"},{"type":"null"}]},"estimatedMarketValueUsd":{"anyOf":[{"type":"integer"},{"type":"null"}]},"facilitySqFt":{"anyOf":[{"type":"integer"},{"type":"null"}]},"saleLeasebackReadiness":{"type":"string","enum":["review_ready","needs_verification","not_applicable"]},"priorityOwnerVerification":{"type":"object","properties":{"status":{"type":"string","enum":["catalog_confirmed","research_required"]},"ownerName":{"anyOf":[{"type":"string"},{"type":"null"}]},"nextSteps":{"type":"array","items":{"type":"string"}}},"required":[]},"source":{"type":"string","enum":["catalog_estimate"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","tenantId","factoryId","source","createdAt"]},"AuditEvent":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"actorUserId":{"type":"string"},"action":{"type":"string"},"resourceType":{"type":"string"},"resourceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"details":{"type":"object","properties":{},"required":[]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","tenantId","actorUserId","action","resourceType","resourceId","details","createdAt"]},"CustomScraperConfig":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["catalog","odoo_directory"]},"erpSystems":{"type":"array","items":{"type":"string"}},"certifications":{"type":"array","items":{"type":"string"}},"limit":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"lastRunAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"lastMatchCount":{"type":"integer"}},"required":[]},"CustomAgentWorkflow":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"trigger":{"type":"string","enum":["manual","new_factory","mandate_match","deal_stage_changed"]},"steps":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":[]},"InsufficientCredits":{"type":"object","properties":{"error":{"type":"string"},"required":{"type":"integer","minimum":0},"available":{"type":"integer","minimum":0},"shortfall":{"type":"integer","minimum":0}},"required":["error","required","available","shortfall"]},"Error":{"type":"object","properties":{"error":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"array","items":{"type":["string","integer"]}},"message":{"type":"string"}},"required":[]}}},"required":["error"]},"Owner":{"type":"object","properties":{"id":{"type":"string"},"fullName":{"type":"string"},"title":{"type":"string"},"isConfirmedOwner":{"type":"boolean"},"workEmail":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}]},"directPhone":{"anyOf":[{"type":"string"},{"type":"null"}]},"linkedinUrl":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]}},"required":["id","fullName","title"]},"Factory":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"website":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"description":{"type":"string"},"ownershipType":{"type":"string"},"processes":{"type":"array","items":{"type":"string"}},"endMarkets":{"type":"array","items":{"type":"string"}},"certifications":{"type":"array","items":{"type":"string"}},"erpSystems":{"type":"array","items":{"type":"string"}},"owners":{"type":"array","items":{"$ref":"#/components/schemas/Owner"}},"succession":{"type":"object","properties":{"successionReadinessScore":{"type":"integer"},"founderTenureYears":{"anyOf":[{"type":"integer"},{"type":"null"}]},"ownsRealEstate":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"peBacked":{"type":"boolean"}},"required":[]}},"required":["id","name","slug","owners"]},"Dossier":{"type":"object","properties":{"factory":{"$ref":"#/components/schemas/Factory"},"privateNote":{"anyOf":[{"type":"object","properties":{},"required":[]},{"type":"null"}]},"cardScans":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"voiceMemos":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"matchingMandates":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"ownerVerificationBadge":{"type":"string"},"peBackedWarning":{"type":"boolean"},"isPrivateCandidate":{"type":"boolean"},"outreachSequences":{"type":"array","items":{"type":"object","properties":{},"required":[]}},"ownerContactRevealed":{"type":"boolean"},"deedEnrichment":{"anyOf":[{"$ref":"#/components/schemas/DeedEnrichment"},{"type":"null"}]}},"required":["factory","ownerContactRevealed"]},"Criteria":{"type":"object","properties":{"keywords":{"type":"array","items":{"type":"string"}},"processes":{"type":"array","items":{"type":"string"}},"endMarkets":{"type":"array","items":{"type":"string"}},"states":{"type":"array","items":{"type":"string"}},"regions":{"type":"array","items":{"type":"string"}},"certifications":{"type":"array","items":{"type":"string"}},"erpSystems":{"type":"array","items":{"type":"string"}},"ownershipTypes":{"type":"array","items":{"type":"string"}},"revenueBands":{"type":"array","items":{"type":"string"}},"independentOnly":{"type":"boolean"},"minSuccessionScore":{"anyOf":[{"type":"integer"},{"type":"null"}]},"minFounderTenureYears":{"anyOf":[{"type":"integer"},{"type":"null"}]},"ownsRealEstate":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"required":[]},"QueryPlan":{"type":"object","properties":{"rawQuery":{"type":"string"},"interpretedSummary":{"type":"string"},"criteria":{"$ref":"#/components/schemas/Criteria"},"shouldTriggerLiveDiscovery":{"type":"boolean"},"discoverySource":{"type":"string","enum":["odoo_directory","web_enrichment","catalog_only"]},"discoveryLimit":{"type":"integer","minimum":1,"maximum":50},"suggestedMandateName":{"anyOf":[{"type":"string"},{"type":"null"}]},"confidence":{"type":"number"},"analysisSource":{"type":"string","enum":["deterministic","openrouter","gemini"]},"explanationSteps":{"type":"array","items":{"type":"string"}}},"required":["rawQuery","interpretedSummary","criteria"]},"DiscoveryJob":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"source":{"type":"string","enum":["all","verified_classifieds","odoo_directory","openfda","epa_echo","web_enrichment"]},"query":{"type":"string"},"status":{"type":"string","enum":["queued","running","completed","failed"]},"creditsCharged":{"type":"integer","minimum":0},"discoveredCount":{"type":"integer"},"factoryIds":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","tenantId","source","query","status","creditsCharged","factoryIds"]},"Settings":{"type":"object","properties":{"firmName":{"type":"string"},"billingEmail":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}]},"defaultBuyerPersona":{"type":"string","enum":["pe_fund","search_fund","independent_sponsor","strategic_manufacturer","ma_broker"]},"crmDefaultFormat":{"type":"string","enum":["ghl","hubspot","affinity","csv"]},"alertMinFitScore":{"type":"number","minimum":0,"maximum":100},"allowRemoteVision":{"type":"boolean"},"autoEnrichCards":{"type":"boolean"},"webhookUrl":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"tenantId":{"type":"string"},"planTier":{"type":"string","enum":["free_trial","scout","deal_team","enterprise"]},"seatLimit":{"type":"integer"},"updatedAt":{"type":"string","format":"date-time"}},"required":["tenantId","firmName","planTier","seatLimit"]},"CreditTransaction":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"kind":{"type":"string","enum":["grant","purchase","usage","refund"]},"action":{"type":"string"},"amount":{"type":"integer"},"balanceAfter":{"type":"integer","minimum":0},"description":{"type":"string"},"referenceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"idempotencyKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","tenantId","kind","action","amount","balanceAfter","createdAt"]},"CheckoutSession":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"mode":{"type":"string","enum":["subscription","credit_pack"]},"itemId":{"type":"string"},"interval":{"anyOf":[{"type":"string","enum":["monthly","annual"]},{"type":"null"}]},"amountCents":{"type":"integer","minimum":0},"creditsGranted":{"type":"integer"},"status":{"type":"string","enum":["pending","completed","expired","canceled"]},"provider":{"type":"string","enum":["stripe","local_sandbox"]},"checkoutUrl":{"type":"string","format":"uri-reference"},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","tenantId","mode","itemId","amountCents","creditsGranted","status","provider","checkoutUrl"]},"Plan":{"type":"object","properties":{"id":{"type":"string","enum":["free_trial","scout","deal_team","enterprise"]},"name":{"type":"string"},"tagline":{"type":"string"},"monthlyPriceCents":{"type":"integer","minimum":0},"annualPriceCents":{"type":"integer","minimum":0},"includedCreditsPerMonth":{"type":"integer"},"seatLimit":{"type":"integer"},"apiAccess":{"type":"boolean"},"cliAccess":{"type":"boolean"},"liveDiscovery":{"type":"boolean"},"customScrapers":{"type":"boolean"},"features":{"type":"array","items":{"type":"string"}},"highlighted":{"type":"boolean"}},"required":["id","name","monthlyPriceCents","annualPriceCents","includedCreditsPerMonth","seatLimit"]},"CreditPack":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"credits":{"type":"integer"},"priceCents":{"type":"integer","minimum":0},"unitPriceCents":{"type":"integer","minimum":0},"badge":{"type":"string"}},"required":["id","name","credits","priceCents"]},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["read:factories","write:vault","run:discovery","spend:credits","export:crm","manage:settings"]}},"createdByUserId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastUsedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","tenantId","name","prefix","scopes","createdAt"]}}}}