API Documentation
Complete reference for the SudoClaw API. All endpoints require authentication unless noted.
Base URL
Authentication
Include your session token in the Authorization header:
Authentication
/api/auth/registerRegister a new user
Request Body:
{
"email": "[email protected]",
"password": "securepassword",
"name": "John Doe"
}Response:
{
"success": true,
"data": {
"userId": "user_xxx",
"email": "[email protected]",
"sessionToken": "jwt_token"
}
}/api/auth/loginLogin and get session token
Request Body:
{
"email": "[email protected]",
"password": "securepassword"
}Response:
{
"success": true,
"data": {
"userId": "user_xxx",
"email": "[email protected]",
"sessionToken": "jwt_token"
}
}/api/auth/logoutLogout and invalidate session
Response:
{
"success": true,
"message": "Logged out successfully"
}/api/auth/meGet current user info
Response:
{
"success": true,
"data": {
"id": "user_xxx",
"email": "[email protected]",
"name": "John Doe",
"organizations": []
}
}Organizations
/api/organizationsList user organizations
Response:
{
"success": true,
"data": {
"organizations": []
}
}/api/organizationsCreate new organization
Request Body:
{
"name": "My Company",
"slug": "my-company"
}Response:
{
"success": true,
"data": {
"organization": {
"id": "org_xxx",
"name": "My Company"
}
}
}/api/organizations/:orgIdGet organization details
Response:
{
"success": true,
"data": {
"organization": {
"id": "org_xxx",
"name": "My Company"
}
}
}/api/organizations/:orgId/membersInvite member to organization
Request Body:
{
"email": "[email protected]",
"role": "member"
}Response:
{
"success": true,
"message": "Member invited successfully"
}Agents
/api/agentsList all agents
Response:
{
"success": true,
"data": {
"agents": []
}
}/api/agentsCreate new agent
Request Body:
{
"name": "My Agent",
"description": "A helpful assistant"
}Response:
{
"success": true,
"data": {
"agent": {
"id": "agent_xxx",
"name": "My Agent",
"status": "deploying"
}
}
}/api/agents/:agentIdGet agent details
Response:
{
"success": true,
"data": {
"agent": {},
"skills": [],
"metrics": [],
"alerts": []
}
}/api/agents/:agentIdUpdate agent
Request Body:
{
"name": "Updated Name"
}Response:
{
"success": true,
"data": {
"agent": {}
}
}/api/agents/:agentIdDelete agent
Response:
{
"success": true,
"message": "Agent deleted successfully"
}/api/agents/:agentId/skillsAdd skill to agent
Request Body:
{
"skillName": "web_search",
"skillUrl": "https://..."
}Response:
{
"success": true,
"data": {
"skill": {}
}
}/api/agents/:agentId/healthGet agent health status
Response:
{
"success": true,
"data": {
"status": "online",
"last_seen": 1234567890
}
}/api/agents/:agentId/heartbeatAgent heartbeat (internal)
Request Body:
{
"status": "online",
"metrics": {
"api_calls": 100
}
}Response:
{
"success": true,
"message": "Heartbeat recorded"
}Billing
/api/billing/plansList pricing plans
Response:
{
"success": true,
"data": {
"plans": [
{
"id": "free",
"name": "Free",
"price": 0
},
{
"id": "pro",
"name": "Pro",
"price": 29
}
]
}
}/api/billing/create-checkoutCreate checkout session
Request Body:
{
"priceId": "price_xxx",
"organizationId": "org_xxx"
}Response:
{
"success": true,
"data": {
"checkoutUrl": "https://checkout.polar.sh/...",
"checkoutId": "chk_xxx"
}
}/api/billing/usage/:orgIdGet usage for organization
Response:
{
"success": true,
"data": {
"agents": 3,
"apiCalls": 15000,
"cost": 12.5
}
}Telegram
/api/telegram/webhookTelegram webhook verification
Query Parameters:
{
"hub_mode": "subscribe",
"hub_verify_token": "..."
}Response:
"challenge_string"
/api/telegram/webhookTelegram webhook handler
Request Body:
{
"update_id": 123,
"message": {
"chat": {
"id": 12345
},
"text": "/start"
}
}Response:
{
"ok": true
}/api/telegram/sendSend message to Telegram user
Request Body:
{
"chatId": "12345",
"text": "Hello!",
"agentId": "agent_xxx"
}Response:
{
"ok": true
}Rate Limiting
API requests are rate limited based on your plan. Free plans: 100 requests/hour. Pro plans: 10,000 requests/hour.
Error Responses
All errors return a consistent format:
{
"success": false,
"error": "Error message"
}Common status codes: 400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 429 (Rate Limited), 500 (Server Error).