Introduction

Our API provides a simple interface for integrating cryptocurrency purchases into your application. Partners can obtain real-time quotes and create widget sessions that allow users to purchase cryptocurrencies with fiat currency.

Key Features

  • Real-time Quotes - Get accurate pricing with complete fee transparency
  • Widget Integration - Embed our payment widget for seamless user experience
  • Transaction Monitoring - Track transaction status in real-time
  • Multi-Currency Support - Support for USD, EUR and various cryptocurrencies
  • Webhook Notifications - Receive updates about transaction status changes
  • Flexible Integration - Multiple payment methods including cards and bank transfers

Getting Started

Base URL

https://api-ramp.kryptonim.com

Authentication

All API requests require an API key in the header:
X-API-Key: your_api_key_here
X-Request-Signature Authentication: Widget session creation requests additionally require HMAC-SHA256 signature validation. See the Widget Sessions documentation for detailed signature generation instructions.

Test Credentials

In order to receive Testnet API Key, contact [email protected] or [email protected]
Important Testnet Limitation: The testnet environment currently supports only USDC, USDT, MATIC on Polygon network. Do not attempt to initiate transactions with other tokens or on other blockchain networks as they will fail. Always use:
  • Tokens: USDC, USDT, MATIC
  • Network: polygon only

Quick Start

Here’s how to quickly implement a cryptocurrency purchase flow:

1. Get a Quote

First, get a quote to show the user current rates and fees:
const quote = await fetch('{{base_url}}/v1/quotes', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here'
  },
  body: JSON.stringify({
    side: 'BUY',
    fiatCurrency: 'USD',
    amount: '100',
    tokenAddress: 'USDC', // Can be token symbol or contract address
    chainId: 'polygon' // Can be chain name or numeric chain ID
  })
}).then(res => res.json());

console.log(`User will receive ${quote.cryptoAmount} ${quote.cryptoCurrency}`);
console.log(`Total fees: $${quote.totalFee}`);

2. Create Widget Session

Create a session for the user to complete their purchase:
Widget session creation requires HMAC-SHA256 signature authentication. See the Widget Sessions documentation for complete implementation details including signature generation.
const session = await fetch('{{base_url}}/v1/widget-sessions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here',
    'X-Request-Signature': 'generated_signature_here'
  },
  body: JSON.stringify({
    fiatAmount: 15,
    fiatCurrency: 'EUR',
    cryptoCurrency: 'USDC',
    network: 'polygon',
    destinationAddress: '0x977BC1915dA4f7edA9D2e49BC08356db37478538',
    email: '[email protected]',
    paymentMethod: 'google_pay',
    metadata: {
        "yourfield": "loremipsum",
        "someotherfield": 1234
    },
    successUrl: 'https://yoursite.com/success',
    failureUrl: 'https://yoursite.com/failure',
    unlockedFields: ['currency', 'convertedAmount', 'destinationAddress']
  })
}).then(res => res.json());

3. Redirect to Widget

Redirect the user to complete their purchase:
// Redirect in current window
window.location.href = session.widgetUrl;

// Or open in new window
window.open(session.widgetUrl, '_blank');

4. Monitor Transaction Status

Check transaction status using the transaction ID:
const status = await fetch(
  `{{base_url}}/v1/transactions/${transactionId}/status`,
  {
    headers: { 'X-API-Key': 'your_api_key_here' }
  }
).then(res => res.json());

console.log(`Transaction status: ${status.status}`);

API Reference

Explore our comprehensive API documentation:

Integration Example

Here’s a complete example of integrating the onramp flow:
Widget session creation requires HMAC-SHA256 signature authentication. See the Widget Sessions documentation for complete implementation details including signature generation.
class CryptoOnramp {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = '{{base_url}}';
  }

  async getQuote(params) {
    const response = await fetch(`${this.baseUrl}/v1/quotes`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': this.apiKey
      },
      body: JSON.stringify(params)
    });

    if (!response.ok) {
      throw new Error(`Quote failed: ${response.statusText}`);
    }

    return response.json();
  }

  async createSession(params, signature) {
    const response = await fetch(`${this.baseUrl}/v1/widget-sessions`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': this.apiKey,
        'X-Request-Signature': signature
      },
      body: JSON.stringify(params)
    });

    if (!response.ok) {
      throw new Error(`Session creation failed: ${response.statusText}`);
    }

    return response.json();
  }

  async checkStatus(transactionId) {
    const response = await fetch(
      `${this.baseUrl}/v1/transactions/${transactionId}/status`,
      {
        headers: { 'X-API-Key': this.apiKey }
      }
    );

    if (!response.ok) {
      throw new Error(`Status check failed: ${response.statusText}`);
    }

    return response.json();
  }
}

// Usage
const onramp = new CryptoOnramp('your_api_key_here');

// Get quote
const quote = await onramp.getQuote({
  side: 'BUY',
  fiatCurrency: 'USD',
  amount: '100',
  tokenAddress: 'USDC', // Can be token symbol or contract address
  chainId: 'polygon' // Can be chain name or numeric chain ID
});

// Create session (signature must be generated separately)
const session = await onramp.createSession({
  fiatAmount: 15,
  fiatCurrency: 'EUR',
  cryptoCurrency: 'USDC',
  network: 'polygon',
  destinationAddress: '0x977BC1915dA4f7edA9D2e49BC08356db37478538',
  email: '[email protected]',
  paymentMethod: 'google_pay',
  metadata: {
      "yourfield": "loremipsum",
      "someotherfield": 1234
  },
  successUrl: 'https://yoursite.com/success',
  failureUrl: 'https://yoursite.com/failure',
  unlockedFields: ['currency', 'convertedAmount', 'destinationAddress']
}, 'generated_signature_here');

// Redirect user
window.location.href = session.widgetUrl;

Rate Limits

  • 1000 requests per second per API key
  • Can be increased upon request

Support

For technical support: