This page provides comprehensive API reference documentation for all available endpoints in the Two-Coin payment system.

Base URL

https://api.dev2coin.space/api

All endpoints are prefixed with /api (e.g., /api/on_ramp/orders)

Important: Currency references use integer IDs from the currency dictionary, not ticker symbols (e.g., use 35 for USD, 15 for BTC).

Dictionary Endpoints

Dictionary endpoints provide reference data that should be cached on startup.

Currency Dictionary

GEThttps://api.dev2coin.space/api/dict/currencies

Fetch all available currencies with their integer IDs. Cache this response daily.

⚠️ Required first: Call this endpoint before using any other endpoints to build a currency ID lookup table.

Response:

{
  "currencies": [
    {
      "id": 35,
      "ticker": "USD",
      "currency_type": "fiat",
      "precision": 2,
      "name": "US Dollar",
      "icon_url": "..."
    },
    {
      "id": 15,
      "ticker": "BTC",
      "network": "bitcoin",
      "currency_type": "crypto",
      "precision": 8,
      "name": "Bitcoin",
      "icon_url": "..."
    }
  ]
}

See currency ID guide →

Countries Dictionary

GEThttps://api.dev2coin.space/api/dict/countries

Fetch all countries with their states/provinces. Use this for country/state selection UI.

Response:

{
  "countries": [
    {
      "code": "US",
      "name": "United States",
      "icon_url": "...",
      "states": [
        { "code": "CA", "name": "California" },
        { "code": "NY", "name": "New York" }
      ]
    }
  ]
}

On-Ramp Endpoints

Endpoints for cryptocurrency purchase flow (on-ramp).

Payment Methods

GEThttps://api.dev2coin.space/api/on_ramp/payment_methods

Get available payment methods for a fiat currency and country.

Required Query Parameters:

  • fiat_currency - Currency ID (integer, e.g., 35 for USD)

Optional Query Parameters:

  • country_code - Two-letter country code (e.g., US)
  • state - State code (e.g., CA, NY)
  • provider_codes - Comma-separated provider codes

Response:

{
  "payment_methods": [
    {
      "code": "card",
      "name": "Credit/Debit Card",
      "icon_url": "..."
    }
  ]
}

See detailed documentation →

Payment Methods Extra Info

GEThttps://api.dev2coin.space/api/on_ramp/payment_methods_extra_info

Get fee information for payment methods from a specific provider.

Required Query Parameters:

  • provider_code - Provider code (e.g., changelly, kado)

Response:

{
  "payment_methods": [
    {
      "payment_method_code": "card",
      "fee": "3.5%"
    }
  ]
}

Offers

GEThttps://api.dev2coin.space/api/on_ramp/offers

Get available offers from multiple providers based on currency pair and amount.

Required Query Parameters:

  • external_user_id - Your internal user ID
  • currency_from - Source currency ID (integer)
  • currency_to - Target currency ID (integer)
  • amount_from - Amount to exchange (string)
  • country - Two-letter country code

Optional Query Parameters:

  • state - State code (required if country has states in dictionary)
  • ip - User IP address
  • payment_method - Filter by payment method code
  • provider_codes - Comma-separated list to filter providers

Response: Object with provider codes as keys

{
  "changelly": {
    "rate": "0.000025",
    "inverted_rate": "40000.00",
    "fee": "4.99",
    "amount_from": "100.00",
    "amount_expected_to": "0.002375",
    "payment_methods": [
      { "payment_method_code": "card", "fee": "3.5%" }
    ]
  },
  "kado": {
    "rate": "0.0000251",
    "inverted_rate": "39841.27",
    "fee": "3.99",
    "amount_from": "100.00",
    "amount_expected_to": "0.002410"
  }
}

See detailed documentation →

Orders

POSThttps://api.dev2coin.space/api/on_ramp/orders

Create a new cryptocurrency purchase order.

⚠️ Use integer currency IDs (from currency dictionary), not ticker symbols.

See detailed documentation →

GEThttps://api.dev2coin.space/api/on_ramp/orders/{provider_code}

Get status of a specific order. Requires code query parameter.

See detailed documentation →

Discovery Endpoints

GEThttps://api.dev2coin.space/api/on_ramp/countries

Get list of countries supported by on-ramp providers.

Optional Query Parameters:

  • provider_codes - Comma-separated list to filter by providers

Response:

{
  "countries": [
    { "code": "US", "states": ["CA", "NY", "TX"] },
    { "code": "GB" },
    { "code": "DE" }
  ]
}
GEThttps://api.dev2coin.space/api/on_ramp/currency_pairs

Get available currency pairs grouped by provider.

Required Query Parameters:

  • country_code - Two-letter country code

Optional Query Parameters:

  • state - State code (for US)
  • provider_codes - Comma-separated list to filter

Response: Array of provider currency pairs

[
  {
    "provider_code": "changelly",
    "fiat_currencies": [35, 6, 49],
    "crypto_currencies": [15, 22, 2]
  },
  {
    "provider_code": "kado",
    "fiat_currencies": [35],
    "crypto_currencies": [15, 22]
  }
]

See integration guide →

GEThttps://api.dev2coin.space/api/on_ramp/providers

Get providers supporting a specific currency pair in a country.

Required Query Parameters:

  • country_code - Two-letter country code
  • from_currency - Source currency ID (integer)
  • to_currency - Target currency ID (integer)

Optional Query Parameters:

  • state - State code
  • provider_codes - Comma-separated list to filter

Response:

{
  "providers": [
    {
      "code": "changelly",
      "name": "Changelly",
      "description": "...",
      "icon_url": "..."
    },
    {
      "code": "kado",
      "name": "Kado",
      "description": "...",
      "icon_url": "..."
    }
  ]
}

Wallet Validation

POSThttps://api.dev2coin.space/api/on_ramp/validate-address

Validate a wallet address before creating an order.

Request Body:

{
  "provider_code": "changelly",
  "currency": 15,
  "wallet_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
}

Response:

{
  "result": true
}

Returns true if the wallet address is valid for the specified cryptocurrency, false otherwise.

Common Mistakes

❌ Wrong: {"from_currency": "USD", "to_currency": "BTC"}

✅ Correct: {"from_currency": 35, "to_currency": 15}

Always use integer currency IDs from the GET /api/dict/currencies endpoint.

Getting Started

New to Two-Coin? Start with the Complete Integration Flow guide for a step-by-step walkthrough with examples.

Support

If you encounter any issues or have questions not addressed in this documentation, please contact our support team on Telegram at https://t.me/cs_2coin (@cs_2coin).