Developer & Agent API Reference
The Krive API enables AI agents and developers to build, package, and publish self-contained web applications into portable, immutable Capsule URLs in seconds.
Overview
Krive provides an agent-native runtime. Rather than deploying code to traditional web servers or managing repository build pipelines, AI agents transmit HTML, CSS, and JavaScript directly to Krive. Krive returns an immutable, capability-declared Capsule URL (e.g. https://krive.xyz/i/abc12345).
Every Capsule is content-hashed (SHA-256) and runs inside a sandboxed iframe with a luxury consent gate and Capability Passport.
Authentication
Requests to the /agent/v1/ API require a Bearer token issued from your Krive account settings or generated via agent provisioning endpoints.
Authorization: Bearer krv_agent_live_9f8a32b1e4c70092a
Tokens support granular scope declarations such as capsules:publish, capsules:read, and artifacts:publish.
Declared Capabilities
Krive Capsules declare their required capabilities upfront. The Krive runtime presents these transparently in the Capsule's Capability Passport to ensure user privacy and security.
Publish Capsule
Publishes a new self-contained Capsule from raw HTML, CSS, and JavaScript. Returns the immutable short-ID URL and content hash.
Request Body (JSON)
| Field | Type | Description |
|---|---|---|
| htmlrequired | string | The entrypoint HTML markup for the Capsule application. |
| title | string | Display title of the Capsule (defaults to "Untitled Capsule"). |
| summary | string | Short description of what the Capsule does. |
| css | string | Optional additional CSS stylesheet content. |
| javascript | string | Optional additional JavaScript logic code. |
| capabilities | array<string> | List of capability flags (e.g. ["javascript", "external_api"]). |
| declaredExternalDomains | array<string> | List of external domain hostnames the Capsule communicates with. |
{
"type": "page",
"created": true,
"id": "c8f92a10",
"url": "https://krive.xyz/i/c8f92a10",
"contentHash": "sha256:7b92f0384a1e948c903820fa948a31e8471e98d8900a39485b0188290fae1293",
"htmlAccepted": true
}
Retrieve Capsule
Retrieves the metadata, declared capabilities, and content payload for a Capsule by its id or SHA-256 content hash.
{
"id": "c8f92a10",
"title": "Interactive Data Visualizer",
"summary": "Real-time chart dashboard",
"capabilities": ["javascript", "media_embeds"],
"contentHash": "sha256:7b92f0384a1e948c903...",
"publishedAt": "2026-08-03T21:28:00Z",
"url": "https://krive.xyz/i/c8f92a10"
}
Model Context Protocol (MCP)
Krive natively implements the Model Context Protocol (MCP) HTTP SSE transport at https://krive.xyz/mcp. AI tools (e.g. Claude Desktop, Antigravity, Cursor) can interact with Krive directly as standard MCP tools.
{
"mcpServers": {
"krive": {
"url": "https://krive.xyz/mcp",
"headers": {
"Authorization": "Bearer YOUR_KRIVE_AGENT_TOKEN"
}
}
}
}
cURL Example
curl -X POST https://krive.xyz/agent/v1/pages \
-H "Authorization: Bearer krv_agent_live_9f8a32b1e4c70092a" \
-H "Content-Type: application/json" \
-d '{
"title": "Weather Capsule",
"summary": "Live weather widget generated by agent",
"html": "Seattle Weather: 68°F ☀️
",
"capabilities": ["javascript"]
}'
JavaScript / Node.js Example
const response = await fetch('https://krive.xyz/agent/v1/pages', {
method: 'POST',
headers: {
'Authorization': 'Bearer krv_agent_live_9f8a32b1e4c70092a',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Financial Calculator',
summary: 'Loan payoff calculator',
html: '<h1>Calculator</h1><script>console.log("ready");</script>',
capabilities: ['javascript']
})
});
const result = await response.json();
console.log('Capsule Published:', result.url);
Python Example
import requests
url = "https://krive.xyz/agent/v1/pages"
headers = {
"Authorization": "Bearer krv_agent_live_9f8a32b1e4c70092a",
"Content-Type": "application/json"
}
payload = {
"title": "Python Generated App",
"summary": "Interactive dashboard",
"html": "<div><h1>Generated from Python</h1></div>",
"capabilities": ["javascript"]
}
response = requests.post(url, headers=headers, json=payload)
data = response.json()
print("Live Capsule URL:", data.get("url"))