{"openapi":"3.1.0","info":{"title":"The Club Academy API pública","version":"1.0.0","description":"API REST para creadores. Autenticación con API key (Bearer). Límite por key (por defecto 60 req/min, cabeceras X-RateLimit-*). Paginación por cursor."},"servers":[{"url":"https://escuela.theclubcoffe.com/api/v1"}],"paths":{"/communities":{"get":{"summary":"Listar comunidades","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"description":"Scope requerido: `read:communities`.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Community"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pásalo como ?cursor= para la siguiente página."}}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/members":{"get":{"summary":"Listar miembros de una comunidad","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"description":"Scope requerido: `read:members`.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"},{"name":"community_id","in":"query","required":true,"description":"UUID de la comunidad","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Member"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pásalo como ?cursor= para la siguiente página."}}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/courses":{"get":{"summary":"Listar cursos","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"description":"Scope requerido: `read:courses`.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"},{"name":"status","in":"query","required":false,"description":"","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Course"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pásalo como ?cursor= para la siguiente página."}}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/enrollments":{"get":{"summary":"Listar inscripciones","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"description":"Scope requerido: `read:enrollments`.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"},{"name":"course_id","in":"query","required":false,"description":"","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Enrollment"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pásalo como ?cursor= para la siguiente página."}}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/orders":{"get":{"summary":"Listar órdenes (solo lectura)","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"description":"Scope requerido: `read:orders`.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"},{"name":"status","in":"query","required":false,"description":"","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pásalo como ?cursor= para la siguiente página."}}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/leads":{"get":{"summary":"Listar leads","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"description":"Scope requerido: `read:leads`.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pásalo como ?cursor= para la siguiente página."}}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Crear o actualizar un lead (upsert por email)","description":"Scope requerido: `write:leads`.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadInput"}}}},"responses":{"201":{"description":"Lead guardado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Lead"}}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Authorization: Bearer trb_live_..."},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"}},"parameters":{"limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},"cursor":{"name":"cursor","in":"query","schema":{"type":"string"}}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}},"Community":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"cover_url":{"type":["string","null"]},"visibility":{"enum":["public","private","paid"]},"member_count":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}},"Member":{"type":"object","properties":{"community_id":{"type":"string"},"user_id":{"type":"string"},"role":{"type":"string"},"status":{"type":"string"},"joined_at":{"type":"string","format":"date-time"},"profiles":{"type":["object","null"],"properties":{"username":{"type":"string"},"full_name":{"type":["string","null"]},"avatar_url":{"type":["string","null"]}}}}},"Course":{"type":"object","properties":{"id":{"type":"string"},"community_id":{"type":["string","null"]},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"cover_url":{"type":["string","null"]},"status":{"enum":["draft","published","archived"]},"created_at":{"type":"string","format":"date-time"}}},"Enrollment":{"type":"object","properties":{"id":{"type":"string"},"course_id":{"type":"string"},"user_id":{"type":"string"},"cohort_id":{"type":["string","null"]},"enrolled_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"}}},"Order":{"type":"object","properties":{"id":{"type":"string"},"user_id":{"type":"string"},"product_id":{"type":"string"},"amount_cents":{"type":"integer","description":"Centavos"},"currency":{"type":"string"},"status":{"enum":["pending","paid","refunded","disputed","failed"]},"created_at":{"type":"string","format":"date-time"},"paid_at":{"type":["string","null"],"format":"date-time"}}},"Lead":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"source":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"},"created_at":{"type":"string","format":"date-time"}}},"LeadInput":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"name":{"type":"string"},"phone":{"type":"string"},"source":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"}}}}},"x-webhook-events":["order.paid","order.refunded","subscription.canceled","member.joined","post.created","comment.created","reaction.received","lesson.completed","course.completed","enrollment.created"]}