Layerswap API
API Explorer
  • Overview
  • Partner Setup
  • UI Integration
    • Layerswap-hosted page
    • Embedded form
    • Customization
      • Interactive Builder
  • API Integration
    • Quickstart
    • API Reference
    • Swap lifecycle
    • Webhooks
    • DEPRECATED - V1 API Reference
      • Get Available Networks
      • Get Available Routes
      • Get Swap Rate
      • Create Fast Swap
      • Create Swap
      • Prepare Source Transaction
      • Get Swap
  • Mixed Integration
    • Swap Link
  • Data
    • Object types
    • Supported Platforms
      • Supported Networks
      • Supported Fiat Providers
      • Supported CEXes
Powered by GitBook

Layerswap

  • App
  • Explorer
  • Twitter
  • Discord

© 2023 Bransfer, Inc. All rights reserved.

On this page
  • Raw request
  • Raw Response

Was this helpful?

Export as PDF
  1. API Integration
  2. DEPRECATED - V1 API Reference

Get Swap Rate

Before creating a swap, it's possible to programmatically retrieve data about the valid minimum/maximum swap amount and the Layerswap fee. The endpoint is public and does not require any authorization.

POST https://api.layerswap.io/api/swap_rate

Headers

Name
Type
Description

Content-Type*

String

application/json

Request Body

Name
Type
Description

source*

String

destination*

String

source_asset*

String

The currency name. Example: USDC

refuel*

String

If set to true, the user will receive an additional refuel transaction in the native currency for the swap.

destination_asset

String

The currency name. Example: USDC

{
  "data": [
    {
      "min_amount": 0.001431,
      "fee_amount": 0.0006,
      "max_amount": 0.1
    }
  ],
  "error": null
}

Raw request

curl -X 'POST' \
  'https://api.layerswap.io/api/swap_rate' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "source": "ETHEREUM_MAINNET",
  "destination": "ARBITRUM_MAINNET",
  "source_asset": "USDC",
  "destination_asset": "USDC",
  "refuel": true
}'

Raw Response

{
  "data": [
    {
      "min_amount": 0.001431,
      "fee_amount": 0.0006,
      "max_amount": 0.1
    }
  ],
  "error": null
}

Last updated 1 year ago

Was this helpful?

The supported blockchain network name.

The supported blockchain network/CEX/fiat provider name.

A detailed explanation of the Swap Rate Object is .

See available values.
See available values.
available here