Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
curl --request POST \
--url https://swap-api.flux.fun/v1/order/withdraw \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"intentType": "Withdraw",
"destinationAddress": "0x...",
"amount": "1000000",
"tokenType": "erc20",
"tokenAddress": "0x...",
"clientId": "withdraw-123",
"tokenId": "123"
}
'import requests
url = "https://swap-api.flux.fun/v1/order/withdraw"
payload = {
"intentType": "Withdraw",
"destinationAddress": "0x...",
"amount": "1000000",
"tokenType": "erc20",
"tokenAddress": "0x...",
"clientId": "withdraw-123",
"tokenId": "123"
}
headers = {
"x-api-key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
intentType: 'Withdraw',
destinationAddress: '0x...',
amount: '1000000',
tokenType: 'erc20',
tokenAddress: '0x...',
clientId: 'withdraw-123',
tokenId: '123'
})
};
fetch('https://swap-api.flux.fun/v1/order/withdraw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://swap-api.flux.fun/v1/order/withdraw",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'intentType' => 'Withdraw',
'destinationAddress' => '0x...',
'amount' => '1000000',
'tokenType' => 'erc20',
'tokenAddress' => '0x...',
'clientId' => 'withdraw-123',
'tokenId' => '123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://swap-api.flux.fun/v1/order/withdraw"
payload := strings.NewReader("{\n \"intentType\": \"Withdraw\",\n \"destinationAddress\": \"0x...\",\n \"amount\": \"1000000\",\n \"tokenType\": \"erc20\",\n \"tokenAddress\": \"0x...\",\n \"clientId\": \"withdraw-123\",\n \"tokenId\": \"123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://swap-api.flux.fun/v1/order/withdraw")
.header("x-api-key", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"intentType\": \"Withdraw\",\n \"destinationAddress\": \"0x...\",\n \"amount\": \"1000000\",\n \"tokenType\": \"erc20\",\n \"tokenAddress\": \"0x...\",\n \"clientId\": \"withdraw-123\",\n \"tokenId\": \"123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://swap-api.flux.fun/v1/order/withdraw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"intentType\": \"Withdraw\",\n \"destinationAddress\": \"0x...\",\n \"amount\": \"1000000\",\n \"tokenType\": \"erc20\",\n \"tokenAddress\": \"0x...\",\n \"clientId\": \"withdraw-123\",\n \"tokenId\": \"123\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"intent": {
"id": "intent_abc123xyz",
"clientId": "client-order-123",
"action": {
"orderType": "MarketOrder",
"order": {
"quoteToken": {
"type": "chain",
"data": {
"tokenId": "USDC",
"chainId": 8453,
"contractAddress": "0x..."
}
},
"baseToken": {
"type": "kalshi",
"data": {
"marketId": "BTC-100K-2024",
"side": "yes"
}
},
"orderType": "BUY",
"baseQuantity": "100",
"maxQuoteQuantityIn": "50.00"
},
"chainId": 8453
},
"createdAt": "2024-01-12T10:00:00.000Z"
}
}Withdraw funds from your smart account to a destination address. The withdrawal will be processed asynchronously and you can track its status using the returned intent ID.
curl --request POST \
--url https://swap-api.flux.fun/v1/order/withdraw \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"intentType": "Withdraw",
"destinationAddress": "0x...",
"amount": "1000000",
"tokenType": "erc20",
"tokenAddress": "0x...",
"clientId": "withdraw-123",
"tokenId": "123"
}
'import requests
url = "https://swap-api.flux.fun/v1/order/withdraw"
payload = {
"intentType": "Withdraw",
"destinationAddress": "0x...",
"amount": "1000000",
"tokenType": "erc20",
"tokenAddress": "0x...",
"clientId": "withdraw-123",
"tokenId": "123"
}
headers = {
"x-api-key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
intentType: 'Withdraw',
destinationAddress: '0x...',
amount: '1000000',
tokenType: 'erc20',
tokenAddress: '0x...',
clientId: 'withdraw-123',
tokenId: '123'
})
};
fetch('https://swap-api.flux.fun/v1/order/withdraw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://swap-api.flux.fun/v1/order/withdraw",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'intentType' => 'Withdraw',
'destinationAddress' => '0x...',
'amount' => '1000000',
'tokenType' => 'erc20',
'tokenAddress' => '0x...',
'clientId' => 'withdraw-123',
'tokenId' => '123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://swap-api.flux.fun/v1/order/withdraw"
payload := strings.NewReader("{\n \"intentType\": \"Withdraw\",\n \"destinationAddress\": \"0x...\",\n \"amount\": \"1000000\",\n \"tokenType\": \"erc20\",\n \"tokenAddress\": \"0x...\",\n \"clientId\": \"withdraw-123\",\n \"tokenId\": \"123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://swap-api.flux.fun/v1/order/withdraw")
.header("x-api-key", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"intentType\": \"Withdraw\",\n \"destinationAddress\": \"0x...\",\n \"amount\": \"1000000\",\n \"tokenType\": \"erc20\",\n \"tokenAddress\": \"0x...\",\n \"clientId\": \"withdraw-123\",\n \"tokenId\": \"123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://swap-api.flux.fun/v1/order/withdraw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"intentType\": \"Withdraw\",\n \"destinationAddress\": \"0x...\",\n \"amount\": \"1000000\",\n \"tokenType\": \"erc20\",\n \"tokenAddress\": \"0x...\",\n \"clientId\": \"withdraw-123\",\n \"tokenId\": \"123\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"intent": {
"id": "intent_abc123xyz",
"clientId": "client-order-123",
"action": {
"orderType": "MarketOrder",
"order": {
"quoteToken": {
"type": "chain",
"data": {
"tokenId": "USDC",
"chainId": 8453,
"contractAddress": "0x..."
}
},
"baseToken": {
"type": "kalshi",
"data": {
"marketId": "BTC-100K-2024",
"side": "yes"
}
},
"orderType": "BUY",
"baseQuantity": "100",
"maxQuoteQuantityIn": "50.00"
},
"chainId": 8453
},
"createdAt": "2024-01-12T10:00:00.000Z"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Intent type
Withdraw "Withdraw"
Destination wallet address
"0x..."
Amount to withdraw
"1000000"
Token type
erc20, erc1155 "erc20"
Token contract address
"0x..."
Client-side withdrawal ID
"withdraw-123"
Token ID (required for ERC-1155 tokens)
"123"
