{"openapi":"3.1.0","info":{"title":"CaptionAI API","description":"Generador de captions virales para redes sociales con Gemini multimodal","version":"1.0.0"},"paths":{"/api/v1/health":{"get":{"tags":["health"],"summary":"Health Check","description":"Health check endpoint – verifies MongoDB connectivity.","operationId":"health_check_api_v1_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/v1/auth/me":{"get":{"tags":["auth","auth"],"summary":"Get Me","description":"Get current user info from Clerk session.","operationId":"get_me_api_v1_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/sync":{"post":{"tags":["auth","auth"],"summary":"Sync User","description":"Sync Clerk user data.","operationId":"sync_user_api_v1_auth_sync_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/credits/llm-status":{"get":{"tags":["credits"],"summary":"Get Llm Status","description":"Get LLM API credit status.\n\nReturns the status of the LLM provider configuration and available credits.\nCurrently checks if OPENROUTER_API_KEY is configured.","operationId":"get_llm_status_api_v1_credits_llm_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LLMStatusResponse"}}}}}}},"/api/v1/caption/generate":{"post":{"tags":["generate","generate"],"summary":"Generate Caption","description":"Generate a caption using AI.\n\nAccepts JSON body with generation parameters.","operationId":"generate_caption_api_v1_caption_generate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/caption/library":{"get":{"tags":["library","library"],"summary":"List Captions","description":"List saved captions with optional filters and pagination.","operationId":"list_captions_api_v1_caption_library_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"tono","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tono"}},{"name":"plataforma","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plataforma"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/caption/library/{caption_id}":{"get":{"tags":["library","library"],"summary":"Get Caption","description":"Get a specific saved caption by ID.","operationId":"get_caption_api_v1_caption_library__caption_id__get","parameters":[{"name":"caption_id","in":"path","required":true,"schema":{"type":"string","title":"Caption Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedCaption"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["library","library"],"summary":"Update Caption","description":"Update user metadata (nombre, etiquetas, notas) for a saved caption.","operationId":"update_caption_api_v1_caption_library__caption_id__put","parameters":[{"name":"caption_id","in":"path","required":true,"schema":{"type":"string","title":"Caption Id"}},{"name":"nombre","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nombre"}},{"name":"notas","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notas"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Etiquetas"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedCaption"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["library","library"],"summary":"Delete Caption","description":"Delete a saved caption.","operationId":"delete_caption_api_v1_caption_library__caption_id__delete","parameters":[{"name":"caption_id","in":"path","required":true,"schema":{"type":"string","title":"Caption Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Caption Api V1 Caption Library  Caption Id  Delete"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/storage/{file_id}":{"get":{"tags":["storage"],"summary":"Serve Storage","description":"Serve a file stored in GridFS by its ID.","operationId":"serve_storage_api_v1_storage__file_id__get","parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","title":"File Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CaptionContent":{"properties":{"hook":{"type":"string","title":"Hook","description":"Initial hook text"},"cuerpo":{"type":"string","title":"Cuerpo","description":"Main body content"},"emojis":{"items":{"type":"string"},"type":"array","title":"Emojis","description":"List of emojis used"},"hashtags":{"items":{"type":"string"},"type":"array","title":"Hashtags","description":"List of hashtags"},"cta":{"type":"string","title":"Cta","description":"Call-to-action text"},"completo":{"type":"string","title":"Completo","description":"Complete caption ready to publish"}},"type":"object","required":["hook","cuerpo","emojis","hashtags","cta","completo"],"title":"CaptionContent","description":"Caption content structure."},"CaptionListResponse":{"properties":{"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"items":{"items":{"$ref":"#/components/schemas/SavedCaption"},"type":"array","title":"Items"}},"type":"object","required":["total","limit","offset","items"],"title":"CaptionListResponse","description":"Response for listing captions."},"CaptionMetadata":{"properties":{"caracteres":{"type":"integer","title":"Caracteres","description":"Total character count"},"hashtags_count":{"type":"integer","title":"Hashtags Count","description":"Number of hashtags"},"emojis_count":{"type":"integer","title":"Emojis Count","description":"Number of emojis"},"tiempo_generacion_ms":{"type":"integer","title":"Tiempo Generacion Ms","description":"Generation time in milliseconds"}},"type":"object","required":["caracteres","hashtags_count","emojis_count","tiempo_generacion_ms"],"title":"CaptionMetadata","description":"Caption metadata."},"ErrorResponse":{"properties":{"error":{"type":"string","title":"Error"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"timestamp":{"type":"string","title":"Timestamp"}},"type":"object","required":["error"],"title":"ErrorResponse","description":"Error response."},"GenerateRequest":{"properties":{"tema":{"type":"string","title":"Tema"},"tipo_contenido":{"$ref":"#/components/schemas/TipoContenido"},"tono":{"$ref":"#/components/schemas/Tono"},"plataforma":{"anyOf":[{"$ref":"#/components/schemas/Plataforma"},{"type":"null"}]},"plantilla":{"anyOf":[{"$ref":"#/components/schemas/Plantilla"},{"type":"null"}]},"longitud":{"anyOf":[{"$ref":"#/components/schemas/Longitud"},{"type":"null"}],"default":"medio"},"idioma":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idioma","default":"es"},"variantes":{"type":"integer","maximum":5.0,"minimum":1.0,"title":"Variantes","description":"Number of caption variants to generate","default":1}},"type":"object","required":["tema","tipo_contenido","tono"],"title":"GenerateRequest","description":"Request model for caption generation."},"GenerateResponse":{"properties":{"id":{"type":"string","title":"Id"},"tema":{"type":"string","title":"Tema"},"tipo_contenido":{"type":"string","title":"Tipo Contenido"},"tono":{"type":"string","title":"Tono"},"plataforma":{"type":"string","title":"Plataforma"},"plantilla":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plantilla"},"longitud":{"type":"string","title":"Longitud"},"caption":{"$ref":"#/components/schemas/CaptionContent"},"metadatos":{"$ref":"#/components/schemas/CaptionMetadata"},"timestamp":{"type":"string","title":"Timestamp"}},"type":"object","required":["id","tema","tipo_contenido","tono","plataforma","longitud","caption","metadatos","timestamp"],"title":"GenerateResponse","description":"Response for caption generation."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status","default":"ok"},"version":{"type":"string","title":"Version","default":"1.0.0"},"timestamp":{"type":"string","title":"Timestamp"}},"type":"object","required":["timestamp"],"title":"HealthResponse","description":"Health check response."},"LLMStatusResponse":{"properties":{"provider":{"type":"string","title":"Provider"},"status":{"type":"string","enum":["ok","low","critical"],"title":"Status"},"remaining_pct":{"type":"number","title":"Remaining Pct"},"message":{"type":"string","title":"Message"}},"type":"object","required":["provider","status","remaining_pct","message"],"title":"LLMStatusResponse","description":"LLM API status response."},"Longitud":{"type":"string","enum":["corto","medio","largo"],"title":"Longitud","description":"Caption length options."},"Plantilla":{"type":"string","enum":["lanzar_producto","testimonio","behind_scenes","tips","pregunta","storytime"],"title":"Plantilla","description":"Caption template options."},"Plataforma":{"type":"string","enum":["instagram","twitter","linkedin","tiktok","facebook"],"title":"Plataforma","description":"Social media platform options."},"SavedCaption":{"properties":{"id":{"type":"string","title":"Id"},"tema":{"type":"string","title":"Tema"},"tipo_contenido":{"type":"string","title":"Tipo Contenido"},"tono":{"type":"string","title":"Tono"},"plataforma":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plataforma"},"plantilla":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plantilla"},"longitud":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Longitud"},"caption":{"$ref":"#/components/schemas/CaptionContent"},"metadatos":{"$ref":"#/components/schemas/CaptionMetadata"},"nombre":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nombre"},"etiquetas":{"items":{"type":"string"},"type":"array","title":"Etiquetas","default":[]},"notas":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notas"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","tema","tipo_contenido","tono","caption","metadatos"],"title":"SavedCaption","description":"Saved caption with user annotations."},"TipoContenido":{"type":"string","enum":["imagen","video","carousel","story","tweet"],"title":"TipoContenido","description":"Content type options."},"Tono":{"type":"string","enum":["profesional","casual","humor","inspirador","educativo","ventas"],"title":"Tono","description":"Tone options for captions."},"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"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}