Todas las peticiones requieren la cabecera x-api-key con el valor del secret OPENCLAW_API_KEY. Base URL: https://tu-app.lovable.app/api/public/openclaw
/agentscurl https://tu-app.lovable.app/api/public/openclaw/agents \
-H "x-api-key: $OPENCLAW_API_KEY"/agents/:idcurl https://tu-app.lovable.app/api/public/openclaw/agents/gmail \
-H "x-api-key: $OPENCLAW_API_KEY"/agents/:idCampos opcionales: state (working · meeting · review · paused · coordinating), priority (Alta · Media · Baja), tools, position, name, role, hue.
curl -X PATCH https://tu-app.lovable.app/api/public/openclaw/agents/gmail \
-H "x-api-key: $OPENCLAW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"state":"meeting","priority":"Alta","tools":["Gmail","CRM"],"position":2}'/agents/:id/activitycurl -X POST https://tu-app.lovable.app/api/public/openclaw/agents/gmail/activity \
-H "x-api-key: $OPENCLAW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Respuesta enviada","copy":"Confirmación de pedido #4821."}'/agents/:id/statuscurl -X POST https://tu-app.lovable.app/api/public/openclaw/agents/gmail/status \
-H "x-api-key: $OPENCLAW_API_KEY" -H "Content-Type: application/json" \
-d '{"state":"working"}'/office/stateDevuelve agentes + últimas tareas, eventos y comandos.
curl https://tu-app.lovable.app/api/public/openclaw/office/state -H "x-api-key: $OPENCLAW_API_KEY"/office/eventcurl -X POST https://tu-app.lovable.app/api/public/openclaw/office/event \
-H "x-api-key: $OPENCLAW_API_KEY" -H "Content-Type: application/json" \
-d '{"type":"email_received","agent_id":"gmail","payload":{"from":"x@y.com"}}'/tasksFiltros GET: ?status=, ?agent_id=.
curl -X POST https://tu-app.lovable.app/api/public/openclaw/tasks \
-H "x-api-key: $OPENCLAW_API_KEY" -H "Content-Type: application/json" \
-d '{"title":"Revisar contrato","agent_id":"documentos","priority":"Alta"}'/tasks/:idcurl -X PATCH https://tu-app.lovable.app/api/public/openclaw/tasks/<uuid> \
-H "x-api-key: $OPENCLAW_API_KEY" -H "Content-Type: application/json" \
-d '{"status":"done"}'/commandsLa app crea comandos vía POST cuando el usuario pulsa un botón. OpenClaw hace polling con ?status=pending, ejecuta y cierra con PATCH al endpoint de abajo.
curl https://tu-app.lovable.app/api/public/openclaw/commands?status=pending \
-H "x-api-key: $OPENCLAW_API_KEY"/commands/:idcurl -X PATCH https://tu-app.lovable.app/api/public/openclaw/commands/<uuid> \
-H "x-api-key: $OPENCLAW_API_KEY" -H "Content-Type: application/json" \
-d '{"status":"done","result":{"ok":true}}'/agent-messageCrea entrada en la actividad del agente y un evento global.
curl -X POST https://tu-app.lovable.app/api/public/openclaw/agent-message \
-H "x-api-key: $OPENCLAW_API_KEY" -H "Content-Type: application/json" \
-d '{"agent_id":"zac","title":"Aviso","copy":"Reunión a las 17:00."}'/activitycurl https://tu-app.lovable.app/api/public/openclaw/activity?limit=20 \
-H "x-api-key: $OPENCLAW_API_KEY"IDs disponibles: gmail, whatsapp, crm, calendario, reuniones, documentos, zac.