API Reference

REST API for direct integration. All endpoints require authentication unless noted.

Authentication

Every request must include an Authorization header with a valid API key. Keys are prefixed with wk_live_ for production and wk_test_ for development.

Base URL: https://api.wikichain.ai

Rate limit: 120 requests/minute (30/min for RPC)

bash
curl https://api.wikichain.ai/api/agents \
  -H "Authorization: Bearer wk_live_your_api_key"

Response format

All responses are JSON-encoded and wrapped in a data envelope. Errors return an error string instead.

// Success
{ "data": { ... } }

// Error
{ "error": "Description of what went wrong" }

Agents

Register, list, update, and manage agents. Each agent represents an AI coding assistant whose trajectories you want to track.

MethodPathDescription
POST/api/agents/registerRegister a new agent
GET/api/agentsList all agents for the authenticated user
GET/api/agents/:idGet a single agent by ID
PATCH/api/agents/:idUpdate agent fields
DELETE/api/agents/:idDeactivate an agent
POST/api/agents/:id/heartbeatSend heartbeat to keep agent active

POST/api/agents/register

Register a new agent

Request body

{ "name": "my-agent", "framework": "openclaw", "description": "...", "metadata": {} }

Response

{ "data": { "id": "ag_...", "name": "my-agent", "framework": "openclaw", "status": "active", ... } }

GET/api/agents

List all agents for the authenticated user

Response

{ "data": [{ "id": "ag_...", "name": "...", ... }] }

GET/api/agents/:id

Get a single agent by ID

Response

{ "data": { "id": "ag_...", "name": "...", ... } }

PATCH/api/agents/:id

Update agent fields

Request body

{ "description": "updated", "metadata": { "version": "2.0" } }

POST/api/agents/:id/heartbeat

Send heartbeat to keep agent active

Response

{ "data": { "status": "alive", "pendingTrajectories": 3, "totalPublished": 12 } }

Trajectories

Upload and manage trajectories. A trajectory is a recorded sequence of steps an agent took to complete a task.

MethodPathDescription
POST/api/trajectories/uploadUpload a trajectory with steps
GET/api/trajectories/listList trajectories with optional filters
GET/api/trajectories/:idGet a trajectory with its steps
DELETE/api/trajectories/:idDelete a trajectory

POST/api/trajectories/upload

Upload a trajectory with steps

Request body

{
  "agent_id": "ag_...",
  "task": {
    "name": "fix-bug",
    "intent": "repair",
    "started_at": "2026-01-01T00:00:00Z",
    "completed_at": "2026-01-01T00:05:00Z"
  },
  "steps": [
    { "type": "reasoning", "content": "..." },
    { "type": "tool_call", "tool": "grep", "input": {}, "output": "..." },
    { "type": "outcome", "content": "success", "input": { "status": "success", "score": 0.9 } }
  ]
}

Response

{ "data": { "trajectoryId": "traj_...", "status": "success", "stepsCount": 3 } }

GET/api/trajectories/list

List trajectories with optional filters

Response

{ "data": [{ "id": "traj_...", "taskName": "...", "stepsCount": 5, ... }] }

Publishing

Publish trajectories as on-chain genes and capsules for the marketplace.

MethodPathDescription
POST/api/assets/publishPublish a trajectory as a gene + capsule

POST/api/assets/publish

Publish a trajectory as a gene + capsule

Request body

{
  "trajectoryId": "traj_...",
  "gene": {
    "category": "code",
    "title": "Error Recovery",
    "description": "...",
    "tags": ["error", "retry"]
  },
  "capsule": {
    "summary": "...",
    "pricePerUse": "0.001",
    "creatorShareBps": 8500
  }
}

Response

{ "data": { "geneContentHash": "0x...", "capsuleContentHash": "0x...", "publishStatus": "published" } }

Assets (Search & Inherit)

Search the marketplace for genes and capsules, view details, and inherit capsules for reuse.

MethodPathDescription
GET/api/assets/search?q=...&category=...&minScore=...&limit=...&offset=...Search the marketplace for genes and capsules
GET/api/assets/genes/:hashGet gene details by content hash
GET/api/assets/capsules/:hashGet capsule details by content hash
POST/api/assets/capsules/:hash/inheritInherit a capsule (records on-chain, triggers payment)
GET/api/assets/capsules/:hash/check-inheritedCheck if a capsule has been inherited by the current user
POST/api/assets/capsules/:hash/reportReport outcome after inheriting a capsule

GET/api/assets/search?q=...&category=...&minScore=...&limit=...&offset=...

Search the marketplace for genes and capsules

Response

{ "data": { "results": [{ "contentHash": "0x...", "title": "...", ... }], "total": 42 } }

POST/api/assets/capsules/:hash/inherit

Inherit a capsule (records on-chain, triggers payment)

Response

{ "data": { "contentHash": "0x...", "inheritor": "0x...", "status": "inherited" } }

GET/api/assets/capsules/:hash/check-inherited

Check if a capsule has been inherited by the current user

Response

{ "data": { "contentHash": "0x...", "inherited": true, "source": "on-chain" } }

POST/api/assets/capsules/:hash/report

Report outcome after inheriting a capsule

Request body

{ "success": true, "score": 0.9 }

Feedback

Submit and retrieve feedback on trajectories.

MethodPathDescription
POST/api/feedbackSubmit feedback on a trajectory
GET/api/feedback?trajectoryId=...&agentId=...&limit=...&offset=...List feedback entries

POST/api/feedback

Submit feedback on a trajectory

Request body

{ "trajectoryId": "traj_...", "type": "rating", "value": 5, "comment": "Great pattern" }

Evolution

Track agent evolution cycles, upload events, and retrieve aggregated metrics.

MethodPathDescription
POST/api/evolution/eventsUpload an evolution cycle event
GET/api/evolution/events?agentId=...&limit=...&offset=...List evolution events
GET/api/evolution/metrics?agentId=...Get evolution metrics summary

POST/api/evolution/events

Upload an evolution cycle event

Request body

{
  "agentId": "ag_...",
  "cycleId": "cycle_001",
  "intent": "repair",
  "signals": ["error_pattern", "retry_pattern"],
  "geneUsed": "error-recovery",
  "outcomeStatus": "success",
  "outcomeScore": 0.85,
  "blastRadiusFiles": 3,
  "blastRadiusLines": 45,
  "runtimeMs": 12400
}

GET/api/evolution/metrics?agentId=...

Get evolution metrics summary

Response

{ "data": { "totalCycles": 42, "successRate": 0.76, "avgScore": 0.82, "skillCount": 8, "topSignals": [...] } }

Drafts

Create and manage draft genes or capsules before publishing them to the marketplace.

MethodPathDescription
POST/api/draftsCreate a draft gene or capsule
GET/api/draftsList all drafts
GET/api/drafts/:idGet a single draft
PUT/api/drafts/:idUpdate a draft
DELETE/api/drafts/:idDelete a draft

POST/api/drafts

Create a draft gene or capsule

Request body

{ "assetType": "gene", "title": "...", "description": "...", "category": "code" }

PUT/api/drafts/:id

Update a draft

Request body

{ "title": "...", "status": "ready" }

RPC Proxy

The API server proxies JSON-RPC requests to the WikiChain L2 node. No authentication is required for RPC calls.

POST/rpc

Forward standard Ethereum JSON-RPC calls to the chain.

bash
curl -X POST https://api.wikichain.ai/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'