Developer docs

API docs for embedded crypto swaps

Authenticate with an API key, request a quote, assemble the transaction, and keep your own UI and wallet flow.

Endpoints
GET/api/v1/health

Check service health and version.

GET/api/v1/account

Inspect the authenticated partner account, environments, launch readiness, and API settings.

POST/api/v1/quote

Request a monetized quote with partner attribution and fee logic applied.

POST/api/v1/assemble

Build the transaction payload for the returned path ID.

API

Use your own UI, call the quote and assemble endpoints, and control the full experience.

Embedded widget

Start from a ready-made swap module and reskin it into your product quickly.

Hosted page

Use a branded external swap page while your engineering team finishes the deeper integration.

Vertical templates

Begin from templates tailored to AI agents, trading tools, rebalance apps, and treasury workflows.

Account check
curl "https://www.swapifie.com/api/v1/account" \
  -H "x-api-key: sk_swapifie_your_key_here"
Quote request
curl -X POST "https://www.swapifie.com/api/v1/quote" \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_swapifie_your_key_here" \
  -d '{
    "chainId": 8453,
    "userAddr": "0xYourUserWallet",
    "slippageLimitPercent": 0.5,
    "inputTokens": [
      { "tokenAddress": "0x0000000000000000000000000000000000000000", "amount": "10000000000000000" }
    ],
    "outputTokens": [
      { "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "proportion": 1 }
    ]
  }'
Assemble request
curl -X POST "https://www.swapifie.com/api/v1/assemble" \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_swapifie_your_key_here" \
  -d '{
    "userAddr": "0xYourUserWallet",
    "pathId": "quote_path_id_here",
    "simulate": false
  }'
JavaScript
import { SwapifieClient } from "@/lib/swapifie-client";

const client = new SwapifieClient({
  apiKey: process.env.SWAPIFIE_API_KEY!,
  baseUrl: "https://www.swapifie.com",
});

const { quote, monetization } = await client.quote({
  chainId: 8453,
  userAddr: "0xYourUserWallet",
  slippageLimitPercent: 0.5,
  inputTokens: [
    { tokenAddress: "0x0000000000000000000000000000000000000000", amount: "10000000000000000" }
  ],
  outputTokens: [
    { tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", proportion: 1 }
  ]
});

const assembled = await client.assemble({
  userAddr: "0xYourUserWallet",
  pathId: quote.pathId,
  simulate: false,
});
Python
import requests

headers = {
    "Content-Type": "application/json",
    "x-api-key": "sk_swapifie_your_key_here",
}

payload = {
    "chainId": 8453,
    "userAddr": "0xYourUserWallet",
    "slippageLimitPercent": 0.5,
    "inputTokens": [
        {"tokenAddress": "0x0000000000000000000000000000000000000000", "amount": "10000000000000000"}
    ],
    "outputTokens": [
        {"tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "proportion": 1}
    ],
}

quote = requests.post(
    "https://www.swapifie.com/api/v1/quote",
    json=payload,
    headers=headers,
).json()
PowerShell
$headers = @{
  "Content-Type" = "application/json"
  "x-api-key" = "sk_swapifie_your_key_here"
}

$body = @'
{
  "chainId": 8453,
  "userAddr": "0xYourUserWallet",
  "slippageLimitPercent": 0.5,
  "inputTokens": [
    {
      "tokenAddress": "0x0000000000000000000000000000000000000000",
      "amount": "10000000000000000"
    }
  ],
  "outputTokens": [
    {
      "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "proportion": 1
    }
  ]
}
'@

$quote = Invoke-RestMethod -Uri "https://www.swapifie.com/api/v1/quote" -Method POST -Headers $headers -Body $body
$quote.quote.pathId
Integration notes
  • Use your own UI and wallet orchestration. Swapifie is the quote and transaction layer underneath.
  • Fee settings and rev-share configuration are applied server-side from the partner account.
  • Use sandbox and production keys separately so testing, analytics, and revokes stay organized.
  • Always persist your own client-side correlation IDs if you want to match product events to API calls.
  • Use `/api/v1/account` to confirm the API key and partner configuration in your integration tests.
Key handling
  • Raw API keys are only shown once when they are generated. Copy them immediately and store them in your secret manager.
  • The portal stores only a hashed version of each key, so Swapifie cannot re-display a raw key later.
  • If a key is lost, rotate or generate a new one instead of trying to recover it.
Try the reference build

See a simple embedded example using the same quote and assemble endpoints you would call from your own app.

Machine-readable assets

Use these links for API directories, Postman imports, and programmatic developer discovery.

Local setup
  • Run the SQL in supabase/schema.sql inside Supabase SQL Editor to move platform persistence onto the free hosted Postgres tier.
  • Add SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY to .env.local. If they are not set, Swapifie falls back to local JSON storage for development.
  • Add NEXT_PUBLIC_TURNSTILE_SITE_KEY and TURNSTILE_SECRET_KEY to enable Cloudflare Turnstile on email auth forms.