Documentation Index
Fetch the complete documentation index at: https://docs.usewraith.xyz/llms.txt
Use this file to discover all available pages before exploring further.
The TEE server exposes a REST API. The SDK’s Wraith and WraithAgent classes wrap these endpoints — most developers don’t call them directly.
Authentication
All requests require an API key:
Authorization: Bearer wraith_live_abc123
Optional BYOM headers:
X-AI-Provider: openai
X-AI-Key: sk-...
Agent Endpoints
Create Agent
Create a new agent with a .wraith name.
Request:
{
name: string; // "alice" (becomes alice.wraith)
chain: string; // "horizen" | "stellar" | "ethereum" | ...
wallet: string; // owner wallet address
signature: string; // EIP-191 or ed25519 signature
message?: string; // signed message (for verification)
}
Response:
{
id: string; // UUID
name: string; // "alice"
chain: string; // "horizen"
address: string; // agent's on-chain address
metaAddress: string; // stealth meta-address
}
List Agents
Returns all agents for the authenticated API key.
Response: AgentInfo[]
Get Agent by ID
Response: AgentInfo
Get Agent by Name
Look up an agent by .wraith name.
Response: AgentInfo
Get Agent by Wallet
GET /agent/wallet/:address
Look up an agent by owner wallet address.
Response: AgentInfo
Get Agent Status
Returns balance, pending invoices, and other stats.
Response:
{
balance: string;
tokens: Record<string, string>;
pendingInvoices: number;
address: string;
metaAddress: string;
chain: string;
}
Export Private Key
Export the agent’s private key. Requires a fresh wallet signature.
Request:
{
signature: string; // fresh signature from owner wallet
message: string; // signed message
}
Response:
{
secret: string; // "0x..." — the agent's private key
}
Chat
Send Message
Send a natural language message to the AI agent.
Request:
{
message: string;
conversationId?: string; // continue existing conversation
}
Response:
{
response: string; // agent's text reply
toolCalls?: ToolCall[]; // tools the agent executed
conversationId: string; // conversation ID for continuity
}
interface ToolCall {
name: string; // "send_payment", "scan_payments", etc.
status: string; // "success" or "error"
detail?: string; // JSON string with tool result
}
Conversations
List Conversations
GET /agent/:id/conversations
Response: Conversation[]
interface Conversation {
id: string;
title: string;
createdAt: string;
updatedAt: string;
}
Create Conversation
POST /agent/:id/conversations
Response: Conversation
Get Messages
GET /agent/:id/conversations/:convId/messages
Response:
Array<{
role: "user" | "agent" | "tool" | "system";
text: string;
createdAt: string;
}>
Delete Conversation
DELETE /agent/:id/conversations/:convId
Invoices
Get Invoice
Response:
{
id: string;
agentName: string;
amount: string;
asset: string;
memo: string;
status: "pending" | "paid";
txHash: string | null;
paymentLink: string;
createdAt: string;
}
Mark Invoice Paid
Idempotent — calling multiple times doesn’t create duplicate notifications.
Notifications
List Notifications
GET /agent/:id/notifications
Response:
{
notifications: Notification[];
unreadCount: number;
}
interface Notification {
id: number;
type: string;
title: string;
body: string;
read: boolean;
createdAt: string;
}
Mark All Read
POST /agent/:id/notifications/read
Clear All
DELETE /agent/:id/notifications
TEE
Health Check
Response:
TEE Info
Returns TEE environment information.
Remote Attestation
Returns cryptographic proof that the TEE is running authentic code and the agent’s keys were derived correctly.
Error Responses
All errors return JSON with a message field:
{
message: string;
statusCode: number;
}
| Status Code | Meaning |
|---|
| 400 | Bad request (missing params, invalid signature) |
| 401 | Unauthorized (invalid API key) |
| 404 | Agent/invoice/conversation not found |
| 409 | Conflict (name already taken) |
| 500 | Server error |
Example
// 400 Bad Request
{
"message": "Name must be 3-32 characters, lowercase alphanumeric and hyphens only",
"statusCode": 400
}
// 401 Unauthorized
{
"message": "Invalid API key",
"statusCode": 401
}
// 409 Conflict
{
"message": "Name 'alice' is already registered",
"statusCode": 409
}