REST API

Developer API

Integrate Kerypto into your app. Enable your users to buy and sell crypto with M-Pesa directly from your platform.

Quick Start

1. Get a quote

GET /api/quote?token=USDC&direction=onramp&amount=5000

2. Initiate a swap

POST /api/swap/initiate
{
  "direction": "onramp",
  "fiatAmount": 5000,
  "tokenSymbol": "USDC",
  "chain": "BASE",
  "phoneNumber": "254712345678",
  "walletAddress": "0x742d35Cc..."
}

3. Track status

GET /api/transaction/KRP-XXXXXXXX

Endpoints

GET/api/quote
POST/api/swap/initiate
GET/api/transaction/:id
POST/api/mpesa/callback
GET/api/rates

Webhook Verification

All webhook payloads include an HMAC-SHA256 signature in theX-Kerypto-Signatureheader. Verify this against your webhook secret.

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(JSON.stringify(payload))
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

Your API Keys

Live Key

krp_live_••••••••••••••••

Test Key

krp_test_sk_1a2b3c4d5e6f7g8h

Rate Limits

Free100 req/min
Pro1,000 req/min
EnterpriseUnlimited

Supported

Tokens

USDCUSDTETHSOLMATIC

Chains

EthereumBasePolygonSolana