InnoClaw provides a set of REST API endpoints served by Next.js API routes. All endpoints are under the /api/ path.
GET /api/workspaces
Returns all workspaces.
Response:
[
{
"id": "workspace-uuid",
"name": "my-project",
"rootPath": "/data/research/my-project",
"createdAt": "2025-01-01T00:00:00.000Z"
}
]POST /api/workspaces
Request Body:
{
"path": "/data/research/my-project"
}DELETE /api/workspaces/[workspaceId]
Removes the workspace record from the database. Files on disk are not deleted.
GET /api/files/browse?workspaceId={id}&path={relativePath}
Returns the file listing for a directory within a workspace.
GET /api/files/read?workspaceId={id}&path={relativePath}
Returns the content of a file.
POST /api/files/write
Request Body:
{
"workspaceId": "workspace-uuid",
"path": "relative/path/to/file.txt",
"content": "file content here"
}POST /api/files/upload
Accepts multipart/form-data with file, workspaceId, and path fields.
DELETE /api/files/delete
Request Body:
{
"workspaceId": "workspace-uuid",
"path": "relative/path/to/file.txt"
}POST /api/files/rename
Request Body:
{
"workspaceId": "workspace-uuid",
"oldPath": "old/name.txt",
"newPath": "new/name.txt"
}POST /api/files/mkdir
Request Body:
{
"workspaceId": "workspace-uuid",
"path": "relative/path/to/new-dir"
}POST /api/chat
Sends a message and receives a streaming AI response via RAG.
Request Body:
{
"messages": [
{ "role": "user", "content": "What is this project about?" }
],
"workspaceId": "workspace-uuid"
}Response: Server-Sent Events (SSE) stream with AI response tokens.
POST /api/agent
Sends a message to the autonomous AI agent with tool-calling capability.
Request Body:
{
"messages": [],
"workspaceId": "workspace-uuid",
"cwd": "/data/research/my-project",
"skillId": "optional-skill-id",
"paramValues": {},
"mode": "agent"
}| Field | Type | Required | Description |
|---|---|---|---|
messages |
UIMessage[] |
Yes | Chat message history |
workspaceId |
string |
Yes | Workspace identifier |
cwd |
string |
Yes | Current working directory for tool execution |
skillId |
string |
No | Skill ID to use for this request |
paramValues |
object |
No | Skill parameter values |
mode |
string |
No | "agent", "plan", or "ask" (default: "agent") |
Response: Streaming response with tool calls and text.
POST /api/agent/summarize
Summarizes agent conversation history and optionally saves as a note.
Request Body:
{
"workspaceId": "workspace-uuid",
"messages": [],
"trigger": "clear",
"preview": false,
"locale": "en"
}| Field | Type | Required | Description |
|---|---|---|---|
workspaceId |
string |
Yes | Workspace identifier |
messages |
array |
Yes | Message array with parts and roles |
trigger |
string |
No | "clear" or "overflow" |
preview |
boolean |
No | If true, returns summary without saving |
locale |
string |
No | "en" or "zh" (default: "en") |
GET /api/notes?workspaceId={id}
POST /api/notes
Request Body:
{
"workspaceId": "workspace-uuid",
"title": "My Note",
"content": "Note content here"
}PUT /api/notes/[noteId]
DELETE /api/notes/[noteId]
POST /api/generate
Request Body:
{
"workspaceId": "workspace-uuid",
"type": "summary"
}Supported types: summary, faq, brief, timeline, memory, daily_report, weekly_report.
POST /api/daily-report
Generates a daily activity report for a workspace.
Request Body:
{
"workspaceId": "workspace-uuid",
"date": "2025-03-01",
"locale": "en"
}| Field | Type | Required | Description |
|---|---|---|---|
workspaceId |
string |
Yes | Workspace identifier |
date |
string |
No | YYYY-MM-DD format (defaults to today) |
locale |
string |
No | "en" or "zh" (default: "en") |
Response: Returns note object (201) or { skipped: true, reason: "..." } (200) if no activities found.
POST /api/weekly-report
Generates a weekly activity report for a workspace.
Request Body:
{
"workspaceId": "workspace-uuid",
"locale": "en"
}Response: Returns note object (201) or { skipped: true, reason: "..." } (200) if no activities found.
GET /api/datasets
Returns all datasets ordered by creation date (newest first).
POST /api/datasets
Creates a dataset record and initiates background download.
Request Body:
{
"repoId": "username/dataset-name",
"repoType": "dataset",
"revision": "main",
"name": "My Dataset",
"allowPatterns": ["*.parquet"],
"ignorePatterns": ["*.bin"],
"source": "huggingface"
}| Field | Type | Required | Description |
|---|---|---|---|
repoId |
string |
Yes | HuggingFace or ModelScope repository ID |
repoType |
string |
No | "dataset", "model", or "space" (default: "dataset") |
revision |
string |
No | Specific branch or tag |
name |
string |
No | Display name |
allowPatterns |
string[] |
No | File glob patterns to include |
ignorePatterns |
string[] |
No | File glob patterns to exclude |
source |
string |
No | "huggingface" or "modelscope" (default: "huggingface") |
GET /api/datasets/[datasetId]
Returns complete dataset information including parsed manifest and stats.
DELETE /api/datasets/[datasetId]?deleteFiles=true
Removes dataset from database. Set deleteFiles=true to also delete local files.
GET /api/datasets/[datasetId]/status
Returns live download progress.
Response:
{
"datasetId": "dataset-uuid",
"status": "downloading",
"progress": 45,
"phase": "downloading",
"downloadedBytes": 1048576,
"totalBytes": 2097152,
"downloadedFiles": 3,
"totalFiles": 10
}POST /api/datasets/[datasetId]/pause
POST /api/datasets/[datasetId]/retry
POST /api/datasets/[datasetId]/cancel
POST /api/datasets/[datasetId]/refresh
Recalculates manifest and stats from disk for ready datasets.
GET /api/datasets/[datasetId]/preview?split=default&n=20
Returns sample data from ready datasets. n is capped at 1000.
GET /api/datasets/[datasetId]/workspaces
POST /api/datasets/[datasetId]/workspaces
DELETE /api/datasets/[datasetId]/workspaces?workspaceId={id}
Link/unlink datasets to workspaces (many-to-many relationship).
POST /api/datasets/import-local
Request Body:
{
"localPath": "/data/my-local-dataset",
"name": "My Local Dataset"
}GET /api/datasets/repo-info?repoId={repoId}&repoType=dataset
GET /api/datasets/modelscope-info?repoId={repoId}&repoType=dataset
POST /api/paper-study/search
Request Body:
{
"keywords": ["transformer", "attention"],
"maxResults": 10,
"dateFrom": "2025-01-01",
"dateTo": "2025-03-01",
"sources": ["arxiv", "huggingface"]
}| Field | Type | Required | Description |
|---|---|---|---|
keywords |
string[] |
Yes | At least one keyword required |
maxResults |
number |
No | Max 30 (default: 10) |
dateFrom |
string |
No | Start date filter |
dateTo |
string |
No | End date filter |
sources |
string[] |
No | "arxiv" and/or "huggingface" (default: both) |
GET /api/scheduled-tasks
POST /api/scheduled-tasks
Request Body:
{
"name": "Daily Git Sync",
"taskType": "git_sync",
"schedule": "0 0 * * *",
"workspaceId": "workspace-uuid",
"isEnabled": true
}| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | Task display name |
taskType |
string |
Yes | "daily_report", "weekly_report", "git_sync", "source_sync", or "custom" |
schedule |
string |
Yes | Valid cron expression (e.g. "0 0 * * *") |
workspaceId |
string |
No | Workspace to bind (null = global) |
config |
object |
No | Task-specific JSON configuration |
isEnabled |
boolean |
No | Default: true |
GET /api/scheduled-tasks/[taskId]
PUT /api/scheduled-tasks/[taskId]
DELETE /api/scheduled-tasks/[taskId]
POST /api/terminal/exec
Executes a shell command in the workspace directory.
Request Body:
{
"command": "ls -la",
"cwd": "/data/research/my-project"
}| Field | Type | Required | Description |
|---|---|---|---|
command |
string |
Yes | Shell command (max 4096 chars) |
cwd |
string |
Yes | Working directory (validated against allowed roots) |
Response:
{
"stdout": "...",
"stderr": "...",
"exitCode": 0,
"cwd": "/data/research/my-project"
}Timeout: 30 seconds. Max output: 1MB.
GET /api/cluster/status
Returns Kubernetes cluster overview (nodes, jobs, pods). Returns { configured: false } if KUBECONFIG_PATH is not set.
Response:
{
"configured": true,
"nodes": [{ "name": "...", "ready": true, "roles": "...", "cpu": "...", "memory": "...", "gpu": "..." }],
"jobs": [{ "name": "...", "namespace": "...", "active": 1, "succeeded": 0, "failed": 0 }],
"pods": [{ "name": "...", "namespace": "...", "phase": "Running", "nodeName": "..." }],
"timestamp": "2025-03-01T00:00:00.000Z"
}GET /api/cluster/operations?workspaceId={id}&limit=50&offset=0
Returns paginated cluster operation audit log. limit max: 200.
GET /api/models?provider=openai
Fetches available models from the configured provider's API.
| Parameter | Type | Required | Description |
|---|---|---|---|
provider |
string |
No | "openai" or "anthropic" (default: "openai") |
Response:
{
"models": [
{ "id": "gpt-4o", "name": "gpt-4o" }
]
}GET /api/system/network
Returns current network speed measurement.
POST /api/bot/feishu/push
Pushes a message or interactive card to a Feishu chat.
Headers:
Authorization: Bearer <FEISHU_PUSH_SECRET>
Request Body:
{
"chatId": "oc_xxxxxxxxxxxx",
"title": "Agent Message",
"content": "Message content here",
"type": "card"
}| Field | Type | Required | Description |
|---|---|---|---|
chatId |
string |
Yes | Feishu chat/group ID |
title |
string |
No | Card title (default: "Agent Message") |
content |
string |
Yes | Message content |
type |
string |
No | "text" or "card" (default: "card") |
POST /api/git/clone
Request Body:
{
"url": "https://github.com/user/repo.git",
"rootPath": "/data/research"
}POST /api/git/pull
Request Body:
{
"workspaceId": "workspace-uuid"
}GET /api/git/status?workspaceId={id}
GET /api/settings
PUT /api/settings
GET /api/skills?workspaceId={id}
POST /api/skills
POST /api/skills/import
GET /api/skills/[skillId]/export
PUT /api/skills/[skillId]
DELETE /api/skills/[skillId]
All API endpoints return standard HTTP status codes:
| Status | Description |
|---|---|
200 |
Success |
201 |
Created (new resource) |
400 |
Bad request (missing or invalid parameters) |
401 |
Unauthorized (invalid authentication) |
404 |
Resource not found |
500 |
Internal server error |
503 |
Service unavailable (AI not configured) |
Error responses include a JSON body:
{
"error": "Description of the error"
}