https://api.kuberna.io/v1
All API requests require authentication using JWT tokens or API keys.
Authorization: Bearer <your-jwt-token>X-API-Key: <your-api-key>- Rate Limit: 100 requests per minute per API key
- Burst Limit: 20 requests per second
Rate limit headers are included in all responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640000000
POST /api/v1/payments/intentsRequest Body:
{
"userId": "user-123",
"amount": "100",
"currency": "USD",
"token": "0x0000000000000000000000000000000000000000",
"chain": "ethereum",
"metadata": {
"description": "Task payment",
"durationSeconds": 86400
}
}Response:
{
"intentId": "0x...",
"escrowId": "0x...",
"status": "created",
"requiredApproval": {
"token": "0x...",
"spender": "0x...",
"amount": "100"
}
}POST /api/v1/payments/escrows/:id/fundRequest Body:
{
"txHash": "0x...",
"chain": "ethereum"
}Response:
{
"success": true,
"escrowId": "0x...",
"status": "funded"
}POST /api/v1/payments/escrows/:id/releaseResponse:
{
"success": true,
"txHash": "0x...",
"status": "released"
}POST /api/v1/payments/escrows/:id/refundRequest Body:
{
"reason": "Task not completed"
}Response:
{
"success": true,
"txHash": "0x...",
"status": "refunded"
}GET /api/v1/payments/intents/:idResponse:
{
"intentId": "0x...",
"escrowId": "0x...",
"status": "funded",
"amount": "100",
"token": "0x...",
"chain": "ethereum",
"requester": "0x...",
"executor": "0x...",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:05:00Z"
}POST /api/v1/payments/withdrawalsRequest Body:
{
"userId": "user-123",
"token": "0x...",
"amount": "50",
"chain": "ethereum"
}Response:
{
"success": true,
"txHash": "0x..."
}GET /api/v1/payments/tokens?chain=ethereumResponse:
{
"tokens": [
{
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ethereum",
"decimals": 18,
"minAmount": "0",
"maxAmount": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
}
]
}POST /api/v1/payments/gas-estimateRequest Body:
{
"chain": "ethereum",
"operation": "createEscrow",
"params": {
"intentId": "0x...",
"token": "0x...",
"amount": "100",
"durationSeconds": 86400
}
}Response:
{
"gasLimit": "150000",
"gasPrice": "30000000000",
"totalCost": "4500000000000000",
"totalCostUSD": "12.50",
"warning": "Gas price is currently 50% higher than average"
}POST /api/v1/tee/deploymentsRequest Body:
{
"agentId": "agent-123",
"ownerId": "user-123",
"code": "base64-encoded-code",
"config": {
"model": "gpt-4",
"temperature": 0.7
},
"provider": "phala",
"resources": {
"cpu": 2,
"memory": 4096,
"storage": 10240
}
}Response:
{
"deploymentId": "phala-1234567890-abc",
"enclaveId": "enclave-123",
"endpoint": "https://enclave-123.phala.cloud",
"attestation": {
"quote": "0x...",
"mrenclave": "0x...",
"mrsigner": "0x...",
"timestamp": 1640000000,
"signature": "0x...",
"isValid": true
},
"status": "running"
}GET /api/v1/tee/deployments/:idResponse:
{
"deploymentId": "phala-1234567890-abc",
"agentId": "agent-123",
"provider": "phala",
"status": "running",
"endpoint": "https://enclave-123.phala.cloud",
"createdAt": "2024-01-15T10:00:00Z",
"health": {
"cpu": 45.5,
"memory": 2048,
"uptime": 3600,
"requestCount": 1000,
"errorRate": 0.01,
"lastPing": "2024-01-15T11:00:00Z"
}
}DELETE /api/v1/tee/deployments/:idResponse:
{
"success": true,
"deploymentId": "phala-1234567890-abc",
"status": "stopped"
}POST /api/v1/tee/attestations/verifyRequest Body:
{
"quote": "0x...",
"mrenclave": "0x...",
"mrsigner": "0x...",
"timestamp": 1640000000,
"signature": "0x...",
"isValid": true
}Response:
{
"valid": true,
"details": {
"signatureValid": true,
"mrenclaveValid": true,
"timestampValid": true
}
}POST /api/v1/tee/zktls/proofsRequest Body:
{
"agentId": "agent-123",
"provider": "reclaim",
"dataSource": "https://bank.example.com",
"claimType": "bank_balance",
"parameters": {
"accountId": "12345"
}
}Response:
{
"proofId": "session-123",
"claim": {
"type": "bank_balance",
"dataSource": "https://bank.example.com",
"parameters": {
"accountId": "12345"
}
},
"proof": "0x...",
"attestationId": "0x...",
"verified": true
}GET /api/v1/tee/zktls/proofs/:id/verifyResponse:
{
"proofId": "session-123",
"verified": true,
"claim": {
"type": "bank_balance",
"value": "10000"
}
}GET /api/v1/tee/enclaves/:id/healthResponse:
{
"enclaveId": "enclave-123",
"cpu": 45.5,
"memory": 2048,
"uptime": 3600,
"requestCount": 1000,
"errorRate": 0.01,
"lastPing": "2024-01-15T11:00:00Z"
}POST /api/v1/intentsRequest Body:
{
"description": "Swap 1 ETH to USDC",
"sourceChain": "ethereum",
"sourceToken": "0x...",
"sourceAmount": "1000000000000000000",
"destChain": "ethereum",
"destToken": "0x...",
"minDestAmount": "2000000000",
"budget": "1000000000000000000",
"durationSeconds": 86400
}Response:
{
"intentId": "0x...",
"status": "open",
"createdAt": "2024-01-15T10:00:00Z"
}GET /api/v1/intents/:idResponse:
{
"intentId": "0x...",
"requester": "0x...",
"description": "Swap 1 ETH to USDC",
"status": "bidding",
"bids": [
{
"solver": "0x...",
"price": "950000000000000000",
"estimatedTime": 300,
"status": "pending"
}
],
"createdAt": "2024-01-15T10:00:00Z"
}GET /api/v1/intents?page=1&limit=10&status=openResponse:
{
"intents": [
{
"intentId": "0x...",
"description": "Swap 1 ETH to USDC",
"status": "open",
"createdAt": "2024-01-15T10:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 100,
"pages": 10
}
}POST /api/v1/intents/:id/bidsRequest Body:
{
"price": "950000000000000000",
"estimatedTime": 300,
"routeDetails": "0x..."
}Response:
{
"bidId": 0,
"intentId": "0x...",
"solver": "0x...",
"status": "pending"
}POST /api/v1/intents/:id/bids/:bidId/acceptResponse:
{
"success": true,
"intentId": "0x...",
"bidId": 0,
"status": "assigned"
}DELETE /api/v1/intents/:id/bids/:bidIdResponse:
{
"success": true,
"bidId": 0,
"status": "retracted"
}POST /api/v1/intents/:id/cancelResponse:
{
"success": true,
"intentId": "0x...",
"status": "cancelled"
}POST /api/v1/certificatesRequest Body:
{
"recipient": "0x...",
"recipientName": "John Doe",
"courseTitle": "Web3 Development",
"courseId": "course-123",
"instructorName": "Jane Smith",
"verificationHash": "0x..."
}Response:
{
"tokenId": 1,
"recipient": "0x...",
"txHash": "0x..."
}GET /api/v1/certificates/:idResponse:
{
"tokenId": 1,
"recipient": "0x...",
"recipientName": "John Doe",
"courseTitle": "Web3 Development",
"courseId": "course-123",
"issuedAt": "2024-01-15T10:00:00Z",
"isValid": true
}GET /api/v1/certificates/verify/:hashResponse:
{
"valid": true,
"tokenId": 1,
"recipient": "0x...",
"courseTitle": "Web3 Development"
}POST /api/v1/certificates/:id/revokeRequest Body:
{
"reason": "Fraudulent completion"
}Response:
{
"success": true,
"tokenId": 1,
"status": "revoked"
}GET /api/v1/users/:id/certificatesResponse:
{
"certificates": [
{
"tokenId": 1,
"courseTitle": "Web3 Development",
"issuedAt": "2024-01-15T10:00:00Z",
"isValid": true
}
]
}POST /api/v1/wallets/connectRequest Body:
{
"address": "0x...",
"signature": "0x...",
"message": "Sign this message to authenticate"
}Response:
{
"success": true,
"token": "jwt-token",
"address": "0x..."
}POST /api/v1/wallets/disconnectResponse:
{
"success": true
}GET /api/v1/wallets/balance?address=0x...&chain=ethereumResponse:
{
"address": "0x...",
"chain": "ethereum",
"balances": [
{
"token": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"balance": "1000000000000000000",
"balanceFormatted": "1.0"
}
]
}POST /api/v1/wallets/signRequest Body:
{
"message": "Sign this message",
"address": "0x..."
}Response:
{
"signature": "0x...",
"message": "Sign this message"
}All error responses follow this format:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": {
"field": "Additional error details"
}
}
}400- Bad Request401- Unauthorized403- Forbidden404- Not Found429- Too Many Requests500- Internal Server Error503- Service Unavailable
Configure webhooks to receive real-time notifications for events.
payment.intent.createdpayment.escrow.fundedpayment.funds.releasedtee.deployment.createdtee.deployment.stoppedintent.createdintent.bid.submittedintent.bid.acceptedcertificate.mintedcertificate.revoked
{
"event": "payment.escrow.funded",
"timestamp": "2024-01-15T10:00:00Z",
"data": {
"escrowId": "0x...",
"amount": "100",
"chain": "ethereum"
}
}For easier integration, use the Kuberna SDK:
import { KubernaSDK } from '@kuberna/sdk';
const sdk = new KubernaSDK({
apiKey: 'your-api-key',
network: 'mainnet'
});
// Create payment intent
const intent = await sdk.payments.createIntent({
amount: '100',
token: '0x...',
chain: 'ethereum'
});
// Deploy to TEE
const deployment = await sdk.tee.deploy({
agentId: 'agent-123',
provider: 'phala'
});