{"openapi":"3.0.3","info":{"title":"Chat Export API","description":"Claude Code Chat Export Service API - Transforms Claude Code conversations to LibreChat format.\n\nThis API provides endpoints for:\n- Listing and viewing Claude Code conversations\n- Exporting conversations to LibreChat JSON format\n- Multi-machine support with upload and merge capabilities\n","version":"1.0.0","contact":{"name":"Haiven Infrastructure"},"license":{"name":"MIT"}},"servers":[{"url":"https://chat-export.haiven.site","description":"Production server"}],"paths":{"/health":{"get":{"summary":"Health check","description":"Returns service health status and validation of required paths","operationId":"healthCheck","tags":["Health"],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"},"example":{"status":"healthy","machine_id":"abc123def456","checks":{"claude_projects_path":"ok","export_output_path":"ok","upload_path":"ok"}}}}},"503":{"description":"Service is unhealthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/projects":{"get":{"summary":"List projects","description":"Returns all Claude Code project directories","operationId":"listProjects","tags":["Projects"],"responses":{"200":{"description":"List of projects","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}}}},"example":{"projects":[{"id":"my-project","name":"my-project","path":"/data/claude-projects/my-project","conversation_count":42}]}}}}}}},"/api/conversations":{"get":{"summary":"List conversations","description":"Returns all conversations with optional filtering","operationId":"listConversations","tags":["Conversations"],"parameters":[{"name":"project","in":"query","description":"Filter by project ID","schema":{"type":"string"}},{"name":"search","in":"query","description":"Search text in conversation content","schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum number of results","schema":{"type":"integer","default":50}},{"name":"offset","in":"query","description":"Offset for pagination","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"List of conversations","content":{"application/json":{"schema":{"type":"object","properties":{"conversations":{"type":"array","items":{"$ref":"#/components/schemas/ConversationSummary"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}}}}}}}},"/api/conversations/{session_id}":{"get":{"summary":"Get conversation details","description":"Returns full conversation with all messages","operationId":"getConversation","tags":["Conversations"],"parameters":[{"name":"session_id","in":"path","required":true,"description":"The session UUID","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Conversation details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}},"404":{"description":"Conversation not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/export/single":{"post":{"summary":"Export single conversation","description":"Exports a single conversation to LibreChat JSON format","operationId":"exportSingle","tags":["Export"],"parameters":[{"name":"session_id","in":"query","required":true,"description":"The session UUID to export","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Export successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportResponse"}}}},"404":{"description":"Conversation not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/export/batch":{"post":{"summary":"Export multiple conversations","description":"Exports multiple conversations to LibreChat JSON format","operationId":"exportBatch","tags":["Export"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"session_ids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"List of session UUIDs to export"},"all":{"type":"boolean","description":"Export all conversations","default":false}}},"example":{"session_ids":["550e8400-e29b-41d4-a716-446655440001","550e8400-e29b-41d4-a716-446655440002"]}}}},"responses":{"200":{"description":"Batch export successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchExportResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/upload":{"post":{"summary":"Upload export from another machine","description":"Uploads a LibreChat JSON export file from another machine","operationId":"uploadExport","tags":["Import"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"The export JSON file"}}}}}},"responses":{"200":{"description":"Upload successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadResponse"}}}},"400":{"description":"Invalid file","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/machines":{"get":{"summary":"List registered machines","description":"Returns all machines that have uploaded exports","operationId":"listMachines","tags":["Machines"],"responses":{"200":{"description":"List of machines","content":{"application/json":{"schema":{"type":"object","properties":{"machines":{"type":"array","items":{"$ref":"#/components/schemas/Machine"}}}}}}}}}}},"components":{"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["healthy","unhealthy"]},"machine_id":{"type":"string"},"checks":{"type":"object","properties":{"claude_projects_path":{"type":"string","enum":["ok","error"]},"export_output_path":{"type":"string","enum":["ok","error"]},"upload_path":{"type":"string","enum":["ok","error"]}}}}},"Project":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"path":{"type":"string"},"conversation_count":{"type":"integer"}}},"ConversationSummary":{"type":"object","properties":{"session_id":{"type":"string","format":"uuid"},"project":{"type":"string"},"title":{"type":"string"},"first_message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"message_count":{"type":"integer"}}},"Conversation":{"type":"object","properties":{"session_id":{"type":"string","format":"uuid"},"project":{"type":"string"},"title":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}},"Message":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"parent_uuid":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["user","assistant"]},"content":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"tool_calls":{"type":"array","items":{"$ref":"#/components/schemas/ToolCall"}}}},"ToolCall":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"parameters":{"type":"object"},"result":{"type":"string"}}},"ExportResponse":{"type":"object","properties":{"success":{"type":"boolean"},"file_path":{"type":"string"},"file_size":{"type":"integer"},"conversation_id":{"type":"string"},"message_count":{"type":"integer"}}},"BatchExportResponse":{"type":"object","properties":{"success":{"type":"boolean"},"exported_count":{"type":"integer"},"failed_count":{"type":"integer"},"files":{"type":"array","items":{"type":"object","properties":{"session_id":{"type":"string"},"file_path":{"type":"string"},"status":{"type":"string"}}}}}},"UploadResponse":{"type":"object","properties":{"success":{"type":"boolean"},"machine_id":{"type":"string"},"imported_count":{"type":"integer"},"duplicate_count":{"type":"integer"}}},"Machine":{"type":"object","properties":{"machine_id":{"type":"string"},"hostname":{"type":"string"},"last_seen":{"type":"string","format":"date-time"},"export_count":{"type":"integer"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"object"}}}}},"tags":[{"name":"Health","description":"Service health check endpoints"},{"name":"Projects","description":"Claude Code project operations"},{"name":"Conversations","description":"Conversation listing and viewing"},{"name":"Export","description":"Export conversations to LibreChat format"},{"name":"Import","description":"Import exports from other machines"},{"name":"Machines","description":"Multi-machine registry operations"}]}