{"openapi":"3.1.0","info":{"title":"Attorly REST API","version":"1.0.0","description":"JSON over HTTPS for Attorly’s legal AI. Every operation runs the same handler as the matching MCP tool (https://attorly.ai/api/mcp), with the same API keys, scopes, per-key rate limits and AI-credit billing. Available on the Pro and Enterprise plans. Idempotency-Key is not supported: a repeated POST runs, and is billed, again."},"servers":[{"url":"https://attorly.ai"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Documents"},{"name":"Clauses"},{"name":"Research"},{"name":"Redlines"},{"name":"Negotiations"},{"name":"Workflows"},{"name":"Due diligence"},{"name":"Templates and drafts"}],"paths":{"/api/v1/analyses":{"post":{"operationId":"createAnalysis","summary":"Analyse a stored document (mode \"full\") or a document or inline text (mode \"quick\")","description":"Required scopes: full: DOCUMENTS_ANALYZE; quick: DOCUMENTS_READ, DOCUMENTS_ANALYZE. MCP equivalent: documents_analyze, documents_analyze_quick. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"mode":{"const":"full","description":"Runs documents_analyze.","default":"full"},"documentId":{"type":"string"},"content":{"type":"string"},"mimeType":{"type":"string"},"options":{"type":"object","properties":{"jurisdiction":{"type":"string"},"contractType":{"type":"string"},"partyRole":{"type":"string","enum":["BUYER","SELLER","LANDLORD","TENANT","EMPLOYER","EMPLOYEE","NEUTRAL"]},"depth":{"type":"string","enum":["QUICK","STANDARD","DETAILED"]}}}},"title":"mode: full"},{"type":"object","properties":{"mode":{"const":"quick","description":"Runs documents_analyze_quick."},"documentId":{"type":"string"},"content":{"type":"string"},"mimeType":{"type":"string"},"options":{"type":"object","properties":{"jurisdiction":{"type":"string"},"contractType":{"type":"string"},"partyRole":{"type":"string","enum":["BUYER","SELLER","LANDLORD","TENANT","EMPLOYER","EMPLOYEE","NEUTRAL"]},"depth":{"type":"string","enum":["QUICK","STANDARD","DETAILED"]}}}},"title":"mode: quick","required":["mode"]}]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"anyOf":[{"title":"mode: full","type":"object","properties":{"summary":{"type":"string"},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]},"riskScore":{"type":"number"},"keyTerms":{"type":"array","items":{"type":"object","properties":{"term":{"type":"string"},"definition":{"type":"string"},"importance":{"type":"string","enum":["low","medium","high"]}},"required":["term"]}},"clauses":{"type":"array","items":{"type":"object"}},"recommendations":{"type":"array","items":{"type":"object"}}},"required":["summary","riskLevel","riskScore","keyTerms","clauses","recommendations"]},{"title":"mode: quick","type":"object","properties":{"summary":{"type":"string"},"documentType":{"type":"string"},"keyPoints":{"type":"array","items":{"type":"string"}},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"parties":{"type":"array","items":{"type":"string"}}},"required":["summary"]}]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/documents/{documentId}/analyses":{"post":{"operationId":"createDocumentAnalysis","summary":"Analyse a stored document (mode \"full\" or \"quick\")","description":"Required scopes: full: DOCUMENTS_ANALYZE; quick: DOCUMENTS_READ, DOCUMENTS_ANALYZE. MCP equivalent: documents_analyze, documents_analyze_quick. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Documents"],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"mode":{"const":"full","description":"Runs documents_analyze.","default":"full"},"content":{"type":"string"},"mimeType":{"type":"string"},"options":{"type":"object","properties":{"jurisdiction":{"type":"string"},"contractType":{"type":"string"},"partyRole":{"type":"string","enum":["BUYER","SELLER","LANDLORD","TENANT","EMPLOYER","EMPLOYEE","NEUTRAL"]},"depth":{"type":"string","enum":["QUICK","STANDARD","DETAILED"]}}}},"title":"mode: full"},{"type":"object","properties":{"mode":{"const":"quick","description":"Runs documents_analyze_quick."},"content":{"type":"string"},"mimeType":{"type":"string"},"options":{"type":"object","properties":{"jurisdiction":{"type":"string"},"contractType":{"type":"string"},"partyRole":{"type":"string","enum":["BUYER","SELLER","LANDLORD","TENANT","EMPLOYER","EMPLOYEE","NEUTRAL"]},"depth":{"type":"string","enum":["QUICK","STANDARD","DETAILED"]}}}},"title":"mode: quick","required":["mode"]}]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"anyOf":[{"title":"mode: full","type":"object","properties":{"summary":{"type":"string"},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]},"riskScore":{"type":"number"},"keyTerms":{"type":"array","items":{"type":"object","properties":{"term":{"type":"string"},"definition":{"type":"string"},"importance":{"type":"string","enum":["low","medium","high"]}},"required":["term"]}},"clauses":{"type":"array","items":{"type":"object"}},"recommendations":{"type":"array","items":{"type":"object"}}},"required":["summary","riskLevel","riskScore","keyTerms","clauses","recommendations"]},{"title":"mode: quick","type":"object","properties":{"summary":{"type":"string"},"documentType":{"type":"string"},"keyPoints":{"type":"array","items":{"type":"string"}},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"parties":{"type":"array","items":{"type":"string"}}},"required":["summary"]}]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/documents/{documentId}/text":{"get":{"operationId":"getDocumentText","summary":"Extract the plain text of a stored PDF or DOCX document","description":"Required scopes: DOCUMENTS_READ. MCP equivalent: documents_extract_text. Does not use AI credits.","tags":["Documents"],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"text":{"type":"string"},"documentName":{"type":"string"},"documentType":{"type":"string"},"mimeType":{"type":"string"},"characterCount":{"type":"integer"},"wordCount":{"type":"integer"}},"required":["text","documentName","documentType","mimeType","characterCount","wordCount"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/comparisons":{"post":{"operationId":"createComparison","summary":"Compare two documents or texts line by line","description":"Required scopes: DOCUMENTS_READ. MCP equivalent: documents_compare. Does not use AI credits.","tags":["Documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sourceDocumentId":{"type":"string"},"sourceContent":{"type":"string"},"targetDocumentId":{"type":"string"},"targetContent":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"differences":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["addition","deletion","unchanged"]},"content":{"type":"string"},"lines":{"type":"integer"}},"required":["type","content"]}},"summary":{"type":"object","properties":{"additions":{"type":"integer"},"deletions":{"type":"integer"},"unchanged":{"type":"integer"},"totalChanges":{"type":"integer"}},"required":["additions","deletions","unchanged","totalChanges"]}},"required":["differences","summary"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/clauses":{"get":{"operationId":"searchClauses","summary":"Search the clause library","description":"Required scopes: CLAUSES_READ. MCP equivalent: clauses_search. Does not use AI credits.","tags":["Clauses"],"parameters":[{"name":"query","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"category","in":"query","required":false,"schema":{"type":"string","enum":["INDEMNIFICATION","LIABILITY","TERMINATION","CONFIDENTIALITY","INTELLECTUAL_PROPERTY","PAYMENT","DISPUTE_RESOLUTION","FORCE_MAJEURE","WARRANTIES","REPRESENTATIONS","GENERAL","CUSTOM"]}},{"name":"jurisdiction","in":"query","required":false,"schema":{"type":"string"}},{"name":"riskLevel","in":"query","required":false,"schema":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]}},{"name":"limit","in":"query","required":false,"schema":{"default":10,"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"clauses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"content":{"type":"string"},"category":{"type":"string"},"jurisdiction":{"type":["string","null"]},"riskLevel":{"type":["string","null"]},"usageCount":{"type":"integer"},"description":{"type":["string","null"]}},"required":["id","name","content","category"]}},"count":{"type":"integer"}},"required":["clauses","count"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/clauses/risk-assessments":{"post":{"operationId":"createClauseRiskAssessment","summary":"Assess the risk of a clause","description":"Required scopes: CLAUSES_READ. MCP equivalent: clauses_analyze_risk. Does not use AI credits.","tags":["Clauses"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clauseText":{"type":"string","minLength":1},"category":{"description":"The kind of clause; its risk rules are applied","type":"string","enum":["INDEMNIFICATION","LIABILITY","TERMINATION","CONFIDENTIALITY","INTELLECTUAL_PROPERTY","PAYMENT","DISPUTE_RESOLUTION","FORCE_MAJEURE","WARRANTIES","REPRESENTATIONS","GENERAL","CUSTOM"]},"jurisdiction":{"description":"ISO 3166-1 alpha-2 country code; defaults to international","type":"string"},"contractType":{"type":"string"},"partyRole":{"type":"string","enum":["BUYER","SELLER","LANDLORD","TENANT","EMPLOYER","EMPLOYEE","NEUTRAL"]}},"required":["clauseText"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"clauseText":{"type":"string"},"clauseType":{"type":"string"},"jurisdiction":{"type":"string"},"overallRiskScore":{"type":"number","minimum":0,"maximum":100},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]},"riskFactors":{"type":"array","items":{"type":"object"}},"recommendations":{"type":"array","items":{"type":"string"}},"alternatives":{"type":"array","items":{"type":"object"}},"complianceIssues":{"type":"array","items":{"type":"object"}},"negotiationTips":{"type":"array","items":{"type":"string"}}},"required":["clauseType","jurisdiction","overallRiskScore","riskLevel","riskFactors","recommendations"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/clauses/market-comparisons":{"post":{"operationId":"createClauseMarketComparison","summary":"Compare a clause with market-standard language","description":"Required scopes: CLAUSES_READ. MCP equivalent: clauses_compare_to_market. Does not use AI credits.","tags":["Clauses"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clauseText":{"type":"string"},"category":{"type":"string","enum":["INDEMNIFICATION","LIABILITY","TERMINATION","CONFIDENTIALITY","INTELLECTUAL_PROPERTY","PAYMENT","DISPUTE_RESOLUTION","FORCE_MAJEURE","WARRANTIES","REPRESENTATIONS","GENERAL","CUSTOM"]},"contractType":{"type":"string"},"jurisdiction":{"type":"string"}},"required":["clauseText","category"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"inputClause":{"type":"string"},"category":{"type":"string"},"marketStandards":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"content":{"type":"string"},"riskLevel":{"type":["string","null"]}},"required":["id","name","content"]}},"comparison":{"type":"object","properties":{"matchCount":{"type":"integer"},"recommendation":{"type":"string"}},"required":["matchCount","recommendation"]}},"required":["inputClause","category","marketStandards","comparison"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/clauses/playbook-checks":{"post":{"operationId":"createClausePlaybookCheck","summary":"Check a clause against a playbook","description":"Required scopes: CLAUSES_READ. MCP equivalent: clauses_check_playbook. Does not use AI credits.","tags":["Clauses"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clauseText":{"type":"string"},"playbookId":{"type":"string"}},"required":["clauseText","playbookId"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"playbookName":{"type":"string"},"compliant":{"type":"boolean"},"violations":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"rulesChecked":{"type":"integer"}},"required":["playbookName","compliant","violations","warnings","rulesChecked"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/research/searches":{"post":{"operationId":"searchResearch","summary":"Search legal sources (Lovdata, EUR-Lex, legislation.gov.uk, CourtListener, Finlex, …)","description":"Required scopes: RESEARCH_READ. MCP equivalent: research_search. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Research"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1},"jurisdictions":{"description":"ISO 3166-1 alpha-2 country code to search under, or \"EU\"; the first entry is used. Defaults to the key owner's country.","type":"array","items":{"type":"string"}},"sources":{"description":"Keep only results from these publishers","type":"array","items":{"type":"string","enum":["lovdata","eurlex","legislation_uk","congress_gov","courtlistener","finlex"]}},"dateFrom":{"description":"Keep only dated results on or after this day","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dateTo":{"description":"Keep only dated results on or before this day","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"limit":{"default":10,"type":"integer","minimum":1,"maximum":50}},"required":["query"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"query":{"type":"string"},"jurisdiction":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"source":{"type":"string"},"jurisdiction":{"type":"string"},"citation":{"type":"string"},"url":{"type":"string"},"date":{"type":"string"},"excerpt":{"type":"string"},"relevanceScore":{"type":"number"},"attribution":{"type":"string"},"asOf":{"type":"string"}},"required":["id","title","source","jurisdiction","citation","excerpt"]}},"totalCount":{"type":"integer","description":"Results matching the filters, before `limit`."},"sources":{"type":"string"}},"required":["query","jurisdiction","results","totalCount","sources"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/research/statutes":{"get":{"operationId":"getStatute","summary":"Look up a statute by citation","description":"Required scopes: RESEARCH_READ. MCP equivalent: research_get_statute. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Research"],"parameters":[{"name":"citation","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"jurisdiction","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"ISO 3166-1 alpha-2 country code, or \"EU\""}}],"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"source":{"type":"string"},"jurisdiction":{"type":"string"},"citation":{"type":"string"},"url":{"type":"string"},"date":{"type":"string"},"excerpt":{"type":"string"},"relevanceScore":{"type":"number"},"attribution":{"type":"string"},"asOf":{"type":"string"}},"required":["id","title","source","jurisdiction","citation","excerpt"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/redlines":{"post":{"operationId":"createRedlines","summary":"Generate redline suggestions for a document or text","description":"Required scopes: REDLINES_GENERATE. MCP equivalent: redlines_generate. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Redlines"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentId":{"type":"string"},"content":{"type":"string"},"partyRole":{"type":"string","enum":["BUYER","SELLER","LANDLORD","TENANT","EMPLOYER","EMPLOYEE"]},"riskTolerance":{"default":"MODERATE","type":"string","enum":["CONSERVATIVE","MODERATE","AGGRESSIVE"]},"focusAreas":{"type":"array","items":{"type":"string"}},"playbookId":{"description":"Redline against this playbook's position ladders (own, organisation, system or shared playbooks)","type":"string"},"side":{"description":"Whose paper the document is, to pick the playbook positions that apply","type":"string","enum":["OUR_PAPER","THEIR_PAPER","EITHER"]}},"required":["partyRole"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"changes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["INSERT","DELETE","MODIFY","COMMENT"]},"position":{"type":"object","properties":{"start":{"type":"integer"},"end":{"type":"integer"},"paragraph":{"type":"integer"},"clause":{"type":"string"}},"required":["start","end"]},"originalText":{"type":"string"},"newText":{"type":"string"},"comment":{"type":"string"},"reasoning":{"type":"string"},"priority":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]},"status":{"type":"string","enum":["PENDING","ACCEPTED","REJECTED","MODIFIED"]}},"required":["id","type","reasoning","priority","status"]}},"summary":{"type":"object"},"negotiationNotes":{"type":"array","items":{"type":"string"}},"statistics":{"type":"object","properties":{"totalChanges":{"type":"integer"},"byType":{"type":"object","properties":{"additions":{"type":"integer"},"deletions":{"type":"integer"},"modifications":{"type":"integer"},"comments":{"type":"integer"}},"required":["additions","deletions","modifications","comments"]}},"required":["totalChanges","byType"]}},"required":["changes","summary","negotiationNotes","statistics"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/documents/{documentId}/redlines/resolutions":{"post":{"operationId":"resolveRedlines","summary":"Accept or reject redline changes on a document","description":"Required scopes: REDLINES_GENERATE. MCP equivalent: redlines_apply. Does not use AI credits.","tags":["Redlines"],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"changes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string","enum":["accept","reject"]}},"required":["id","action"]}}},"required":["changes"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"accepted":{"type":"integer"},"rejected":{"type":"integer"},"message":{"type":"string"}},"required":["accepted","rejected","message"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/negotiations/position-analyses":{"post":{"operationId":"createNegotiationPositionAnalysis","summary":"Analyse a negotiation position","description":"Required scopes: NEGOTIATIONS_READ. MCP equivalent: negotiations_analyze_position. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Negotiations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentId":{"type":"string"},"content":{"type":"string"},"partyRole":{"type":"string","enum":["BUYER","SELLER","LANDLORD","TENANT","EMPLOYER","EMPLOYEE"]},"context":{"type":"object","properties":{"dealValue":{"type":"number"},"dealType":{"type":"string"},"industry":{"type":"string"},"urgency":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"alternatives":{"type":"string"}}}},"required":["partyRole"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"overallPosition":{"type":"string","enum":["FAVORABLE","BALANCED","UNFAVORABLE"]},"positions":{"type":"array","items":{"type":"object","properties":{"clause":{"type":"string"},"currentTerms":{"type":"string"},"preferredTerms":{"type":"string"},"fallbackTerms":{"type":"string"},"reasoning":{"type":"string"},"leverage":{"type":"string","enum":["STRONG","MODERATE","WEAK"]}},"required":["clause","reasoning","leverage"]}},"prioritizedConcessions":{"type":"array","items":{"type":"string"}},"dealBreakers":{"type":"array","items":{"type":"string"}},"suggestedApproach":{"type":"string"},"estimatedOutcome":{"type":"object","properties":{"bestCase":{"type":"string"},"likelyCase":{"type":"string"},"worstCase":{"type":"string"}},"required":["bestCase","likelyCase","worstCase"]}},"required":["overallPosition","positions"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/negotiations/playbooks":{"post":{"operationId":"createNegotiationPlaybook","summary":"Build a negotiation playbook from a strategy","description":"Required scopes: NEGOTIATIONS_READ. MCP equivalent: negotiations_generate_playbook. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Negotiations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"strategy":{"type":"object","properties":{"overallPosition":{"type":"string","minLength":1,"description":"Your stance, e.g. \"collaborative\", \"firm\", \"aggressive\", or a sentence"},"priorities":{"minItems":1,"type":"array","items":{"type":"string","minLength":1},"description":"What you need from the deal, most important first"},"dealBreakers":{"type":"array","items":{"type":"string"}},"concessions":{"type":"array","items":{"type":"string"}}},"required":["overallPosition","priorities"]},"context":{"type":"object","properties":{"counterpartyType":{"type":"string"},"negotiationStage":{"type":"string"}}}},"required":["strategy"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"playbook":{"type":"array","items":{"type":"object","properties":{"stage":{"type":"string","enum":["opening","exploration","trading","concession","closing","walk_away"]},"move":{"type":"string"},"rationale":{"type":"string"},"fallback":{"type":"string"},"talkingPoints":{"type":"array","items":{"type":"string"}},"linkedPriority":{"type":"string"}},"required":["stage","move","rationale","talkingPoints"]}},"anticipatedObjections":{"type":"array","items":{"type":"object","properties":{"objection":{"type":"string"},"response":{"type":"string"}},"required":["objection","response"]}},"recommendations":{"type":"array","items":{"type":"string"}},"summary":{"type":"object","properties":{"position":{"type":"string"},"priorityCount":{"type":"integer"},"concessionCount":{"type":"integer"},"dealBreakerCount":{"type":"integer"},"moveCount":{"type":"integer"}},"required":["position","priorityCount","concessionCount","dealBreakerCount","moveCount"]}},"required":["playbook","anticipatedObjections","recommendations","summary"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/workflows/templates":{"get":{"operationId":"listWorkflowTemplates","summary":"List workflow templates","description":"Required scopes: WORKFLOWS_EXECUTE. MCP equivalent: workflows_list_templates. Does not use AI credits.","tags":["Workflows"],"parameters":[{"name":"category","in":"query","required":false,"schema":{"description":"Due diligence project type the template is built for","type":"string","enum":["MA_ACQUISITION","MA_MERGER","INVESTMENT","IPO","REAL_ESTATE","REGULATORY","CUSTOM"]}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"projectType":{"type":"string"},"definition":{"type":"object"},"isSystemDefault":{"type":"boolean"},"usageCount":{"type":"integer"}},"required":["id","name","projectType","isSystemDefault"]}},"count":{"type":"integer"}},"required":["templates","count"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/workflows/executions":{"post":{"operationId":"createWorkflowExecution","summary":"Start a workflow on a due diligence project","description":"Required scopes: WORKFLOWS_EXECUTE. MCP equivalent: workflows_execute. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Workflows"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"type":"string"},"projectId":{"type":"string"},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"options":{"type":"object","properties":{"priority":{"type":"string","enum":["low","normal","high"]},"webhookUrl":{"type":"string","format":"uri"}}}},"required":["templateId","projectId","inputs"]}}}},"responses":{"202":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"executionId":{"type":"string"},"templateId":{"type":"string"},"templateName":{"type":"string"},"status":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"message":{"type":"string"}},"required":["executionId","templateId","templateName","status","startedAt","message"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/workflows/executions/{executionId}":{"get":{"operationId":"getWorkflowExecution","summary":"Get the status of a workflow execution","description":"Required scopes: WORKFLOWS_EXECUTE. MCP equivalent: workflows_get_status. Does not use AI credits.","tags":["Workflows"],"parameters":[{"name":"executionId","in":"path","required":true,"schema":{"type":"string"}},{"name":"includeSteps","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"executionId":{"type":"string"},"templateName":{"type":"string"},"status":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"variables":{"type":"object"},"error":{"type":["string","null"]},"steps":{"type":"array","items":{"type":"object"}}},"required":["executionId","templateName","status"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/due-diligence/projects":{"post":{"operationId":"createDueDiligenceProject","summary":"Create a due diligence project","description":"Required scopes: DUE_DILIGENCE_FULL. MCP equivalent: due_diligence_create_project. Does not use AI credits.","tags":["Due diligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"dealType":{"type":"string","enum":["MA_ACQUISITION","MA_MERGER","INVESTMENT","IPO","REAL_ESTATE","REGULATORY","CUSTOM"]},"targetCompany":{"type":"string"},"description":{"type":"string"},"settings":{"type":"object","properties":{"riskCategories":{"type":"array","items":{"type":"string"}},"jurisdictions":{"type":"array","items":{"type":"string"}},"customChecklist":{"type":"array","items":{"type":"string"}}}}},"required":["name","dealType"]}}}},"responses":{"201":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"projectId":{"type":"string"},"name":{"type":"string"},"projectType":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"message":{"type":"string"}},"required":["projectId","name","projectType","status","createdAt","message"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/due-diligence/projects/{projectId}/documents":{"post":{"operationId":"addDueDiligenceDocuments","summary":"Add documents to a due diligence project","description":"Required scopes: DUE_DILIGENCE_FULL. MCP equivalent: due_diligence_add_documents. Does not use AI credits.","tags":["Due diligence"],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentIds":{"type":"array","items":{"type":"string"}},"category":{"type":"string"}},"required":["documentIds"]}}}},"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"projectId":{"type":"string"},"documentsAdded":{"type":"integer"},"totalDocuments":{"type":"integer"},"category":{"type":"string"},"message":{"type":"string"}},"required":["projectId","documentsAdded","totalDocuments","category","message"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/due-diligence/projects/{projectId}/findings":{"get":{"operationId":"listDueDiligenceFindings","summary":"List the findings of a due diligence project","description":"Required scopes: DUE_DILIGENCE_FULL. MCP equivalent: due_diligence_get_findings. Does not use AI credits.","tags":["Due diligence"],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}},{"name":"riskLevel","in":"query","required":false,"schema":{"type":"string","enum":["INFO","LOW","MEDIUM","HIGH","CRITICAL"]}},{"name":"category","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"projectId":{"type":"string"},"projectName":{"type":"string"},"findings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"severity":{"type":"string","enum":["INFO","LOW","MEDIUM","HIGH","CRITICAL"]},"category":{"type":["string","null"]},"recommendation":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","title","description","severity","createdAt"]}},"riskSummary":{"type":"object","additionalProperties":{"type":"integer"},"description":"Number of findings per severity."},"totalFindings":{"type":"integer"}},"required":["projectId","projectName","findings","riskSummary","totalFindings"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/due-diligence/projects/{projectId}/reports":{"post":{"operationId":"createDueDiligenceReport","summary":"Generate a due diligence report","description":"Required scopes: DUE_DILIGENCE_FULL. MCP equivalent: due_diligence_generate_report. Does not use AI credits.","tags":["Due diligence"],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","enum":["pdf","markdown"],"description":"\"markdown\" returns the report text; \"pdf\" also returns the formatted PDF (base64)"},"sections":{"minItems":1,"type":"array","items":{"type":"string","enum":["executive_summary","risk_overview","findings_detail","document_analysis","recommendations"]}},"includeRecommendations":{"type":"boolean"}},"required":["format"]}}}},"responses":{"201":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"reportId":{"type":"string"},"projectId":{"type":"string"},"projectName":{"type":"string"},"format":{"type":"string","enum":["pdf","markdown"]},"status":{"type":"string"},"sections":{"type":"array","items":{"type":"string"}},"documentCount":{"type":"integer"},"findingCount":{"type":"integer"},"markdown":{"type":"string"},"attachment":{"type":"object","properties":{"format":{"type":"string"},"filename":{"type":"string"},"sizeBytes":{"type":"integer"},"base64":{"type":"string","contentEncoding":"base64","contentMediaType":"application/pdf"}},"required":["format","filename","sizeBytes","base64"]},"message":{"type":"string"}},"required":["reportId","projectId","format","status","markdown"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/templates":{"get":{"operationId":"listTemplates","summary":"List document templates","description":"Required scopes: TEMPLATES_READ. MCP equivalent: templates_list. Does not use AI credits.","tags":["Templates and drafts"],"parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string","enum":["NDA","EMPLOYMENT","SERVICE_AGREEMENT","LEASE","REAL_ESTATE","CORPORATE","INTELLECTUAL_PROPERTY","COMPLIANCE","FINANCE","PARTNERSHIP","PURCHASE","GENERAL","CUSTOM"]}},{"name":"jurisdiction","in":"query","required":false,"schema":{"description":"ISO 3166-1 alpha-2 country code (e.g. \"NO\", \"GB\"); jurisdiction-neutral templates are always included","type":"string"}},{"name":"language","in":"query","required":false,"schema":{"description":"ISO 639-1 language code of the template text (e.g. \"en\", \"nb\")","type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"category":{"type":"string"},"locale":{"type":"string"},"jurisdiction":{"type":["string","null"]},"requiredVariables":{"type":"array","items":{"type":"string"},"description":"Variables a draft must supply: required, with no default."},"variables":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","date","email","textarea","select"]},"required":{"type":"boolean"},"defaultValue":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"description":{"type":"string"}},"required":["name","label","type","required"]}},"usageCount":{"type":"integer"}},"required":["id","name","category","locale","requiredVariables","variables"]}},"count":{"type":"integer"}},"required":["templates","count"]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/drafts":{"post":{"operationId":"createDraft","summary":"Create a draft from a template (mode \"template\") or with AI (mode \"ai\")","description":"Required scopes: template: TEMPLATES_DRAFT; ai: TEMPLATES_DRAFT. MCP equivalent: templates_draft, templates_generate_ai. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP.","tags":["Templates and drafts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"mode":{"const":"template","description":"Runs templates_draft.","default":"template"},"templateId":{"type":"string"},"variables":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"options":{"type":"object","properties":{"format":{"type":"string","enum":["docx","pdf","markdown"]},"language":{"type":"string"}}}},"required":["templateId","variables"],"title":"mode: template"},{"type":"object","properties":{"mode":{"const":"ai","description":"Runs templates_generate_ai."},"documentType":{"type":"string"},"requirements":{"type":"string"},"context":{"type":"object","properties":{"jurisdiction":{"type":"string"},"parties":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"role":{"type":"string"}},"required":["name","role"]}},"keyTerms":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}}},"options":{"type":"object","properties":{"tone":{"type":"string","enum":["formal","standard","friendly"]},"length":{"type":"string","enum":["concise","standard","detailed"]},"language":{"type":"string"}}}},"required":["mode","documentType","requirements"],"title":"mode: ai"}]}}}},"responses":{"201":{"description":"Success","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"anyOf":[{"title":"mode: template","type":"object","properties":{"draftId":{"type":"string"},"content":{"type":"string","description":"The full text of the draft, as Markdown."},"characterCount":{"type":"integer"},"message":{"type":"string"},"draftIds":{"type":"array","items":{"type":"string"}},"fileCount":{"type":"integer"},"templateId":{"type":"string"},"templateName":{"type":"string"},"format":{"type":"string","const":"markdown"},"variablesUsed":{"type":"integer"}},"required":["draftId","content","characterCount"]},{"title":"mode: ai","type":"object","properties":{"draftId":{"type":"string"},"content":{"type":"string","description":"The full text of the draft, as Markdown."},"characterCount":{"type":"integer"},"message":{"type":"string"},"documentType":{"type":"string"},"estimatedPages":{"type":"integer"}},"required":["draftId","content","characterCount"]}]},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"400":{"description":"Invalid request body or query (`invalid_request`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Authorization header (`unauthorized`), or an unknown, revoked or expired key (`invalid_api_key`, `api_key_revoked`, `api_key_expired`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"AI credits exhausted (`insufficient_credits`) or AI usage limit reached (`usage_limit_exceeded`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`)","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`); it may be retried","headers":{"X-Request-ID":{"$ref":"#/components/headers/X-Request-ID"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"headers":{"X-Request-ID":{"description":"Identifies this request; quote it when contacting support.","schema":{"type":"string","format":"uuid"}},"RateLimit-Limit":{"description":"Requests allowed per window for this key and operation.","schema":{"type":"integer"}},"RateLimit-Remaining":{"description":"Requests left in the current window.","schema":{"type":"integer"}},"RateLimit-Reset":{"description":"Seconds until the window resets.","schema":{"type":"integer"}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"An MCP connection key (lbmcp_…, Pro and Enterprise) or an organization API key (lb_…, Enterprise)."}},"schemas":{"Meta":{"type":"object","properties":{"warnings":{"type":"array","items":{"type":"string"}}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["invalid_request","unauthorized","invalid_api_key","api_key_revoked","api_key_expired","insufficient_credits","usage_limit_exceeded","forbidden","insufficient_scope","plan_required","ai_consent_withdrawn","not_found","conflict","unprocessable","rate_limited","internal_error","timeout"]},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","required":["path","message"],"properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}