{"openapi":"3.0.3","info":{"title":"PdfParse API","version":"1.0.0","description":"PdfParse REST API for project-scoped tables, rows, documents, and jobs."},"servers":[{"url":"/v1","description":"Versioned API server"}],"tags":[{"name":"System"},{"name":"Tables"},{"name":"Rows"},{"name":"Documents"},{"name":"Jobs"},{"name":"Uploads"},{"name":"Webhooks"},{"name":"Extraction Attempts"},{"name":"Routing Rules"},{"name":"Splitters"},{"name":"SQL"}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"Project-scoped user API key"}},"schemas":{},"parameters":{}},"paths":{"/health":{"get":{"tags":["System"],"summary":"Health check","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/openapi.json":{"get":{"tags":["System"],"summary":"Fetch OpenAPI document","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/docs":{"get":{"tags":["System"],"summary":"Swagger UI HTML","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/tables":{"post":{"tags":["Tables"],"summary":"Create table","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"prompt":{"type":"string"},"primaryKey":{"type":"boolean"},"unique":{"type":"boolean"},"autoIncrement":{"type":"boolean"},"nullable":{"type":"boolean"},"reanalyzeExisting":{"type":"boolean"},"type":{"type":"string","enum":["text","number","date","boolean","foreign_key"]},"referencedTable":{"type":"string"},"referencedColumn":{"type":"string"},"parentTable":{"type":"string"}},"required":["name","prompt"]},"minItems":1},"inlineArrays":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"prompt":{"type":"string"},"primaryKey":{"type":"boolean"},"unique":{"type":"boolean"},"autoIncrement":{"type":"boolean"},"nullable":{"type":"boolean"},"reanalyzeExisting":{"type":"boolean"},"type":{"type":"string","enum":["text","number","date","boolean","foreign_key"]},"referencedTable":{"type":"string"},"referencedColumn":{"type":"string"},"parentTable":{"type":"string"}},"required":["name","prompt"]}}},"required":["name","columns"]}},"childTables":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"prompt":{"type":"string"},"primaryKey":{"type":"boolean"},"unique":{"type":"boolean"},"autoIncrement":{"type":"boolean"},"nullable":{"type":"boolean"},"reanalyzeExisting":{"type":"boolean"},"type":{"type":"string","enum":["text","number","date","boolean","foreign_key"]},"referencedTable":{"type":"string"},"referencedColumn":{"type":"string"},"parentTable":{"type":"string"}},"required":["name","prompt"]}}},"required":["name","columns"]}}},"required":["name","columns"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"get":{"tags":["Tables"],"summary":"List tables","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/tables/{table_id}":{"get":{"tags":["Tables"],"summary":"Get table","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"table_id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"patch":{"tags":["Tables"],"summary":"Update table","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"table_id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"prompt":{"type":"string"},"primaryKey":{"type":"boolean"},"unique":{"type":"boolean"},"autoIncrement":{"type":"boolean"},"nullable":{"type":"boolean"},"reanalyzeExisting":{"type":"boolean"},"type":{"type":"string","enum":["text","number","date","boolean","foreign_key"]},"referencedTable":{"type":"string"},"referencedColumn":{"type":"string"},"parentTable":{"type":"string"}},"required":["name","prompt"]},"minItems":1}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"delete":{"tags":["Tables"],"summary":"Delete table","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"table_id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/rows":{"post":{"tags":["Rows"],"summary":"Insert row","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"table_id":{"type":"string","minLength":1},"document_record_id":{"type":"string","minLength":1},"values":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"array","items":{"nullable":true}},{"type":"object","additionalProperties":{"nullable":true}}]}}},"required":["table_id","values"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"row_id":{"type":"string"},"document_record_id":{"type":"string"},"row":{"type":"object","nullable":true,"properties":{"row_id":{"type":"string"}},"required":["row_id"],"additionalProperties":{"nullable":true}}},"required":["row_id","document_record_id","row"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"get":{"tags":["Rows"],"summary":"List rows","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"table_id","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"number"},"pageSize":{"type":"number"},"total":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{"row_id":{"type":"string"}},"required":["row_id"],"additionalProperties":{"nullable":true}}},"pageCount":{"type":"number"}},"required":["page","pageSize","total","results","pageCount"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/rows/search":{"post":{"tags":["Rows"],"summary":"Query rows","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"table_id":{"type":"string","minLength":1},"filters":{"type":"array","items":{"type":"object","properties":{"column":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","ne","gt","gte","lt","lte","like","in"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"array","items":{"nullable":true}},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"array","items":{"nullable":true}},{"type":"object","additionalProperties":{"nullable":true}}]}}]}},"required":["column","op","value"]},"default":[]},"orderBy":{"type":"object","properties":{"column":{"type":"string","minLength":1},"direction":{"type":"string","enum":["asc","desc"],"default":"asc"}},"required":["column"]},"page":{"type":"integer","minimum":1,"default":1},"pageSize":{"type":"integer","minimum":1,"maximum":200,"default":50}},"required":["table_id"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"number"},"pageSize":{"type":"number"},"total":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{"row_id":{"type":"string"}},"required":["row_id"],"additionalProperties":{"nullable":true}}},"pageCount":{"type":"number"}},"required":["page","pageSize","total","results","pageCount"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/rows/{row_id}":{"patch":{"tags":["Rows"],"summary":"Update row","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"row_id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"values":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"array","items":{"nullable":true}},{"type":"object","additionalProperties":{"nullable":true}}]}}},"required":["values"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"row_id":{"type":"string"},"row":{"type":"object","properties":{"row_id":{"type":"string"}},"required":["row_id"],"additionalProperties":{"nullable":true}}},"required":["row_id","row"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"delete":{"tags":["Rows"],"summary":"Delete row","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"row_id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/documents":{"get":{"tags":["Documents"],"summary":"List documents","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"document_record_id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","nullable":true},"file_size":{"type":"number","nullable":true},"page_count":{"type":"number","nullable":true},"table_id":{"type":"string","nullable":true},"tableName":{"type":"string","nullable":true},"tableSlug":{"type":"string","nullable":true},"routingStatus":{"type":"string","nullable":true},"routingConfidence":{"type":"number","nullable":true},"routingReasoning":{"type":"string","nullable":true},"routingError":{"type":"string","nullable":true},"routingRuleId":{"type":"string","nullable":true},"routingRuleName":{"type":"string","nullable":true},"routingSuggestedTableId":{"type":"string","nullable":true},"routingThreshold":{"type":"number","nullable":true},"created_at":{"type":"string","nullable":true}},"required":["id","document_record_id","name","status","file_size","page_count","table_id","tableName","tableSlug","routingStatus","routingConfidence","routingReasoning","routingError","routingRuleId","routingRuleName","routingSuggestedTableId","routingThreshold","created_at"]}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/documents/{document_id}":{"get":{"tags":["Documents"],"summary":"Get document","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"document_id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"file_id":{"type":"string"},"upload_id":{"type":"string","nullable":true},"name":{"type":"string"},"status":{"type":"string","nullable":true},"file_size":{"type":"number","nullable":true},"page_count":{"type":"number","nullable":true},"is_duplicate":{"type":"boolean"},"duplicate_count":{"type":"number"},"mistral_id":{"type":"string","nullable":true},"user_id":{"type":"string","nullable":true},"project_id":{"type":"number","nullable":true},"table_id":{"type":"string","nullable":true},"processed_at":{"type":"string","nullable":true},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true}},"required":["id","file_id","name"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"delete":{"tags":["Documents"],"summary":"Delete a document, source file, and extracted rows","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"document_id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"document_id":{"type":"number"},"workflow_id":{"type":"string"},"status":{"type":"string"}},"required":["document_id","workflow_id","status"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/documents/{document_id}/route":{"post":{"tags":["Documents"],"summary":"Manually route a document and start extraction","description":"Resolve an unclassified document by assigning a destination table in the active project. The document is claimed once and extraction starts immediately.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"document_id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tableId":{"type":"string","minLength":1}},"required":["tableId"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"number"},"workflowId":{"type":"string"}},"required":["success","jobId","workflowId"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/documents/{document_id}/attempts":{"get":{"tags":["Extraction Attempts"],"summary":"List extraction attempts for a document","description":"Review every extraction attempt for a document, newest first, including status, timing, extracted output, and failure details. Use [Get document](/docs/documents/documents/document_id/get) for the source document and [Get job](/docs/jobs/jobs/job_id/get) for its extraction job.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"document_id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number","example":42},"document_id":{"type":"number","example":128},"job_id":{"type":"number","nullable":true,"example":73},"workflow_instance_id":{"type":"string","example":"extract-01J9X2F6A8"},"workflow_type":{"type":"string","example":"document-extraction"},"status":{"type":"string","example":"completed"},"extracted_data":{"nullable":true,"example":{"invoice_number":"INV-1042","total":184.5}},"error_message":{"type":"string","nullable":true},"error_details":{"type":"string","nullable":true},"attempt_number":{"type":"number","example":1},"started_at":{"type":"string","nullable":true,"example":"2026-09-06T14:31:02.000Z"},"completed_at":{"type":"string","nullable":true,"example":"2026-09-06T14:31:08.000Z"},"processing_duration_ms":{"type":"number","nullable":true,"example":6234},"table_id":{"type":"string","example":"01J9X1ZT5TQ1W0R7NM7GX3A2V5"},"tableName":{"type":"string","nullable":true,"example":"Invoices"},"created_at":{"type":"string","nullable":true,"example":"2026-09-06T14:31:02.000Z"}},"required":["id","document_id","job_id","workflow_instance_id","workflow_type","status","error_message","error_details","attempt_number","started_at","completed_at","processing_duration_ms","table_id","tableName","created_at"]}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/tables/{table_id}/failed-attempts":{"get":{"tags":["Extraction Attempts"],"summary":"List latest failed extraction attempts for a table","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"table_id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/jobs":{"post":{"tags":["Jobs"],"summary":"Create extraction job","description":"Queue extraction for uploaded documents into a table. Credits are charged per page. Documents that are already processing, classifying, or attached to an active processing run are rejected with a 409 conflict so concurrent requests cannot double-process a file.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tableSlug":{"type":"string"},"documentKeys":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["tableSlug","documentKeys"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"status":{"type":"string"},"workflow_type":{"type":"string","nullable":true},"table_id":{"type":"string"},"projects_id":{"type":"number"},"processing_mode":{"type":"string","enum":["instant","batch"],"description":"Extraction path chosen for this job. Jobs at or below the project's instant-mode threshold run instantly; larger jobs use the provider batch API."},"document_count":{"type":"integer"},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true}},"required":["id","status","table_id","projects_id","created_at","updated_at"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"get":{"tags":["Jobs"],"summary":"List recent extraction jobs","description":"List jobs in the API key's active project, newest ID first. Optionally filter by status and limit the number returned (1–100).","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["queued","in_progress","completed","failed","waiting"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"status":{"type":"string"},"workflow_type":{"type":"string","nullable":true},"table_id":{"type":"string"},"projects_id":{"type":"number"},"processing_mode":{"type":"string","enum":["instant","batch"],"description":"Extraction path chosen for this job. Jobs at or below the project's instant-mode threshold run instantly; larger jobs use the provider batch API."},"document_count":{"type":"integer"},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true}},"required":["id","status","table_id","projects_id","created_at","updated_at"]}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/jobs/{job_id}":{"get":{"tags":["Jobs"],"summary":"Get job","description":"Return a job with the documents linked to it through their processing runs and any provider batches.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"job_id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"status":{"type":"string"},"workflow_type":{"type":"string","nullable":true},"table_id":{"type":"string"},"projects_id":{"type":"number"},"processing_mode":{"type":"string","enum":["instant","batch"],"description":"Extraction path chosen for this job. Jobs at or below the project's instant-mode threshold run instantly; larger jobs use the provider batch API."},"document_count":{"type":"integer"},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true},"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number","description":"Numeric document ID."},"file_id":{"type":"string","nullable":true},"status":{"type":"string"},"run_status":{"type":"string","nullable":true}},"required":["id","file_id","status"]}},"batches":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["id","status","table_id","projects_id","created_at","updated_at"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/uploads":{"post":{"tags":["Uploads"],"summary":"Create a TUS resumable upload","description":"Requires Tus-Resumable, Upload-Length, and base64-encoded Upload-Metadata headers. Subsequent Location requests remain under /v1/uploads.","security":[{"BearerAuth":[]}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/uploads/{upload_id}":{"head":{"tags":["Uploads"],"summary":"Read a TUS upload offset","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"upload_id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"patch":{"tags":["Uploads"],"summary":"Append bytes to a TUS upload","description":"Continue the resumable upload created by [Create a TUS upload](/docs/uploads/uploads/post). Send the next binary chunk at the offset returned by [Read the upload offset](/docs/uploads/uploads/upload_id/head). A successful request returns the updated offset in the response headers and no response body.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"upload_id","in":"path"},{"schema":{"type":"string","enum":["application/offset+octet-stream"],"description":"TUS upload chunk media type."},"required":true,"description":"TUS upload chunk media type.","name":"Content-Type","in":"header"},{"schema":{"type":"string","description":"Current byte offset before applying this chunk.","example":"1048576"},"required":true,"description":"Current byte offset before applying this chunk.","name":"Upload-Offset","in":"header"},{"schema":{"type":"string","enum":["1.0.0"]},"required":true,"name":"Tus-Resumable","in":"header"}],"requestBody":{"required":true,"content":{"application/offset+octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"204":{"description":"Chunk accepted; continue from the returned Upload-Offset.","headers":{"Upload-Offset":{"schema":{"type":"string","description":"Next byte offset for the upload.","example":"2097152"},"required":true,"description":"Next byte offset for the upload."},"Tus-Resumable":{"schema":{"type":"string","enum":["1.0.0"]},"required":true}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/webhooks":{"post":{"tags":["Webhooks"],"summary":"Create a webhook endpoint","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"description":{"type":"string","maxLength":500},"events":{"type":"array","items":{"type":"string","minLength":1},"minItems":1},"project_id":{"type":"integer"},"signing_secret":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["url","events"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"get":{"tags":["Webhooks"],"summary":"List webhook endpoints","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/webhooks/{id}":{"patch":{"tags":["Webhooks"],"summary":"Update a webhook endpoint","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"description":{"type":"string","nullable":true,"maxLength":500},"events":{"type":"array","items":{"type":"string","minLength":1},"minItems":1},"status":{"type":"string","enum":["active","disabled"]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"delete":{"tags":["Webhooks"],"summary":"Delete a webhook endpoint and its deliveries","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/webhooks/{id}/deliveries":{"get":{"tags":["Webhooks"],"summary":"List webhook delivery attempts","description":"Inspect the delivery history for one webhook endpoint, including event identifiers, retry attempts, response status, and delivery timing. Find endpoint IDs with [List webhook endpoints](/docs/webhooks/webhooks/get) or update delivery settings with [Update a webhook endpoint](/docs/webhooks/webhooks/id/patch).","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"01J9X4BS8MF8XQ3ZXD9AC7V8WP"},"endpoint_id":{"type":"string","example":"01J9X42NVQG5A4EMZH1KD6F2S8"},"event_id":{"type":"string","example":"evt_01J9X4APZC3H1F5M2T8V6R7QK9"},"event_type":{"type":"string","example":"job.completed"},"attempt":{"type":"number","example":1},"status":{"type":"string","example":"delivered"},"request_body":{"type":"string","nullable":true},"signature":{"type":"string","nullable":true},"response_status":{"type":"number","nullable":true,"example":200},"response_body":{"type":"string","nullable":true,"example":"ok"},"delivered_at":{"type":"string","nullable":true,"example":"2026-09-06T14:32:14.000Z"},"next_attempt_at":{"type":"string","nullable":true},"createdAt":{"type":"string","nullable":true,"example":"2026-09-06T14:32:13.000Z"}},"required":["id","endpoint_id","event_id","event_type","attempt","status","request_body","signature","response_status","response_body","delivered_at","next_attempt_at","createdAt"]}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/routing-rules":{"post":{"tags":["Routing Rules"],"summary":"Create a document routing rule","description":"Create an automatic document routing rule for a destination table in the active project.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":100},"prompt":{"type":"string","minLength":10},"confidenceThreshold":{"type":"integer","minimum":60,"maximum":100,"default":70},"tableId":{"type":"string","minLength":1},"enabled":{"type":"boolean","default":true}},"required":["name","prompt","tableId"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"01J9X6VJ7BRQ8M5ACN3T2K4F0P"},"name":{"type":"string","example":"Invoice routing"},"prompt":{"type":"string","example":"Invoices containing a vendor, invoice number, and total"},"confidenceThreshold":{"type":"integer","minimum":60,"maximum":100,"example":70},"enabled":{"type":"boolean"},"tableId":{"type":"string"},"tableName":{"type":"string"},"tableSlug":{"type":"string"},"createdAt":{"type":"string","nullable":true},"updatedAt":{"type":"string","nullable":true}},"required":["id","name","prompt","confidenceThreshold","enabled","tableId","tableName","tableSlug","createdAt","updatedAt"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"get":{"tags":["Routing Rules"],"summary":"List document routing rules","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"01J9X6VJ7BRQ8M5ACN3T2K4F0P"},"name":{"type":"string","example":"Invoice routing"},"prompt":{"type":"string","example":"Invoices containing a vendor, invoice number, and total"},"confidenceThreshold":{"type":"integer","minimum":60,"maximum":100,"example":70},"enabled":{"type":"boolean"},"tableId":{"type":"string"},"tableName":{"type":"string"},"tableSlug":{"type":"string"},"createdAt":{"type":"string","nullable":true},"updatedAt":{"type":"string","nullable":true}},"required":["id","name","prompt","confidenceThreshold","enabled","tableId","tableName","tableSlug","createdAt","updatedAt"]}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/routing-rules/{id}":{"get":{"tags":["Routing Rules"],"summary":"Get a document routing rule","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"01J9X6VJ7BRQ8M5ACN3T2K4F0P"},"name":{"type":"string","example":"Invoice routing"},"prompt":{"type":"string","example":"Invoices containing a vendor, invoice number, and total"},"confidenceThreshold":{"type":"integer","minimum":60,"maximum":100,"example":70},"enabled":{"type":"boolean"},"tableId":{"type":"string"},"tableName":{"type":"string"},"tableSlug":{"type":"string"},"createdAt":{"type":"string","nullable":true},"updatedAt":{"type":"string","nullable":true}},"required":["id","name","prompt","confidenceThreshold","enabled","tableId","tableName","tableSlug","createdAt","updatedAt"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"patch":{"tags":["Routing Rules"],"summary":"Update a document routing rule","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":100},"prompt":{"type":"string","minLength":10},"confidenceThreshold":{"type":"integer","minimum":60,"maximum":100,"default":70},"tableId":{"type":"string","minLength":1},"enabled":{"type":"boolean","default":true}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"01J9X6VJ7BRQ8M5ACN3T2K4F0P"},"name":{"type":"string","example":"Invoice routing"},"prompt":{"type":"string","example":"Invoices containing a vendor, invoice number, and total"},"confidenceThreshold":{"type":"integer","minimum":60,"maximum":100,"example":70},"enabled":{"type":"boolean"},"tableId":{"type":"string"},"tableName":{"type":"string"},"tableSlug":{"type":"string"},"createdAt":{"type":"string","nullable":true},"updatedAt":{"type":"string","nullable":true}},"required":["id","name","prompt","confidenceThreshold","enabled","tableId","tableName","tableSlug","createdAt","updatedAt"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"delete":{"tags":["Routing Rules"],"summary":"Delete a document routing rule","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/splitters":{"post":{"tags":["Splitters"],"summary":"Create a page-range splitter draft","description":"Create a deterministic splitter that maps one-indexed inclusive page ranges to existing destination tables.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":100},"description":{"type":"string","maxLength":1000},"config":{"type":"object","properties":{"mode":{"type":"string","enum":["page_range"],"default":"page_range"},"overlap_policy":{"type":"string","enum":["exclusive","allowed"],"default":"exclusive"},"unassigned_policy":{"type":"string","enum":["review","ignore","fallback"],"default":"review"},"fallback_section_key":{"type":"string"},"max_segments":{"type":"integer","minimum":1,"maximum":100,"default":50},"sections":{"type":"array","items":{"type":"object","properties":{"section_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":1000},"destination_table_id":{"type":"string","minLength":1},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer","minimum":1},"end_page":{"type":"integer","minimum":1}},"required":["start_page","end_page"]},"minItems":1,"maxItems":100}},"required":["section_key","name","destination_table_id","page_spans"]},"minItems":1,"maxItems":100}},"required":["sections"]}},"required":["name","config"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"mode":{"type":"string","enum":["page_range","logical"]},"status":{"type":"string","enum":["draft","published","archived"]},"draft_revision":{"type":"integer"},"latest_version":{"type":"integer"},"config":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["page_range"],"default":"page_range"},"overlap_policy":{"type":"string","enum":["exclusive","allowed"],"default":"exclusive"},"unassigned_policy":{"type":"string","enum":["review","ignore","fallback"],"default":"review"},"fallback_section_key":{"type":"string"},"max_segments":{"type":"integer","minimum":1,"maximum":100,"default":50},"sections":{"type":"array","items":{"type":"object","properties":{"section_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":1000},"destination_table_id":{"type":"string","minLength":1},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer","minimum":1},"end_page":{"type":"integer","minimum":1}},"required":["start_page","end_page"]},"minItems":1,"maxItems":100}},"required":["section_key","name","destination_table_id","page_spans"]},"minItems":1,"maxItems":100}},"required":["sections"]},{"type":"object","properties":{"mode":{"type":"string","enum":["logical"]},"sourceInboxId":{"type":"string","nullable":true,"minLength":1},"instructions":{"type":"string","minLength":10,"maxLength":4000},"sectionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["key","name"]},"maxItems":50},"routingMode":{"type":"string","enum":["project_rules"]},"reviewUncertainBoundaries":{"type":"boolean"},"reviewUncertainDestinations":{"type":"boolean"},"boundaryConfidenceThreshold":{"type":"integer","minimum":0,"maximum":100,"default":75},"maxSegments":{"type":"integer","minimum":1,"maximum":100,"default":50}},"required":["mode","sourceInboxId","instructions","sectionTypes","routingMode","reviewUncertainBoundaries","reviewUncertainDestinations"]}]},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true}},"required":["id","name","description","mode","status","draft_revision","latest_version","config","created_at","updated_at"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"get":{"tags":["Splitters"],"summary":"List splitters","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"mode":{"type":"string","enum":["page_range","logical"]},"status":{"type":"string","enum":["draft","published","archived"]},"draft_revision":{"type":"integer"},"latest_version":{"type":"integer"},"config":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["page_range"],"default":"page_range"},"overlap_policy":{"type":"string","enum":["exclusive","allowed"],"default":"exclusive"},"unassigned_policy":{"type":"string","enum":["review","ignore","fallback"],"default":"review"},"fallback_section_key":{"type":"string"},"max_segments":{"type":"integer","minimum":1,"maximum":100,"default":50},"sections":{"type":"array","items":{"type":"object","properties":{"section_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":1000},"destination_table_id":{"type":"string","minLength":1},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer","minimum":1},"end_page":{"type":"integer","minimum":1}},"required":["start_page","end_page"]},"minItems":1,"maxItems":100}},"required":["section_key","name","destination_table_id","page_spans"]},"minItems":1,"maxItems":100}},"required":["sections"]},{"type":"object","properties":{"mode":{"type":"string","enum":["logical"]},"sourceInboxId":{"type":"string","nullable":true,"minLength":1},"instructions":{"type":"string","minLength":10,"maxLength":4000},"sectionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["key","name"]},"maxItems":50},"routingMode":{"type":"string","enum":["project_rules"]},"reviewUncertainBoundaries":{"type":"boolean"},"reviewUncertainDestinations":{"type":"boolean"},"boundaryConfidenceThreshold":{"type":"integer","minimum":0,"maximum":100,"default":75},"maxSegments":{"type":"integer","minimum":1,"maximum":100,"default":50}},"required":["mode","sourceInboxId","instructions","sectionTypes","routingMode","reviewUncertainBoundaries","reviewUncertainDestinations"]}]},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true}},"required":["id","name","description","mode","status","draft_revision","latest_version","config","created_at","updated_at"]}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/splitters/logical":{"post":{"tags":["Splitters"],"summary":"Create a logical splitter draft for mixed documents","description":"Bind to one project inbox, or use a null sourceInboxId for project uploads. Publishing activates routing through project classification rules.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","nullable":true,"maxLength":500},"config":{"type":"object","properties":{"mode":{"type":"string","enum":["logical"]},"sourceInboxId":{"type":"string","nullable":true,"minLength":1},"instructions":{"type":"string","minLength":10,"maxLength":4000},"sectionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["key","name"]},"maxItems":50},"routingMode":{"type":"string","enum":["project_rules"]},"reviewUncertainBoundaries":{"type":"boolean"},"reviewUncertainDestinations":{"type":"boolean"},"boundaryConfidenceThreshold":{"type":"integer","minimum":0,"maximum":100,"default":75},"maxSegments":{"type":"integer","minimum":1,"maximum":100,"default":50}},"required":["mode","sourceInboxId","instructions","sectionTypes","routingMode","reviewUncertainBoundaries","reviewUncertainDestinations"]}},"required":["name","config"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"mode":{"type":"string","enum":["page_range","logical"]},"status":{"type":"string","enum":["draft","published","archived"]},"draft_revision":{"type":"integer"},"latest_version":{"type":"integer"},"config":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["page_range"],"default":"page_range"},"overlap_policy":{"type":"string","enum":["exclusive","allowed"],"default":"exclusive"},"unassigned_policy":{"type":"string","enum":["review","ignore","fallback"],"default":"review"},"fallback_section_key":{"type":"string"},"max_segments":{"type":"integer","minimum":1,"maximum":100,"default":50},"sections":{"type":"array","items":{"type":"object","properties":{"section_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":1000},"destination_table_id":{"type":"string","minLength":1},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer","minimum":1},"end_page":{"type":"integer","minimum":1}},"required":["start_page","end_page"]},"minItems":1,"maxItems":100}},"required":["section_key","name","destination_table_id","page_spans"]},"minItems":1,"maxItems":100}},"required":["sections"]},{"type":"object","properties":{"mode":{"type":"string","enum":["logical"]},"sourceInboxId":{"type":"string","nullable":true,"minLength":1},"instructions":{"type":"string","minLength":10,"maxLength":4000},"sectionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["key","name"]},"maxItems":50},"routingMode":{"type":"string","enum":["project_rules"]},"reviewUncertainBoundaries":{"type":"boolean"},"reviewUncertainDestinations":{"type":"boolean"},"boundaryConfidenceThreshold":{"type":"integer","minimum":0,"maximum":100,"default":75},"maxSegments":{"type":"integer","minimum":1,"maximum":100,"default":50}},"required":["mode","sourceInboxId","instructions","sectionTypes","routingMode","reviewUncertainBoundaries","reviewUncertainDestinations"]}]},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true}},"required":["id","name","description","mode","status","draft_revision","latest_version","config","created_at","updated_at"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/splitters/{id}":{"get":{"tags":["Splitters"],"summary":"Get a splitter and its published versions","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"mode":{"type":"string","enum":["page_range","logical"]},"status":{"type":"string","enum":["draft","published","archived"]},"draft_revision":{"type":"integer"},"latest_version":{"type":"integer"},"config":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["page_range"],"default":"page_range"},"overlap_policy":{"type":"string","enum":["exclusive","allowed"],"default":"exclusive"},"unassigned_policy":{"type":"string","enum":["review","ignore","fallback"],"default":"review"},"fallback_section_key":{"type":"string"},"max_segments":{"type":"integer","minimum":1,"maximum":100,"default":50},"sections":{"type":"array","items":{"type":"object","properties":{"section_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":1000},"destination_table_id":{"type":"string","minLength":1},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer","minimum":1},"end_page":{"type":"integer","minimum":1}},"required":["start_page","end_page"]},"minItems":1,"maxItems":100}},"required":["section_key","name","destination_table_id","page_spans"]},"minItems":1,"maxItems":100}},"required":["sections"]},{"type":"object","properties":{"mode":{"type":"string","enum":["logical"]},"sourceInboxId":{"type":"string","nullable":true,"minLength":1},"instructions":{"type":"string","minLength":10,"maxLength":4000},"sectionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["key","name"]},"maxItems":50},"routingMode":{"type":"string","enum":["project_rules"]},"reviewUncertainBoundaries":{"type":"boolean"},"reviewUncertainDestinations":{"type":"boolean"},"boundaryConfidenceThreshold":{"type":"integer","minimum":0,"maximum":100,"default":75},"maxSegments":{"type":"integer","minimum":1,"maximum":100,"default":50}},"required":["mode","sourceInboxId","instructions","sectionTypes","routingMode","reviewUncertainBoundaries","reviewUncertainDestinations"]}]},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true},"versions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"version":{"type":"integer"},"revision_hash":{"type":"string"},"published_at":{"type":"string","nullable":true}},"required":["id","version","revision_hash","published_at"]}}},"required":["id","name","description","mode","status","draft_revision","latest_version","config","created_at","updated_at","versions"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"patch":{"tags":["Splitters"],"summary":"Update a splitter draft","description":"Update authoring state using optimistic draft revision checking. Published versions remain immutable.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":100},"description":{"type":"string","nullable":true,"maxLength":1000},"config":{"type":"object","properties":{"mode":{"type":"string","enum":["page_range"],"default":"page_range"},"overlap_policy":{"type":"string","enum":["exclusive","allowed"],"default":"exclusive"},"unassigned_policy":{"type":"string","enum":["review","ignore","fallback"],"default":"review"},"fallback_section_key":{"type":"string"},"max_segments":{"type":"integer","minimum":1,"maximum":100,"default":50},"sections":{"type":"array","items":{"type":"object","properties":{"section_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":1000},"destination_table_id":{"type":"string","minLength":1},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer","minimum":1},"end_page":{"type":"integer","minimum":1}},"required":["start_page","end_page"]},"minItems":1,"maxItems":100}},"required":["section_key","name","destination_table_id","page_spans"]},"minItems":1,"maxItems":100}},"required":["sections"]},"expected_draft_revision":{"type":"integer","minimum":1}},"required":["expected_draft_revision"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"mode":{"type":"string","enum":["page_range","logical"]},"status":{"type":"string","enum":["draft","published","archived"]},"draft_revision":{"type":"integer"},"latest_version":{"type":"integer"},"config":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["page_range"],"default":"page_range"},"overlap_policy":{"type":"string","enum":["exclusive","allowed"],"default":"exclusive"},"unassigned_policy":{"type":"string","enum":["review","ignore","fallback"],"default":"review"},"fallback_section_key":{"type":"string"},"max_segments":{"type":"integer","minimum":1,"maximum":100,"default":50},"sections":{"type":"array","items":{"type":"object","properties":{"section_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":1000},"destination_table_id":{"type":"string","minLength":1},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer","minimum":1},"end_page":{"type":"integer","minimum":1}},"required":["start_page","end_page"]},"minItems":1,"maxItems":100}},"required":["section_key","name","destination_table_id","page_spans"]},"minItems":1,"maxItems":100}},"required":["sections"]},{"type":"object","properties":{"mode":{"type":"string","enum":["logical"]},"sourceInboxId":{"type":"string","nullable":true,"minLength":1},"instructions":{"type":"string","minLength":10,"maxLength":4000},"sectionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["key","name"]},"maxItems":50},"routingMode":{"type":"string","enum":["project_rules"]},"reviewUncertainBoundaries":{"type":"boolean"},"reviewUncertainDestinations":{"type":"boolean"},"boundaryConfidenceThreshold":{"type":"integer","minimum":0,"maximum":100,"default":75},"maxSegments":{"type":"integer","minimum":1,"maximum":100,"default":50}},"required":["mode","sourceInboxId","instructions","sectionTypes","routingMode","reviewUncertainBoundaries","reviewUncertainDestinations"]}]},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true}},"required":["id","name","description","mode","status","draft_revision","latest_version","config","created_at","updated_at"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}},"delete":{"tags":["Splitters"],"summary":"Delete an unpublished splitter or archive a published splitter","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"archived":{"type":"boolean"}},"required":["success","archived"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/splitters/{id}/logical":{"patch":{"tags":["Splitters"],"summary":"Update a logical splitter draft","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","nullable":true,"maxLength":500},"config":{"type":"object","properties":{"mode":{"type":"string","enum":["logical"]},"sourceInboxId":{"type":"string","nullable":true,"minLength":1},"instructions":{"type":"string","minLength":10,"maxLength":4000},"sectionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["key","name"]},"maxItems":50},"routingMode":{"type":"string","enum":["project_rules"]},"reviewUncertainBoundaries":{"type":"boolean"},"reviewUncertainDestinations":{"type":"boolean"},"boundaryConfidenceThreshold":{"type":"integer","minimum":0,"maximum":100,"default":75},"maxSegments":{"type":"integer","minimum":1,"maximum":100,"default":50}},"required":["mode","sourceInboxId","instructions","sectionTypes","routingMode","reviewUncertainBoundaries","reviewUncertainDestinations"]},"expected_draft_revision":{"type":"integer","minimum":1}},"required":["name","config","expected_draft_revision"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"mode":{"type":"string","enum":["page_range","logical"]},"status":{"type":"string","enum":["draft","published","archived"]},"draft_revision":{"type":"integer"},"latest_version":{"type":"integer"},"config":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["page_range"],"default":"page_range"},"overlap_policy":{"type":"string","enum":["exclusive","allowed"],"default":"exclusive"},"unassigned_policy":{"type":"string","enum":["review","ignore","fallback"],"default":"review"},"fallback_section_key":{"type":"string"},"max_segments":{"type":"integer","minimum":1,"maximum":100,"default":50},"sections":{"type":"array","items":{"type":"object","properties":{"section_key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":1000},"destination_table_id":{"type":"string","minLength":1},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer","minimum":1},"end_page":{"type":"integer","minimum":1}},"required":["start_page","end_page"]},"minItems":1,"maxItems":100}},"required":["section_key","name","destination_table_id","page_spans"]},"minItems":1,"maxItems":100}},"required":["sections"]},{"type":"object","properties":{"mode":{"type":"string","enum":["logical"]},"sourceInboxId":{"type":"string","nullable":true,"minLength":1},"instructions":{"type":"string","minLength":10,"maxLength":4000},"sectionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,63}$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500}},"required":["key","name"]},"maxItems":50},"routingMode":{"type":"string","enum":["project_rules"]},"reviewUncertainBoundaries":{"type":"boolean"},"reviewUncertainDestinations":{"type":"boolean"},"boundaryConfidenceThreshold":{"type":"integer","minimum":0,"maximum":100,"default":75},"maxSegments":{"type":"integer","minimum":1,"maximum":100,"default":50}},"required":["mode","sourceInboxId","instructions","sectionTypes","routingMode","reviewUncertainBoundaries","reviewUncertainDestinations"]}]},"created_at":{"type":"string","nullable":true},"updated_at":{"type":"string","nullable":true}},"required":["id","name","description","mode","status","draft_revision","latest_version","config","created_at","updated_at"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/splitters/{id}/publish":{"post":{"tags":["Splitters"],"summary":"Publish an immutable splitter version","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expected_draft_revision":{"type":"integer","minimum":1}},"required":["expected_draft_revision"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"splitter_id":{"type":"string"},"version_id":{"type":"string"},"version":{"type":"integer"},"revision_hash":{"type":"string"},"published_at":{"type":"string","nullable":true},"reused":{"type":"boolean"}},"required":["splitter_id","version_id","version","revision_hash","published_at","reused"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/splitters/{id}/test":{"post":{"tags":["Splitters"],"summary":"Preview a splitter without writing document segments","description":"Compile the draft or a published version against a document page count and report segments, gaps, overlaps, review state, and downstream page fan-out.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"page_count":{"type":"integer","minimum":1,"maximum":10000},"version":{"type":"integer","minimum":1}},"required":["page_count"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"splitter_id":{"type":"string"},"version":{"type":"integer","nullable":true},"draft_revision":{"type":"integer","nullable":true},"page_count":{"type":"integer"},"segments":{"type":"array","items":{"type":"object","properties":{"segment_key":{"type":"string"},"section_key":{"type":"string"},"section_name":{"type":"string"},"destination_table_id":{"type":"string"},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer"},"end_page":{"type":"integer"}},"required":["start_page","end_page"]}},"page_count":{"type":"integer"},"ordinal":{"type":"integer"},"review_required":{"type":"boolean"}},"required":["segment_key","section_key","section_name","destination_table_id","page_spans","page_count","ordinal","review_required"]}},"unassigned_page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer"},"end_page":{"type":"integer"}},"required":["start_page","end_page"]}},"overlaps":{"type":"array","items":{"type":"object","properties":{"page":{"type":"integer"},"section_keys":{"type":"array","items":{"type":"string"}}},"required":["page","section_keys"]}},"review_required":{"type":"boolean"},"unique_assigned_page_count":{"type":"integer"},"downstream_page_count":{"type":"integer"}},"required":["splitter_id","version","draft_revision","page_count","segments","unassigned_page_spans","overlaps","review_required","unique_assigned_page_count","downstream_page_count"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/splitters/{id}/run":{"post":{"tags":["Splitters"],"summary":"Run a published page-range splitter on a stored document","description":"Persist immutable document segments and queued destination work items. Unassigned pages pause the processing run for human review.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours."},"required":false,"description":"Scopes replay protection to the authenticated project, method, and route for 24 hours.","name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"document_id":{"type":"integer","minimum":1},"version":{"type":"integer","minimum":1}},"required":["document_id"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"processing_run_id":{"type":"string"},"split_run_id":{"type":"string"},"splitter_id":{"type":"string"},"version_id":{"type":"string"},"version":{"type":"integer"},"status":{"type":"string","enum":["succeeded","waiting_for_review"]},"segment_count":{"type":"integer"},"review_count":{"type":"integer"},"segments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"segment_key":{"type":"string"},"ordinal":{"type":"integer"},"page_spans":{"type":"array","items":{"type":"object","properties":{"start_page":{"type":"integer"},"end_page":{"type":"integer"}},"required":["start_page","end_page"]}},"page_count":{"type":"integer"},"review_status":{"type":"string","enum":["not_required","pending","approved","rejected"]},"destination_table_id":{"type":"string"}},"required":["id","segment_key","ordinal","page_spans","page_count","review_status","destination_table_id"]}}},"required":["processing_run_id","split_run_id","splitter_id","version_id","version","status","segment_count","review_count","segments"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}},"/sql/query":{"post":{"tags":["SQL"],"summary":"Run a read-only SQLite query","description":"Execute one SELECT, WITH, or EXPLAIN statement against the active project's SQLite database. Results are capped at 100 rows. Bound parameters use SQLite question-mark placeholders.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sql":{"type":"string","minLength":1,"maxLength":20000},"params":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"maxItems":100},"maxRows":{"type":"integer","minimum":1,"maximum":100,"default":100}},"required":["sql"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"type":"string"}},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"rowCount":{"type":"integer"},"maxRows":{"type":"integer"},"truncated":{"type":"boolean"},"durationMs":{"type":"integer"},"rowsRead":{"type":"integer"}},"required":["columns","rows","rowCount","maxRows","truncated","durationMs","rowsRead"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Workflow error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]}}}}}}}}}