import { createClient } from "@parlayx/sdk";
const client = createClient({ apiKey: process.env.PARLAYX_API_KEY! });
const { rebalanceId } = await client.submitRebalance({
sourceVenue: "polymarket",
destinationVenue: "limitless",
amount: 25,
});
console.log("submitted rebalance:", rebalanceId);curl --request POST \
--url https://api.parlayx.com/v1/rebalances \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'x-api-key: <api-key>' \
--data '
{
"sourceVenue": "polymarket",
"destinationVenue": "polymarket",
"amount": 25,
"maxSlippageBps": 200
}
'import requests
url = "https://api.parlayx.com/v1/rebalances"
payload = {
"sourceVenue": "polymarket",
"destinationVenue": "polymarket",
"amount": 25,
"maxSlippageBps": 200
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sourceVenue: 'polymarket',
destinationVenue: 'polymarket',
amount: 25,
maxSlippageBps: 200
})
};
fetch('https://api.parlayx.com/v1/rebalances', 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://api.parlayx.com/v1/rebalances",
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([
'sourceVenue' => 'polymarket',
'destinationVenue' => 'polymarket',
'amount' => 25,
'maxSlippageBps' => 200
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"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://api.parlayx.com/v1/rebalances"
payload := strings.NewReader("{\n \"sourceVenue\": \"polymarket\",\n \"destinationVenue\": \"polymarket\",\n \"amount\": 25,\n \"maxSlippageBps\": 200\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("x-api-key", "<api-key>")
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://api.parlayx.com/v1/rebalances")
.header("Idempotency-Key", "<idempotency-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sourceVenue\": \"polymarket\",\n \"destinationVenue\": \"polymarket\",\n \"amount\": 25,\n \"maxSlippageBps\": 200\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.parlayx.com/v1/rebalances")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sourceVenue\": \"polymarket\",\n \"destinationVenue\": \"polymarket\",\n \"amount\": 25,\n \"maxSlippageBps\": 200\n}"
response = http.request(request)
puts response.read_body{
"rebalanceId": "3f8b2c9a-2d18-4f7e-9c2a-1b6e1f0c8a4d"
}{
"error": {
"message": "<string>"
}
}{
"message": "Forbidden"
}{
"error": {
"code": "IDEMPOTENCY_CONFLICT",
"message": "Idempotency key was reused with a different request body"
}
}{
"error": {
"message": "<string>"
}
}Submit Rebalance
Moves funds from one venue to another and returns an issued rebalanceId.
import { createClient } from "@parlayx/sdk";
const client = createClient({ apiKey: process.env.PARLAYX_API_KEY! });
const { rebalanceId } = await client.submitRebalance({
sourceVenue: "polymarket",
destinationVenue: "limitless",
amount: 25,
});
console.log("submitted rebalance:", rebalanceId);curl --request POST \
--url https://api.parlayx.com/v1/rebalances \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'x-api-key: <api-key>' \
--data '
{
"sourceVenue": "polymarket",
"destinationVenue": "polymarket",
"amount": 25,
"maxSlippageBps": 200
}
'import requests
url = "https://api.parlayx.com/v1/rebalances"
payload = {
"sourceVenue": "polymarket",
"destinationVenue": "polymarket",
"amount": 25,
"maxSlippageBps": 200
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sourceVenue: 'polymarket',
destinationVenue: 'polymarket',
amount: 25,
maxSlippageBps: 200
})
};
fetch('https://api.parlayx.com/v1/rebalances', 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://api.parlayx.com/v1/rebalances",
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([
'sourceVenue' => 'polymarket',
'destinationVenue' => 'polymarket',
'amount' => 25,
'maxSlippageBps' => 200
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"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://api.parlayx.com/v1/rebalances"
payload := strings.NewReader("{\n \"sourceVenue\": \"polymarket\",\n \"destinationVenue\": \"polymarket\",\n \"amount\": 25,\n \"maxSlippageBps\": 200\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("x-api-key", "<api-key>")
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://api.parlayx.com/v1/rebalances")
.header("Idempotency-Key", "<idempotency-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sourceVenue\": \"polymarket\",\n \"destinationVenue\": \"polymarket\",\n \"amount\": 25,\n \"maxSlippageBps\": 200\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.parlayx.com/v1/rebalances")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sourceVenue\": \"polymarket\",\n \"destinationVenue\": \"polymarket\",\n \"amount\": 25,\n \"maxSlippageBps\": 200\n}"
response = http.request(request)
puts response.read_body{
"rebalanceId": "3f8b2c9a-2d18-4f7e-9c2a-1b6e1f0c8a4d"
}{
"error": {
"message": "<string>"
}
}{
"message": "Forbidden"
}{
"error": {
"code": "IDEMPOTENCY_CONFLICT",
"message": "Idempotency key was reused with a different request body"
}
}{
"error": {
"message": "<string>"
}
}Authorizations
Headers
Idempotency key for this request. Re-sending the same key with the same body returns the original result and creates no duplicate; re-sending it with a different body is rejected with 422.
1"2f1a8c4e-0b3d-4a9c-8e7f-1a2b3c4d5e6f"
Body
Venue whose resting form funds the move. polymarket: pUSD on Polygon. limitless: USDC on Base.
polymarket, limitless, predict_fun "polymarket"
Venue the funds must land spendable at. Must differ from sourceVenue.
polymarket, limitless, predict_fun "polymarket"
Amount to move, in USDC (up to 6 decimal places). This is the amount that must land spendable at the destination venue; execution grosses up the source debit to cover bridge/swap slippage.
x > 025
Optional slippage-protection cap (basis points, below 10000) for the lossy swap/bridge steps. Defaults server-side when omitted.
0 < x <= 9999200
Response
Rebalance accepted
Issued rebalanceId. Stable handle for status lookups.
1"3f8b2c9a-2d18-4f7e-9c2a-1b6e1f0c8a4d"