{"openapi":"3.1.0","info":{"title":"August Public API","description":"Programmatic access to August. Authenticate every request with a Clerk API key: `Authorization: Bearer ak_...`.","version":"1.0.0"},"servers":[{"url":"https://app.august.law/api/v1"}],"tags":[{"name":"Projects"},{"name":"Folders"},{"name":"Files"},{"name":"Uploads"},{"name":"Search"},{"name":"Chats"},{"name":"Agents"},{"name":"Skills"},{"name":"Tags"},{"name":"Sharing Policies"}],"paths":{"/chats":{"get":{"operationId":"chat-list","summary":"List chats","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","schema":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]}},{"in":"query","name":"projectId","schema":{"type":"string"}},{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"chatTypes","schema":{"type":"array","items":{"type":"string"}}},{"in":"query","name":"modes","schema":{"type":"array","items":{"type":"string"}}},{"in":"query","name":"minutesAgo","schema":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},{"in":"query","name":"tagIds","schema":{"type":"array","items":{"type":"string"}}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"updated_at":{"type":"string"},"type":{"type":"string"},"created_at":{"type":"string"},"permission_level":{"type":"string"},"is_pinned":{"type":"boolean"},"message_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"time_taken_seconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"work_product_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"is_responding":{"type":"boolean"},"first_question":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"answer":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"modes":{"type":"array","items":{"type":"string"}}},"required":["id","text","answer","status","created_at","modes"],"additionalProperties":false},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","first_name","last_name","image_url"],"additionalProperties":false},{"type":"null"}]}},"required":["id","name","updated_at","type","created_at","permission_level","is_pinned","message_count","time_taken_seconds","work_product_count","is_responding","first_question","owner"],"additionalProperties":false}},"nextCursor":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["items","nextCursor"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"post":{"operationId":"chat-create","summary":"Start a legacy-compatible chat query","description":"Submits a query through the legacy-compatible Python chat runtime and returns the chat and question ids. The answer is produced asynchronously — poll `GET /chats/{chatId}` for the result.","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{"type":"string","minLength":1},"chat_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"mode":{"default":["auto"],"type":"array","items":{"type":"string"}},"folder_ids":{"default":[],"type":"array","items":{"type":"string"}},"file_ids":{"default":[],"type":"array","items":{"type":"string"}},"tabular_review_ids":{"default":[],"type":"array","items":{"type":"string"}},"playbook_ids":{"default":[],"type":"array","items":{"type":"string"}},"workflow_ids":{"default":[],"type":"array","items":{"type":"string"}},"workflow_run_ids":{"default":[],"type":"array","items":{"type":"string"}},"workflow_name":{"default":"query","type":"string"},"project_id":{"type":"string"}},"required":["prompt","chat_id"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"success"},"message":{"type":"string"},"chat_id":{"type":"string"},"question_id":{"type":"string"}},"required":["status","message","chat_id","question_id"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/chats/questions/{question_id}/cancel":{"post":{"operationId":"chat-cancel","summary":"Cancel a running query","description":"Cancels a running or pending question. No-op if already in a terminal state. `question_id` is the chat_questions id returned by POST /chats.","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"question_id","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"questionId":{"type":"string"},"status":{"type":"string"},"message":{"type":"string"}},"required":["questionId","status","message"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/chats/{chatId}":{"get":{"operationId":"chat-byId","summary":"Get a chat thread","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"chatId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"chat":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["name"],"additionalProperties":false},{"type":"null"}]},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"chat_id":{"type":"string"},"question":{"type":"string"},"answer":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"mode":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","chat_id","question","answer","status","mode","created_at","updated_at"],"additionalProperties":false}},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"question_id":{"type":"string"},"step_number":{"type":"number"},"step_group":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"number"}]},{"type":"null"}]},"type":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"anyOf":[{},{"type":"null"}]},"time_taken":{"anyOf":[{"type":"number"},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","question_id","step_number","step_group","type","content","metadata","time_taken","created_at","updated_at"],"additionalProperties":false}},"follow_up_questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"question_id":{"type":"string"},"follow_up_question":{"type":"string"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","question_id","follow_up_question","created_at"],"additionalProperties":false}},"documents":{"type":"array","items":{"type":"object","properties":{"question_id":{"type":"string"},"doc_id":{"type":"string"},"doc_name":{"type":"string"},"data_source_id":{"type":"string"}},"required":["question_id","doc_id","doc_name","data_source_id"],"additionalProperties":false}},"data_sources":{"type":"array","items":{"type":"object","properties":{"question_id":{"type":"string"},"data_source_id":{"type":"string"},"name":{"type":"string"},"type":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["question_id","data_source_id","name","type"],"additionalProperties":false}},"tabular_reviews":{"type":"array","items":{"type":"object","properties":{"question_id":{"type":"string"},"tabular_review_id":{"type":"string"},"name":{"type":"string"}},"required":["question_id","tabular_review_id","name"],"additionalProperties":false}},"playbooks":{"type":"array","items":{"type":"object","properties":{"question_id":{"type":"string"},"playbook_id":{"type":"string"},"name":{"type":"string"}},"required":["question_id","playbook_id","name"],"additionalProperties":false}},"style_guides":{"type":"array","items":{"type":"object","properties":{"question_id":{"type":"string"},"style_guide_id":{"type":"string"}},"required":["question_id","style_guide_id"],"additionalProperties":false}}},"required":["chat","questions","steps","follow_up_questions","documents","data_sources","tabular_reviews","playbooks","style_guides"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"patch":{"operationId":"chat-rename","summary":"Rename a chat","description":"Renames a chat. Caller must be a chat editor.","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"chatId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255}},"required":["name"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","updated_at"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"chat-delete","summary":"Delete a chat","description":"Deletes a chat and its messages, preserving records when retention is enabled. Caller must be a chat editor. Active responses must be stopped first.","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"chatId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","const":"deleted"}},"required":["id","status"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/chats/questions/{questionId}/status":{"get":{"operationId":"chat-questionStatus","summary":"Get question status","description":"Polls the status of a submitted question, with a lightweight step-count progress signal.","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"questionId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"questionId":{"type":"string"},"status":{"type":"string"},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"stepCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastStepAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["questionId","status","createdAt","updatedAt","stepCount","lastStepAt"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/chats/questions/{questionId}/files":{"get":{"operationId":"chat-questionFiles","summary":"Get question output files","description":"Lists work-product documents generated by a question and stored in its genius_outputs folder.","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"questionId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"questionId":{"type":"string"},"chatId":{"type":"string"},"files":{"type":"array","items":{"type":"object","properties":{"docId":{"type":"string"},"name":{"type":"string"},"contentType":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["docId","name","contentType"],"additionalProperties":false}}},"required":["questionId","chatId","files"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/chats/questions/{questionId}/result":{"get":{"operationId":"chat-questionResult","summary":"Get question result","description":"Returns the answer, follow-up questions, and citation ids for a completed question. Citation excerpt resolution (doc name/text) is not yet available.","tags":["Chats"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"questionId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"questionId":{"type":"string"},"status":{"type":"string"},"answer":{"anyOf":[{"type":"string"},{"type":"null"}]},"answerRaw":{"anyOf":[{"type":"string"},{"type":"null"}]},"question":{"anyOf":[{"type":"string"},{"type":"null"}]},"citationIds":{"type":"array","items":{"type":"string"}},"followUpQuestions":{"type":"array","items":{"type":"string"}},"mode":{"type":"array","items":{"type":"string"}}},"required":["questionId","status","answer","answerRaw","question","citationIds","followUpQuestions","mode"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/files/{docId}/download-url":{"get":{"operationId":"documents-getPresignedUrl","summary":"Get a document download URL","tags":["Files"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"docId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"required":true},{"in":"query","name":"usePdf","schema":{"default":false,"type":"boolean"}},{"in":"query","name":"ttl","schema":{"default":3600,"type":"number","minimum":60,"maximum":86400}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/files/{docId}/content":{"get":{"operationId":"documents-getContent","summary":"Get parsed text content of a document","description":"Returns the parsed text of a document as ordered chunks. Paginate with startChunkIndex/limit; re-call with startChunkIndex = endChunkIndex + 1 while hasMore is true.","tags":["Files"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"docId","schema":{"type":"string"},"required":true},{"in":"query","name":"startChunkIndex","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"in":"query","name":"limit","schema":{"default":100,"type":"integer","minimum":1,"maximum":500}},{"in":"query","name":"projectId","schema":{"anyOf":[{"type":"string"},{"type":"null"}]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"docId":{"type":"string"},"docName":{"type":"string"},"chunks":{"type":"array","items":{"type":"object","properties":{"chunkIndex":{"type":"number"},"text":{"type":"string"},"pageNumber":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["chunkIndex","text","pageNumber"],"additionalProperties":false}},"startChunkIndex":{"type":"number"},"endChunkIndex":{"type":"number"},"hasMore":{"type":"boolean"}},"required":["docId","docName","chunks","startChunkIndex","endChunkIndex","hasMore"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/folders":{"post":{"operationId":"folder-create","summary":"Create a folder","description":"Three positioning modes: subfolder (parentId), project root (projectId), or personal root (neither). Caller becomes owner.","tags":["Folders"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string"},"parentId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"projectId":{"type":"string"}},"required":["name"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"folder-delete","summary":"Delete folders","description":"Soft-deletes one or more folders and their whole subtrees (owner-only). folderIds serialize as repeated query params.","tags":["Folders"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"folderIds","schema":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string"}},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deletedCount":{"type":"number"}},"required":["success","deletedCount"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/folders/contents":{"get":{"operationId":"folder-list","summary":"List a folder's contents","description":"Folders (alphabetical, first page only) then files (paginated by cursor/limit). Omit parentFolderId (null) for the personal/project root. All inputs are optional query params; arrays (filterTagIds) serialize as repeated query params. Returns items[] plus total_folders, total_files, nextCursor.","tags":["Folders"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"projectId","schema":{"anyOf":[{"type":"string"},{"type":"null"}]}},{"in":"query","name":"parentFolderId","schema":{"anyOf":[{"type":"string"},{"type":"null"}]}},{"in":"query","name":"cursor","schema":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]}},{"in":"query","name":"limit","schema":{"default":5000,"type":"integer","minimum":1,"maximum":5000}},{"in":"query","name":"sortBy","schema":{"default":"name","type":"string","enum":["name","created_at","updated_at","file_size","file_type"]}},{"in":"query","name":"sortDesc","schema":{"default":false,"type":"boolean"}},{"in":"query","name":"filterTagIds","schema":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}}},{"in":"query","name":"includeFiles","schema":{"default":true,"type":"boolean"}},{"in":"query","name":"includeTags","schema":{"default":true,"type":"boolean"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"folder"},"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"file_count":{"type":"number"},"subfolder_count":{"type":"number"},"recursive_file_count":{"type":"number"},"shared_by_me":{"type":"boolean"},"shared_with_me":{"type":"boolean"}},"required":["type","id","name","description"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"file"},"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"file_size":{"anyOf":[{"type":"number"},{"type":"null"}]},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"tag_id":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["tag_id","name","color"],"additionalProperties":false}},"is_ready":{"type":"boolean"},"parent_folder_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"parent_folder_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["type","id","name"],"additionalProperties":false}],"type":"object"}},"total_folders":{"type":"number"},"total_files":{"type":"number"},"nextCursor":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["items","total_folders","total_files","nextCursor"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/search":{"get":{"operationId":"folder-search","summary":"Search files and folders","description":"Name search across the accessible folder tree. Pass projectId (optional query param) to scope to a project; omit for the caller's personal workspace. Returns a flat array of folder/file hits.","tags":["Folders"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"query","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"projectId","schema":{"anyOf":[{"type":"string"},{"type":"null"}]}},{"in":"query","name":"scope","schema":{"default":"folders","type":"string","enum":["folders","files","all"]}},{"in":"query","name":"parentFolderId","schema":{"anyOf":[{"type":"string"},{"type":"null"}]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"folder"},"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"file_count":{"type":"number"},"subfolder_count":{"type":"number"},"recursive_file_count":{"type":"number"},"shared_by_me":{"type":"boolean"},"shared_with_me":{"type":"boolean"}},"required":["type","id","name","description"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"file"},"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"file_size":{"anyOf":[{"type":"number"},{"type":"null"}]},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"tag_id":{"type":"string"},"name":{"type":"string"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["tag_id","name","color"],"additionalProperties":false}},"is_ready":{"type":"boolean"},"parent_folder_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"parent_folder_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["type","id","name"],"additionalProperties":false}],"type":"object"}}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/folders/resolve":{"get":{"operationId":"folder-resolveByName","summary":"Resolve a folder by name","description":"Find the id of an accessible folder by its exact (case-insensitive) name. Pass projectId (optional query param) to scope to a project, or parentFolderId to scope to a subtree; omit both for the caller's personal workspace. 404 when no folder matches; 409 when the name is ambiguous (the message lists the candidate ids).","tags":["Folders"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"name","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"projectId","schema":{"anyOf":[{"type":"string"},{"type":"null"}]}},{"in":"query","name":"parentFolderId","schema":{"anyOf":[{"type":"string"},{"type":"null"}]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/folders/{folderId}/tree":{"get":{"operationId":"folder-tree","summary":"Get folder subtree","description":"Returns the recursive folder hierarchy rooted at folderId. Caller must have read access to the folder.","tags":["Folders"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"folderId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"folderId":{"type":"string"},"tree":{"type":"array","items":{"$ref":"#/components/schemas/__schema0"}}},"required":["folderId","tree"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects":{"get":{"operationId":"projects-list","summary":"List accessible projects","description":"Returns every project the authenticated user can access, most recently updated first.","tags":["Projects"],"security":[{"Authorization":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"client_num":{"anyOf":[{"type":"string"},{"type":"null"}]},"matter_num":{"anyOf":[{"type":"string"},{"type":"null"}]},"sharing_enabled":{"type":"boolean"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissionLevel":{"type":"string","enum":["owner","editor","viewer"]},"hiddenFromSidebar":{"type":"boolean"},"pinnedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","description","client_num","matter_num","sharing_enabled","created_at","updated_at","permissionLevel","hiddenFromSidebar","pinnedAt"],"additionalProperties":false}}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"post":{"operationId":"projects-create","summary":"Create a project","description":"Creates a new project owned by the caller. The caller is added as the project owner.","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"clientNum":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]},"matterNum":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]},"intelligencePrompt":{"anyOf":[{"type":"string","maxLength":5000},{"type":"null"}]},"sharingEnabled":{"default":false,"type":"boolean"}},"required":["name"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissionLevel":{"type":"string","const":"owner"}},"required":["id","name","description","createdAt","permissionLevel"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{projectId}/members":{"get":{"operationId":"projects-members","summary":"List project members","description":"Returns every member of the project with their permission level. Caller must be a project member.","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissionLevel":{"type":"string","enum":["owner","editor","viewer"]}},"required":["id","email","first_name","last_name","image_url","permissionLevel"],"additionalProperties":false}}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{projectId}/folders":{"get":{"operationId":"projects-rootFolders","summary":"List project root folders","description":"Lists the top-level folders (data sources) the project is anchored to. Caller must be a project member.","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","description","createdAt","updatedAt"],"additionalProperties":false}}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/projects/{projectId}":{"patch":{"operationId":"projects-rename","summary":"Rename a project","description":"Renames a project. Caller must be a project editor.","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200}},"required":["name"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"projects-delete","summary":"Delete a project","description":"Permanently deletes a project and its resource links (chats and folders survive as personal resources). Caller must be a project editor. Destructive and irreversible; pass confirm=true.","tags":["Projects"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"projectId","schema":{"type":"string"},"required":true},{"in":"query","name":"confirm","schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","const":true}},"required":["id","deleted"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/search/content":{"post":{"operationId":"search-content","summary":"Search document content","description":"Full-text (BM25) search across the parsed text of documents the caller can access. Scope with folderIds and/or docIds; returns matching chunks with highlighted snippets.","tags":["Search"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"q":{"type":"string","minLength":1},"folderIds":{"default":[],"type":"array","items":{"type":"string"}},"docIds":{"default":[],"type":"array","items":{"type":"string"}},"projectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"topK":{"default":10,"type":"integer","minimum":1,"maximum":100}},"required":["q"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"chunkId":{"type":"string"},"docId":{"type":"string"},"docName":{"type":"string"},"chunkIndex":{"type":"number"},"pageNumber":{"anyOf":[{"type":"number"},{"type":"null"}]},"content":{"type":"string"},"highlights":{"type":"array","items":{"type":"string"}},"score":{"type":"number"}},"required":["chunkId","docId","docName","chunkIndex","pageNumber","content","highlights","score"],"additionalProperties":false}},"query":{"type":"string"},"count":{"type":"number"}},"required":["results","query","count"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/sharing-policies":{"get":{"operationId":"sharing-policies-list","summary":"List sharing policies","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"conditionType":{"type":"string","enum":["organization_membership","email_exact","email_domain","all_users"]},"conditionValue":{"type":"string"},"deliveryMode":{"type":"string","enum":["share","duplicate"]},"destinationType":{"anyOf":[{"type":"string","enum":["personal","project"]},{"type":"null"}]},"targetProjectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissionLevel":{"anyOf":[{"type":"string"},{"type":"null"}]},"isEnabled":{"type":"boolean"},"backfillExistingUsers":{"type":"boolean"},"applyToFutureUsers":{"type":"boolean"},"createdByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"artifactCount":{"type":"number"},"artifacts":{"type":"array","items":{"type":"object","properties":{"artifactType":{"type":"string","enum":["project","folder","workflow","skill","skill_category","playbook","tabular_review","tabular_review_template"]},"artifactId":{"type":"string"}},"required":["artifactType","artifactId"],"additionalProperties":false}},"appliedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"failedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"matchedUsersCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"targetProjectName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","conditionType","conditionValue","deliveryMode","destinationType","targetProjectId","permissionLevel","isEnabled","backfillExistingUsers","applyToFutureUsers","createdByUserId","createdAt","updatedAt","artifactCount","artifacts","appliedCount","failedCount","matchedUsersCount","targetProjectName"],"additionalProperties":false}}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"post":{"operationId":"sharing-policies-create","summary":"Create a sharing policy","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"conditionType":{"type":"string","enum":["organization_membership","email_exact","email_domain","all_users"]},"conditionValue":{"type":"string","minLength":1},"deliveryMode":{"type":"string","enum":["share","duplicate"]},"destinationType":{"anyOf":[{"type":"string","enum":["personal","project"]},{"type":"null"}]},"targetProjectId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"permissionLevel":{"anyOf":[{"type":"string","enum":["owner","editor","viewer"]},{"type":"null"}]},"isEnabled":{"type":"boolean"},"backfillExistingUsers":{"type":"boolean"},"applyToFutureUsers":{"default":true,"type":"boolean"},"artifacts":{"minItems":1,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"artifactType":{"type":"string","enum":["project","folder","workflow","skill","skill_category","playbook","tabular_review","tabular_review_template"]}},"required":["artifactId","artifactType"]}}},"required":["name","conditionType","conditionValue","deliveryMode","destinationType","targetProjectId","permissionLevel","isEnabled","backfillExistingUsers","artifacts"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"conditionType":{"type":"string","enum":["organization_membership","email_exact","email_domain","all_users"]},"conditionValue":{"type":"string"},"deliveryMode":{"type":"string","enum":["share","duplicate"]},"destinationType":{"anyOf":[{"type":"string","enum":["personal","project"]},{"type":"null"}]},"targetProjectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissionLevel":{"anyOf":[{"type":"string"},{"type":"null"}]},"isEnabled":{"type":"boolean"},"backfillExistingUsers":{"type":"boolean"},"applyToFutureUsers":{"type":"boolean"},"createdByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"artifactCount":{"type":"number"},"artifacts":{"type":"array","items":{"type":"object","properties":{"artifactType":{"type":"string","enum":["project","folder","workflow","skill","skill_category","playbook","tabular_review","tabular_review_template"]},"artifactId":{"type":"string"}},"required":["artifactType","artifactId"],"additionalProperties":false}},"appliedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"failedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"matchedUsersCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"targetProjectName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","conditionType","conditionValue","deliveryMode","destinationType","targetProjectId","permissionLevel","isEnabled","backfillExistingUsers","applyToFutureUsers","createdByUserId","createdAt","updatedAt","artifactCount","artifacts","appliedCount","failedCount","matchedUsersCount","targetProjectName"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/sharing-policies/preview-matches":{"post":{"operationId":"sharing-policies-previewMatches","summary":"Preview how many accounts an audience condition reaches","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"conditionType":{"type":"string","enum":["organization_membership","email_exact","email_domain","all_users"]},"conditionValue":{"type":"string"}},"required":["conditionType","conditionValue"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"matchedUsersCount":{"type":"number"}},"required":["matchedUsersCount"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/sharing-policies/{policyId}":{"get":{"operationId":"sharing-policies-get","summary":"Get a sharing policy","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"policyId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"conditionType":{"type":"string","enum":["organization_membership","email_exact","email_domain","all_users"]},"conditionValue":{"type":"string"},"deliveryMode":{"type":"string","enum":["share","duplicate"]},"destinationType":{"anyOf":[{"type":"string","enum":["personal","project"]},{"type":"null"}]},"targetProjectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissionLevel":{"anyOf":[{"type":"string"},{"type":"null"}]},"isEnabled":{"type":"boolean"},"backfillExistingUsers":{"type":"boolean"},"applyToFutureUsers":{"type":"boolean"},"createdByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"artifactCount":{"type":"number"},"artifacts":{"type":"array","items":{"type":"object","properties":{"artifactType":{"type":"string","enum":["project","folder","workflow","skill","skill_category","playbook","tabular_review","tabular_review_template"]},"artifactId":{"type":"string"}},"required":["artifactType","artifactId"],"additionalProperties":false}},"appliedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"failedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"matchedUsersCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"targetProjectName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","conditionType","conditionValue","deliveryMode","destinationType","targetProjectId","permissionLevel","isEnabled","backfillExistingUsers","applyToFutureUsers","createdByUserId","createdAt","updatedAt","artifactCount","artifacts","appliedCount","failedCount","matchedUsersCount","targetProjectName"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"put":{"operationId":"sharing-policies-update","summary":"Update a sharing policy","description":"Replaces the policy's fields and artifact set. The artifacts array is authoritative: anything omitted is removed along with its delivery history. Omitting applyToFutureUsers preserves the stored value.","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"policyId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"conditionType":{"type":"string","enum":["organization_membership","email_exact","email_domain","all_users"]},"conditionValue":{"type":"string","minLength":1},"deliveryMode":{"type":"string","enum":["share","duplicate"]},"destinationType":{"anyOf":[{"type":"string","enum":["personal","project"]},{"type":"null"}]},"targetProjectId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"permissionLevel":{"anyOf":[{"type":"string","enum":["owner","editor","viewer"]},{"type":"null"}]},"isEnabled":{"type":"boolean"},"backfillExistingUsers":{"type":"boolean"},"applyToFutureUsers":{"type":"boolean"},"artifacts":{"minItems":1,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"artifactType":{"type":"string","enum":["project","folder","workflow","skill","skill_category","playbook","tabular_review","tabular_review_template"]}},"required":["artifactId","artifactType"]}}},"required":["name","conditionType","conditionValue","deliveryMode","destinationType","targetProjectId","permissionLevel","isEnabled","backfillExistingUsers","artifacts"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"conditionType":{"type":"string","enum":["organization_membership","email_exact","email_domain","all_users"]},"conditionValue":{"type":"string"},"deliveryMode":{"type":"string","enum":["share","duplicate"]},"destinationType":{"anyOf":[{"type":"string","enum":["personal","project"]},{"type":"null"}]},"targetProjectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissionLevel":{"anyOf":[{"type":"string"},{"type":"null"}]},"isEnabled":{"type":"boolean"},"backfillExistingUsers":{"type":"boolean"},"applyToFutureUsers":{"type":"boolean"},"createdByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"artifactCount":{"type":"number"},"artifacts":{"type":"array","items":{"type":"object","properties":{"artifactType":{"type":"string","enum":["project","folder","workflow","skill","skill_category","playbook","tabular_review","tabular_review_template"]},"artifactId":{"type":"string"}},"required":["artifactType","artifactId"],"additionalProperties":false}},"appliedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"failedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"matchedUsersCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"targetProjectName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","conditionType","conditionValue","deliveryMode","destinationType","targetProjectId","permissionLevel","isEnabled","backfillExistingUsers","applyToFutureUsers","createdByUserId","createdAt","updatedAt","artifactCount","artifacts","appliedCount","failedCount","matchedUsersCount","targetProjectName"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"sharing-policies-delete","summary":"Delete a sharing policy","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"policyId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"patch":{"operationId":"sharing-policies-toggleEnabled","summary":"Enable or disable a sharing policy","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"policyId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"isEnabled":{"type":"boolean"}},"required":["isEnabled"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"conditionType":{"type":"string","enum":["organization_membership","email_exact","email_domain","all_users"]},"conditionValue":{"type":"string"},"deliveryMode":{"type":"string","enum":["share","duplicate"]},"destinationType":{"anyOf":[{"type":"string","enum":["personal","project"]},{"type":"null"}]},"targetProjectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissionLevel":{"anyOf":[{"type":"string"},{"type":"null"}]},"isEnabled":{"type":"boolean"},"backfillExistingUsers":{"type":"boolean"},"applyToFutureUsers":{"type":"boolean"},"createdByUserId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"artifactCount":{"type":"number"},"artifacts":{"type":"array","items":{"type":"object","properties":{"artifactType":{"type":"string","enum":["project","folder","workflow","skill","skill_category","playbook","tabular_review","tabular_review_template"]},"artifactId":{"type":"string"}},"required":["artifactType","artifactId"],"additionalProperties":false}},"appliedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"failedCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"matchedUsersCount":{"anyOf":[{"type":"number"},{"type":"null"}]},"targetProjectName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","conditionType","conditionValue","deliveryMode","destinationType","targetProjectId","permissionLevel","isEnabled","backfillExistingUsers","applyToFutureUsers","createdByUserId","createdAt","updatedAt","artifactCount","artifacts","appliedCount","failedCount","matchedUsersCount","targetProjectName"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/sharing-policies/{policyId}/backfill":{"post":{"operationId":"sharing-policies-backfill","summary":"Deliver a sharing policy to existing matching accounts","description":"Enqueues deliveries for every account the policy matches today and applies what fits the request budget. Huge audiences span requests: hasMore=true means unfinished work — including the enqueue itself, which resumes from a persisted cursor — is completed by the hourly sweep or the next backfill call.","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"policyId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"createdDeliveries":{"type":"number"},"processedUsers":{"type":"number"},"hasMore":{"type":"boolean"}},"required":["createdDeliveries","processedUsers","hasMore"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/sharing-policies/retry-failures":{"post":{"operationId":"sharing-policies-retryFailures","summary":"Retry failed sharing deliveries","description":"Resets failed deliveries to pending (optionally scoped to one policy) and drains what fits the request budget.","tags":["Sharing Policies"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"policyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"processedUsers":{"type":"number"},"hasMore":{"type":"boolean"}},"required":["processedUsers","hasMore"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/skills":{"get":{"operationId":"skills-list","summary":"List skills","description":"Lists the skills visible to the caller in a project scope. Personal skills (not attached to any project) are included in every scope unless includePersonal is false; pass projectId=\"personal\" for personal skills only.","tags":["Skills"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"projectId","schema":{"anyOf":[{"type":"string","const":"personal"},{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}]},"required":true},{"in":"query","name":"search","schema":{"type":"string","maxLength":500}},{"in":"query","name":"includePersonal","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"isPinned":{"type":"boolean"},"preShared":{"type":"boolean"},"isPersonal":{"type":"boolean"},"permissionLevel":{"type":"string","enum":["owner","editor","viewer"]},"owner":{"type":"string"},"ownerName":{"type":"string"},"ownerImageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"categoryIds":{"type":"array","items":{"type":"string"}},"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"type":"number"},"type":{"type":"string","enum":["document","folder","workflow","playbook","tabular-review"]}},"required":["id","name","position","type"],"additionalProperties":false}},"bodyPreview":{"type":"string"}},"required":["id","name","slug","description","createdAt","isPinned","preShared","isPersonal","permissionLevel","owner","ownerName","ownerImageUrl","categoryIds","resources","bodyPreview"],"additionalProperties":false}}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"post":{"operationId":"skills-create","summary":"Create a skill","description":"Creates a skill owned by the caller. Pass projectId=\"personal\" to keep it out of any project.","tags":["Skills"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"body":{"type":"string","minLength":1,"maxLength":40000},"description":{"anyOf":[{"type":"string","maxLength":1024},{"type":"null"}]},"projectId":{"anyOf":[{"type":"string","const":"personal"},{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}]},"resources":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"name":{"anyOf":[{"type":"string","minLength":1,"maxLength":300},{"type":"null"}]},"type":{"type":"string","enum":["document","folder","workflow","playbook","tabular-review"]}},"required":["id","type"]}},"categoryIds":{"maxItems":100,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["name","body","projectId"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"type":"string"},"createdAt":{"type":"string"},"isPinned":{"type":"boolean"},"preShared":{"type":"boolean"},"isPersonal":{"type":"boolean"},"permissionLevel":{"type":"string","enum":["owner","editor","viewer"]},"owner":{"type":"string"},"ownerName":{"type":"string"},"ownerImageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"categoryIds":{"type":"array","items":{"type":"string"}},"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"type":"number"},"type":{"type":"string","enum":["document","folder","workflow","playbook","tabular-review"]}},"required":["id","name","position","type"],"additionalProperties":false}}},"required":["id","name","slug","description","body","createdAt","isPinned","preShared","isPersonal","permissionLevel","owner","ownerName","ownerImageUrl","categoryIds","resources"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/skills/{id}":{"get":{"operationId":"skills-get","summary":"Get a skill","tags":["Skills"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"type":"string"},"createdAt":{"type":"string"},"isPinned":{"type":"boolean"},"preShared":{"type":"boolean"},"isPersonal":{"type":"boolean"},"permissionLevel":{"type":"string","enum":["owner","editor","viewer"]},"owner":{"type":"string"},"ownerName":{"type":"string"},"ownerImageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"categoryIds":{"type":"array","items":{"type":"string"}},"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"type":"number"},"type":{"type":"string","enum":["document","folder","workflow","playbook","tabular-review"]}},"required":["id","name","position","type"],"additionalProperties":false}}},"required":["id","name","slug","description","body","createdAt","isPinned","preShared","isPersonal","permissionLevel","owner","ownerName","ownerImageUrl","categoryIds","resources"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"patch":{"operationId":"skills-update","summary":"Update a skill","description":"Updates a skill. Requires editor access or above.","tags":["Skills"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"body":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string","maxLength":1024},{"type":"null"}]},"resources":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"name":{"anyOf":[{"type":"string","minLength":1,"maxLength":300},{"type":"null"}]},"type":{"type":"string","enum":["document","folder","workflow","playbook","tabular-review"]}},"required":["id","type"]}},"categoryIds":{"maxItems":100,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"type":"string"},"createdAt":{"type":"string"},"isPinned":{"type":"boolean"},"preShared":{"type":"boolean"},"isPersonal":{"type":"boolean"},"permissionLevel":{"type":"string","enum":["owner","editor","viewer"]},"owner":{"type":"string"},"ownerName":{"type":"string"},"ownerImageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"categoryIds":{"type":"array","items":{"type":"string"}},"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"type":"number"},"type":{"type":"string","enum":["document","folder","workflow","playbook","tabular-review"]}},"required":["id","name","position","type"],"additionalProperties":false}}},"required":["id","name","slug","description","body","createdAt","isPinned","preShared","isPersonal","permissionLevel","owner","ownerName","ownerImageUrl","categoryIds","resources"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"skills-remove","summary":"Delete a skill","description":"Soft-deletes a skill. Requires editor access to the skill.","tags":["Skills"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/skills/{id}/duplicate":{"post":{"operationId":"skills-duplicate","summary":"Duplicate a skill","description":"Copies any accessible skill into a new skill owned by the caller.","tags":["Skills"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"anyOf":[{"type":"string","const":"personal"},{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}]}},"required":["projectId"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"type":"string"},"createdAt":{"type":"string"},"isPinned":{"type":"boolean"},"preShared":{"type":"boolean"},"isPersonal":{"type":"boolean"},"permissionLevel":{"type":"string","enum":["owner","editor","viewer"]},"owner":{"type":"string"},"ownerName":{"type":"string"},"ownerImageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"categoryIds":{"type":"array","items":{"type":"string"}},"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"type":"number"},"type":{"type":"string","enum":["document","folder","workflow","playbook","tabular-review"]}},"required":["id","name","position","type"],"additionalProperties":false}}},"required":["id","name","slug","description","body","createdAt","isPinned","preShared","isPersonal","permissionLevel","owner","ownerName","ownerImageUrl","categoryIds","resources"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/uploads/sign":{"post":{"operationId":"upload-signSinglePut","summary":"Get a presigned upload URL","description":"Step 1 of the two-step upload. Returns a presigned CloudFront URL; PUT the raw file bytes to it (Content-Type must match), then call POST /uploads/register with the returned bucket + key and the destination folderId (resolve a folder name via GET /folders/resolve). Suitable for files up to a single part (~25MB); larger files use the multipart procedures.","tags":["Uploads"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contentType":{"type":"string","minLength":1},"fileName":{"type":"string"},"fileSize":{"type":"integer","minimum":0,"maximum":9007199254740991},"uploadAttemptId":{"type":"string"},"uploadBatchId":{"type":"string"},"expiresInSeconds":{"type":"integer","exclusiveMinimum":0,"maximum":604800}},"required":["contentType"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"bucket":{"type":"string","minLength":1},"key":{"type":"string"},"url":{"type":"string"},"routePrefix":{"type":"string"},"uploadAttemptId":{"type":"string"},"region":{"type":"string"},"uploadRegion":{"type":"string"}},"required":["bucket","key","url","routePrefix","region","uploadRegion"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/uploads/register":{"post":{"operationId":"upload-register","summary":"Register uploaded files","description":"Step 2 of the two-step upload. After PUTting bytes to a presigned URL from POST /uploads/sign, register each file into a destination folder (folderId — resolve a folder name via GET /folders/resolve). Requires editor access to each destination folder; files targeting folders where the caller is viewer-only fail per-file with a FORBIDDEN error. Returns a per-file result array in submission order; each entry is either {ok:true, docId, status} or {ok:false, error}.","tags":["Uploads"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"files":{"minItems":1,"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string","minLength":1},"key":{"type":"string","minLength":1},"fileName":{"type":"string","minLength":1},"folderId":{"type":"string","minLength":1},"password":{"type":"string"},"fileSize":{"type":"integer","minimum":0,"maximum":9007199254740991},"uploadAttemptId":{"type":"string"},"archiveFormat":{"type":"string","const":"production"},"sourcePreference":{"type":"string","enum":["auto","native_only","image_only"]},"checksumCrc64":{"type":"string"}},"required":["bucket","key","fileName","folderId"]}},"uploadBatchId":{"type":"string"}},"required":["files"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"files":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"string"}},"required":["ok","error"],"additionalProperties":false},{"type":"object","properties":{"ok":{"type":"boolean","const":true},"docId":{"type":"string"},"status":{"type":"string"},"zipUpload":{"type":"object","properties":{"zipId":{"type":"string"},"fileName":{"type":"string"},"status":{"type":"string"}},"required":["zipId","fileName","status"],"additionalProperties":false}},"required":["ok","docId","status"],"additionalProperties":false}],"type":"object"}}},"required":["files"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tags":{"get":{"operationId":"tags-list","summary":"List tags","description":"Lists all of the caller's tags.","tags":["Tags"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"projectId","schema":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"owner_user_id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","owner_user_id","name","description","color","created_at","updated_at"],"additionalProperties":false}}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"post":{"operationId":"tags-create","summary":"Create a tag","tags":["Tags"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"name":{"type":"string","maxLength":128},"description":{"type":"string","maxLength":2000},"color":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}]}},"required":["name"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"owner_user_id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","owner_user_id","name","description","color","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tags/{tagId}":{"patch":{"operationId":"tags-update","summary":"Update a tag","tags":["Tags"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"tagId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":128},"description":{"type":"string","maxLength":2000},"color":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}]}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"owner_user_id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","owner_user_id","name","description","color","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"tags-delete","summary":"Delete a tag","description":"Deletes a tag the caller owns, clearing its assignments first.","tags":["Tags"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"tagId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/tags/{tagId}/assignments":{"post":{"operationId":"tags-assign","summary":"Assign a tag","description":"Assigns a tag to a document, chat, or agent.","tags":["Tags"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"tagId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entityType":{"type":"string","enum":["document","chat","workflow"]},"entityId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},"required":["entityType","entityId"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"delete":{"operationId":"tags-unassign","summary":"Unassign a tag","description":"Removes a tag from a document, chat, or agent. entityType and entityId ride as query parameters.","tags":["Tags"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"tagId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"required":true},{"in":"query","name":"entityType","schema":{"type":"string","enum":["document","chat","workflow"]},"required":true},{"in":"query","name":"entityId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/workflows":{"get":{"operationId":"workflows-list","summary":"List accessible agents","description":"List the agents the caller owns or has been shared, most recent first. Use the returned id with GET /workflows/{workflowId}/run-inputs to see how to run one, then POST /workflows/{workflowId}/run to trigger it.","tags":["Agents"],"security":[{"Authorization":[]}],"parameters":[{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"default":50,"type":"number","minimum":1}},{"in":"query","name":"offset","schema":{"default":0,"type":"number","minimum":0}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"isEnabled":{"type":"boolean"},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","description","isEnabled","createdAt"],"additionalProperties":false}},"total":{"type":"number"}},"required":["items","total"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"post":{"operationId":"workflows-createFromPrompt","summary":"Create an agent from a prompt","description":"Generates a runnable agent draft from a natural-language prompt and saves it. Reuse idempotencyKey to dedupe retries. Trigger provisioning is best-effort — failures return in triggerWarnings.","tags":["Agents"],"security":[{"Authorization":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{"type":"string","minLength":1,"maxLength":20000},"projectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"idempotencyKey":{"type":"string","minLength":1,"maxLength":256}},"required":["prompt"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"workflowId":{"type":"string"},"name":{"type":"string"},"created":{"type":"boolean"},"alreadyExisted":{"type":"boolean"},"idempotencyKey":{"type":"string"},"triggerWarnings":{"type":"array","items":{"type":"string"}}},"required":["workflowId","name","created","alreadyExisted","idempotencyKey","triggerWarnings"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/workflows/{workflowId}/run-inputs":{"get":{"operationId":"workflows-getRunInputs","summary":"Get an agent's run inputs","description":"Describe how to run an agent: the per-run input fields to answer (via the `inputs` map on POST /workflows/{workflowId}/run) and the default attachments the run inherits. 404 if the agent is inaccessible or has no runnable version.","tags":["Agents"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"workflowId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true},{"in":"query","name":"projectId","schema":{"default":"personal","type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"workflowId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentVersionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"goal":{"type":"string"},"inputs":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["file","folder","playbook","tabular_review","workflow","choice","text","recipients"]},"required":{"type":"boolean"},"description":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"default":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","kind"],"additionalProperties":false}},"file_ids":{"type":"array","items":{"type":"string"}},"folder_ids":{"type":"array","items":{"type":"string"}},"tabular_review_ids":{"type":"array","items":{"type":"string"}},"playbook_ids":{"type":"array","items":{"type":"string"}},"workflow_ids":{"type":"array","items":{"type":"string"}},"skill_ids":{"type":"array","items":{"type":"string"}},"input_defaults":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["fields","file_ids","folder_ids","tabular_review_ids","playbook_ids","workflow_ids","skill_ids","input_defaults"],"additionalProperties":false}},"required":["workflowId","name","description","currentVersionId","goal","inputs"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/workflows/{workflowId}/definition":{"get":{"operationId":"workflows-getDefinition","summary":"Get an agent's definition","description":"Read an agent's name, description, and the full definition JSON of its current version (goal, strategy, steps, inputs, outputs). Edit agents read-modify-write style: adjust this definition, then PUT /workflows/{workflowId}/definition, passing currentVersionId as expectedCurrentVersionId to detect concurrent edits. 404 if the agent is inaccessible or has no version yet.","tags":["Agents"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"workflowId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true},{"in":"query","name":"projectId","schema":{"default":"personal","type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"workflowId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentVersionId":{"type":"string"},"currentVersionNumber":{"type":"number"},"definition":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["workflowId","name","description","currentVersionId","currentVersionNumber","definition"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}},"put":{"operationId":"workflows-updateDefinition","summary":"Update an agent's definition","description":"Replace an agent's name, description, and definition by creating a new immutable version and pointing the agent at it (previous versions are kept, so a bad edit is rolled back by re-saving the prior definition). Read the current state with GET /workflows/{workflowId}/definition first and pass its currentVersionId as expectedCurrentVersionId — the update then fails with 412 instead of overwriting a concurrent edit.","tags":["Agents"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"workflowId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"default":"personal","type":"string"},"name":{"type":"string","minLength":1},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"definition":{"type":"object","properties":{"schema_version":{"default":1,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"goal":{"default":"Agent execution","type":"string"},"strategy":{"anyOf":[{"type":"string"},{"type":"null"}]},"allow_human_input":{"type":"boolean"},"steps":{"minItems":1,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"reasoning":{"type":"string"},"type":{"type":"string","const":"analysis"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"tool_inputs_description":{"type":"string"},"human_input":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"type":"string"}}},{"type":"null"}]},"condition":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["input","human_input","step_output"]},"key":{"type":"string"},"step_key":{"type":"string"},"path":{"type":"string"}},"required":["kind"]},{"type":"null"}]},"convergence_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"never_rejoin":{"type":"boolean"},"branches":{"default":[],"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"condition":{"type":"string"},"target_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"skip_step_ids":{"type":"array","items":{"type":"string"}}},"required":["label"]}}}},{"type":"null"}]}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"reasoning":{"type":"string"},"type":{"type":"string","const":"synthesis"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"tool_inputs_description":{"type":"string"},"human_input":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"type":"string"}}},{"type":"null"}]},"condition":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["input","human_input","step_output"]},"key":{"type":"string"},"step_key":{"type":"string"},"path":{"type":"string"}},"required":["kind"]},{"type":"null"}]},"convergence_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"never_rejoin":{"type":"boolean"},"branches":{"default":[],"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"condition":{"type":"string"},"target_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"skip_step_ids":{"type":"array","items":{"type":"string"}}},"required":["label"]}}}},{"type":"null"}]}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"reasoning":{"type":"string"},"type":{"type":"string","const":"tool_call"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"tool_inputs_description":{"type":"string"},"human_input":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"type":"string"}}},{"type":"null"}]},"condition":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["input","human_input","step_output"]},"key":{"type":"string"},"step_key":{"type":"string"},"path":{"type":"string"}},"required":["kind"]},{"type":"null"}]},"convergence_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"never_rejoin":{"type":"boolean"},"branches":{"default":[],"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"condition":{"type":"string"},"target_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"skip_step_ids":{"type":"array","items":{"type":"string"}}},"required":["label"]}}}},{"type":"null"}]}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"reasoning":{"type":"string"},"type":{"type":"string","const":"human_input"},"human_input":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"type":"string"}}},{"type":"null"}]},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"tool_inputs_description":{"type":"string"},"condition":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["input","human_input","step_output"]},"key":{"type":"string"},"step_key":{"type":"string"},"path":{"type":"string"}},"required":["kind"]},{"type":"null"}]},"convergence_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"never_rejoin":{"type":"boolean"},"branches":{"default":[],"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"condition":{"type":"string"},"target_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"skip_step_ids":{"type":"array","items":{"type":"string"}}},"required":["label"]}}}},{"type":"null"}]}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"reasoning":{"type":"string"},"type":{"type":"string","const":"condition"},"condition":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["input","human_input","step_output"]},"key":{"type":"string"},"step_key":{"type":"string"},"path":{"type":"string"}},"required":["kind"]},{"type":"null"}]},"convergence_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"never_rejoin":{"type":"boolean"},"branches":{"default":[],"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"condition":{"type":"string"},"target_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"skip_step_ids":{"type":"array","items":{"type":"string"}}},"required":["label"]}}}},{"type":"null"}]},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"tool_inputs_description":{"type":"string"},"human_input":{"anyOf":[{"type":"object","properties":{"prompt":{"type":"string"},"input_key":{"type":"string"}}},{"type":"null"}]}},"required":["id","type"]}],"type":"object"}},"output":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"description":{"type":"string"},"source_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"formats":{"type":"array","items":{"type":"string"}}}},{"type":"null"}]},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string"},"description":{"type":"string"},"source_step_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"formats":{"type":"array","items":{"type":"string"}}}}},"inputs":{"default":{"file_ids":[],"folder_ids":[],"tabular_review_ids":[],"playbook_ids":[],"workflow_ids":[],"skill_ids":[],"input_defaults":{},"fields":[]},"type":"object","properties":{"file_ids":{"default":[],"type":"array","items":{"type":"string"}},"folder_ids":{"default":[],"type":"array","items":{"type":"string"}},"tabular_review_ids":{"default":[],"type":"array","items":{"type":"string"}},"playbook_ids":{"default":[],"type":"array","items":{"type":"string"}},"workflow_ids":{"default":[],"type":"array","items":{"type":"string"}},"skill_ids":{"default":[],"type":"array","items":{"type":"string"}},"input_defaults":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"fields":{"default":[],"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["file","folder","playbook","tabular_review","workflow","choice","text","recipients"]},"required":{"type":"boolean"},"description":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"default":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","kind"]}}}}},"required":["steps"]},"expectedCurrentVersionId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["name","description","definition"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workflow_id":{"type":"string"},"version_number":{"type":"number"},"created_by":{"type":"string"},"created_at":{"type":"string"}},"required":["id","workflow_id","version_number","created_by","created_at"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/workflows/{workflowId}/runs":{"get":{"operationId":"workflows-listRuns","summary":"List an agent's runs","description":"List the agent runs visible to the caller — the ones they triggered, plus any whose chat was explicitly shared with them — most recent first (keyset-paginated by cursor). Each item carries the run's status and produced documents; use GET /workflows/{workflowId}/runs/{runId} for the full run payload.","tags":["Agents"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"workflowId","schema":{"type":"string"},"required":true},{"in":"query","name":"projectId","schema":{"default":"personal","type":"string"}},{"in":"query","name":"limit","schema":{"default":20,"type":"number","minimum":1,"maximum":100}},{"in":"query","name":"cursor","schema":{"anyOf":[{"type":"string"},{"type":"null"}]}},{"in":"query","name":"runnerEmail","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workflow_id":{"type":"string"},"workflow_version_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"version_number":{"anyOf":[{"type":"number"},{"type":"null"}]},"chat_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"question_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"trigger_type":{"type":"string","enum":["manual","scheduled","event"]},"created_at":{"type":"string"},"user_email":{"type":"string"},"status":{"default":"pending","type":"string","enum":["pending","running","waiting","succeeded","failed","cancelled"]},"source_event_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"source_trigger_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"parent_run_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"root_run_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"error":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelled_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"type":"string","enum":["succeeded","succeeded_with_warnings"]},{"type":"null"}]},"producedDocuments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","type"],"additionalProperties":false}},"runner":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","first_name","last_name","image_url"],"additionalProperties":false},{"type":"null"}]}},"required":["id","workflow_id","workflow_version_id","version_number","chat_id","question_id","trigger_type","created_at","user_email","status","source_event_id","parent_run_id","root_run_id","error","started_at","completed_at","cancelled_at","producedDocuments","runner"],"additionalProperties":false}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"totalCount":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["runs","nextCursor","totalCount"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/workflows/{workflowId}/runs/{runId}":{"get":{"operationId":"workflows-getRun","summary":"Get an agent run","description":"Status and result of a single run: its status, resolved inputs, final output / error, and produced documents. Poll this after POST /workflows/{workflowId}/run until status is succeeded/failed/cancelled.","tags":["Agents"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"workflowId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true},{"in":"path","name":"runId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true},{"in":"query","name":"projectId","schema":{"default":"personal","type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string"},"workflow_id":{"type":"string"},"workflow_version_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"version_number":{"anyOf":[{"type":"number"},{"type":"null"}]},"chat_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"question_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"trigger_type":{"type":"string","enum":["manual","scheduled","event"]},"created_at":{"type":"string"},"user_email":{"type":"string"},"status":{"default":"pending","type":"string","enum":["pending","running","waiting","succeeded","failed","cancelled"]},"outcome":{"anyOf":[{"type":"string","enum":["succeeded","succeeded_with_warnings"]},{"type":"null"}]},"source_event_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"source_trigger_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"resolved_inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"final_output":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"cancelled_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","workflow_id","workflow_version_id","version_number","chat_id","question_id","trigger_type","created_at","user_email","status","outcome","source_event_id","resolved_inputs","final_output","error","started_at","completed_at","cancelled_at"],"additionalProperties":false},"producedDocuments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","type"],"additionalProperties":false}}},"required":["run","producedDocuments"],"additionalProperties":false}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.NOT_FOUND"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}},"/workflows/{workflowId}/run":{"post":{"operationId":"workflows-trigger","summary":"Run an agent","description":"Trigger a manual run of an agent. Attachments (file_ids/folder_ids/…) and the `inputs` map override the agent's defaults; omit them to run with the defaults from GET /workflows/{workflowId}/run-inputs. Returns run_id immediately — poll GET /workflows/{workflowId}/runs/{run_id} for status and output.","tags":["Agents"],"security":[{"Authorization":[]}],"parameters":[{"in":"path","name":"workflowId","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"default":"personal","type":"string"},"file_ids":{"type":"array","items":{"type":"string"}},"folder_ids":{"type":"array","items":{"type":"string"}},"tabular_review_ids":{"type":"array","items":{"type":"string"}},"playbook_ids":{"type":"array","items":{"type":"string"}},"workflow_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"workflow_ids_override":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"skill_ids":{"type":"array","items":{"type":"string"}},"email_ids":{"type":"array","items":{"type":"string"}},"run_context":{"type":"string"},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"input_bindings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"file_ids":{"type":"array","items":{"type":"string"}},"folder_ids":{"type":"array","items":{"type":"string"}},"tabular_review_ids":{"type":"array","items":{"type":"string"}},"playbook_ids":{"type":"array","items":{"type":"string"}},"workflow_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"additionalProperties":false}},"allow_human_input":{"description":"Defaults to true. When false, the run can never ask a person for anything: it does its best with the attached inputs and defaults, and fails with the missing items named only when the deliverable cannot be produced without them.","type":"boolean"}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"run_id":{"type":"string"},"workflow_id":{"type":"string"},"chat_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"question_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"message":{"type":"string"}},"required":["run_id","workflow_id","message"],"additionalProperties":false,"description":"Response model for triggered workflow run."}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.BAD_REQUEST"}}}},"401":{"description":"Authorization not provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.UNAUTHORIZED"}}}},"403":{"description":"Insufficient access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.FORBIDDEN"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.INTERNAL_SERVER_ERROR"}}}}}}}},"components":{"schemas":{"error.BAD_REQUEST":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Invalid input data"},"code":{"type":"string","description":"The error code","example":"BAD_REQUEST"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Invalid input data error (400)","description":"The error information","example":{"code":"BAD_REQUEST","message":"Invalid input data","issues":[]}},"error.UNAUTHORIZED":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Authorization not provided"},"code":{"type":"string","description":"The error code","example":"UNAUTHORIZED"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Authorization not provided error (401)","description":"The error information","example":{"code":"UNAUTHORIZED","message":"Authorization not provided","issues":[]}},"error.FORBIDDEN":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Insufficient access"},"code":{"type":"string","description":"The error code","example":"FORBIDDEN"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Insufficient access error (403)","description":"The error information","example":{"code":"FORBIDDEN","message":"Insufficient access","issues":[]}},"error.NOT_FOUND":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Not found"},"code":{"type":"string","description":"The error code","example":"NOT_FOUND"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Not found error (404)","description":"The error information","example":{"code":"NOT_FOUND","message":"Not found","issues":[]}},"error.INTERNAL_SERVER_ERROR":{"type":"object","properties":{"message":{"type":"string","description":"The error message","example":"Internal server error"},"code":{"type":"string","description":"The error code","example":"INTERNAL_SERVER_ERROR"},"issues":{"description":"An array of issues that were responsible for the error","example":[],"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false,"title":"Internal server error error (500)","description":"The error information","example":{"code":"INTERNAL_SERVER_ERROR","message":"Internal server error","issues":[]}},"__schema0":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"children":{"type":"array","items":{"$ref":"#/components/schemas/__schema0"}},"documentCount":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","name","description","children","documentCount"],"additionalProperties":false}},"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer","description":"Clerk API key (prefixed `ak_`). Create and manage keys from your August account settings."}}}}