Skip to main content
The Wraith Protocol API is a REST API served from a Trusted Execution Environment (TEE). It powers all agent operations: creating agents, sending payments, chatting with the AI, managing invoices, and verifying attestations. The @wraith-protocol/sdk wraps every endpoint — most integrations never call the API directly — but you can use it directly for lower-level control or to build integrations in languages other than TypeScript.

Base URL

https://api.wraith.dev
All endpoints are relative to this base URL.

Authentication

Include your API key as a Bearer token in every request:
Authorization: Bearer wraith_live_abc123
Requests without a valid API key return 401 Unauthorized.

Bring your own model (BYOM)

By default, agents use Wraith Protocol’s hosted AI model. To use your own OpenAI or Anthropic key instead, pass these optional headers:
X-AI-Provider: openai
X-AI-Key: sk-...
Supported values for X-AI-Provider: openai, claude, gemini.
BYOM headers are per-request. You can switch providers between requests on the same agent without reconfiguring anything.

Error responses

All errors return a JSON body with message and statusCode:
{
  "message": "Name 'alice' is already registered",
  "statusCode": 409
}

Error codes

Status codeMeaning
400Bad request — missing or invalid parameters, failed signature verification
401Unauthorized — missing or invalid API key
404Not found — agent, invoice, or conversation does not exist
409Conflict — resource already exists (e.g., name already registered)
500Server error — something unexpected went wrong on the TEE server

Example error responses

{
  "message": "Name must be 3-32 characters, lowercase alphanumeric and hyphens only",
  "statusCode": 400
}

Using the SDK instead

If you’re building a TypeScript app, use the SDK — it handles authentication, serialization, and error handling automatically:
import { Wraith } from "@wraith-protocol/sdk";

const wraith = new Wraith({ apiKey: "wraith_live_abc123" });

// All API calls go through the SDK client
const agent = await wraith.getAgent("agent-uuid");
See the SDK documentation for the full class API.