{"openapi":"3.1.0","info":{"title":"Content Hub API","version":"1.0.0","description":"Publica contenido con la voz editorial de tu organización: notas al sitio web (CMS) y posts a redes sociales. Las keys se crean en Admin → API y agentes (plan Pro o superior). También disponible como servidor MCP en /api/v1/mcp."},"servers":[{"url":"https://contenthub.cl/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key de la organización (chk_…)"}},"schemas":{"Author":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"role":{"type":"string"},"photo":{"type":"string","format":"uri"}}},"NoteRequest":{"type":"object","description":"Envía \"url\" (se scrapea y reescribe), o bien \"title\" + \"content\".","properties":{"url":{"type":"string","format":"uri"},"title":{"type":"string","maxLength":300},"copete":{"type":"string","maxLength":1000},"content":{"type":"string","description":"HTML o texto plano"},"genero":{"type":"string","enum":["noticia","opinion"]},"author":{"$ref":"#/components/schemas/Author"},"image_url":{"type":"string","format":"uri"},"generate":{"type":"boolean","default":true,"description":"true: reescribe con la voz del medio. false: publica tal cual"},"publish":{"type":"object","properties":{"web":{"type":"boolean","default":true},"channels":{"type":"array","items":{"type":"string","enum":["facebook","instagram","twitter","x"]}}}},"schedule_at":{"type":"string","format":"date-time","description":"Programa en vez de publicar ahora"},"categoria_id":{"type":"string"},"columnista_id":{"type":"string"}}},"Job":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","running","done","error"]},"result":{"type":"object","nullable":true},"error":{"type":"string","nullable":true}}},"SocialPostRequest":{"type":"object","required":["caption","channels"],"properties":{"caption":{"type":"string","maxLength":5000},"image_url":{"type":"string","format":"uri"},"video_url":{"type":"string","format":"uri"},"channels":{"type":"array","items":{"type":"string","enum":["facebook","instagram","twitter","x"]}},"schedule_at":{"type":"string","format":"date-time"}}}}},"paths":{"/me":{"get":{"summary":"Verifica la key: organización, plan, scopes y rate limit restante","responses":{"200":{"description":"OK"},"401":{"description":"API key faltante, inválida o revocada"}}}},"/notes":{"post":{"summary":"Crea y publica una nota (asíncrono)","description":"Scrapea la URL (o toma title+content), reescribe con la voz editorial de la organización y publica al sitio web y redes. Responde 202 con job_id; consulta el estado en GET /notes/{job_id}. Requiere scope notes:write.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteRequest"}}}},"responses":{"202":{"description":"Encolado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"API key faltante, inválida o revocada"},"403":{"description":"Scope faltante o plan sin API"},"422":{"description":"Payload inválido"},"429":{"description":"Rate limit"}}}},"/notes/{job_id}":{"get":{"summary":"Estado y resultado de un trabajo","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"404":{"description":"No encontrado"}}}},"/social-posts":{"post":{"summary":"Publica (o programa) un post suelto a redes","description":"Sin tocar el sitio web. Instagram exige image_url o video_url. Requiere scope social:write.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SocialPostRequest"}}}},"responses":{"200":{"description":"Publicado"},"202":{"description":"Programado"},"401":{"description":"API key faltante, inválida o revocada"},"422":{"description":"Payload inválido"}}}},"/channels":{"get":{"summary":"Canales conectados de la organización y qué permite su plan","description":"Requiere scope channels:read.","responses":{"200":{"description":"OK"},"401":{"description":"API key faltante, inválida o revocada"}}}}}}