{"openapi":"3.1.0","info":{"title":"AnyFormat API","description":"Document extraction and workflow automation API.\n\nAll endpoints use the `/v2/` path prefix. All responses include `X-API-Version`.\n","version":"2.0.0"},"servers":[{"url":"https://api.anyformat.ai","description":"API server"}],"paths":{"/health/":{"get":{"tags":["health"],"summary":"Health Check","description":"Health check endpoint.\n\nReturns 200 OK if the service is running.\nNo authentication required.","operationId":"health_check_health__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v2/webhooks/":{"post":{"tags":["webhooks"],"summary":"Create webhook","description":"Create a new webhook subscription.\n\nValidates URL (HTTPS only) and event types, then forwards to backend service.\nReturns the created webhook with generated secret.","operationId":"create_webhook_v2_webhooks__post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["webhooks"],"summary":"List webhooks","description":"List all webhook subscriptions for the authenticated organization.\n\nReturns a list of webhooks (secrets are excluded in list view).","operationId":"list_webhooks_v2_webhooks__get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookListItem"},"title":"Response List Webhooks V2 Webhooks  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/webhooks/{webhook_id}/":{"delete":{"tags":["webhooks"],"summary":"Delete webhook","description":"Delete a webhook subscription by ID.\n\nReturns 204 on success, 404 if webhook not found, 403 if unauthorized.","operationId":"delete_webhook_v2_webhooks__webhook_id___delete","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","title":"Webhook Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/files/":{"get":{"tags":["files"],"summary":"List file collections","description":"List file collections for a workflow.","operationId":"list_files_v2_files__get","parameters":[{"name":"workflow_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_CollectionListItem_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["files"],"summary":"Create file collection","description":"Upload files to a workflow, creating a file collection.","operationId":"create_file_v2_files__post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_file_v2_files__post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCollectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/files/{collection_id}/":{"delete":{"tags":["files"],"summary":"Delete file collection","description":"Delete a file collection and all its files.","operationId":"delete_file_v2_files__collection_id___delete","parameters":[{"name":"collection_id","in":"path","required":true,"schema":{"type":"string","title":"Collection Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/files/{collection_id}/extraction/":{"get":{"tags":["files"],"summary":"Get extraction results","description":"Get extraction results for a file collection.\n\nReturns 412 if the extraction is not yet complete.","operationId":"get_extraction_results_v2_files__collection_id__extraction__get","parameters":[{"name":"collection_id","in":"path","required":true,"schema":{"type":"string","title":"Collection Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/workflows/":{"post":{"tags":["workflows"],"summary":"Create workflow","description":"Create a new workflow.","operationId":"v2_create_workflow","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["workflows"],"summary":"List workflows","description":"List workflows with pagination.","operationId":"v2_list_workflows","parameters":[{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sort By"}},{"name":"order","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/workflows/{workflow_id}/":{"get":{"tags":["workflows"],"summary":"Get workflow","description":"Get workflow by ID.","operationId":"v2_get_workflow","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["workflows"],"summary":"Delete workflow","description":"Delete workflow by ID.","operationId":"v2_delete_workflow","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/workflows/{workflow_id}/run/":{"post":{"tags":["workflows"],"summary":"Run workflow","description":"Execute workflow — returns collection UUID.","operationId":"v2_run_workflow","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_v2_run_workflow"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRunResponseV2"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/workflows/{workflow_id}/upload/":{"post":{"tags":["workflows"],"summary":"Upload file","description":"Upload file without executing workflow.","operationId":"v2_upload_file","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_v2_upload_file"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadFileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/workflows/{workflow_id}/results/":{"get":{"tags":["workflows"],"summary":"Get workflow results","description":"Get workflow results.\n\nReturns a unified JSON response with parsed markdown (visual variant\nwith embedded images) and extraction data for each file.\n\nPass ``file_id`` to retrieve results for a single file.","operationId":"v2_get_workflow_results","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}},{"name":"file_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter results to a single file by its UUID","title":"File Id"},"description":"Filter results to a single file by its UUID"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/workflows/{workflow_id}/runs/":{"get":{"tags":["workflows"],"summary":"List workflow runs","description":"List extraction runs for a workflow, identified by collection UUID.","operationId":"v2_list_workflow_runs","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRunListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_create_file_v2_files__post":{"properties":{"workflow_id":{"type":"string","title":"Workflow Id"},"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"}},"type":"object","required":["workflow_id","files"],"title":"Body_create_file_v2_files__post"},"Body_v2_run_workflow":{"properties":{"file":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"File"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"}},"type":"object","title":"Body_v2_run_workflow"},"Body_v2_upload_file":{"properties":{"file":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"File"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"}},"type":"object","title":"Body_v2_upload_file"},"CollectionListItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"status":{"type":"string","title":"Status"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","status"],"title":"CollectionListItem","description":"A single file collection entry in list responses."},"CreateCollectionResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"files":{"items":{"$ref":"#/components/schemas/FileItem"},"type":"array","title":"Files"},"workflow_id":{"type":"string","title":"Workflow Id"}},"type":"object","required":["id","files","workflow_id"],"title":"CreateCollectionResponse","description":"Response from creating a file collection."},"FileItem":{"properties":{"filename":{"type":"string","title":"Filename"},"status":{"type":"string","title":"Status"}},"type":"object","required":["filename","status"],"title":"FileItem","description":"A single file within a collection."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PaginatedResponse_CollectionListItem_":{"properties":{"results":{"items":{"$ref":"#/components/schemas/CollectionListItem"},"type":"array","title":"Results"},"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["results","count","page","page_size"],"title":"PaginatedResponse[CollectionListItem]"},"UploadFileResponse":{"properties":{"status":{"type":"string","title":"Status"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"}},"type":"object","required":["status"],"title":"UploadFileResponse","description":"POST /workflows/{id}/upload/ — upload confirmation."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WebhookCreateRequest":{"properties":{"url":{"type":"string","maxLength":2083,"minLength":1,"format":"uri","title":"Url"},"events":{"items":{"type":"string"},"type":"array","title":"Events","default":["extraction.completed","extraction.failed"]}},"type":"object","required":["url"],"title":"WebhookCreateRequest","description":"Request schema for creating a webhook subscription"},"WebhookListItem":{"properties":{"id":{"type":"string","title":"Id"},"url":{"type":"string","title":"Url"},"events":{"items":{"type":"string"},"type":"array","title":"Events"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","url","events","is_active","created_at"],"title":"WebhookListItem","description":"Response schema for listing webhooks (excludes secret)"},"WebhookResponse":{"properties":{"id":{"type":"string","title":"Id"},"url":{"type":"string","title":"Url"},"events":{"items":{"type":"string"},"type":"array","title":"Events"},"is_active":{"type":"boolean","title":"Is Active"},"secret":{"type":"string","title":"Secret"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","url","events","is_active","secret","created_at"],"title":"WebhookResponse","description":"Response schema for webhook subscription (includes secret)"},"WorkflowListResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/WorkflowResponse"},"type":"array","title":"Results"},"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["results","count","page","page_size"],"title":"WorkflowListResponse","description":"GET /workflows/ — paginated workflow list."},"WorkflowResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"},"fields":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Fields"}},"type":"object","required":["id","name"],"title":"WorkflowResponse","description":"Workflow detail — used for get, create, and list items."},"WorkflowRunListItem":{"properties":{"id":{"type":"string","title":"Id"},"status":{"type":"string","title":"Status"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","status"],"title":"WorkflowRunListItem","description":"Item in GET /workflows/{id}/runs/ paginated list."},"WorkflowRunListResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/WorkflowRunListItem"},"type":"array","title":"Results"},"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["results","count","page","page_size"],"title":"WorkflowRunListResponse","description":"GET /workflows/{id}/runs/ — paginated run list."},"WorkflowRunResponseV2":{"properties":{"id":{"type":"string","title":"Id"},"status":{"type":"string","title":"Status"},"workflow_id":{"type":"string","title":"Workflow Id"}},"type":"object","required":["id","status","workflow_id"],"title":"WorkflowRunResponseV2","description":"Response for workflow run endpoint (v2) — collection UUID as identifier."}}},"tags":[{"name":"workflows","description":"Workflow CRUD, execution, runs, and results."},{"name":"files","description":"File collection management."},{"name":"webhooks","description":"Webhook subscriptions for async notifications."},{"name":"health","description":"Health checks."}]}