{"openapi":"3.0.3","info":{"title":"Outlaw API","version":"1.0.0","description":"Internal API for the Outlaw contract management platform"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Firebase ID Token","description":"Firebase ID token obtained from Firebase Authentication"}},"schemas":{}},"paths":{"/teams/search":{"post":{"summary":"Search teams","tags":["Teams"],"description":"Admin-only Elasticsearch search across teams. Ported from POST /api/getTeams (legacy Api.js handler, removed in OLP-232).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"},"page":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991},"hitsPerPage":{"default":50,"type":"integer","exclusiveMinimum":true,"maximum":1000},"sort":{"default":null,"nullable":true,"type":"string","pattern":"^.+\\.(asc|desc)$"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"hits":{"type":"array","items":{"type":"object","additionalProperties":{}}},"nbHits":{"type":"number"},"page":{"type":"number"},"hitsPerPage":{"type":"number"},"nbPages":{"type":"number"}},"required":["hits","nbHits","page","hitsPerPage","nbPages"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/teams/{teamId}":{"get":{"summary":"Get team info","tags":["Teams"],"description":"Get team info by ID. Supports anonymous access with an invite ID.","parameters":[{"schema":{"type":"string","minLength":1},"in":"query","name":"inviteId","required":false,"description":"Invite ID for access validation (allows anonymous access)"},{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true,"description":"Team ID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update team info","tags":["Teams"],"description":"Apply a partial info update to a team. Owners and editors only. Ported from POST /api/updateTeamInfo (legacy Api.js handler). Returns 204 No Content on success.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"legalName":{"type":"string"},"license":{"type":"string"},"logo":{"nullable":true,"type":"string"},"letterhead":{"nullable":true,"type":"string"},"address":{"type":"string"},"addressProperties":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"}}},"brandColor":{"type":"string"},"shareMessage":{"nullable":true,"type":"string"},"salesforceID":{"nullable":true,"type":"string"}}}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/teams/{teamId}/record":{"get":{"summary":"Get admin team record","tags":["Teams"],"description":"Admin-only. Returns the full TeamRecord projection used by the admin Team editor. Ported from POST /api/getTeamRecord (legacy Api.js handler, removed in OLP-231).","parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true,"description":"Team ID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/teams/{teamId}/filters":{"get":{"summary":"List team filters","tags":["Teams"],"description":"Return all filters for a team. Any team member may read. New endpoint; previously the team's filters shipped as a field on the team document returned by getUserTeams.","parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"filterID":{"type":"string"},"teamID":{"type":"string"},"title":{"type":"string"},"searchParams":{"type":"object","additionalProperties":{}}},"required":["filterID","teamID","title","searchParams"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/teams/{teamId}/workflows":{"get":{"summary":"List team workflows","tags":["Teams"],"description":"Return a team's workflows, keyed by workflowKey. Owner/editor only. Ported from GET /api/getTeamWorkflows (legacy Api.js handler). Keeps the legacy map shape rather than an array because workflowKey is optional on the stored document; the map key is the only identity a keyless entry has.","parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true,"description":"Team ID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"workflows":{"type":"object","additionalProperties":{"type":"object","properties":{"aiEngine":{"type":"string"},"aiModel":{"type":"string"},"aiPromptType":{"type":"string"},"aiProvider":{"type":"string"},"collectionStepName":{"type":"string"},"description":{"nullable":true,"type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"serviceProviderName":{"type":"string"},"serviceProviders":{"type":"boolean"},"steps":{"type":"array","items":{"type":"object","properties":{"checkpoint":{"type":"boolean"},"checkpointSkippable":{"type":"boolean"},"color":{"type":"string"},"description":{"nullable":true,"type":"string"},"key":{"type":"string"},"locked":{"type":"boolean"},"name":{"type":"string"},"restricted":{"type":"boolean"},"signable":{"type":"boolean"},"status":{"type":"string"},"checkpointGroupApprovalRule":{"nullable":true,"type":"string"},"checkpointGroupKey":{"nullable":true,"type":"string"}},"required":["checkpoint","checkpointSkippable","color","key","locked","name","signable"],"additionalProperties":false}},"workflowKey":{"type":"string"}},"required":["isDefault","name","steps"],"additionalProperties":false}}},"required":["workflows"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/teams/{teamId}/filters/{filterId}":{"post":{"summary":"Create or update a team filter","tags":["Teams"],"description":"Upsert a team filter at the URL-specified ID. Owners and editors only. Ported from the team-filter branch of POST /api/saveFilter (legacy Api.js handler). Returns 204 No Content on success.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"searchParams":{"default":{},"type":"object","additionalProperties":{}}},"required":["title"]}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true},{"schema":{"type":"string","minLength":1},"in":"path","name":"filterId","required":true,"description":"Client-generated unique ID (UUID v4 recommended)"}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete a team filter","tags":["Teams"],"description":"Delete a team filter. Owners and editors only. Ported from POST /api/deleteTeamFilter (legacy Api.js handler). Returns 204 No Content on success.","parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true},{"schema":{"type":"string","minLength":1},"in":"path","name":"filterId","required":true}],"responses":{"204":{"description":"Default Response"},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/teams/{teamId}/features/{featureName}":{"put":{"summary":"Set a team feature flag","tags":["Teams"],"description":"Activate or deactivate a single team feature flag. Admin-only. Deactivating deletes the flag key rather than writing false, because readers distinguish an absent flag from an explicit false. Port of: POST /api/setTeamFeature (legacy Api.js handler). Returns 204 No Content on success.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"isActive":{"type":"boolean","description":"Activate the feature, or remove the key entirely when false"}},"required":["isActive"]}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true,"description":"Team ID"},{"schema":{"type":"string","minLength":1,"pattern":"^[A-Za-z0-9_-]+$"},"in":"path","name":"featureName","required":true,"description":"Team feature flag key, e.g. \"webhooks\""}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/teams/{teamId}/users/{userId}":{"delete":{"summary":"Remove a team member","tags":["Teams"],"description":"Remove a member from a team, revoke a pending invite (userId is the inviteID), or leave the team (userId is the caller). Any member may remove themselves; removing someone else requires the owner role; platform admins may remove anyone, even on a team they aren't on. Returns 409 if the team would be left with no owner. A userId not on the team is a no-op 204. Port of POST /api/removeTeamMember (legacy Api.js handler). Returns 204 No Content on success.","parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true,"description":"Team ID"},{"schema":{"type":"string","minLength":1,"maxLength":768,"pattern":"^[^.$#[\\]/\\p{Cc}]+$"},"in":"path","name":"userId","required":true,"description":"Member uid, or a pending invite ID"}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a team member","tags":["Teams"],"description":"Partially update a member's team role and member options (observer, observer role, new-doc, upload-doc, redline and section-lock flags, service provider), or edit a pending invite in place (userId is the inviteID; no email is sent). Omitted fields keep their stored value. Owners only; platform admins may update members of any team. Returns 404 if userId is not on the team and 409 if the team would be left with no owner. Port of the role-change branch of POST /api/addTeamMember (legacy Api.js handler). Returns 204 No Content on success.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["viewer","editor","owner"]},"observer":{"type":"boolean"},"observerRole":{"description":"Deal role applied when the member opens an observed document","nullable":true,"type":"string","enum":["viewer","proposer","editor","owner","temp"]},"canCreateNewDoc":{"type":"boolean"},"canUploadDoc":{"type":"boolean"},"withoutRedline":{"description":"null is stored as false","nullable":true,"type":"boolean"},"canLockSections":{"description":"null is stored as false","nullable":true,"type":"boolean"},"canOverrideLocks":{"description":"null is stored as false","nullable":true,"type":"boolean"},"serviceProvider":{"nullable":true,"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"teamId","required":true,"description":"Team ID"},{"schema":{"type":"string","minLength":1,"maxLength":768,"pattern":"^[^.$#[\\]/\\p{Cc}]+$"},"in":"path","name":"userId","required":true,"description":"Member uid, or a pending invite ID"}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/deals/search":{"post":{"summary":"Search deals","tags":["Deals"],"description":"Search and filter deals via Elasticsearch. Uses POST because the query body can be complex.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"teamId":{"type":"string"},"filterId":{"type":"string"},"query":{"type":"string"},"name":{"type":"string"},"page":{"type":"integer","minimum":0,"maximum":9007199254740991},"hitsPerPage":{"type":"integer","minimum":1,"maximum":200},"sort":{"type":"object","additionalProperties":{}},"facets":{"type":"array","items":{}},"dateFilters":{"type":"array","items":{}},"variables":{"type":"array","items":{}},"variableQuery":{"type":"array","items":{}},"tags":{"type":"array","items":{"type":"string"}},"connections":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"}}}},"projectId":{"type":"string"},"sharingStatus":{"type":"string"},"needsReview":{"type":"boolean"},"deleted":{"type":"boolean"},"grades":{"type":"array","items":{}},"lenses":{"type":"array","items":{}}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/deals/":{"post":{"summary":"Create deal","tags":["Deals"],"description":"Create a new deal on a team.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dealParams":{"type":"object","properties":{"teamID":{"type":"string","minLength":1},"title":{"description":"The new deal's name. Defaults to 'Untitled'. For a Template, templateData.title replaces it when set","type":"string"},"templateData":{}},"required":["teamID"],"additionalProperties":{}}},"required":["dealParams"]}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/deals/{dealId}":{"delete":{"summary":"Delete deal","tags":["Deals"],"description":"Soft-delete a deal (or hard-delete with ?hard=true). Requires owner role. Returns 204 No Content on success.","parameters":[{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"hard","required":false,"description":"If 'true', permanently delete instead of soft-delete"},{"schema":{"type":"string","minLength":1,"pattern":"^[\\w-]+$"},"in":"path","name":"dealId","required":true,"description":"Deal ID"}],"responses":{"204":{"description":"Default Response"},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/deals/{dealId}/behavior":{"patch":{"summary":"Update a deal behavior setting","tags":["Deals"],"description":"Sets one root-level behavior aspect (a DealConstants.BEHAVIOR key) on a deal or template. Turning guestSigning off also sets autoGuest to false. Admins bypass role checks; otherwise requires deal owner (regular deals) or team owner/editor (templates). Returns 204 No Content.","requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"aspect":{"type":"string","enum":["autoGuest"]},"value":{"type":"boolean"}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["commenting"]},"value":{"type":"boolean"}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["vinesign"]},"value":{"type":"boolean"}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["guestSigning"]},"value":{"type":"boolean"}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["letterheadType"]},"value":{"type":"string","minLength":1}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["readonly"]},"value":{"type":"boolean"}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["showLetterhead"]},"value":{"type":"boolean"}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["showTitle"]},"value":{"type":"boolean"}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["theme"]},"value":{"nullable":true,"description":"DealStyle key, or null for the team default","type":"string","minLength":1}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["workflow"]},"value":{"nullable":true,"description":"Workflow key, or null for the default workflow","type":"string","minLength":1}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["exportAttachments"]},"value":{"type":"boolean"}},"required":["aspect","value"]},{"type":"object","properties":{"aspect":{"type":"string","enum":["excludeSignatureActions"]},"value":{"type":"boolean"}},"required":["aspect","value"]}]}}}},"parameters":[{"schema":{"type":"string","minLength":1,"pattern":"^[\\w-]+$"},"in":"path","name":"dealId","required":true,"description":"Deal ID"}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/deals/{dealId}/connections":{"post":{"summary":"Create or update a deal connection","tags":["Deals"],"description":"Upserts a single integration connection on a deal or template. Requires deal owner/editor (regular deals) or team owner/editor (templates).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","minLength":1,"description":"Integration service type (e.g. 'filevine', 'vinesign')"}},"required":["type"],"additionalProperties":{}}}}},"parameters":[{"schema":{"type":"string","minLength":1,"pattern":"^[\\w-]+$"},"in":"path","name":"dealId","required":true,"description":"Deal ID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/deals/{dealId}/connections/{connectionId}":{"delete":{"summary":"Delete a deal connection","tags":["Deals"],"description":"Deletes a single connection by key. Requires deal owner/editor (regular deals) or team owner/editor (templates). Returns 204 No Content.","parameters":[{"schema":{"type":"string","minLength":1,"pattern":"^[\\w-]+$"},"in":"path","name":"dealId","required":true,"description":"Deal ID"},{"schema":{"type":"string","minLength":1},"in":"path","name":"connectionId","required":true,"description":"Connection key"}],"responses":{"204":{"description":"Default Response"},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/deals/{dealId}/merge-report/elements/{index}/resolution":{"put":{"summary":"Resolve an import report line","tags":["Deals"],"description":"Marks a red or orange line resolved, recording when. Requires an admin or partner with owner/editor access to the deal or template. Returns 204 No Content.","parameters":[{"schema":{"type":"string","minLength":1,"pattern":"^[\\w-]+$"},"in":"path","name":"dealId","required":true,"description":"Deal ID"},{"schema":{"type":"integer","minimum":0,"maximum":9007199254740991},"in":"path","name":"index","required":true,"description":"The line's index in mergeReport.elements"}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Re-open an import report line","tags":["Deals"],"description":"Clears a line's resolution so it shows under its status again. Same access as resolving. Returns 204 No Content.","parameters":[{"schema":{"type":"string","minLength":1,"pattern":"^[\\w-]+$"},"in":"path","name":"dealId","required":true,"description":"Deal ID"},{"schema":{"type":"integer","minimum":0,"maximum":9007199254740991},"in":"path","name":"index","required":true,"description":"The line's index in mergeReport.elements"}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/deals/{dealId}/template":{"put":{"summary":"Apply a template to a document","tags":["Deals"],"description":"Applies a template from the document's own team: adds the template's auto users, copies its variables, workflow and settings, and records it as the document's source template. Requires deal owner/editor and membership of the document's team. Not for templates. Returns 204 No Content.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"templateDealId":{"type":"string","minLength":1,"pattern":"^[\\w-]+$","description":"Deal ID of the template to apply"}},"required":["templateDealId"]}}}},"parameters":[{"schema":{"type":"string","minLength":1,"pattern":"^[\\w-]+$"},"in":"path","name":"dealId","required":true,"description":"Deal ID"}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Detach a document from its template","tags":["Deals"],"description":"Removes the document's source template and the template's variables. The document stays on its current team. Requires deal owner/editor. Not for templates. Returns 204 No Content.","parameters":[{"schema":{"type":"string","minLength":1,"pattern":"^[\\w-]+$"},"in":"path","name":"dealId","required":true,"description":"Deal ID"}],"responses":{"204":{"description":"Default Response"},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/check-account":{"post":{"summary":"Check account existence","tags":["Auth"],"description":"Check whether an account exists for an email address. Returns a uniform response to prevent user enumeration. No authentication required.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$","description":"Email address to look up"}},"required":["email"]}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}}},"required":["data"],"additionalProperties":false}}}}}}},"/auth/fvid-context":{"get":{"summary":"Get FVID SSO context for a deal","tags":["Auth"],"description":"Returns whether FVID SSO is enabled for the team that owns a given deal, and the FVID tenant ID. Called pre-authentication from the Filevine iframe to determine whether to auto-trigger FVID login. No authentication required.","parameters":[{"schema":{"type":"string"},"in":"query","name":"dealId","required":true,"description":"Deal ID to resolve FVID SSO context for"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"fvidEnabled":{"type":"boolean","description":"Whether FVID SSO is enabled for this deal's team"},"tenantId":{"nullable":true,"description":"FVID tenant ID for the team, or null if not configured","type":"string"}},"required":["fvidEnabled","tenantId"],"additionalProperties":false}}}}}}},"/auth/fvid-token-exchange":{"post":{"summary":"Exchange FVID token for Firebase custom token","tags":["Auth"],"description":"Verifies a short-lived FVID access token from the Filevine iframe dotvine postMessage, looks up or creates the matching Outlaw user, and returns a Firebase custom token. The client calls signInWithCustomToken() to establish a silent Firebase session. No authentication required — the FVID token is the credential.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fvidToken":{"type":"string","description":"Short-lived FVID access token from Filevine dotvine postMessage"}},"required":["fvidToken"]}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"firebaseCustomToken":{"type":"string","description":"Firebase custom token — call signInWithCustomToken() on the client to establish a silent Firebase session"}},"required":["firebaseCustomToken"],"additionalProperties":false}}}}}}},"/auth/fvid-enabled":{"get":{"summary":"Check if a user should be routed to FVID login","tags":["Auth"],"description":"Determines whether the user with the given email should be automatically redirected to FVID login (Phase 2 standalone login flow). Checks whether the FVID OIDC provider is linked to the Firebase account, then the team features.fvid flag. No authentication required.","parameters":[{"schema":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"in":"query","name":"email","required":true,"description":"User email address to check FVID enablement for"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"fvidEnabled":{"type":"boolean","description":"Whether this user should be routed to FVID login"}},"required":["fvidEnabled"],"additionalProperties":false}}}}}}},"/auth/fvid-link":{"post":{"summary":"Link FVID identity ID (+ tenant/user-type claims) to current user","tags":["Auth"],"description":"Stores the FVID identity ID from the authenticated user's Firebase oidc.filevine sign-in on their record, and upserts the user_type / tenant_id claims from a verified FVID ID token when one is sent. Called after signInWithRedirect / signInWithPopup succeeds. identityId self-heals once; tenant/user-type claims upsert on every login. tenantId is persisted only for Customer / FederatedCustomer / ServiceAccount user types. Returns 403 if the account has no Filevine sign-in or the token's sub doesn't match it, and 409 if the identity is linked to another user or the user to another identity.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fvidIdToken":{"description":"FVID ID token from the sign-in result. Its sub must match the FVID identity on the caller's Firebase account. Its user_type claim is stored, and its tenant_id claim only for Customer / FederatedCustomer / ServiceAccount user types (never Employee/Partner, who tenant-surf). Omit it to link the identity alone.","type":"string","minLength":1}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"linked":{"type":"boolean"}},"required":["linked"],"additionalProperties":false}}}}}}},"/users/search":{"post":{"summary":"Search users","tags":["Users"],"description":"Admin-only Elasticsearch search across users with filters.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"names":{"type":"array","items":{"type":"string"}},"emails":{"type":"array","items":{"type":"string"}},"titles":{"type":"array","items":{"type":"string"}},"roles":{"type":"array","items":{"type":"string"}},"access":{"type":"array","items":{"type":"string"}},"observer":{"type":"boolean"},"page":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991},"hitsPerPage":{"default":50,"type":"integer","exclusiveMinimum":true,"maximum":1000},"sort":{"default":null,"nullable":true,"type":"string","pattern":"^.+\\.(asc|desc)$"},"defaultFilter":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"hits":{"type":"array","items":{"type":"object","additionalProperties":{}}},"nbHits":{"type":"number"},"page":{"type":"number"},"hitsPerPage":{"type":"number"},"nbPages":{"type":"number"}},"required":["hits","nbHits","page","hitsPerPage","nbPages"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/users/{userID}":{"get":{"summary":"Get user record","tags":["Users"],"description":"Admin-only fetch of a single UserRecord by ID. Ported from POST /api/getUserRecord (legacy Api.js handler, removed in OLP-234).","parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"userID","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string"},"org":{"type":"string"},"title":{"type":"string"},"phone":{"type":"string"},"address":{"type":"string"},"addressProperties":{"type":"object","properties":{"line1":{"nullable":true,"type":"string"},"line2":{"nullable":true,"type":"string"},"city":{"nullable":true,"type":"string"},"state":{"nullable":true,"type":"string"},"postalCode":{"nullable":true,"type":"string"},"country":{"nullable":true,"type":"string"}},"additionalProperties":false},"created":{"anyOf":[{"type":"string"},{"type":"object","properties":{"_seconds":{"type":"number"},"_nanoseconds":{"type":"number"}},"required":["_seconds","_nanoseconds"],"additionalProperties":false},{"type":"number"}]},"updated":{"anyOf":[{"type":"string"},{"type":"object","properties":{"_seconds":{"type":"number"},"_nanoseconds":{"type":"number"}},"required":["_seconds","_nanoseconds"],"additionalProperties":false},{"type":"number"}]},"lastLogin":{"anyOf":[{"type":"string"},{"type":"object","properties":{"_seconds":{"type":"number"},"_nanoseconds":{"type":"number"}},"required":["_seconds","_nanoseconds"],"additionalProperties":false},{"type":"number"}]},"isAdmin":{"type":"boolean"},"isPartner":{"type":"boolean"},"features":{"type":"object","additionalProperties":{"type":"boolean"}},"teams":{"type":"array","items":{"type":"object","properties":{"teamID":{"type":"string"},"role":{"type":"string"},"observer":{"type":"boolean"},"withoutRedline":{"type":"boolean"}},"required":["teamID","role"],"additionalProperties":false}},"teamsCount":{"nullable":true,"type":"number"}},"required":["id","isAdmin","isPartner","features","teams","teamsCount"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/users/{userId}/filters/{filterId}":{"post":{"summary":"Create or update a user filter","tags":["Users"],"description":"Upsert a user filter at the URL-specified ID. Caller must match :userId. Ported from the user-filter branch of POST /api/saveFilter (legacy Api.js handler).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"searchParams":{"default":{},"type":"object","additionalProperties":{}}},"required":["title"]}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"userId","required":true},{"schema":{"type":"string","minLength":1},"in":"path","name":"filterId","required":true,"description":"Client-generated unique ID (UUID v4 recommended)"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"filterID":{"type":"string"},"userID":{"type":"string"},"title":{"type":"string"},"searchParams":{"type":"object","additionalProperties":{}}},"required":["filterID","userID","title","searchParams"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete a user filter","tags":["Users"],"description":"Delete a user filter. Caller must match :userId. Ported from POST /api/deleteUserFilter (legacy Api.js handler).","parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"userId","required":true},{"schema":{"type":"string","minLength":1},"in":"path","name":"filterId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"filterID":{"type":"string"},"userID":{"type":"string"},"title":{"type":"string"},"searchParams":{"type":"object","additionalProperties":{}}},"required":["filterID","userID","title","searchParams"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/users/{userId}":{"patch":{"summary":"Update a user's profile info and/or feature flags","tags":["Users"],"description":"Partial update of a user. `info` is writable by the user themselves or an admin; `features` (including isAdmin/isPartner) are admin-only. Consolidates POST /api/saveUserInfo and POST /api/updateUser (legacy Api.js handlers).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"info":{"type":"object","properties":{"fullName":{"type":"string"},"org":{"type":"string"},"title":{"type":"string"},"phone":{"type":"string"},"address":{"type":"string"},"addressProperties":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"}}}}},"features":{"type":"object","additionalProperties":{"type":"boolean"}}}}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/users/{userId}/notification-settings":{"patch":{"summary":"Update a user's email notification settings","tags":["Users"],"description":"Partial merge-update of a user's notification settings (global + per-team email toggles). Caller must be the user themselves or an admin. Port of POST /api/saveUserNotificationSettings (legacy Api.js handler).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"global":{"type":"object","properties":{"accessRequests":{"type":"object","properties":{"email":{"type":"boolean"}}},"checkpointStatusUpdates":{"type":"object","properties":{"email":{"type":"boolean"}}},"contractActivity":{"type":"object","properties":{"email":{"type":"boolean"}}},"contractReviewRequests":{"type":"object","properties":{"email":{"type":"boolean"}}},"dealCompletion":{"type":"object","properties":{"email":{"type":"boolean"}}},"userInvitationErrors":{"type":"object","properties":{"email":{"type":"boolean"}}}}},"teams":{"type":"object","additionalProperties":{"type":"object","properties":{"accessRequests":{"type":"object","properties":{"email":{"type":"boolean"}}},"checkpointStatusUpdates":{"type":"object","properties":{"email":{"type":"boolean"}}},"contractActivity":{"type":"object","properties":{"email":{"type":"boolean"}}},"contractReviewRequests":{"type":"object","properties":{"email":{"type":"boolean"}}},"dealCompletion":{"type":"object","properties":{"email":{"type":"boolean"}}},"userInvitationErrors":{"type":"object","properties":{"email":{"type":"boolean"}}},"enabled":{"type":"boolean"}}}}}}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/users/{userId}/notifications":{"post":{"summary":"Save a user notification","tags":["Users"],"description":"Write a single notification under the user's notifications/{type} node. Caller must be the user themselves or an admin. Port of POST /api/saveUserNotification (legacy Api.js handler).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["dashboard"]},"json":{"type":"object","properties":{"frequency":{"type":"string","enum":["daily","weekly","monthly"]},"day":{"nullable":true,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"time":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"lastSent":{"nullable":true,"anyOf":[{"type":"string"},{"type":"number"}]}}}},"required":["type","json"]}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/tools/inspect-url":{"post":{"summary":"Inspect an Outlaw URL","tags":["Tools"],"description":"Admin only. Resolves a pasted Outlaw URL (deal, template, public deal) to what the system knows about it: object type, native vs external, bundle, provenance, owning team, your access, environment, users and connections. Metadata and counts only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2048}},"required":["url"]}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"url":{"type":"object","properties":{"host":{"type":"string"},"kind":{"type":"string","enum":["deal","template","public-deal","invitation"]},"id":{"type":"string"},"subId":{"type":"string"}},"required":["host","kind","id"],"additionalProperties":false},"environment":{"type":"object","properties":{"env":{"type":"string"},"firebaseProject":{"nullable":true,"type":"string"}},"required":["env","firebaseProject"],"additionalProperties":false},"objectType":{"type":"string","enum":["deal","template","invitation"]},"deal":{"nullable":true,"type":"object","properties":{"dealID":{"type":"string"},"name":{"nullable":true,"type":"string"},"dealType":{"type":"string"},"isNative":{"type":"boolean"},"isExternal":{"type":"boolean"},"sourceTemplateKey":{"nullable":true,"type":"string"},"sourceTeam":{"nullable":true,"type":"string"},"sourceTemplateName":{"nullable":true,"type":"string"},"sourceTemplate":{"nullable":true,"type":"object","properties":{"key":{"type":"string"},"name":{"nullable":true,"type":"string"},"exists":{"type":"boolean"},"dealID":{"nullable":true,"type":"string"},"inbound":{"nullable":true,"type":"boolean"},"inboundParty":{"nullable":true,"type":"string"}},"required":["key","name","exists","dealID","inbound","inboundParty"],"additionalProperties":false},"created":{"nullable":true,"type":"string"},"updated":{"nullable":true,"type":"string"},"createdBy":{"nullable":true,"type":"object","properties":{"uid":{"type":"string"},"email":{"nullable":true,"type":"string"},"fullName":{"nullable":true,"type":"string"},"at":{"nullable":true,"type":"string"},"action":{"type":"string"}},"required":["uid","email","fullName","at","action"],"additionalProperties":false},"deleted":{"nullable":true,"type":"object","properties":{"at":{"nullable":true,"type":"string"},"by":{"nullable":true,"type":"string"},"byEmail":{"nullable":true,"type":"string"}},"required":["at","by","byEmail"],"additionalProperties":false},"owners":{"type":"array","items":{"type":"string"}},"status":{"nullable":true,"type":"object","properties":{"key":{"type":"string"},"name":{"nullable":true,"type":"string"}},"required":["key","name"],"additionalProperties":false},"inbound":{"nullable":true,"type":"boolean"},"inboundParty":{"nullable":true,"type":"string"},"template":{"nullable":true,"type":"object","properties":{"key":{"nullable":true,"type":"string"},"title":{"nullable":true,"type":"string"},"public":{"type":"boolean"},"inbound":{"type":"boolean"},"inboundParty":{"nullable":true,"type":"string"},"inboundMulti":{"type":"boolean"},"workflow":{"nullable":true,"type":"string"}},"required":["key","title","public","inbound","inboundParty","inboundMulti","workflow"],"additionalProperties":false},"currentVersion":{"nullable":true,"type":"string"},"versionCount":{"type":"number"},"counts":{"type":"object","properties":{"sections":{"type":"number"},"variables":{"type":"number"},"attachments":{"type":"number"},"parties":{"type":"number"},"users":{"type":"number"}},"required":["sections","variables","attachments","parties","users"],"additionalProperties":false}},"required":["dealID","name","dealType","isNative","isExternal","sourceTemplateKey","sourceTeam","sourceTemplateName","sourceTemplate","created","updated","createdBy","deleted","owners","status","inbound","inboundParty","template","currentVersion","versionCount","counts"],"additionalProperties":false},"invitation":{"nullable":true,"type":"object","properties":{"teamID":{"type":"string"},"templateKey":{"type":"string"},"template":{"nullable":true,"type":"object","properties":{"dealID":{"nullable":true,"type":"string"},"key":{"type":"string"},"title":{"nullable":true,"type":"string"},"name":{"nullable":true,"type":"string"},"exists":{"type":"boolean"}},"required":["dealID","key","title","name","exists"],"additionalProperties":false},"enabled":{"type":"boolean"},"party":{"nullable":true,"type":"string"},"allowsMultiple":{"type":"boolean"},"requiresSignedUrl":{"type":"boolean"},"hasEligibleOwner":{"type":"boolean"},"blockers":{"type":"array","items":{"type":"string"}}},"required":["teamID","templateKey","template","enabled","party","allowsMultiple","requiresSignedUrl","hasEligibleOwner","blockers"],"additionalProperties":false},"bundle":{"nullable":true,"type":"object","properties":{"role":{"type":"string","enum":["parent","child","none"]},"bundleID":{"nullable":true,"type":"string"},"parent":{"nullable":true,"type":"object","properties":{"dealID":{"type":"string"},"name":{"nullable":true,"type":"string"},"deleted":{"type":"boolean"}},"required":["dealID","name","deleted"],"additionalProperties":false},"children":{"type":"array","items":{"type":"object","properties":{"dealID":{"type":"string"},"templateKey":{"type":"string"},"title":{"nullable":true,"type":"string"},"deleted":{"type":"boolean"}},"required":["title"],"additionalProperties":false}},"childCount":{"type":"number"}},"required":["role","bundleID","parent","children","childCount"],"additionalProperties":false},"team":{"nullable":true,"type":"object","properties":{"teamID":{"type":"string"},"name":{"nullable":true,"type":"string"},"memberCount":{"type":"number"},"resolvedMemberCount":{"nullable":true,"type":"number"},"unresolvedMemberCount":{"nullable":true,"type":"number"}},"required":["teamID","name","memberCount","resolvedMemberCount","unresolvedMemberCount"],"additionalProperties":false},"membership":{"type":"object","properties":{"team":{"nullable":true,"type":"object","properties":{"isMember":{"type":"boolean"},"role":{"nullable":true,"type":"string"},"observer":{"type":"boolean"},"observerRole":{"nullable":true,"type":"string"},"canCreateNewDoc":{"nullable":true,"type":"boolean"},"canUploadDoc":{"nullable":true,"type":"boolean"},"withoutRedline":{"nullable":true,"type":"boolean"},"canLockSections":{"nullable":true,"type":"boolean"},"canOverrideLocks":{"nullable":true,"type":"boolean"},"serviceProvider":{"nullable":true,"type":"string"}},"required":["isMember","role","observer","observerRole","canCreateNewDoc","canUploadDoc","withoutRedline","canLockSections","canOverrideLocks","serviceProvider"],"additionalProperties":false},"deal":{"nullable":true,"type":"object","properties":{"hasAccess":{"type":"boolean"},"role":{"nullable":true,"type":"string"}},"required":["hasAccess","role"],"additionalProperties":false}},"required":["team","deal"],"additionalProperties":false},"users":{"type":"array","items":{"type":"object","properties":{"uid":{"nullable":true,"type":"string"},"email":{"nullable":true,"type":"string"},"fullName":{"nullable":true,"type":"string"},"role":{"nullable":true,"type":"string"},"source":{"type":"string","enum":["deal","team"]},"unresolved":{"type":"boolean"}},"required":["uid","email","fullName","role","source","unresolved"],"additionalProperties":false}},"usersTruncated":{"type":"boolean"},"connections":{"type":"array","items":{"type":"object","properties":{"key":{"nullable":true,"type":"string"},"type":{"nullable":true,"type":"string"},"name":{"nullable":true,"type":"string"},"objectType":{"nullable":true,"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"id":{"nullable":true,"type":"string"},"projectId":{"nullable":true,"type":"string"},"source":{"nullable":true,"type":"string"},"sourceType":{"nullable":true,"type":"string"}},"required":["key","type","name","objectType","id","projectId","source","sourceType"],"additionalProperties":false}}},"required":["url","environment","objectType","deal","invitation","bundle","team","membership","users","usersTruncated","connections"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/ai/models":{"get":{"summary":"List AI models","tags":["AI"],"description":"Chat models a provider currently offers for AI blocks, newest first, from the provider's live model list (cached 24h).","parameters":[{"schema":{"type":"string","enum":["openai","anthropic"]},"in":"query","name":"provider","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["openai","anthropic"]},"model":{"type":"string"},"title":{"type":"string"},"capabilities":{"type":"object","properties":{"supportsTemperature":{"type":"boolean"}},"required":["supportsTemperature"],"additionalProperties":false}},"required":["provider","model","title","capabilities"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/lfw/exports":{"post":{"summary":"Create a 1-click LFW export URL","tags":["LFW"],"description":"Mints a short-lived, single-use URL. The frontend launches it via ms-word:ofe|u|<url> so Word fetches the DOCX directly (full-trust, no Protected View) and the embedded LFW add-in pane auto-opens.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dealId":{"type":"string","minLength":1,"pattern":"^[\\w-]+$","description":"Deal ID to export"},"name":{"description":"Deal name, used for the exported .docx filename","type":"string"},"locale":{"description":"BCP-47 locale for date/number formatting","type":"string"},"timeZone":{"description":"IANA time zone for date formatting","type":"string"}},"required":["dealId"]}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Short-lived, single-use ms-word: openable URL"}},"required":["url"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/lfw/docx/{filename}":{"get":{"summary":"Fetch a deal DOCX via a single-use export token","tags":["LFW"],"description":"Anonymous endpoint Word calls directly via the ms-word: protocol. Authorized solely by the single-use token in the query string; hard-fails without a valid one. Streams the DOCX with the LFW add-in embedded. The :filename path segment is cosmetic (the deal name Word shows); the loaded deal, not the URL, is the source of truth for the streamed document.","parameters":[{"schema":{"type":"string","pattern":"^[0-9a-f]{64}$"},"in":"query","name":"token","required":true,"description":"Single-use export ticket (64 hex chars)"},{"schema":{"type":"string","minLength":1},"in":"path","name":"filename","required":true,"description":"Exported document filename, e.g. \"My Deal.docx\""}],"responses":{"200":{"description":"Default Response"}}}}},"servers":[{"url":"http://localhost:4000","description":"Local development"}],"security":[{"bearerAuth":[]}]}