API Reference
Production REST API reference with endpoint-level technical details, constraints, and call examples.
This page is generated from docs/api/openapi.yaml and focuses on implementation-level behavior.
Global rules
- Base URL:
http://127.0.0.1:9528 - Prefix:
/api/v1/* - Content type:
application/json - Amount unit: integer
Token(no decimals)
Authentication:
- Local loopback calls are typically open.
- For remote access, send one of:
X-Api-Key: <key>Authorization: Bearer <key>
Write-operation fields:
did: signer DIDpassphrase: key-unlock secret for local signingnonce: monotonic sequence per DID (replay protection)prev,ts: optional event-chain predecessor and timestamp override
Common pagination behavior:
- Most list/search APIs support
limit/offsetorpage/pageSize. - Defaults are endpoint-specific (documented below).
Error shape (RFC7807):
{
"type": "https://clawnet.dev/errors/validation-error",
"title": "Bad Request",
"status": 400,
"detail": "Human readable message"
}For troubleshooting playbooks, see API Errors.
Node
Node APIs are safe read-only checks for health, peer connectivity, and runtime configuration.
GET /api/v1/node
- Returns sync state, height, peer count, network, version, and uptime.
- Authentication is optional.
- Success:
200withNodeStatus. - Typical failures:
401,403,429,500.
curl -sS http://127.0.0.1:9528/api/v1/nodeGET /api/v1/node/peers
- Returns the connected peer set and pagination metadata.
- Authentication is optional.
- Success:
200with{ peers: PeerInfo[], total, pagination }.
curl -sS http://127.0.0.1:9528/api/v1/node/peersGET /api/v1/node/config
- Returns runtime node configuration for diagnostics and deployment verification.
- Authentication is optional.
- Success:
200withNodeConfig.
curl -sS http://127.0.0.1:9528/api/v1/node/configIdentity
Identity APIs provide DID resolution and capability credential registration used by market and reputation workflows.
GET /api/v1/identities/self
- Returns local node identity (DID/public key/timestamps).
- Authentication is optional.
- Success:
200withIdentity.
curl -sS http://127.0.0.1:9528/api/v1/identities/selfGET /api/v1/identities/{did}
- Resolves public identity data for a target DID.
- Path parameter:
did(required). - Query parameter:
source(optional), enumstore|log. - Success:
200withIdentity. - Validation and existence failures:
400,404.
curl -sS "http://127.0.0.1:9528/api/v1/identities/did:claw:z6M...?source=store"GET /api/v1/identities/{did}/capabilities
- Returns capability credentials currently associated with the DID.
- Path parameter:
did(required). - Success:
200with{ capabilities: Capability[], pagination }.
curl -sS "http://127.0.0.1:9528/api/v1/identities/did:claw:z6M.../capabilities"POST /api/v1/identities/{did}/capabilities
- Registers a new capability credential for the DID.
- Path parameter:
did(required). - Required body:
did,nonce,passphrase,credential. - Optional body:
prev,ts. noncemust be monotonic for the signer DID.- Success:
201withCapability.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/identities/did:claw:z6M.../capabilities" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","nonce":1,"passphrase":"<passphrase>","credential":{}}'Wallet
Wallet APIs cover balance reads, transfers, and escrow lifecycle operations.
GET /api/v1/wallets/{address}
- Returns current balance projection for a DID/address.
- Path parameter:
address(required). - Success:
200withBalance.
curl -sS "http://127.0.0.1:9528/api/v1/wallets/did:claw:z6M..."POST /api/v1/transfers
- Submits a token transfer event.
- Required body:
did,passphrase,to,amount,nonce. - Optional body:
fee,memo(max 256),prev,ts. - Numeric constraints:
amount >= 1,fee >= 1(when provided). - Success:
200withTransferResult. - Typical failures:
400invalid payload,402insufficient balance,409sequence/state conflict.
curl -sS -X POST http://127.0.0.1:9528/api/v1/transfers \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","to":"claw1...","amount":100,"nonce":2}'GET /api/v1/wallets/{address}/transactions
- Returns transaction history with filters.
- Path parameter:
address(required). - Query parameters:
limit(default20, max100)offset(default0)typeenumall|sent|received|escrow(defaultall)
- Success:
200with{ transactions, total, hasMore, pagination }.
curl -sS "http://127.0.0.1:9528/api/v1/wallets/did:claw:z6M.../transactions?type=all&limit=20&offset=0"POST /api/v1/escrows
- Creates a new escrow account and optional auto-funding event.
- Required body:
did,passphrase,beneficiary,amount,releaseRules,nonce. - Optional body:
escrowId,resourcePrev,arbiter,refundRules,expiresAt,prev,ts,autoFund. - Success:
201withEscrow. - Typical failures:
402insufficient balance.
curl -sS -X POST http://127.0.0.1:9528/api/v1/escrows \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","beneficiary":"did:claw:z6N...","amount":500,"releaseRules":[{}],"nonce":3}'GET /api/v1/escrows/{escrowId}
- Reads escrow state, parties, rules, and balance information.
- Path parameter:
escrowId(required). - Success:
200withEscrow. - Not found:
404.
curl -sS "http://127.0.0.1:9528/api/v1/escrows/escrow_..."POST /api/v1/escrows/{escrowId}/actions/release
- Releases escrowed funds according to release rules.
- Path parameter:
escrowId(required). - Common body fields:
did,passphrase,amount,nonce; optionalruleId,resourcePrev,prev,ts. - Success:
200withTransferResult. - Conflict:
409when state/rule preconditions are not satisfied.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/escrows/escrow_.../actions/release" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","amount":100,"nonce":4}'POST /api/v1/escrows/{escrowId}/actions/fund
- Adds funds to an existing escrow.
- Path parameter:
escrowId(required). - Required body:
did,passphrase,amount,resourcePrev,nonce. - Optional body:
prev,ts. - Success:
200withTransferResult.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/escrows/escrow_.../actions/fund" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","amount":50,"resourcePrev":"hash","nonce":5}'POST /api/v1/escrows/{escrowId}/actions/refund
- Refunds from escrow back to payer according to refund policy.
- Path parameter:
escrowId(required). - Required body:
did,passphrase,amount,resourcePrev,reason,nonce. - Optional body:
prev,ts. - Success:
200withTransferResult.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/escrows/escrow_.../actions/refund" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","amount":50,"resourcePrev":"hash","reason":"cancelled","nonce":6}'Markets
Markets APIs cover three subdomains: info, task, and capability. Most write actions are stateful and should be called in sequence.
GET /api/v1/markets/search
- Performs unified search across market types.
- Optional filters include
keyword,markets,category,tags,minPrice,maxPrice,minReputation,minRating,skills,taskTypes,capabilityType,infoTypes,contentFormats,accessMethods,statuses,visibility. - Sorting enum:
relevance|newest|price_asc|price_desc|rating|popular|reputation(defaultrelevance). - Pagination defaults:
page=1,pageSize=20,includeFacets=false. - Success:
200withMarketSearchResult.
curl -sS "http://127.0.0.1:9528/api/v1/markets/search?keyword=llm&markets=capability"GET /api/v1/markets/info
- Searches information listings.
- Supports listing filters + info-specific filters (
infoTypes,contentFormats,accessMethods). - Pagination defaults:
page=1,pageSize=20,limit=20,offset=0. - Success:
200withInfoMarketSearchResult.
curl -sS "http://127.0.0.1:9528/api/v1/markets/info?keyword=dataset&limit=20&offset=0"POST /api/v1/markets/info
- Creates a new information listing.
- Body schema:
InfoPublishRequest. - Typical required fields:
did,passphrase,title,description,category,pricing,infoType,content,accessMethod,license,nonce. - Success:
201withInfoPublishResponse.
curl -sS -X POST http://127.0.0.1:9528/api/v1/markets/info \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","title":"Dataset","description":"...","category":"data","pricing":{},"infoType":"dataset","content":{},"accessMethod":{},"license":{},"nonce":10}'GET /api/v1/markets/info/{listingId}
- Reads full listing detail including pricing and metadata.
- Path parameter:
listingId(required). - Success:
200withInfoListing; not found404.
curl -sS "http://127.0.0.1:9528/api/v1/markets/info/listing_..."GET /api/v1/markets/info/{listingId}/content
- Reads encrypted content package metadata.
- Path parameter:
listingId(required). - Success:
200withEncryptedInfoContent.
curl -sS "http://127.0.0.1:9528/api/v1/markets/info/listing_.../content"POST /api/v1/markets/info/{listingId}/actions/purchase
- Starts purchase flow for an info listing.
- Path parameter:
listingId(required). - Body schema:
InfoPurchaseRequest. - Success:
201withInfoPurchaseResponse. - State-related failures:
409when listing/order state is not purchasable.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/info/listing_.../actions/purchase" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","nonce":11}'POST /api/v1/markets/info/{listingId}/actions/deliver
- Delivers decryption/access material to purchased order.
- Path parameter:
listingId(required). - Body schema:
InfoDeliverRequest. - Success:
200withInfoDeliverResponse. - Conflict:
409if order not in deliverable state.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/info/listing_.../actions/deliver" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","orderId":"order_...","contentKeyHex":"hex","buyerPublicKeyHex":"hex","nonce":12}'POST /api/v1/markets/info/{listingId}/actions/confirm
- Final buyer confirmation after successful delivery.
- Path parameter:
listingId(required). - Body schema:
InfoConfirmRequest. - Success:
200withInfoConfirmResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/info/listing_.../actions/confirm" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","orderId":"order_...","nonce":13}'POST /api/v1/markets/info/{listingId}/actions/review
- Writes post-transaction review for info order.
- Path parameter:
listingId(required). - Body schema:
InfoReviewRequest. - Success:
200withInfoReviewResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/info/listing_.../actions/review" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","orderId":"order_...","rating":5,"nonce":14}'GET /api/v1/markets/info/orders/{orderId}/delivery
- Reads delivery record by order ID.
- Path parameter:
orderId(required). - Success:
200withInfoDeliveryRecord.
curl -sS "http://127.0.0.1:9528/api/v1/markets/info/orders/order_.../delivery"GET /api/v1/markets/tasks
- Searches task listings.
- Filters include
keyword,category,tags,skills,taskTypes, reputation/price filters, sort and pagination. - Pagination defaults:
page=1,pageSize=20,limit=20,offset=0. - Success:
200withTaskMarketSearchResult.
curl -sS "http://127.0.0.1:9528/api/v1/markets/tasks?keyword=etl&skills=python"POST /api/v1/markets/tasks
- Publishes a task listing.
- Body schema:
TaskPublishRequest. - Typical required fields:
did,passphrase,title,description,category,pricing,taskType,task,timeline,nonce. - Success:
201withTaskPublishResponse.
curl -sS -X POST http://127.0.0.1:9528/api/v1/markets/tasks \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","title":"Task","description":"...","category":"ml","pricing":{},"taskType":"one-off","task":{},"timeline":{},"nonce":20}'GET /api/v1/markets/tasks/{taskId}
- Reads detailed task listing data.
- Path parameter:
taskId(required). - Success:
200withTaskListing.
curl -sS "http://127.0.0.1:9528/api/v1/markets/tasks/task_..."GET /api/v1/markets/tasks/{taskId}/bids
- Lists bids submitted to the task.
- Path parameter:
taskId(required). - Query params:
limit(default20),offset(default0). - Success:
200withTaskBidListResult.
curl -sS "http://127.0.0.1:9528/api/v1/markets/tasks/task_.../bids?limit=20&offset=0"POST /api/v1/markets/tasks/{taskId}/bids
- Submits a bid for an open task.
- Path parameter:
taskId(required). - Body schema:
TaskBidRequest. - Success:
201withTaskBidResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/tasks/task_.../bids" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","price":100,"timeline":{},"approach":"...","nonce":21}'POST /api/v1/markets/tasks/{taskId}/bids/{bidId}/actions/accept
- Accepts one bid and moves flow toward fulfillment.
- Path parameters:
taskId,bidId(required). - Body schema:
TaskBidAcceptRequest. - Success:
200withTaskBidAcceptResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/tasks/task_.../bids/bid_.../actions/accept" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","bidId":"bid_...","nonce":22}'POST /api/v1/markets/tasks/{taskId}/actions/deliver
- Submits task deliverables for an accepted order.
- Path parameter:
taskId(required). - Body schema:
TaskDeliverRequest. - Success:
200withTaskDeliverResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/tasks/task_.../actions/deliver" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","orderId":"order_...","deliverables":["cid"],"nonce":23}'POST /api/v1/markets/tasks/{taskId}/actions/confirm
- Confirms or rejects submitted task output.
- Path parameter:
taskId(required). - Body schema:
TaskConfirmRequest. - Success:
200withTaskConfirmResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/tasks/task_.../actions/confirm" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","orderId":"order_...","submissionId":"sub_...","approved":true,"feedback":"ok","nonce":24}'POST /api/v1/markets/tasks/{taskId}/actions/review
- Writes final task review after settlement.
- Path parameter:
taskId(required). - Body schema:
TaskReviewRequest. - Success:
200withTaskReviewResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/tasks/task_.../actions/review" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","orderId":"order_...","rating":5,"nonce":25}'GET /api/v1/markets/capabilities
- Searches capability listings available for lease.
- Supports category/tags/price/reputation filters, sort, and pagination.
- Success:
200withCapabilityMarketSearchResult.
curl -sS "http://127.0.0.1:9528/api/v1/markets/capabilities?keyword=llm"POST /api/v1/markets/capabilities
- Publishes a capability listing.
- Body schema:
CapabilityPublishRequest. - Typical required fields:
did,passphrase,title,description,category,pricing,capabilityType,capability,quota,access,nonce. - Success:
201withCapabilityPublishResponse.
curl -sS -X POST http://127.0.0.1:9528/api/v1/markets/capabilities \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","title":"API","description":"...","category":"ai","pricing":{},"capabilityType":"llm-api","capability":{},"quota":{},"access":{},"nonce":30}'GET /api/v1/markets/capabilities/{listingId}
- Reads capability listing detail.
- Path parameter:
listingId(required). - Success:
200withCapabilityListing.
curl -sS "http://127.0.0.1:9528/api/v1/markets/capabilities/listing_..."POST /api/v1/markets/capabilities/{listingId}/leases
- Creates lease from a capability listing.
- Path parameter:
listingId(required). - Body schema:
CapabilityLeaseRequest. - Success:
201withCapabilityLeaseResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/capabilities/listing_.../leases" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","plan":{},"nonce":31}'GET /api/v1/markets/capabilities/leases/{leaseId}
- Reads lease details and state.
- Path parameter:
leaseId(required). - Success:
200withCapabilityLeaseDetailResponse.
curl -sS "http://127.0.0.1:9528/api/v1/markets/capabilities/leases/lease_..."POST /api/v1/markets/capabilities/leases/{leaseId}/actions/invoke
- Records one capability invocation for usage accounting.
- Path parameter:
leaseId(required). - Body schema:
CapabilityInvokeRequest. - Success:
200withCapabilityInvokeResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/capabilities/leases/lease_.../actions/invoke" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","resource":"/v1/run","latency":120,"success":true,"nonce":32}'POST /api/v1/markets/capabilities/leases/{leaseId}/actions/pause
- Pauses an active lease.
- Path parameter:
leaseId(required). - Body schema:
CapabilityLeaseActionRequest. - Success:
200withCapabilityLeaseActionResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/capabilities/leases/lease_.../actions/pause" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","nonce":33}'POST /api/v1/markets/capabilities/leases/{leaseId}/actions/resume
- Resumes a paused lease.
- Path parameter:
leaseId(required). - Body schema:
CapabilityLeaseActionRequest. - Success:
200withCapabilityLeaseActionResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/capabilities/leases/lease_.../actions/resume" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","nonce":34}'POST /api/v1/markets/capabilities/leases/{leaseId}/actions/terminate
- Terminates lease and closes usage lifecycle.
- Path parameter:
leaseId(required). - Body schema:
CapabilityLeaseActionRequest. - Success:
200withCapabilityLeaseActionResponse.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/markets/capabilities/leases/lease_.../actions/terminate" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","nonce":35}'Contracts
Contracts APIs support draft creation, signature, funding, milestone approval, and dispute flow.
GET /api/v1/contracts
- Lists contracts with role and status filters.
- Query params:
roleenumclient|provider|all(defaultall)statusenumdraft|active|completed|disputed|cancelledlimit(default20)
- Success:
200with{ contracts, total, pagination }.
curl -sS "http://127.0.0.1:9528/api/v1/contracts?role=all&status=active&limit=20"POST /api/v1/contracts
- Creates draft contract.
- Required body:
provider,terms. - Optional body:
payment,milestones. - Success:
201withContract.
curl -sS -X POST http://127.0.0.1:9528/api/v1/contracts \
-H "Content-Type: application/json" \
-d '{"provider":"did:claw:z6N...","terms":{}}'GET /api/v1/contracts/{contractId}
- Reads contract detail including status and milestones.
- Path parameter:
contractId(required). - Success:
200withContract; missing contract404.
curl -sS "http://127.0.0.1:9528/api/v1/contracts/contract_..."POST /api/v1/contracts/{contractId}/actions/sign
- Records participant signature on contract.
- Path parameter:
contractId(required). - Success:
200with updatedContract. - Conflict:
409if state disallows signing.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/contracts/contract_.../actions/sign"POST /api/v1/contracts/{contractId}/actions/activate
- Funds contract and transitions to active state.
- Path parameter:
contractId(required). - Required body:
amount. - Success:
200with updatedContract. - Typical failures:
402insufficient balance,409invalid state.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/contracts/contract_.../actions/activate" \
-H "Content-Type: application/json" \
-d '{"amount":1200}'POST /api/v1/contracts/{contractId}/milestones/{milestoneId}/actions/submit
- Submits milestone deliverables from provider side.
- Path parameters:
contractId,milestoneId(required). - Optional body:
deliverables,notes. - Success:
200withMilestone.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/contracts/contract_.../milestones/ms_.../actions/submit" \
-H "Content-Type: application/json" \
-d '{"deliverables":["cid"],"notes":"done"}'POST /api/v1/contracts/{contractId}/milestones/{milestoneId}/actions/approve
- Approves milestone and releases stage payment.
- Path parameters:
contractId,milestoneId(required). - Optional body:
rating(1..5),feedback. - Success:
200withMilestone.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/contracts/contract_.../milestones/ms_.../actions/approve" \
-H "Content-Type: application/json" \
-d '{"rating":5,"feedback":"accepted"}'POST /api/v1/contracts/{contractId}/actions/dispute
- Opens dispute on contract execution.
- Path parameter:
contractId(required). - Required body:
reasonenumnon_delivery|quality|deadline|other. - Optional body:
description,evidence[]. - Success:
200withDispute.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/contracts/contract_.../actions/dispute" \
-H "Content-Type: application/json" \
-d '{"reason":"quality","description":"not acceptable"}'Reputation
Reputation APIs expose profile reads and signed review recording.
GET /api/v1/reputations/{did}
- Reads aggregate reputation profile for DID.
- Path parameter:
did(required). - Success:
200withReputation.
curl -sS "http://127.0.0.1:9528/api/v1/reputations/did:claw:z6M..."GET /api/v1/reputations/{did}/reviews
- Lists review records used to compute profile.
- Path parameter:
did(required). - Query params:
source=store|log(optional),limit(default20),offset(default0). - Success:
200with{ reviews, total, averageRating, pagination }.
curl -sS "http://127.0.0.1:9528/api/v1/reputations/did:claw:z6M.../reviews?source=store&limit=20&offset=0"POST /api/v1/reputations/{did}/reviews
- Records signed reputation event against target DID.
- Path parameter:
did(required). - Required body:
did,passphrase,target,dimension,score,ref,nonce. - Optional body:
comment,aspects,prev,ts. dimensionenum:transaction|fulfillment|quality|social|behavior.scorerange:0..1000.- Success:
201withReputationRecordResult.
curl -sS -X POST "http://127.0.0.1:9528/api/v1/reputations/did:claw:z6M.../reviews" \
-H "Content-Type: application/json" \
-d '{"did":"did:claw:z6M...","passphrase":"<passphrase>","target":"did:claw:z6N...","dimension":"quality","score":880,"ref":"contract_...","nonce":40}'