{"openapi":"3.1.0","info":{"title":"Attorly REST API","version":"2026-11-01","description":"JSON over HTTPS for Attorly’s legal AI. Every AI operation runs the same handler as the matching MCP tool (https://attorly.ai/api/mcp), with the same scopes, rate limits and AI-credit billing. Available on the Pro and Enterprise plans.\n\nThis document describes API version 2026-11-01. Send Attorly-Version: <version> to use another; a key without the header uses the version it was pinned to when it was created. Versions: 2026-10-01, 2026-11-01. Breaking changes:\n- 2026-11-01 (list_envelope): List operations return { object: \"list\", data: [...], hasMore, nextCursor } instead of the items under a resource-named field (data.documents, data.templates) with count.\n- 2026-11-01 (long_running_async): Long-running AI operations (full analyses, redlines, workflows, due diligence reports, AI drafts) answer 202 Accepted with an operation to poll unless the request sends Prefer: wait=<seconds> (at most 60) and the call finishes within it.\n\nSend Idempotency-Key on POST, PATCH and DELETE to retry safely: a retry with the same key and request gets the first response back and is not run or billed again (keys are kept 24 hours; server errors are not stored). Lists are { object: \"list\", data, hasMore, nextCursor }: pass nextCursor as cursor for the next page (limit 1–100). Rate limits: the key's hourly limit, 600 requests per minute per organization, and per key per minute 300 reads, 60 writes and 30 AI calls; 5 long-running AI operations per organization at once. Test-mode keys (atly_test_…) reach the same endpoints with deterministic fixture results, no AI and no credits."},"servers":[{"url":"https://attorly.ai"}],"security":[{"bearerAuth":[]},{"oauth2":[]}],"tags":[{"name":"Documents"},{"name":"Clauses"},{"name":"Research"},{"name":"Redlines"},{"name":"Negotiations"},{"name":"Workflows"},{"name":"Due diligence"},{"name":"Templates and drafts"},{"name":"Operations"},{"name":"Webhooks"},{"name":"Events"},{"name":"Usage, logs and test data"}],"externalDocs":{"description":"Developer documentation","url":"https://attorly.ai/docs/api"},"paths":{"/api/v1/documents":{"get":{"operationId":"listDocuments","summary":"List the stored documents the key can read, newest first","description":"Required scopes: DOCUMENTS_READ. MCP equivalent: documents_list. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"type","in":"query","required":false,"schema":{"description":"Only documents of this kind","type":"string","enum":["EMPLOYMENT_CONTRACT","LEASE_AGREEMENT","PURCHASE_AGREEMENT","NDA","TERMS_OF_SERVICE","EMAIL","OTHER"]},"description":"Only documents of this kind"},{"name":"status","in":"query","required":false,"schema":{"description":"Only documents in this processing state","type":"string","enum":["PENDING","PROCESSING","ANALYZED","FAILED"]},"description":"Only documents in this processing state"},{"name":"query","in":"query","required":false,"schema":{"description":"Only documents whose name contains this text","type":"string","minLength":1,"maxLength":200},"description":"Only documents whose name contains this text"},{"name":"includeArchived","in":"query","required":false,"schema":{"description":"Also list archived documents (left out by default)","type":"boolean"},"description":"Also list archived documents (left out by default)"},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512,"description":"Pass the nextCursor of the previous page to get the next one"},"description":"Pass the nextCursor of the previous page to get the next one"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"originalName":{"type":"string"},"type":{"type":"string","enum":["EMPLOYMENT_CONTRACT","LEASE_AGREEMENT","PURCHASE_AGREEMENT","NDA","TERMS_OF_SERVICE","EMAIL","OTHER"]},"mimeType":{"type":"string"},"size":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Bytes"},"status":{"type":"string","enum":["PENDING","PROCESSING","ANALYZED","FAILED"],"description":"PENDING until processing starts; ANALYZED once the analysis is stored"},"archived":{"type":"boolean"},"ownedByYou":{"type":"boolean","description":"false when the document is shared with you"},"createdAt":{"type":"string","description":"ISO 8601 date-time"},"updatedAt":{"type":"string","description":"ISO 8601 date-time"}},"required":["id","name","originalName","type","mimeType","size","status","archived","ownedByYou","createdAt","updatedAt"],"additionalProperties":{}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_3aa0f4a71f00b7e4","name":"Test-mode fixture (name): no model was called and no credits were used.","originalName":"Test-mode fixture (originalName): no model was called and no credits were used.","type":"EMPLOYMENT_CONTRACT","mimeType":"Test-mode fixture (mimeType): no model was called and no credits were used.","size":0,"status":"PENDING","archived":true,"ownedByYou":true,"createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used.","updatedAt":"Test-mode fixture (updatedAt): no model was called and no credits were used."}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/documents\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]},"post":{"operationId":"uploadDocument","summary":"Upload a document (multipart/form-data, or JSON with base64 content or text)","description":"Required scopes: DOCUMENTS_WRITE. MCP equivalent: documents_upload. Runs AI and draws on the key owner’s AI credits, exactly as the same call over MCP. Rate limit group: ai (30 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":255,"description":"The file name with its extension, e.g. \"nda.pdf\"; the extension decides the file type when mimeType is absent"},"contentBase64":{"description":"The file, base64-encoded","type":"string","minLength":1},"text":{"description":"Plain text to store as a .txt document, instead of contentBase64","type":"string","minLength":1},"mimeType":{"description":"The file's MIME type; checked against its content","type":"string","maxLength":255},"name":{"description":"Display name; defaults to the file name","type":"string","minLength":1,"maxLength":255},"type":{"default":"OTHER","description":"What the document is","type":"string","enum":["EMPLOYMENT_CONTRACT","LEASE_AGREEMENT","PURCHASE_AGREEMENT","NDA","TERMS_OF_SERVICE","EMAIL","OTHER"]},"url":{"description":"An https URL Attorly downloads the file from (public hosts only, up to 10 MB), instead of contentBase64 or text","type":"string","maxLength":2048,"format":"uri"},"analyze":{"default":true,"description":"Analyse the document in the background after upload, as the app does (uses AI credits). false stores it only","type":"boolean"}},"required":["filename"]},"example":{"filename":"<filename>"}},"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The document; its file name and type are read from the part"},"name":{"type":"string","description":"Display name; defaults to the file name"},"type":{"type":"string","description":"What the document is, as in the JSON body"},"analyze":{"type":"string","enum":["true","false"],"description":"As in the JSON body; default true"}}}}}},"responses":{"201":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"originalName":{"type":"string"},"type":{"type":"string","enum":["EMPLOYMENT_CONTRACT","LEASE_AGREEMENT","PURCHASE_AGREEMENT","NDA","TERMS_OF_SERVICE","EMAIL","OTHER"]},"size":{"type":"integer","minimum":0,"maximum":9007199254740991},"status":{"type":"string","enum":["PENDING","PROCESSING","ANALYZED","FAILED"],"description":"PENDING until processing starts; ANALYZED once the analysis is stored"},"analysisQueued":{"type":"boolean","description":"true when the background analysis was started"},"createdAt":{"type":"string","description":"ISO 8601 date-time"},"url":{"type":"string","description":"Where the document opens in Attorly"}},"required":["id","name","originalName","type","size","status","analysisQueued","createdAt","url"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_45ac2303c48ac479","name":"Test-mode fixture (name): no model was called and no credits were used.","originalName":"Test-mode fixture (originalName): no model was called and no credits were used.","type":"EMPLOYMENT_CONTRACT","size":0,"status":"PENDING","analysisQueued":true,"createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used.","url":"https://attorly.ai/docs/api#test-mode"},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/documents\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"filename\":\"<filename>\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"filename\":\"<filename>\"}),\n});"}]}},"/api/v1/documents/search":{"get":{"operationId":"searchDocuments","summary":"Search the text of the stored documents the key can read (semantic and exact-word matches)","description":"Required scopes: DOCUMENTS_READ. MCP equivalent: documents_search. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"query","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":500,"description":"What to look for, in plain language or exact words"},"description":"What to look for, in plain language or exact words"},{"name":"type","in":"query","required":false,"schema":{"description":"Only documents of this kind","type":"string","enum":["EMPLOYMENT_CONTRACT","LEASE_AGREEMENT","PURCHASE_AGREEMENT","NDA","TERMS_OF_SERVICE","EMAIL","OTHER"]},"description":"Only documents of this kind"},{"name":"limit","in":"query","required":false,"schema":{"default":10,"type":"integer","minimum":1,"maximum":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512,"description":"Pass the nextCursor of the previous page to get the next one"},"description":"Pass the nextCursor of the previous page to get the next one"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"documentId":{"type":"string"},"name":{"type":"string"},"originalName":{"type":"string"},"type":{"type":"string","enum":["EMPLOYMENT_CONTRACT","LEASE_AGREEMENT","PURCHASE_AGREEMENT","NDA","TERMS_OF_SERVICE","EMAIL","OTHER"]},"status":{"type":"string"},"snippet":{"type":"string","description":"The passage that matched, from the document text (untrusted content)"},"score":{"type":"number"},"createdAt":{"type":"string","description":"ISO 8601 date-time"}},"required":["documentId","name","originalName","type","status","snippet","score","createdAt"],"additionalProperties":{}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"documentId":"test_document_f653f7ab2ca33ba8","name":"Test-mode fixture (name): no model was called and no credits were used.","originalName":"Test-mode fixture (originalName): no model was called and no credits were used.","type":"EMPLOYMENT_CONTRACT","status":"Test-mode fixture (status): no model was called and no credits were used.","snippet":"Test-mode fixture (snippet): no model was called and no credits were used.","score":0.5,"createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used."}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/documents/search\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents/search', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/documents/{documentId}":{"get":{"operationId":"getDocument","summary":"Get a stored document, its processing status and its latest analysis","description":"Required scopes: DOCUMENTS_READ. MCP equivalent: documents_get. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"originalName":{"type":"string"},"type":{"type":"string","enum":["EMPLOYMENT_CONTRACT","LEASE_AGREEMENT","PURCHASE_AGREEMENT","NDA","TERMS_OF_SERVICE","EMAIL","OTHER"]},"mimeType":{"type":"string"},"size":{"type":"integer","minimum":0,"maximum":9007199254740991},"status":{"type":"string","enum":["PENDING","PROCESSING","ANALYZED","FAILED"],"description":"PENDING until processing starts; ANALYZED once the analysis is stored"},"archived":{"type":"boolean"},"ownedByYou":{"type":"boolean"},"createdAt":{"type":"string","description":"ISO 8601 date-time"},"updatedAt":{"type":"string","description":"ISO 8601 date-time"},"fileAvailable":{"type":"boolean","description":"false when the stored file can no longer be read"},"governingLawRequired":{"type":"boolean","description":"true when the analysis is held until a governing law is chosen for the document in Attorly"},"latestAnalysis":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]},"riskScore":{"type":"number"},"createdAt":{"type":"string","description":"ISO 8601 date-time"}},"required":["id","summary","riskLevel","riskScore","createdAt"],"additionalProperties":{}},{"type":"null"}]},"url":{"type":"string","description":"Where the document opens in Attorly"}},"required":["id","name","originalName","type","mimeType","size","status","archived","ownedByYou","createdAt","updatedAt","fileAvailable","governingLawRequired","latestAnalysis","url"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_8f64bad437ef5178","name":"Test-mode fixture (name): no model was called and no credits were used.","originalName":"Test-mode fixture (originalName): no model was called and no credits were used.","type":"EMPLOYMENT_CONTRACT","mimeType":"Test-mode fixture (mimeType): no model was called and no credits were used.","size":0,"status":"PENDING","archived":true,"ownedByYou":true,"createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used.","updatedAt":"Test-mode fixture (updatedAt): no model was called and no credits were used.","fileAvailable":true,"governingLawRequired":true,"latestAnalysis":{"id":"test_id_8f64bad437ef5178","summary":"Test-mode fixture (summary): no model was called and no credits were used.","riskLevel":"LOW","riskScore":0.5,"createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used."},"url":"https://attorly.ai/docs/api#test-mode"},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/documents/document_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents/document_123', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]},"delete":{"operationId":"deleteDocument","summary":"Permanently delete a document you own","description":"Required scopes: DOCUMENTS_DELETE. MCP equivalent: documents_delete. Does not use AI credits. Rate limit group: write (60 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","const":true}},"required":["id","deleted"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_26de6eae5943acfe","deleted":true},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X DELETE \"https://attorly.ai/api/v1/documents/document_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents/document_123', {\n  method: 'DELETE',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n  },\n});"}]}},"/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. Rate limit group: ai (30 requests per minute per key). Long-running (mode full): counts against the organization’s 5 concurrent AI operations, and answers 202 Accepted unless Prefer: wait=<seconds> (≤ 60) lets it finish in time.","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]}]},"example":{"mode":"full"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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"]}}}},"clauses":{"type":"array","items":{"type":"object"}},"recommendations":{"type":"array","items":{"type":"object"}}},"required":["summary","riskLevel","riskScore"],"additionalProperties":{}},{"title":"mode: quick","type":"object","properties":{"summary":{"type":"string"},"documentType":{"type":"string"},"keyPoints":{"type":"array","items":{"type":"string"}},"riskLevel":{"type":"string"},"parties":{"type":"array","items":{"type":"string"}}},"additionalProperties":{}}]},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"summary":"Test-mode fixture (summary): no model was called and no credits were used.","riskLevel":"LOW","riskScore":0.5,"keyTerms":[{"term":"Test-mode fixture (term): no model was called and no credits were used.","definition":"Test-mode fixture (definition): no model was called and no credits were used.","importance":"low"}],"clauses":[{}],"recommendations":[{}]},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background. Poll the Location until status is succeeded or failed, or wait for the operation.succeeded webhook.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`), or the organization already runs its maximum of concurrent AI operations (`concurrency_limit_exceeded`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/analyses\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"mode\":\"full\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/analyses', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"mode\":\"full\"}),\n});"}]}},"/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. Rate limit group: ai (30 requests per minute per key). Long-running (mode full): counts against the organization’s 5 concurrent AI operations, and answers 202 Accepted unless Prefer: wait=<seconds> (≤ 60) lets it finish in time.","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]}]},"example":{"mode":"full"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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"]}}}},"clauses":{"type":"array","items":{"type":"object"}},"recommendations":{"type":"array","items":{"type":"object"}}},"required":["summary","riskLevel","riskScore"],"additionalProperties":{}},{"title":"mode: quick","type":"object","properties":{"summary":{"type":"string"},"documentType":{"type":"string"},"keyPoints":{"type":"array","items":{"type":"string"}},"riskLevel":{"type":"string"},"parties":{"type":"array","items":{"type":"string"}}},"additionalProperties":{}}]},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"summary":"Test-mode fixture (summary): no model was called and no credits were used.","riskLevel":"LOW","riskScore":0.5,"keyTerms":[{"term":"Test-mode fixture (term): no model was called and no credits were used.","definition":"Test-mode fixture (definition): no model was called and no credits were used.","importance":"low"}],"clauses":[{}],"recommendations":[{}]},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background. Poll the Location until status is succeeded or failed, or wait for the operation.succeeded webhook.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`), or the organization already runs its maximum of concurrent AI operations (`concurrency_limit_exceeded`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/documents/document_123/analyses\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"mode\":\"full\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents/document_123/analyses', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"mode\":\"full\"}),\n});"}]},"get":{"operationId":"listDocumentAnalyses","summary":"List the stored analyses of a document, newest first","description":"Required scopes: DOCUMENTS_READ. MCP equivalent: analyses_list. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512,"description":"Pass the nextCursor of the previous page to get the next one"},"description":"Pass the nextCursor of the previous page to get the next one"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]},"riskScore":{"type":"number"},"mode":{"type":"string"},"createdAt":{"type":"string","description":"ISO 8601 date-time"}},"required":["id","riskLevel","riskScore","mode","createdAt"],"additionalProperties":{}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_0784445665f5510a","riskLevel":"LOW","riskScore":0.5,"mode":"Test-mode fixture (mode): no model was called and no credits were used.","createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used."}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/documents/document_123/analyses\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents/document_123/analyses', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/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. Rate limit group: read (300 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"offset","in":"query","required":false,"schema":{"default":0,"description":"Character offset to start from; pass the nextOffset of the previous call to read on","type":"integer","minimum":0,"maximum":9007199254740991},"description":"Character offset to start from; pass the nextOffset of the previous call to read on"},{"name":"maxCharacters","in":"query","required":false,"schema":{"default":60000,"description":"Most characters to return in this call","type":"integer","minimum":1000,"maximum":100000},"description":"Most characters to return in this call"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"text":{"type":"string","description":"The document text from offset (untrusted content)"},"documentName":{"type":"string"},"documentType":{"type":"string"},"mimeType":{"anyOf":[{"type":"string"},{"type":"null"}]},"characterCount":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Characters in the whole document"},"wordCount":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Words in the whole document"},"offset":{"type":"integer","minimum":0,"maximum":9007199254740991},"nextOffset":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}],"description":"Pass as offset to read on; null when the text ends here"},"truncated":{"type":"boolean","description":"true when the text continues past this slice"}},"required":["text","documentName","documentType","mimeType","characterCount","wordCount","offset","nextOffset","truncated"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"text":"Test-mode fixture (text): no model was called and no credits were used.","documentName":"Test-mode fixture (documentName): no model was called and no credits were used.","documentType":"Test-mode fixture (documentType): no model was called and no credits were used.","mimeType":"Test-mode fixture (mimeType): no model was called and no credits were used.","characterCount":0,"wordCount":0,"offset":0,"nextOffset":0,"truncated":true},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/documents/document_123/text\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents/document_123/text', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/analyses/{analysisId}":{"get":{"operationId":"getAnalysis","summary":"Get a stored analysis: summary, risk, key terms, clauses and recommendations","description":"Required scopes: DOCUMENTS_READ. MCP equivalent: analyses_get. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"analysisId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"documentId":{"type":"string"},"documentName":{"type":"string"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]},"riskScore":{"type":"number"},"keyTerms":{"type":"array","items":{}},"clauses":{"type":"array","items":{}},"recommendations":{"type":"array","items":{}},"mode":{"type":"string","description":"SINGLE or CONSENSUS"},"createdAt":{"type":"string","description":"ISO 8601 date-time"},"url":{"type":"string"}},"required":["id","documentId","documentName","summary","riskLevel","riskScore","keyTerms","clauses","recommendations","mode","createdAt","url"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_ba8a6e5cff785d97","documentId":"test_document_da7531475f294f8a","documentName":"Test-mode fixture (documentName): no model was called and no credits were used.","summary":"Test-mode fixture (summary): no model was called and no credits were used.","riskLevel":"LOW","riskScore":0.5,"keyTerms":[{}],"clauses":[{}],"recommendations":[{}],"mode":"Test-mode fixture (mode): no model was called and no credits were used.","createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used.","url":"https://attorly.ai/docs/api#test-mode"},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/analyses/analysis_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/analyses/analysis_123', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/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. Rate limit group: write (60 requests per minute per key).","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sourceDocumentId":{"type":"string"},"sourceContent":{"type":"string"},"targetDocumentId":{"type":"string"},"targetContent":{"type":"string"}}},"example":{"sourceDocumentId":"sourceDocument_123"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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","minimum":0,"maximum":9007199254740991}},"required":["type","content"],"additionalProperties":{}}},"summary":{"type":"object","properties":{"additions":{"type":"integer","minimum":0,"maximum":9007199254740991},"deletions":{"type":"integer","minimum":0,"maximum":9007199254740991},"unchanged":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalChanges":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["additions","deletions","unchanged","totalChanges"],"additionalProperties":{}}},"required":["differences","summary"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"differences":[{"type":"addition","content":"Test-mode fixture (content): no model was called and no credits were used.","lines":0}],"summary":{"additions":0,"deletions":0,"unchanged":0,"totalChanges":0}},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/comparisons\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"sourceDocumentId\":\"sourceDocument_123\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/comparisons', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"sourceDocumentId\":\"sourceDocument_123\"}),\n});"}]}},"/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. Rate limit group: read (300 requests per minute per key).","tags":["Clauses"],"security":[{"bearerAuth":[]}],"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}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-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":{"anyOf":[{"type":"string"},{"type":"null"}]},"riskLevel":{"anyOf":[{"type":"string"},{"type":"null"}]},"usageCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"description":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","content","category"],"additionalProperties":{}}},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["clauses","count"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"clauses":[{"id":"test_id_f1b56937d95788a6","name":"Test-mode fixture (name): no model was called and no credits were used.","content":"Test-mode fixture (content): no model was called and no credits were used.","category":"Test-mode fixture (category): no model was called and no credits were used.","jurisdiction":"Test-mode fixture (jurisdiction): no model was called and no credits were used.","riskLevel":"Test-mode fixture (riskLevel): no model was called and no credits were used.","usageCount":0,"description":"Test-mode fixture (description): no model was called and no credits were used."}],"count":0},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/clauses\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/clauses', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/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. Rate limit group: write (60 requests per minute per key).","tags":["Clauses"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"clauseText":"<clauseText>"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"clauseText":"Test-mode fixture (clauseText): no model was called and no credits were used.","clauseType":"Test-mode fixture (clauseType): no model was called and no credits were used.","jurisdiction":"Test-mode fixture (jurisdiction): no model was called and no credits were used.","overallRiskScore":0,"riskLevel":"LOW","riskFactors":[{}],"recommendations":["Test-mode fixture (recommendation): no model was called and no credits were used."],"alternatives":[{}],"complianceIssues":[{}],"negotiationTips":["Test-mode fixture (negotiationTip): no model was called and no credits were used."]},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/clauses/risk-assessments\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"clauseText\":\"<clauseText>\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/clauses/risk-assessments', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"clauseText\":\"<clauseText>\"}),\n});"}]}},"/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. Rate limit group: write (60 requests per minute per key).","tags":["Clauses"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"clauseText":"<clauseText>","category":"INDEMNIFICATION"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","content"],"additionalProperties":{}}},"comparison":{"type":"object","properties":{"matchCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"recommendation":{"type":"string"}},"required":["matchCount","recommendation"],"additionalProperties":{}}},"required":["inputClause","category","marketStandards","comparison"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"inputClause":"Test-mode fixture (inputClause): no model was called and no credits were used.","category":"Test-mode fixture (category): no model was called and no credits were used.","marketStandards":[{"id":"test_id_60983b77b075fa4a","name":"Test-mode fixture (name): no model was called and no credits were used.","content":"Test-mode fixture (content): no model was called and no credits were used.","riskLevel":"Test-mode fixture (riskLevel): no model was called and no credits were used."}],"comparison":{"matchCount":0,"recommendation":"Test-mode fixture (recommendation): no model was called and no credits were used."}},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/clauses/market-comparisons\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"clauseText\":\"<clauseText>\",\"category\":\"INDEMNIFICATION\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/clauses/market-comparisons', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"clauseText\":\"<clauseText>\",\"category\":\"INDEMNIFICATION\"}),\n});"}]}},"/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. Rate limit group: write (60 requests per minute per key).","tags":["Clauses"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clauseText":{"type":"string"},"playbookId":{"type":"string"}},"required":["clauseText","playbookId"]},"example":{"clauseText":"<clauseText>","playbookId":"playbook_123"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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","minimum":0,"maximum":9007199254740991}},"required":["playbookName","compliant","violations","warnings","rulesChecked"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"playbookName":"Test-mode fixture (playbookName): no model was called and no credits were used.","compliant":true,"violations":["Test-mode fixture (violation): no model was called and no credits were used."],"warnings":["Test-mode fixture (warning): no model was called and no credits were used."],"rulesChecked":0},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/clauses/playbook-checks\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"clauseText\":\"<clauseText>\",\"playbookId\":\"playbook_123\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/clauses/playbook-checks', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"clauseText\":\"<clauseText>\",\"playbookId\":\"playbook_123\"}),\n});"}]}},"/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. Rate limit group: ai (30 requests per minute per key).","tags":["Research"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"query":"<query>"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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"],"additionalProperties":{}}},"totalCount":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Results matching the filters, before limit"},"sources":{"type":"string"}},"required":["query","jurisdiction","results","totalCount"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"query":"Test-mode fixture (query): no model was called and no credits were used.","jurisdiction":"Test-mode fixture (jurisdiction): no model was called and no credits were used.","results":[{"id":"test_id_4cb6dd0b01b439d0","title":"Test-mode fixture (title): no model was called and no credits were used.","source":"Test-mode fixture (source): no model was called and no credits were used.","jurisdiction":"Test-mode fixture (jurisdiction): no model was called and no credits were used.","citation":"Test-mode fixture (citation): no model was called and no credits were used.","url":"https://attorly.ai/docs/api#test-mode","date":"Test-mode fixture (date): no model was called and no credits were used.","excerpt":"Test-mode fixture (excerpt): no model was called and no credits were used.","relevanceScore":0.5,"attribution":"Test-mode fixture (attribution): no model was called and no credits were used.","asOf":"Test-mode fixture (asOf): no model was called and no credits were used."}],"totalCount":0,"sources":"Test-mode fixture (sources): no model was called and no credits were used."},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/research/searches\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\":\"<query>\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/research/searches', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"query\":\"<query>\"}),\n});"}]}},"/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. Rate limit group: ai (30 requests per minute per key).","tags":["Research"],"security":[{"bearerAuth":[]}],"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\""},"description":"ISO 3166-1 alpha-2 country code, or \"EU\""},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-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"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_053a121eede374f8","title":"Test-mode fixture (title): no model was called and no credits were used.","source":"Test-mode fixture (source): no model was called and no credits were used.","jurisdiction":"Test-mode fixture (jurisdiction): no model was called and no credits were used.","citation":"Test-mode fixture (citation): no model was called and no credits were used.","url":"https://attorly.ai/docs/api#test-mode","date":"Test-mode fixture (date): no model was called and no credits were used.","excerpt":"Test-mode fixture (excerpt): no model was called and no credits were used.","relevanceScore":0.5,"attribution":"Test-mode fixture (attribution): no model was called and no credits were used.","asOf":"Test-mode fixture (asOf): no model was called and no credits were used."},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/research/statutes\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/research/statutes', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/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. Rate limit group: ai (30 requests per minute per key). Long-running: counts against the organization’s 5 concurrent AI operations, and answers 202 Accepted unless Prefer: wait=<seconds> (≤ 60) lets it finish in time.","tags":["Redlines"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"partyRole":"BUYER"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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","description":"INSERT, DELETE, MODIFY or COMMENT"},"originalText":{"type":"string"},"newText":{"type":"string"},"comment":{"type":"string"},"reasoning":{"type":"string"},"priority":{"type":"string"},"status":{"type":"string"},"position":{"type":"object","properties":{"start":{"type":"integer"},"end":{"type":"integer"},"paragraph":{"type":"integer"},"clause":{"type":"string"}}}},"required":["type"],"additionalProperties":{}}},"summary":{"type":"object"},"negotiationNotes":{"type":"array","items":{"type":"string"}},"statistics":{"type":"object","properties":{"totalChanges":{"type":"integer","minimum":0,"maximum":9007199254740991},"byType":{"type":"object","properties":{"additions":{"type":"integer","minimum":0,"maximum":9007199254740991},"deletions":{"type":"integer","minimum":0,"maximum":9007199254740991},"modifications":{"type":"integer","minimum":0,"maximum":9007199254740991},"comments":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["additions","deletions","modifications","comments"],"additionalProperties":{}}},"required":["totalChanges","byType"],"additionalProperties":{}}},"required":["changes","statistics"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"changes":[{"id":"test_id_1fb24e1c9462246c","type":"Test-mode fixture (type): no model was called and no credits were used.","originalText":"Test-mode fixture (originalText): no model was called and no credits were used.","newText":"Test-mode fixture (newText): no model was called and no credits were used.","comment":"Test-mode fixture (comment): no model was called and no credits were used.","reasoning":"Test-mode fixture (reasoning): no model was called and no credits were used.","priority":"Test-mode fixture (priority): no model was called and no credits were used.","status":"Test-mode fixture (status): no model was called and no credits were used.","position":{"start":1,"end":1,"paragraph":1,"clause":"Test-mode fixture (clause): no model was called and no credits were used."}}],"summary":{},"negotiationNotes":["Test-mode fixture (negotiationNote): no model was called and no credits were used."],"statistics":{"totalChanges":0,"byType":{"additions":0,"deletions":0,"modifications":0,"comments":0}}},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background. Poll the Location until status is succeeded or failed, or wait for the operation.succeeded webhook.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`), or the organization already runs its maximum of concurrent AI operations (`concurrency_limit_exceeded`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/redlines\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"partyRole\":\"BUYER\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/redlines', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"partyRole\":\"BUYER\"}),\n});"}]}},"/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. Rate limit group: write (60 requests per minute per key).","tags":["Redlines"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"changes":[{}]}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"accepted":{"type":"integer","minimum":0,"maximum":9007199254740991},"rejected":{"type":"integer","minimum":0,"maximum":9007199254740991},"message":{"type":"string"}},"required":["accepted","rejected","message"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"accepted":0,"rejected":0,"message":"Test-mode fixture (message): no model was called and no credits were used."},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/documents/document_123/redlines/resolutions\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"changes\":[{}]}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/documents/document_123/redlines/resolutions', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"changes\":[{}]}),\n});"}]}},"/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. Rate limit group: ai (30 requests per minute per key).","tags":["Negotiations"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"partyRole":"BUYER"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"overallPosition":{"type":"string","description":"FAVORABLE, BALANCED or 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","description":"STRONG, MODERATE or WEAK"}},"required":["clause","reasoning","leverage"],"additionalProperties":{}}},"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"}},"additionalProperties":{}}},"required":["overallPosition","positions"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"overallPosition":"Test-mode fixture (overallPosition): no model was called and no credits were used.","positions":[{"clause":"Test-mode fixture (clause): no model was called and no credits were used.","currentTerms":"Test-mode fixture (currentTerms): no model was called and no credits were used.","preferredTerms":"Test-mode fixture (preferredTerms): no model was called and no credits were used.","fallbackTerms":"Test-mode fixture (fallbackTerms): no model was called and no credits were used.","reasoning":"Test-mode fixture (reasoning): no model was called and no credits were used.","leverage":"Test-mode fixture (leverage): no model was called and no credits were used."}],"prioritizedConcessions":["Test-mode fixture (prioritizedConcession): no model was called and no credits were used."],"dealBreakers":["Test-mode fixture (dealBreaker): no model was called and no credits were used."],"suggestedApproach":"Test-mode fixture (suggestedApproach): no model was called and no credits were used.","estimatedOutcome":{"bestCase":"Test-mode fixture (bestCase): no model was called and no credits were used.","likelyCase":"Test-mode fixture (likelyCase): no model was called and no credits were used.","worstCase":"Test-mode fixture (worstCase): no model was called and no credits were used."}},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/negotiations/position-analyses\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"partyRole\":\"BUYER\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/negotiations/position-analyses', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"partyRole\":\"BUYER\"}),\n});"}]}},"/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. Rate limit group: ai (30 requests per minute per key). Long-running: counts against the organization’s 5 concurrent AI operations, and answers 202 Accepted unless Prefer: wait=<seconds> (≤ 60) lets it finish in time.","tags":["Negotiations"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"strategy":{}}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"playbook":{"type":"array","items":{"type":"object","properties":{"stage":{"type":"string"},"move":{"type":"string"},"rationale":{"type":"string"},"fallback":{"type":"string"},"talkingPoints":{"type":"array","items":{"type":"string"}},"linkedPriority":{"type":"string"}},"required":["stage","move","rationale","talkingPoints"],"additionalProperties":{}}},"anticipatedObjections":{"type":"array","items":{"type":"object","properties":{"objection":{"type":"string"},"response":{"type":"string"}},"required":["objection","response"],"additionalProperties":{}}},"recommendations":{"type":"array","items":{"type":"string"}},"summary":{"type":"object","properties":{"position":{"type":"string"},"priorityCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"concessionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"dealBreakerCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"moveCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["position","priorityCount","concessionCount","dealBreakerCount","moveCount"],"additionalProperties":{}}},"required":["playbook","anticipatedObjections","recommendations","summary"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"playbook":[{"stage":"Test-mode fixture (stage): no model was called and no credits were used.","move":"Test-mode fixture (move): no model was called and no credits were used.","rationale":"Test-mode fixture (rationale): no model was called and no credits were used.","fallback":"Test-mode fixture (fallback): no model was called and no credits were used.","talkingPoints":["Test-mode fixture (talkingPoint): no model was called and no credits were used."],"linkedPriority":"Test-mode fixture (linkedPriority): no model was called and no credits were used."}],"anticipatedObjections":[{"objection":"Test-mode fixture (objection): no model was called and no credits were used.","response":"Test-mode fixture (response): no model was called and no credits were used."}],"recommendations":["Test-mode fixture (recommendation): no model was called and no credits were used."],"summary":{"position":"Test-mode fixture (position): no model was called and no credits were used.","priorityCount":0,"concessionCount":0,"dealBreakerCount":0,"moveCount":0}},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background. Poll the Location until status is succeeded or failed, or wait for the operation.succeeded webhook.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`), or the organization already runs its maximum of concurrent AI operations (`concurrency_limit_exceeded`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/negotiations/playbooks\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"strategy\":{}}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/negotiations/playbooks', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"strategy\":{}}),\n});"}]}},"/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. Rate limit group: read (300 requests per minute per key).","tags":["Workflows"],"security":[{"bearerAuth":[]}],"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"]},"description":"Due diligence project type the template is built for"},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512,"description":"Pass the nextCursor of the previous page to get the next one"},"description":"Pass the nextCursor of the previous page to get the next one"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"projectType":{"type":"string"},"definition":{"type":"object"},"isSystemDefault":{"type":"boolean"},"usageCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","projectType","isSystemDefault"],"additionalProperties":{}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_65e8bb59057d6b82","name":"Test-mode fixture (name): no model was called and no credits were used.","description":"Test-mode fixture (description): no model was called and no credits were used.","projectType":"Test-mode fixture (projectType): no model was called and no credits were used.","definition":{},"isSystemDefault":true,"usageCount":0}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/workflows/templates\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/workflows/templates', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/workflows/executions":{"get":{"operationId":"listWorkflowExecutions","summary":"List workflow executions, newest first, optionally for one project or status","description":"Required scopes: WORKFLOWS_EXECUTE. MCP equivalent: workflows_list_executions. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Workflows"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"projectId","in":"query","required":false,"schema":{"description":"Only executions on this due diligence project","type":"string","minLength":1},"description":"Only executions on this due diligence project"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["PENDING","RUNNING","WAITING_FOR_INPUT","WAITING_FOR_APPROVAL","PAUSED","COMPLETED","FAILED","CANCELLED"]}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512,"description":"Pass the nextCursor of the previous page to get the next one"},"description":"Pass the nextCursor of the previous page to get the next one"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"executionId":{"type":"string"},"templateId":{"type":"string"},"templateName":{"type":"string"},"projectId":{"type":"string"},"status":{"type":"string"},"startedAt":{"anyOf":[{"type":"string","description":"ISO 8601 date-time"},{"type":"null"}]},"completedAt":{"anyOf":[{"type":"string","description":"ISO 8601 date-time"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","description":"ISO 8601 date-time"}},"required":["executionId","templateId","templateName","projectId","status","startedAt","completedAt","error","createdAt"],"additionalProperties":{}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"executionId":"test_execution_3ee37b29bef9da0b","templateId":"test_template_b41b09288da1badf","templateName":"Test-mode fixture (templateName): no model was called and no credits were used.","projectId":"test_project_bdf7f02176aa8e7c","status":"Test-mode fixture (status): no model was called and no credits were used.","startedAt":"Test-mode fixture (startedAt): no model was called and no credits were used.","completedAt":"Test-mode fixture (completedAt): no model was called and no credits were used.","error":"Test-mode fixture (error): no model was called and no credits were used.","createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used."}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/workflows/executions\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/workflows/executions', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]},"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. Rate limit group: ai (30 requests per minute per key). Long-running: counts against the organization’s 5 concurrent AI operations, and answers 202 Accepted unless Prefer: wait=<seconds> (≤ 60) lets it finish in time.","tags":["Workflows"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"templateId":"template_123","projectId":"project_123","inputs":{}}}}},"responses":{"202":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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","description":"ISO 8601 date-time"},"message":{"type":"string"}},"required":["executionId","templateId","templateName","status","startedAt","message"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"executionId":"test_execution_30d9509d1fe53f7e","templateId":"test_template_6f57aedf4c0fa867","templateName":"Test-mode fixture (templateName): no model was called and no credits were used.","status":"Test-mode fixture (status): no model was called and no credits were used.","startedAt":"Test-mode fixture (startedAt): no model was called and no credits were used.","message":"Test-mode fixture (message): no model was called and no credits were used."},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`), or the organization already runs its maximum of concurrent AI operations (`concurrency_limit_exceeded`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/workflows/executions\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"templateId\":\"template_123\",\"projectId\":\"project_123\",\"inputs\":{}}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/workflows/executions', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"templateId\":\"template_123\",\"projectId\":\"project_123\",\"inputs\":{}}),\n});"}]}},"/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. Rate limit group: read (300 requests per minute per key).","tags":["Workflows"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"executionId","in":"path","required":true,"schema":{"type":"string"}},{"name":"includeSteps","in":"query","required":false,"schema":{"type":"boolean"}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-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","description":"ISO 8601 date-time"},"completedAt":{"type":"string","description":"ISO 8601 date-time"},"variables":{"type":"object"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object"}}},"required":["executionId","templateName","status"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"executionId":"test_execution_6b7726fd71e6145d","templateName":"Test-mode fixture (templateName): no model was called and no credits were used.","status":"Test-mode fixture (status): no model was called and no credits were used.","startedAt":"Test-mode fixture (startedAt): no model was called and no credits were used.","completedAt":"Test-mode fixture (completedAt): no model was called and no credits were used.","variables":{},"error":"Test-mode fixture (error): no model was called and no credits were used.","steps":[{}]},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/workflows/executions/execution_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/workflows/executions/execution_123', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/due-diligence/projects":{"get":{"operationId":"listDueDiligenceProjects","summary":"List due diligence projects, newest first","description":"Required scopes: DUE_DILIGENCE_FULL. MCP equivalent: due_diligence_list_projects. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Due diligence"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"description":"Only projects in this state","type":"string","enum":["NOT_STARTED","IN_PROGRESS","UNDER_REVIEW","COMPLETED","ON_HOLD","CANCELLED"]},"description":"Only projects in this state"},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512,"description":"Pass the nextCursor of the previous page to get the next one"},"description":"Pass the nextCursor of the previous page to get the next one"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"projectType":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"targetCompany":{"anyOf":[{"type":"string"},{"type":"null"}]},"dueDate":{"anyOf":[{"type":"string","description":"ISO 8601 date-time"},{"type":"null"}]},"documentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"findingCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"createdAt":{"type":"string","description":"ISO 8601 date-time"},"updatedAt":{"type":"string","description":"ISO 8601 date-time"},"completedAt":{"anyOf":[{"type":"string","description":"ISO 8601 date-time"},{"type":"null"}]}},"required":["id","name","description","projectType","status","priority","targetCompany","dueDate","documentCount","findingCount","createdAt","updatedAt","completedAt"],"additionalProperties":{}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_e2f86812fc00fd10","name":"Test-mode fixture (name): no model was called and no credits were used.","description":"Test-mode fixture (description): no model was called and no credits were used.","projectType":"Test-mode fixture (projectType): no model was called and no credits were used.","status":"Test-mode fixture (status): no model was called and no credits were used.","priority":"Test-mode fixture (priority): no model was called and no credits were used.","targetCompany":"Test-mode fixture (targetCompany): no model was called and no credits were used.","dueDate":"Test-mode fixture (dueDate): no model was called and no credits were used.","documentCount":0,"findingCount":0,"createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used.","updatedAt":"Test-mode fixture (updatedAt): no model was called and no credits were used.","completedAt":"Test-mode fixture (completedAt): no model was called and no credits were used."}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/due-diligence/projects\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/due-diligence/projects', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]},"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. Rate limit group: write (60 requests per minute per key).","tags":["Due diligence"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"name":"<name>","dealType":"MA_ACQUISITION"}}}},"responses":{"201":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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","description":"ISO 8601 date-time"},"message":{"type":"string"}},"required":["projectId","name","projectType","status","createdAt","message"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"projectId":"test_project_a710db5941bc530a","name":"Test-mode fixture (name): no model was called and no credits were used.","projectType":"Test-mode fixture (projectType): no model was called and no credits were used.","status":"Test-mode fixture (status): no model was called and no credits were used.","createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used.","message":"Test-mode fixture (message): no model was called and no credits were used."},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/due-diligence/projects\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"<name>\",\"dealType\":\"MA_ACQUISITION\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/due-diligence/projects', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"name\":\"<name>\",\"dealType\":\"MA_ACQUISITION\"}),\n});"}]}},"/api/v1/due-diligence/projects/{projectId}":{"get":{"operationId":"getDueDiligenceProject","summary":"Get a due diligence project with its document and finding counts","description":"Required scopes: DUE_DILIGENCE_FULL. MCP equivalent: due_diligence_get_project. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Due diligence"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"projectType":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"targetCompany":{"anyOf":[{"type":"string"},{"type":"null"}]},"dueDate":{"anyOf":[{"type":"string","description":"ISO 8601 date-time"},{"type":"null"}]},"documentCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"findingCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"createdAt":{"type":"string","description":"ISO 8601 date-time"},"updatedAt":{"type":"string","description":"ISO 8601 date-time"},"completedAt":{"anyOf":[{"type":"string","description":"ISO 8601 date-time"},{"type":"null"}]}},"required":["id","name","description","projectType","status","priority","targetCompany","dueDate","documentCount","findingCount","createdAt","updatedAt","completedAt"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_f9e7383f0e3c612d","name":"Test-mode fixture (name): no model was called and no credits were used.","description":"Test-mode fixture (description): no model was called and no credits were used.","projectType":"Test-mode fixture (projectType): no model was called and no credits were used.","status":"Test-mode fixture (status): no model was called and no credits were used.","priority":"Test-mode fixture (priority): no model was called and no credits were used.","targetCompany":"Test-mode fixture (targetCompany): no model was called and no credits were used.","dueDate":"Test-mode fixture (dueDate): no model was called and no credits were used.","documentCount":0,"findingCount":0,"createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used.","updatedAt":"Test-mode fixture (updatedAt): no model was called and no credits were used.","completedAt":"Test-mode fixture (completedAt): no model was called and no credits were used."},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/due-diligence/projects/project_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/due-diligence/projects/project_123', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/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. Rate limit group: write (60 requests per minute per key).","tags":["Due diligence"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentIds":{"type":"array","items":{"type":"string"}},"category":{"type":"string"}},"required":["documentIds"]},"example":{"documentIds":["document_123"]}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"projectId":{"type":"string"},"documentsAdded":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalDocuments":{"type":"integer","minimum":0,"maximum":9007199254740991},"category":{"type":"string"},"message":{"type":"string"}},"required":["projectId","documentsAdded","totalDocuments","category","message"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"projectId":"test_project_3dbb86ce0338727e","documentsAdded":0,"totalDocuments":0,"category":"Test-mode fixture (category): no model was called and no credits were used.","message":"Test-mode fixture (message): no model was called and no credits were used."},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background (Prefer: respond-async, or Prefer: wait elapsed). Poll the Location until status is succeeded or failed.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/due-diligence/projects/project_123/documents\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"documentIds\":[\"document_123\"]}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/due-diligence/projects/project_123/documents', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"documentIds\":[\"document_123\"]}),\n});"}]}},"/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. Rate limit group: read (300 requests per minute per key).","tags":["Due diligence"],"security":[{"bearerAuth":[]}],"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}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-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":{"anyOf":[{"type":"string"},{"type":"null"}]},"recommendation":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","description":"ISO 8601 date-time"}},"required":["id","title","description","severity","category","recommendation","createdAt"],"additionalProperties":{}}},"riskSummary":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991},"description":"Number of findings per severity","properties":{}},"totalFindings":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["projectId","projectName","findings","riskSummary","totalFindings"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"projectId":"test_project_8f5df8955637b63e","projectName":"Test-mode fixture (projectName): no model was called and no credits were used.","findings":[{"id":"test_id_f3ac7bf61168748d","title":"Test-mode fixture (title): no model was called and no credits were used.","description":"Test-mode fixture (description): no model was called and no credits were used.","severity":"INFO","category":"Test-mode fixture (category): no model was called and no credits were used.","recommendation":"Test-mode fixture (recommendation): no model was called and no credits were used.","createdAt":"Test-mode fixture (createdAt): no model was called and no credits were used."}],"riskSummary":{},"totalFindings":0},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/due-diligence/projects/project_123/findings\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/due-diligence/projects/project_123/findings', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/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. Rate limit group: write (60 requests per minute per key). Long-running: counts against the organization’s 5 concurrent AI operations, and answers 202 Accepted unless Prefer: wait=<seconds> (≤ 60) lets it finish in time.","tags":["Due diligence"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"]},"example":{"format":"pdf"}}}},"responses":{"201":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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","minimum":0,"maximum":9007199254740991},"findingCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"markdown":{"type":"string"},"attachment":{"type":"object","properties":{"format":{"type":"string"},"filename":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991},"delivery":{"type":"string"},"base64":{"type":"string","contentEncoding":"base64","contentMediaType":"application/pdf"}},"required":["format","filename","sizeBytes"],"additionalProperties":{}},"message":{"type":"string"}},"required":["reportId","projectId","format","status","markdown"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"reportId":"test_report_22250f34daf466bc","projectId":"test_project_d1a144eb68bde991","projectName":"Test-mode fixture (projectName): no model was called and no credits were used.","format":"pdf","status":"Test-mode fixture (status): no model was called and no credits were used.","sections":["Test-mode fixture (section): no model was called and no credits were used."],"documentCount":0,"findingCount":0,"markdown":"Test-mode fixture (markdown): no model was called and no credits were used.","attachment":{"format":"Test-mode fixture (format): no model was called and no credits were used.","filename":"Test-mode fixture (filename): no model was called and no credits were used.","sizeBytes":0,"delivery":"Test-mode fixture (delivery): no model was called and no credits were used.","base64":"QXR0b3JseSB0ZXN0LW1vZGUgZml4dHVyZQ=="},"message":"Test-mode fixture (message): no model was called and no credits were used."},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background. Poll the Location until status is succeeded or failed, or wait for the operation.succeeded webhook.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`), or the organization already runs its maximum of concurrent AI operations (`concurrency_limit_exceeded`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/due-diligence/projects/project_123/reports\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"format\":\"pdf\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/due-diligence/projects/project_123/reports', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"format\":\"pdf\"}),\n});"}]}},"/api/v1/templates":{"get":{"operationId":"listTemplates","summary":"List document templates","description":"Required scopes: TEMPLATES_READ. MCP equivalent: templates_list. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Templates and drafts"],"security":[{"bearerAuth":[]}],"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"},"description":"ISO 3166-1 alpha-2 country code (e.g. \"NO\", \"GB\"); jurisdiction-neutral templates are always included"},{"name":"language","in":"query","required":false,"schema":{"description":"ISO 639-1 language code of the template text (e.g. \"en\", \"nb\")","type":"string"},"description":"ISO 639-1 language code of the template text (e.g. \"en\", \"nb\")"},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512,"description":"Pass the nextCursor of the previous page to get the next one"},"description":"Pass the nextCursor of the previous page to get the next one"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"type":"string"},"locale":{"type":"string"},"jurisdiction":{"anyOf":[{"type":"string"},{"type":"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"},"required":{"type":"boolean"},"defaultValue":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"description":{"type":"string"}},"required":["name","label","type","required"],"additionalProperties":{}}},"usageCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","name","category","locale","requiredVariables","variables"],"additionalProperties":{}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_4e10d8fdc5584646","name":"Test-mode fixture (name): no model was called and no credits were used.","description":"Test-mode fixture (description): no model was called and no credits were used.","category":"Test-mode fixture (category): no model was called and no credits were used.","locale":"Test-mode fixture (locale): no model was called and no credits were used.","jurisdiction":"Test-mode fixture (jurisdiction): no model was called and no credits were used.","requiredVariables":["Test-mode fixture (requiredVariable): no model was called and no credits were used."],"variables":[{"name":"Test-mode fixture (name): no model was called and no credits were used.","label":"Test-mode fixture (label): no model was called and no credits were used.","type":"Test-mode fixture (type): no model was called and no credits were used.","required":true,"defaultValue":"Test-mode fixture (defaultValue): no model was called and no credits were used.","options":["Test-mode fixture (option): no model was called and no credits were used."],"description":"Test-mode fixture (description): no model was called and no credits were used."}],"usageCount":0}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/templates\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/templates', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/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. Rate limit group: ai (30 requests per minute per key). Long-running (mode ai): counts against the organization’s 5 concurrent AI operations, and answers 202 Accepted unless Prefer: wait=<seconds> (≤ 60) lets it finish in time.","tags":["Templates and drafts"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"},{"$ref":"#/components/parameters/Prefer"}],"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"}]},"example":{"templateId":"template_123","variables":{}}}}},"responses":{"201":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"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","minimum":0,"maximum":9007199254740991},"message":{"type":"string"},"draftIds":{"type":"array","items":{"type":"string"}},"fileCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"templateId":{"type":"string"},"templateName":{"type":"string"},"format":{"type":"string","const":"markdown"},"variablesUsed":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["content","characterCount"],"additionalProperties":{}},{"title":"mode: ai","type":"object","properties":{"draftId":{"type":"string"},"content":{"type":"string","description":"The full text of the draft, as Markdown"},"characterCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"message":{"type":"string"},"documentType":{"type":"string"},"estimatedPages":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["content","characterCount"],"additionalProperties":{}}]},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"draftId":"test_draft_27ec4f561f700aee","content":"Test-mode fixture (content): no model was called and no credits were used.","characterCount":0,"message":"Test-mode fixture (message): no model was called and no credits were used.","draftIds":["test_draft_27ec4f561f700aee"],"fileCount":0,"templateId":"test_template_fb97b54b283f40f7","templateName":"Test-mode fixture (templateName): no model was called and no credits were used.","format":"markdown","variablesUsed":0},"meta":{}}}}},"202":{"description":"Accepted: the call runs in the background. Poll the Location until status is succeeded or failed, or wait for the operation.succeeded webhook.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Location":{"description":"The operation to poll","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before polling","schema":{"type":"integer"}},"Preference-Applied":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Operation"}}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key lacks a required scope (`insufficient_scope`), plan without API access (`plan_required`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`), or the organization already runs its maximum of concurrent AI operations (`concurrency_limit_exceeded`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/drafts\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"templateId\":\"template_123\",\"variables\":{}}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/drafts', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"templateId\":\"template_123\",\"variables\":{}}),\n});"}]}},"/api/v1/operations/{operationId}":{"get":{"operationId":"getOperation","summary":"Get the status and result of an asynchronous, idempotent or long-running call","description":"Required scopes: none (only the key that started the operation can read it). Rate limit group: read (300 requests per minute per key).","tags":["Operations"],"security":[{"bearerAuth":[]},{"oauth2":[]}],"parameters":[{"name":"operationId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"A call made with Idempotency-Key or Prefer, or a long-running AI call. result holds the data the call returned, error the error it failed with; httpStatus is the status the call itself answered with.","required":["id","object","operationId","status","livemode","resultUrl","createdAt","completedAt","expiresAt","httpStatus","result","error"],"properties":{"id":{"type":"string","description":"op_…"},"object":{"const":"operation"},"operationId":{"type":"string","description":"The REST operation that was called, e.g. createRedlines"},"status":{"type":"string","enum":["running","succeeded","failed"]},"livemode":{"type":"boolean"},"idempotencyKey":{"type":["string","null"]},"resultUrl":{"type":"string","description":"Where to poll: /api/v1/operations/{id}"},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"httpStatus":{"type":["integer","null"]},"result":{"description":"The data of the successful call"},"meta":{"$ref":"#/components/schemas/Meta"},"error":{"anyOf":[{"$ref":"#/components/schemas/ErrorDetail"},{"type":"null"}]}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_97b18f9485498775","object":"operation","operationId":"test_operation_05a84c22fdbc361a","status":"running","livemode":true,"idempotencyKey":"Test-mode fixture (idempotencyKey): no model was called and no credits were used.","resultUrl":"Test-mode fixture (resultUrl): no model was called and no credits were used.","createdAt":"2026-01-01T00:00:00.000Z","completedAt":"2026-01-01T00:00:00.000Z","expiresAt":"2026-01-01T00:00:00.000Z","httpStatus":1,"result":{},"meta":{},"error":{}},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/operations/operation_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/operations/operation_123', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/webhook-endpoints":{"get":{"operationId":"listWebhookEndpoints","summary":"List the webhook endpoints of the key’s organization and mode","description":"Required scopes: webhooks:read (organization API keys). Rate limit group: read (300 requests per minute per key).","tags":["Webhooks"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","url","enabledEvents","status","livemode","includeSnapshots","apiVersion","createdAt","updatedAt"],"properties":{"id":{"type":"string","description":"we_…"},"object":{"const":"webhook_endpoint"},"url":{"type":"string"},"description":{"type":["string","null"]},"enabledEvents":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["enabled","disabled"]},"disabledReason":{"type":["string","null"],"description":"disabled_by_user or failing_deliveries"},"livemode":{"type":"boolean"},"includeSnapshots":{"type":"boolean"},"apiVersion":{"type":"string"},"failingSince":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"whsec_… — only when the endpoint is created or its secret rolled"}}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_b82ff1ba11fe9520","object":"webhook_endpoint","url":"https://attorly.ai/docs/api#test-mode","description":"Test-mode fixture (description): no model was called and no credits were used.","enabledEvents":["Test-mode fixture (enabledEvent): no model was called and no credits were used."],"status":"enabled","disabledReason":"Test-mode fixture (disabledReason): no model was called and no credits were used.","livemode":true,"includeSnapshots":true,"apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","failingSince":"2026-01-01T00:00:00.000Z","createdAt":"2026-01-01T00:00:00.000Z","updatedAt":"2026-01-01T00:00:00.000Z","secret":"Test-mode fixture (secret): no model was called and no credits were used."}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/webhook-endpoints\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/webhook-endpoints', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]},"post":{"operationId":"createWebhookEndpoint","summary":"Create a webhook endpoint; the response holds its signing secret, shown once","description":"Required scopes: webhooks:write (organization API keys). Rate limit group: write (60 requests per minute per key).","tags":["Webhooks"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri","description":"HTTPS URL that receives the events"},"description":{"type":"string","maxLength":500},"enabledEvents":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string"},"description":"Event types to receive, or [\"*\"] for all"},"includeSnapshots":{"description":"Send object snapshots instead of thin { id, object } payloads, for operations made with organization API keys (calls made with personal keys and connected apps always send thin payloads). Organization owners and admins only.","type":"boolean"}},"required":["url","enabledEvents"],"additionalProperties":false},"example":{"url":"https://example.com/attorly/webhooks","enabledEvents":["<enabledEvent>"]}}}},"responses":{"201":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","object","url","enabledEvents","status","livemode","includeSnapshots","apiVersion","createdAt","updatedAt"],"properties":{"id":{"type":"string","description":"we_…"},"object":{"const":"webhook_endpoint"},"url":{"type":"string"},"description":{"type":["string","null"]},"enabledEvents":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["enabled","disabled"]},"disabledReason":{"type":["string","null"],"description":"disabled_by_user or failing_deliveries"},"livemode":{"type":"boolean"},"includeSnapshots":{"type":"boolean"},"apiVersion":{"type":"string"},"failingSince":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"whsec_… — only when the endpoint is created or its secret rolled"}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_2ec89047c9be10c6","object":"webhook_endpoint","url":"https://attorly.ai/docs/api#test-mode","description":"Test-mode fixture (description): no model was called and no credits were used.","enabledEvents":["Test-mode fixture (enabledEvent): no model was called and no credits were used."],"status":"enabled","disabledReason":"Test-mode fixture (disabledReason): no model was called and no credits were used.","livemode":true,"includeSnapshots":true,"apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","failingSince":"2026-01-01T00:00:00.000Z","createdAt":"2026-01-01T00:00:00.000Z","updatedAt":"2026-01-01T00:00:00.000Z","secret":"Test-mode fixture (secret): no model was called and no credits were used."},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/webhook-endpoints\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"url\":\"https://example.com/attorly/webhooks\",\"enabledEvents\":[\"<enabledEvent>\"]}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/webhook-endpoints', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"url\":\"https://example.com/attorly/webhooks\",\"enabledEvents\":[\"<enabledEvent>\"]}),\n});"}]}},"/api/v1/webhook-endpoints/{endpointId}":{"get":{"operationId":"getWebhookEndpoint","summary":"Get a webhook endpoint","description":"Required scopes: webhooks:read (organization API keys). Rate limit group: read (300 requests per minute per key).","tags":["Webhooks"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","object","url","enabledEvents","status","livemode","includeSnapshots","apiVersion","createdAt","updatedAt"],"properties":{"id":{"type":"string","description":"we_…"},"object":{"const":"webhook_endpoint"},"url":{"type":"string"},"description":{"type":["string","null"]},"enabledEvents":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["enabled","disabled"]},"disabledReason":{"type":["string","null"],"description":"disabled_by_user or failing_deliveries"},"livemode":{"type":"boolean"},"includeSnapshots":{"type":"boolean"},"apiVersion":{"type":"string"},"failingSince":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"whsec_… — only when the endpoint is created or its secret rolled"}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_dd0069d3c1971a78","object":"webhook_endpoint","url":"https://attorly.ai/docs/api#test-mode","description":"Test-mode fixture (description): no model was called and no credits were used.","enabledEvents":["Test-mode fixture (enabledEvent): no model was called and no credits were used."],"status":"enabled","disabledReason":"Test-mode fixture (disabledReason): no model was called and no credits were used.","livemode":true,"includeSnapshots":true,"apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","failingSince":"2026-01-01T00:00:00.000Z","createdAt":"2026-01-01T00:00:00.000Z","updatedAt":"2026-01-01T00:00:00.000Z","secret":"Test-mode fixture (secret): no model was called and no credits were used."},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/webhook-endpoints/endpoint_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/webhook-endpoints/endpoint_123', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]},"patch":{"operationId":"updateWebhookEndpoint","summary":"Change a webhook endpoint’s URL, events or snapshots, or disable and enable it","description":"Required scopes: webhooks:write (organization API keys). Rate limit group: write (60 requests per minute per key).","tags":["Webhooks"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"enabledEvents":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string"}},"includeSnapshots":{"type":"boolean"},"status":{"description":"Disable to pause deliveries; enable to resume","type":"string","enum":["enabled","disabled"]}},"additionalProperties":false},"example":{"url":"https://example.com/attorly/webhooks"}}}},"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","object","url","enabledEvents","status","livemode","includeSnapshots","apiVersion","createdAt","updatedAt"],"properties":{"id":{"type":"string","description":"we_…"},"object":{"const":"webhook_endpoint"},"url":{"type":"string"},"description":{"type":["string","null"]},"enabledEvents":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["enabled","disabled"]},"disabledReason":{"type":["string","null"],"description":"disabled_by_user or failing_deliveries"},"livemode":{"type":"boolean"},"includeSnapshots":{"type":"boolean"},"apiVersion":{"type":"string"},"failingSince":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"whsec_… — only when the endpoint is created or its secret rolled"}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_3a3a71653cd6ab81","object":"webhook_endpoint","url":"https://attorly.ai/docs/api#test-mode","description":"Test-mode fixture (description): no model was called and no credits were used.","enabledEvents":["Test-mode fixture (enabledEvent): no model was called and no credits were used."],"status":"enabled","disabledReason":"Test-mode fixture (disabledReason): no model was called and no credits were used.","livemode":true,"includeSnapshots":true,"apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","failingSince":"2026-01-01T00:00:00.000Z","createdAt":"2026-01-01T00:00:00.000Z","updatedAt":"2026-01-01T00:00:00.000Z","secret":"Test-mode fixture (secret): no model was called and no credits were used."},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X PATCH \"https://attorly.ai/api/v1/webhook-endpoints/endpoint_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"url\":\"https://example.com/attorly/webhooks\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/webhook-endpoints/endpoint_123', {\n  method: 'PATCH',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"url\":\"https://example.com/attorly/webhooks\"}),\n});"}]},"delete":{"operationId":"deleteWebhookEndpoint","summary":"Delete a webhook endpoint and its delivery history","description":"Required scopes: webhooks:write (organization API keys). Rate limit group: write (60 requests per minute per key).","tags":["Webhooks"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","object","deleted"],"properties":{"id":{"type":"string"},"object":{"const":"webhook_endpoint"},"deleted":{"const":true}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_10bdca0409a8e3fe","object":"webhook_endpoint","deleted":true},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X DELETE \"https://attorly.ai/api/v1/webhook-endpoints/endpoint_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/webhook-endpoints/endpoint_123', {\n  method: 'DELETE',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n  },\n});"}]}},"/api/v1/webhook-endpoints/{endpointId}/secret-rolls":{"post":{"operationId":"rollWebhookEndpointSecret","summary":"Replace the signing secret; the old one keeps signing for 24 hours","description":"Required scopes: webhooks:write (organization API keys). Rate limit group: write (60 requests per minute per key).","tags":["Webhooks"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","object","url","enabledEvents","status","livemode","includeSnapshots","apiVersion","createdAt","updatedAt"],"properties":{"id":{"type":"string","description":"we_…"},"object":{"const":"webhook_endpoint"},"url":{"type":"string"},"description":{"type":["string","null"]},"enabledEvents":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["enabled","disabled"]},"disabledReason":{"type":["string","null"],"description":"disabled_by_user or failing_deliveries"},"livemode":{"type":"boolean"},"includeSnapshots":{"type":"boolean"},"apiVersion":{"type":"string"},"failingSince":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"whsec_… — only when the endpoint is created or its secret rolled"}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_179504b6e1f1c5d9","object":"webhook_endpoint","url":"https://attorly.ai/docs/api#test-mode","description":"Test-mode fixture (description): no model was called and no credits were used.","enabledEvents":["Test-mode fixture (enabledEvent): no model was called and no credits were used."],"status":"enabled","disabledReason":"Test-mode fixture (disabledReason): no model was called and no credits were used.","livemode":true,"includeSnapshots":true,"apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","failingSince":"2026-01-01T00:00:00.000Z","createdAt":"2026-01-01T00:00:00.000Z","updatedAt":"2026-01-01T00:00:00.000Z","secret":"Test-mode fixture (secret): no model was called and no credits were used."},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/webhook-endpoints/endpoint_123/secret-rolls\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/webhook-endpoints/endpoint_123/secret-rolls', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n  },\n});"}]}},"/api/v1/webhook-endpoints/{endpointId}/test-events":{"post":{"operationId":"sendWebhookTestEvent","summary":"Send a webhook_endpoint.test event to this endpoint only","description":"Required scopes: webhooks:write (organization API keys). Rate limit group: write (60 requests per minute per key).","tags":["Webhooks"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"}],"responses":{"202":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["eventId"],"properties":{"eventId":{"type":"string"}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"eventId":"test_event_70850337a40d5355"},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/webhook-endpoints/endpoint_123/test-events\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/webhook-endpoints/endpoint_123/test-events', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n  },\n});"}]}},"/api/v1/webhook-endpoints/{endpointId}/deliveries":{"get":{"operationId":"listWebhookDeliveries","summary":"List an endpoint’s deliveries, newest first, with their attempts and outcome","description":"Required scopes: webhooks:read (organization API keys). Rate limit group: read (300 requests per minute per key).","tags":["Webhooks"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"description":"Items per page, 1–100 (default 20)","type":"integer","minimum":1,"maximum":100},"description":"Items per page, 1–100 (default 20)"},{"name":"cursor","in":"query","required":false,"schema":{"description":"The nextCursor of the previous page","type":"string","maxLength":512},"description":"The nextCursor of the previous page"},{"name":"status","in":"query","required":false,"schema":{"description":"Only deliveries in this state","type":"string","enum":["pending","succeeded","failed"]},"description":"Only deliveries in this state"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","eventId","eventType","endpointId","status","attempts","manual","createdAt"],"properties":{"id":{"type":"string"},"object":{"const":"webhook_delivery"},"eventId":{"type":"string"},"eventType":{"type":"string"},"endpointId":{"type":"string"},"status":{"type":"string","enum":["pending","succeeded","failed"]},"attempts":{"type":"integer"},"responseStatus":{"type":["integer","null"]},"error":{"type":["string","null"],"description":"http_<status>, timeout, connection_error, blocked_destination, response_too_large or endpoint_disabled"},"durationMs":{"type":["integer","null"]},"manual":{"type":"boolean"},"lastAttemptAt":{"type":["string","null"],"format":"date-time"},"nextAttemptAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_e364e1d977309bd1","object":"webhook_delivery","eventId":"test_event_2aab0d1ae91ead52","eventType":"Test-mode fixture (eventType): no model was called and no credits were used.","endpointId":"test_endpoint_8a08addc12520b7f","status":"pending","attempts":1,"responseStatus":1,"error":"Test-mode fixture (error): no model was called and no credits were used.","durationMs":1,"manual":true,"lastAttemptAt":"2026-01-01T00:00:00.000Z","nextAttemptAt":"2026-01-01T00:00:00.000Z","createdAt":"2026-01-01T00:00:00.000Z"}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/webhook-endpoints/endpoint_123/deliveries\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/webhook-endpoints/endpoint_123/deliveries', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/events":{"get":{"operationId":"listEvents","summary":"List the events of the last 30 days, newest first","description":"Required scopes: events:read (organization API keys). Rate limit group: read (300 requests per minute per key).","tags":["Events"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"description":"Items per page, 1–100 (default 20)","type":"integer","minimum":1,"maximum":100},"description":"Items per page, 1–100 (default 20)"},{"name":"cursor","in":"query","required":false,"schema":{"description":"The nextCursor of the previous page","type":"string","maxLength":512},"description":"The nextCursor of the previous page"},{"name":"type","in":"query","required":false,"schema":{"description":"Only events of this type, e.g. analysis.completed","type":"string","maxLength":100},"description":"Only events of this type, e.g. analysis.completed"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","type","apiVersion","createdAt","livemode","data"],"properties":{"id":{"type":"string","description":"evt_… — also sent as the webhook-id header; deduplicate on it"},"object":{"const":"event"},"type":{"type":"string","enum":["analysis.completed","analysis.failed","redlines.generated","due_diligence.report.completed","operation.succeeded","operation.failed","webhook_endpoint.test"]},"apiVersion":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"livemode":{"type":"boolean"},"data":{"type":"object","required":["object"],"properties":{"object":{"type":"object","required":["id","object"],"properties":{"id":{"type":"string"},"object":{"type":"string"}}},"operation":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"operation"}}},"snapshot":{"description":"The object itself — only for endpoints with includeSnapshots"}}}}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_767d5ea020d4c154","object":"event","type":"analysis.completed","apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","createdAt":"2026-01-01T00:00:00.000Z","livemode":true,"data":{"object":{"id":"test_id_767d5ea020d4c154","object":"Test-mode fixture (object): no model was called and no credits were used."},"operation":{"id":"test_id_767d5ea020d4c154","object":"operation"},"snapshot":{}}}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/events\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/events', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/events/{eventId}":{"get":{"operationId":"getEvent","summary":"Get an event as webhook endpoints receive it","description":"Required scopes: events:read (organization API keys). Rate limit group: read (300 requests per minute per key).","tags":["Events"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"eventId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","object","type","apiVersion","createdAt","livemode","data"],"properties":{"id":{"type":"string","description":"evt_… — also sent as the webhook-id header; deduplicate on it"},"object":{"const":"event"},"type":{"type":"string","enum":["analysis.completed","analysis.failed","redlines.generated","due_diligence.report.completed","operation.succeeded","operation.failed","webhook_endpoint.test"]},"apiVersion":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"livemode":{"type":"boolean"},"data":{"type":"object","required":["object"],"properties":{"object":{"type":"object","required":["id","object"],"properties":{"id":{"type":"string"},"object":{"type":"string"}}},"operation":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"operation"}}},"snapshot":{"description":"The object itself — only for endpoints with includeSnapshots"}}}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"id":"test_id_6d1a7b3a77837d4e","object":"event","type":"analysis.completed","apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","createdAt":"2026-01-01T00:00:00.000Z","livemode":true,"data":{"object":{"id":"test_id_6d1a7b3a77837d4e","object":"Test-mode fixture (object): no model was called and no credits were used."},"operation":{"id":"test_id_6d1a7b3a77837d4e","object":"operation"},"snapshot":{}}},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/events/event_123\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/events/event_123', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/events/{eventId}/redeliveries":{"post":{"operationId":"redeliverEvent","summary":"Send an event again, to one endpoint or to every endpoint subscribed to it","description":"Required scopes: webhooks:write (organization API keys). Rate limit group: write (60 requests per minute per key).","tags":["Events"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"eventId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"endpointId":{"description":"Only this endpoint; default every endpoint subscribed to the event","type":"string"}},"additionalProperties":false},"example":{"endpointId":"endpoint_123"}}}},"responses":{"202":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["eventId","deliveriesScheduled"],"properties":{"eventId":{"type":"string"},"deliveriesScheduled":{"type":"integer"}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"eventId":"test_event_19f237b63044d8a5","deliveriesScheduled":1},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Body sent as a media type this operation does not take (`unsupported_media_type`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://attorly.ai/api/v1/events/event_123/redeliveries\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"endpointId\":\"endpoint_123\"}'"},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/events/event_123/redeliveries', {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\"endpointId\":\"endpoint_123\"}),\n});"}]}},"/api/v1/organization":{"get":{"operationId":"getOrganization","summary":"The key’s organization: plan, AI credits, default jurisdiction and what the key may do","description":"Required scopes: . MCP equivalent: organization_get_context. Does not use AI credits. Rate limit group: read (300 requests per minute per key).","tags":["Usage, logs and test data"],"security":[{"bearerAuth":[]},{"oauth2":[]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":{}},"user":{"type":"object","properties":{"id":{"type":"string"},"role":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","role"],"additionalProperties":{}},"plan":{"type":"string","description":"STANDARD, PRO or ENTERPRISE"},"billing":{"type":"object","properties":{"scope":{"type":"string","enum":["self","organization"],"description":"Whose wallet pays for AI: the user’s own or the organization’s pool"},"creditsRemaining":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"AI credits left in the wallet; null when it could not be read"},"canTopUp":{"type":"boolean"}},"required":["scope","creditsRemaining","canTopUp"],"additionalProperties":{}},"defaultJurisdiction":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 3166-1 alpha-2 country used when a document names no governing law"},"credential":{"type":"object","properties":{"type":{"type":"string","enum":["mcp_connection","api_key","oauth"]},"scopes":{"type":"array","items":{"type":"string"},"description":"What this connection may do"},"client":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The connected app, for OAuth connections"}},"required":["type","scopes","client"],"additionalProperties":{}},"appUrl":{"type":"string"}},"required":["organization","user","plan","billing","defaultJurisdiction","credential","appUrl"],"additionalProperties":{}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"organization":{"id":"test_id_f5f1b9e34a1b2687","name":"Test-mode fixture (name): no model was called and no credits were used."},"user":{"id":"test_id_f5f1b9e34a1b2687","role":"Test-mode fixture (role): no model was called and no credits were used."},"plan":"Test-mode fixture (plan): no model was called and no credits were used.","billing":{"scope":"self","creditsRemaining":0.5,"canTopUp":true},"defaultJurisdiction":"Test-mode fixture (defaultJurisdiction): no model was called and no credits were used.","credential":{"type":"mcp_connection","scopes":["Test-mode fixture (scope): no model was called and no credits were used."],"client":"Test-mode fixture (client): no model was called and no credits were used."},"appUrl":"Test-mode fixture (appUrl): no model was called and no credits were used."},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The operation did not finish in time (`timeout`). Retry with the same Idempotency-Key, or use Prefer: respond-async","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/organization\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/organization', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/usage":{"get":{"operationId":"getUsage","summary":"Requests per day, key and operation, with error counts","description":"Required scopes: usage:read (organization API keys). Rate limit group: read (300 requests per minute per key).","tags":["Usage, logs and test data"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"from","in":"query","required":false,"schema":{"description":"ISO 8601 date; default 30 days ago (requests are kept 30 days)"},"description":"ISO 8601 date; default 30 days ago (requests are kept 30 days)"},{"name":"to","in":"query","required":false,"schema":{"description":"ISO 8601 date, exclusive; default now"},"description":"ISO 8601 date, exclusive; default now"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["date","credentialId","operationId","requests","clientErrors","serverErrors","averageDurationMs"],"properties":{"date":{"type":"string","format":"date","description":"UTC day"},"credentialId":{"type":"string"},"operationId":{"type":["string","null"]},"requests":{"type":"integer"},"clientErrors":{"type":"integer","description":"4xx responses"},"serverErrors":{"type":"integer","description":"5xx responses"},"averageDurationMs":{"type":"integer"}}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"date":"Test-mode fixture (date): no model was called and no credits were used.","credentialId":"test_credential_66efd3949b4add4f","operationId":"test_operation_343f0c429b75141d","requests":1,"clientErrors":1,"serverErrors":1,"averageDurationMs":1}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/usage\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/usage', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/request-logs":{"get":{"operationId":"listRequestLogs","summary":"List the organization’s API requests of the last 30 days, newest first","description":"Required scopes: usage:read (organization API keys). Rate limit group: read (300 requests per minute per key).","tags":["Usage, logs and test data"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"description":"Items per page, 1–100 (default 20)","type":"integer","minimum":1,"maximum":100},"description":"Items per page, 1–100 (default 20)"},{"name":"cursor","in":"query","required":false,"schema":{"description":"The nextCursor of the previous page","type":"string","maxLength":512},"description":"The nextCursor of the previous page"},{"name":"status","in":"query","required":false,"schema":{"description":"2xx, 4xx, 5xx, or an exact status","type":"string","pattern":"^([1-5]xx|[1-5]\\d\\d)$"},"description":"2xx, 4xx, 5xx, or an exact status"},{"name":"credentialId","in":"query","required":false,"schema":{"description":"Only requests made with this key (apikey:<id>, or an MCP connection id)","type":"string","maxLength":100},"description":"Only requests made with this key (apikey:<id>, or an MCP connection id)"},{"name":"operationId","in":"query","required":false,"schema":{"description":"Only calls of this operation, e.g. createRedlines","type":"string","maxLength":100},"description":"Only calls of this operation, e.g. createRedlines"},{"name":"requestId","in":"query","required":false,"schema":{"description":"One request, by its Request-Id","type":"string","maxLength":100},"description":"One request, by its Request-Id"},{"name":"since","in":"query","required":false,"schema":{"description":"ISO 8601; only requests at or after this time"},"description":"ISO 8601; only requests at or after this time"},{"name":"until","in":"query","required":false,"schema":{"description":"ISO 8601; only requests before this time"},"description":"ISO 8601; only requests before this time"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","method","path","status","durationMs","credentialId","credentialType","surface","createdAt"],"properties":{"id":{"type":"string","description":"The request id (req_…), as in the Request-Id header"},"object":{"const":"request_log"},"method":{"type":"string"},"path":{"type":"string","description":"Path without the query string"},"operationId":{"type":["string","null"]},"status":{"type":"integer"},"errorCode":{"type":["string","null"]},"durationMs":{"type":"integer"},"apiVersion":{"type":["string","null"]},"credentialId":{"type":"string","description":"apikey:<id> for organization API keys, else the MCP connection id"},"credentialType":{"type":"string","enum":["api_key","mcp_connection","oauth"]},"surface":{"type":"string","enum":["rest","mcp"]},"idempotencyKey":{"type":["string","null"]},"operation":{"type":["string","null"],"description":"The op_… operation the request created or replayed"},"clientName":{"type":["string","null"]},"ip":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_fdd3fc5a556891ac","object":"request_log","method":"Test-mode fixture (method): no model was called and no credits were used.","path":"Test-mode fixture (path): no model was called and no credits were used.","operationId":"test_operation_f4323d726b4deb1a","status":1,"errorCode":"Test-mode fixture (errorCode): no model was called and no credits were used.","durationMs":1,"apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","credentialId":"test_credential_671fc8c5ebb073fa","credentialType":"api_key","surface":"rest","idempotencyKey":"Test-mode fixture (idempotencyKey): no model was called and no credits were used.","operation":"Test-mode fixture (operation): no model was called and no credits were used.","clientName":"Test-mode fixture (clientName): no model was called and no credits were used.","ip":"Test-mode fixture (ip): no model was called and no credits were used.","userAgent":"Test-mode fixture (userAgent): no model was called and no credits were used.","createdAt":"2026-01-01T00:00:00.000Z"}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/request-logs\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/request-logs', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/audit-events":{"get":{"operationId":"listAuditEvents","summary":"Who called what, when and with which key (organization owners and admins)","description":"Required scopes: audit:read (organization API keys). Rate limit group: read (300 requests per minute per key). The key’s owner must be an organization owner or admin.","tags":["Usage, logs and test data"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"description":"Items per page, 1–100 (default 20)","type":"integer","minimum":1,"maximum":100},"description":"Items per page, 1–100 (default 20)"},{"name":"cursor","in":"query","required":false,"schema":{"description":"The nextCursor of the previous page","type":"string","maxLength":512},"description":"The nextCursor of the previous page"},{"name":"status","in":"query","required":false,"schema":{"description":"2xx, 4xx, 5xx, or an exact status","type":"string","pattern":"^([1-5]xx|[1-5]\\d\\d)$"},"description":"2xx, 4xx, 5xx, or an exact status"},{"name":"credentialId","in":"query","required":false,"schema":{"description":"Only requests made with this key (apikey:<id>, or an MCP connection id)","type":"string","maxLength":100},"description":"Only requests made with this key (apikey:<id>, or an MCP connection id)"},{"name":"operationId","in":"query","required":false,"schema":{"description":"Only calls of this operation, e.g. createRedlines","type":"string","maxLength":100},"description":"Only calls of this operation, e.g. createRedlines"},{"name":"requestId","in":"query","required":false,"schema":{"description":"One request, by its Request-Id","type":"string","maxLength":100},"description":"One request, by its Request-Id"},{"name":"since","in":"query","required":false,"schema":{"description":"ISO 8601; only requests at or after this time"},"description":"ISO 8601; only requests at or after this time"},{"name":"until","in":"query","required":false,"schema":{"description":"ISO 8601; only requests before this time"},"description":"ISO 8601; only requests before this time"},{"$ref":"#/components/parameters/Attorly-Version"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","hasMore","nextCursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","method","path","status","durationMs","credentialId","credentialType","surface","createdAt","actor","credential"],"properties":{"id":{"type":"string","description":"The request id (req_…), as in the Request-Id header"},"object":{"const":"audit_event"},"method":{"type":"string"},"path":{"type":"string","description":"Path without the query string"},"operationId":{"type":["string","null"]},"status":{"type":"integer"},"errorCode":{"type":["string","null"]},"durationMs":{"type":"integer"},"apiVersion":{"type":["string","null"]},"credentialId":{"type":"string","description":"apikey:<id> for organization API keys, else the MCP connection id"},"credentialType":{"type":"string","enum":["api_key","mcp_connection","oauth"]},"surface":{"type":"string","enum":["rest","mcp"]},"idempotencyKey":{"type":["string","null"]},"operation":{"type":["string","null"],"description":"The op_… operation the request created or replayed"},"clientName":{"type":["string","null"]},"ip":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"actor":{"type":"object","description":"The person the key acts as","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"email":{"type":["string","null"]}}},"credential":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"name":{"type":["string","null"]},"displayPrefix":{"type":["string","null"]}}}}}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"],"description":"Pass as cursor for the next page; null on the last page."},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"object":"list","data":[{"id":"test_id_056f91bfefc88294","object":"audit_event","method":"Test-mode fixture (method): no model was called and no credits were used.","path":"Test-mode fixture (path): no model was called and no credits were used.","operationId":"test_operation_ab642c6a1665d31c","status":1,"errorCode":"Test-mode fixture (errorCode): no model was called and no credits were used.","durationMs":1,"apiVersion":"Test-mode fixture (apiVersion): no model was called and no credits were used.","credentialId":"test_credential_bfab1977b43f6085","credentialType":"api_key","surface":"rest","idempotencyKey":"Test-mode fixture (idempotencyKey): no model was called and no credits were used.","operation":"Test-mode fixture (operation): no model was called and no credits were used.","clientName":"Test-mode fixture (clientName): no model was called and no credits were used.","ip":"Test-mode fixture (ip): no model was called and no credits were used.","userAgent":"Test-mode fixture (userAgent): no model was called and no credits were used.","createdAt":"2026-01-01T00:00:00.000Z","actor":{"id":"test_id_056f91bfefc88294","name":"Test-mode fixture (name): no model was called and no credits were used.","email":"Test-mode fixture (email): no model was called and no credits were used."},"credential":{"id":"test_id_056f91bfefc88294","type":"Test-mode fixture (type): no model was called and no credits were used.","name":"Test-mode fixture (name): no model was called and no credits were used.","displayPrefix":"Test-mode fixture (displayPrefix): no model was called and no credits were used."}}],"hasMore":true,"nextCursor":"Test-mode fixture (nextCursor): no model was called and no credits were used.","meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://attorly.ai/api/v1/audit-events\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/audit-events', {\n  method: 'GET',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n  },\n});"}]}},"/api/v1/test-data":{"delete":{"operationId":"deleteTestData","summary":"Delete every test-mode object, event and operation of the organization (test keys only)","description":"Required scopes: documents:delete (organization API keys). Rate limit group: write (60 requests per minute per key). Test-mode keys only.","tags":["Usage, logs and test data"],"security":[{"bearerAuth":[]},{"oauth2":["documents:delete"]}],"parameters":[{"$ref":"#/components/parameters/Attorly-Version"},{"$ref":"#/components/parameters/Idempotency-Key"}],"responses":{"200":{"description":"Success","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"},"Idempotent-Replayed":{"$ref":"#/components/headers/Idempotent-Replayed"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["object","deleted"],"properties":{"object":{"const":"test_data_purge"},"deleted":{"type":"object","properties":{"objects":{"type":"integer"},"events":{"type":"integer"},"operations":{"type":"integer"}}}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"example":{"data":{"object":"test_data_purge","deleted":{"objects":1,"events":1,"operations":1}},"meta":{}}}}},"400":{"description":"Invalid request body, query or header (`invalid_request`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"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":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"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`), key used from an address outside its IP allowlist (`ip_not_allowed`), AI consent withdrawn (`ai_consent_withdrawn`), or the key may read but not change the resource (`forbidden`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Resource not found or not accessible with this key (`not_found`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflicts with the resource’s state (`conflict`), or a request with the same Idempotency-Key is still running (`idempotency_request_in_progress`; poll the Location)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request body or uploaded file too large (`payload_too_large`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Valid request that cannot be processed (`unprocessable`), or an Idempotency-Key reused with a different request (`idempotency_key_reused`)","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"},"Retry-After":{"schema":{"type":"integer"}},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"RateLimit":{"$ref":"#/components/headers/RateLimit"},"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error (`internal_error`); the message quotes the request id","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"Attorly-Version":{"$ref":"#/components/headers/Attorly-Version"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X DELETE \"https://attorly.ai/api/v1/test-data\" \\\n  -H \"Authorization: Bearer $ATTORLY_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\""},{"lang":"typescript","label":"TypeScript","source":"const res = await fetch('https://attorly.ai/api/v1/test-data', {\n  method: 'DELETE',\n  headers: {\n    Authorization: `Bearer ${process.env.ATTORLY_API_KEY}`,\n    'Idempotency-Key': crypto.randomUUID(),\n  },\n});"}]}}},"webhooks":{"analysis.completed":{"post":{"summary":"analysis.completed","description":"A full analysis requested through the API finished. data.object is the analysed document; read the analysis with GET /api/v1/documents/{id}. Signed per Standard Webhooks: verify webhook-signature (HMAC-SHA256 with the endpoint's whsec_ secret over \"<webhook-id>.<webhook-timestamp>.<body>\"), refuse timestamps more than 5 minutes off, and deduplicate on webhook-id. Answer 2xx within 15 seconds; anything else is retried for up to 72 hours.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"integer"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"const":"analysis.completed"},"data":{"type":"object","properties":{"object":{"type":"object","properties":{"object":{"const":"document"}}}}}}}]}}}},"responses":{"2XX":{"description":"Received. Any other answer is retried."}}}},"analysis.failed":{"post":{"summary":"analysis.failed","description":"A full analysis requested through the API failed. data.operation holds the operation with the error. Signed per Standard Webhooks: verify webhook-signature (HMAC-SHA256 with the endpoint's whsec_ secret over \"<webhook-id>.<webhook-timestamp>.<body>\"), refuse timestamps more than 5 minutes off, and deduplicate on webhook-id. Answer 2xx within 15 seconds; anything else is retried for up to 72 hours.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"integer"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"const":"analysis.failed"},"data":{"type":"object","properties":{"object":{"type":"object","properties":{"object":{"const":"document"}}}}}}}]}}}},"responses":{"2XX":{"description":"Received. Any other answer is retried."}}}},"redlines.generated":{"post":{"summary":"redlines.generated","description":"Redline suggestions requested through the API are ready. data.object is the document (or the operation for inline text). Signed per Standard Webhooks: verify webhook-signature (HMAC-SHA256 with the endpoint's whsec_ secret over \"<webhook-id>.<webhook-timestamp>.<body>\"), refuse timestamps more than 5 minutes off, and deduplicate on webhook-id. Answer 2xx within 15 seconds; anything else is retried for up to 72 hours.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"integer"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"const":"redlines.generated"},"data":{"type":"object","properties":{"object":{"type":"object","properties":{"object":{"const":"document"}}}}}}}]}}}},"responses":{"2XX":{"description":"Received. Any other answer is retried."}}}},"due_diligence.report.completed":{"post":{"summary":"due_diligence.report.completed","description":"A due diligence report requested through the API was generated. Signed per Standard Webhooks: verify webhook-signature (HMAC-SHA256 with the endpoint's whsec_ secret over \"<webhook-id>.<webhook-timestamp>.<body>\"), refuse timestamps more than 5 minutes off, and deduplicate on webhook-id. Answer 2xx within 15 seconds; anything else is retried for up to 72 hours.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"integer"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"const":"due_diligence.report.completed"},"data":{"type":"object","properties":{"object":{"type":"object","properties":{"object":{"const":"due_diligence_report"}}}}}}}]}}}},"responses":{"2XX":{"description":"Received. Any other answer is retried."}}}},"operation.succeeded":{"post":{"summary":"operation.succeeded","description":"An asynchronous, idempotent or long-running API call finished successfully. Read its result at GET /api/v1/operations/{id} (kept 24 hours). Signed per Standard Webhooks: verify webhook-signature (HMAC-SHA256 with the endpoint's whsec_ secret over \"<webhook-id>.<webhook-timestamp>.<body>\"), refuse timestamps more than 5 minutes off, and deduplicate on webhook-id. Answer 2xx within 15 seconds; anything else is retried for up to 72 hours.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"integer"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"const":"operation.succeeded"},"data":{"type":"object","properties":{"object":{"type":"object","properties":{"object":{"const":"operation"}}}}}}}]}}}},"responses":{"2XX":{"description":"Received. Any other answer is retried."}}}},"operation.failed":{"post":{"summary":"operation.failed","description":"An asynchronous, idempotent or long-running API call failed. Read the error at GET /api/v1/operations/{id}. Signed per Standard Webhooks: verify webhook-signature (HMAC-SHA256 with the endpoint's whsec_ secret over \"<webhook-id>.<webhook-timestamp>.<body>\"), refuse timestamps more than 5 minutes off, and deduplicate on webhook-id. Answer 2xx within 15 seconds; anything else is retried for up to 72 hours.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"integer"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"const":"operation.failed"},"data":{"type":"object","properties":{"object":{"type":"object","properties":{"object":{"const":"operation"}}}}}}}]}}}},"responses":{"2XX":{"description":"Received. Any other answer is retried."}}}},"webhook_endpoint.test":{"post":{"summary":"webhook_endpoint.test","description":"Sent only to one endpoint, on request (POST /api/v1/webhook-endpoints/{id}/test-events), to check the receiver. Signed per Standard Webhooks: verify webhook-signature (HMAC-SHA256 with the endpoint's whsec_ secret over \"<webhook-id>.<webhook-timestamp>.<body>\"), refuse timestamps more than 5 minutes off, and deduplicate on webhook-id. Answer 2xx within 15 seconds; anything else is retried for up to 72 hours.","parameters":[{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"integer"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"const":"webhook_endpoint.test"},"data":{"type":"object","properties":{"object":{"type":"object","properties":{"object":{"const":"webhook_endpoint"}}}}}}}]}}}},"responses":{"2XX":{"description":"Received. Any other answer is retried."}}}}},"components":{"parameters":{"Attorly-Version":{"name":"Attorly-Version","in":"header","required":false,"description":"The API version to use for this request; defaults to the version the key is pinned to.","schema":{"type":"string","enum":["2026-10-01","2026-11-01"]}},"Idempotency-Key":{"name":"Idempotency-Key","in":"header","required":false,"description":"A unique key for this request, e.g. a UUID (1–255 printable ASCII characters). A retry with the same key and the same request returns the stored response with Idempotent-Replayed: true instead of running again. Reusing a key for a different request is refused with 422 idempotency_key_reused. Keys expire after 24 hours; a server error is not stored, so its retry runs again.","schema":{"type":"string","minLength":1,"maxLength":255}},"Prefer":{"name":"Prefer","in":"header","required":false,"description":"\"respond-async\" answers 202 Accepted at once and runs the call in the background; \"wait=<seconds>\" (up to 60) waits that long for the result before answering 202. Poll the Location header until the operation finishes.","schema":{"type":"string","examples":["respond-async","wait=30","respond-async, wait=10"]}}},"headers":{"Idempotent-Replayed":{"description":"true when this response was stored for an earlier request with the same Idempotency-Key.","schema":{"type":"string","enum":["true"]}},"Request-Id":{"description":"Identifies this request (req_…); quote it when contacting support. Also sent as X-Request-ID.","schema":{"type":"string"}},"Attorly-Version":{"description":"The API version the request ran at.","schema":{"type":"string"}},"RateLimit-Policy":{"description":"The windows this request counts against (IETF RateLimit headers): \"<name>\";q=<limit>;w=<seconds>, …","schema":{"type":"string"}},"RateLimit":{"description":"Where the request stands in each window: \"<name>\";r=<remaining>;t=<seconds to reset>, …","schema":{"type":"string"}},"X-RateLimit-Limit":{"description":"Limit of the window closest to running out.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests left in that window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix time (seconds) at which that window resets.","schema":{"type":"integer"}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"An organization API key — atly_live_… / atly_rk_live_… (secret / restricted), atly_test_… / atly_rk_test_… for test mode, or a legacy lb_… key — or an MCP connection key (lbmcp_…), or an OAuth access token (atly_oat_…)."},"oauth2":{"type":"oauth2","description":"OAuth 2.1 authorization code with PKCE (S256), for apps that act for an Attorly user. Send resource=https://attorly.ai/api/v1 (RFC 8707); tokens issued for the MCP server are not accepted here. Clients register dynamically (RFC 7591) or with a Client ID Metadata Document; discovery at https://attorly.ai/.well-known/oauth-authorization-server.","flows":{"authorizationCode":{"authorizationUrl":"https://attorly.ai/api/oauth/authorize","tokenUrl":"https://attorly.ai/api/oauth/token","refreshUrl":"https://attorly.ai/api/oauth/token","scopes":{"documents:read":"See your documents, their text and analyses","documents:write":"Upload documents","documents:delete":"Permanently delete documents you own","analysis:create":"Analyse documents with AI (uses AI credits)","clauses:read":"Search the clause library and assess clauses","research:read":"Search legal sources","redlines:write":"Propose and resolve redlines (uses AI credits)","negotiations:read":"Run negotiation analysis (uses AI credits)","workflows:execute":"List, start and follow workflows","due-diligence:write":"Create and run due diligence projects","templates:read":"Read document templates","drafts:write":"Create drafts from templates or with AI","offline_access":"Stay connected: issue a refresh token"}}}}},"schemas":{"Meta":{"type":"object","properties":{"warnings":{"type":"array","items":{"type":"string"}}}},"Operation":{"type":"object","description":"A call made with Idempotency-Key or Prefer, or a long-running AI call. result holds the data the call returned, error the error it failed with; httpStatus is the status the call itself answered with.","required":["id","object","operationId","status","livemode","resultUrl","createdAt","completedAt","expiresAt","httpStatus","result","error"],"properties":{"id":{"type":"string","description":"op_…"},"object":{"const":"operation"},"operationId":{"type":"string","description":"The REST operation that was called, e.g. createRedlines"},"status":{"type":"string","enum":["running","succeeded","failed"]},"livemode":{"type":"boolean"},"idempotencyKey":{"type":["string","null"]},"resultUrl":{"type":"string","description":"Where to poll: /api/v1/operations/{id}"},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"httpStatus":{"type":["integer","null"]},"result":{"description":"The data of the successful call"},"meta":{"$ref":"#/components/schemas/Meta"},"error":{"anyOf":[{"$ref":"#/components/schemas/ErrorDetail"},{"type":"null"}]}}},"Event":{"type":"object","required":["id","object","type","apiVersion","createdAt","livemode","data"],"properties":{"id":{"type":"string","description":"evt_… — also sent as the webhook-id header; deduplicate on it"},"object":{"const":"event"},"type":{"type":"string","enum":["analysis.completed","analysis.failed","redlines.generated","due_diligence.report.completed","operation.succeeded","operation.failed","webhook_endpoint.test"]},"apiVersion":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"livemode":{"type":"boolean"},"data":{"type":"object","required":["object"],"properties":{"object":{"type":"object","required":["id","object"],"properties":{"id":{"type":"string"},"object":{"type":"string"}}},"operation":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"operation"}}},"snapshot":{"description":"The object itself — only for endpoints with includeSnapshots"}}}}},"ErrorDetail":{"type":"object","required":["type","code","message","docUrl"],"properties":{"type":{"type":"string","enum":["invalid_request_error","authentication_error","permission_error","rate_limit_error","api_error"]},"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","ip_not_allowed","ai_consent_withdrawn","not_found","method_not_allowed","conflict","idempotency_request_in_progress","payload_too_large","unsupported_media_type","unprocessable","idempotency_key_reused","rate_limited","concurrency_limit_exceeded","internal_error","timeout"]},"message":{"type":"string"},"param":{"type":"string","description":"The field, header or query parameter at fault"},"docUrl":{"type":"string","description":"https://attorly.ai/docs/api/errors#<code>"},"requestId":{"type":"string","description":"The Request-Id of the response; quote it to support."},"requiredScopes":{"type":"array","items":{"type":"string"},"description":"insufficient_scope only: every scope the call needs."},"details":{"type":"array","items":{"type":"object","required":["path","message"],"properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/ErrorDetail"}}}}}}