Update Leverage for Multiple Instruments
curl --request PATCH \
--url https://api.perpetuals.polymarket.com/v1/trade/leverage/batch \
--header 'Content-Type: application/json' \
--data '
{
"op": {
"type": "updateLeverages",
"args": [
{
"iid": 1,
"lev": 5,
"cross": false
},
{
"iid": 2,
"lev": 10,
"cross": true
}
]
},
"sig": "0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c",
"salt": 333333333,
"ts": 1767000012000
}
'import requests
url = "https://api.perpetuals.polymarket.com/v1/trade/leverage/batch"
payload = {
"op": {
"type": "updateLeverages",
"args": [
{
"iid": 1,
"lev": 5,
"cross": False
},
{
"iid": 2,
"lev": 10,
"cross": True
}
]
},
"sig": "0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c",
"salt": 333333333,
"ts": 1767000012000
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
op: {
type: 'updateLeverages',
args: [{iid: 1, lev: 5, cross: false}, {iid: 2, lev: 10, cross: true}]
},
sig: '0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c',
salt: 333333333,
ts: 1767000012000
})
};
fetch('https://api.perpetuals.polymarket.com/v1/trade/leverage/batch', 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.perpetuals.polymarket.com/v1/trade/leverage/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'op' => [
'type' => 'updateLeverages',
'args' => [
[
'iid' => 1,
'lev' => 5,
'cross' => false
],
[
'iid' => 2,
'lev' => 10,
'cross' => true
]
]
],
'sig' => '0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c',
'salt' => 333333333,
'ts' => 1767000012000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.perpetuals.polymarket.com/v1/trade/leverage/batch"
payload := strings.NewReader("{\n \"op\": {\n \"type\": \"updateLeverages\",\n \"args\": [\n {\n \"iid\": 1,\n \"lev\": 5,\n \"cross\": false\n },\n {\n \"iid\": 2,\n \"lev\": 10,\n \"cross\": true\n }\n ]\n },\n \"sig\": \"0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c\",\n \"salt\": 333333333,\n \"ts\": 1767000012000\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.perpetuals.polymarket.com/v1/trade/leverage/batch")
.header("Content-Type", "application/json")
.body("{\n \"op\": {\n \"type\": \"updateLeverages\",\n \"args\": [\n {\n \"iid\": 1,\n \"lev\": 5,\n \"cross\": false\n },\n {\n \"iid\": 2,\n \"lev\": 10,\n \"cross\": true\n }\n ]\n },\n \"sig\": \"0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c\",\n \"salt\": 333333333,\n \"ts\": 1767000012000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.perpetuals.polymarket.com/v1/trade/leverage/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"op\": {\n \"type\": \"updateLeverages\",\n \"args\": [\n {\n \"iid\": 1,\n \"lev\": 5,\n \"cross\": false\n },\n {\n \"iid\": 2,\n \"lev\": 10,\n \"cross\": true\n }\n ]\n },\n \"sig\": \"0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c\",\n \"salt\": 333333333,\n \"ts\": 1767000012000\n}"
response = http.request(request)
puts response.read_body[
{
"status": "ok",
"instrument_id": 1,
"leverage": 5,
"cross": false
},
{
"status": "err",
"instrument_id": 2,
"error": "insufficient_margin"
}
][
{
"status": "err",
"error": "insufficient_margin"
}
][
{
"status": "err",
"error": "insufficient_margin"
}
][
{
"status": "err",
"error": "insufficient_margin"
}
]Update Leverage for Multiple Instruments
Update leverage for up to 100 unique instruments. Updates are processed
sequentially and are not atomic. If only some responses arrive before the
gateway deadline, missing item results use internal_error; whether those
updates applied is unknown. If no responses arrive, the request returns 500.
Requires proxy signature, see Update Leverage.
PATCH
/
v1
/
trade
/
leverage
/
batch
Update Leverage for Multiple Instruments
curl --request PATCH \
--url https://api.perpetuals.polymarket.com/v1/trade/leverage/batch \
--header 'Content-Type: application/json' \
--data '
{
"op": {
"type": "updateLeverages",
"args": [
{
"iid": 1,
"lev": 5,
"cross": false
},
{
"iid": 2,
"lev": 10,
"cross": true
}
]
},
"sig": "0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c",
"salt": 333333333,
"ts": 1767000012000
}
'import requests
url = "https://api.perpetuals.polymarket.com/v1/trade/leverage/batch"
payload = {
"op": {
"type": "updateLeverages",
"args": [
{
"iid": 1,
"lev": 5,
"cross": False
},
{
"iid": 2,
"lev": 10,
"cross": True
}
]
},
"sig": "0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c",
"salt": 333333333,
"ts": 1767000012000
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
op: {
type: 'updateLeverages',
args: [{iid: 1, lev: 5, cross: false}, {iid: 2, lev: 10, cross: true}]
},
sig: '0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c',
salt: 333333333,
ts: 1767000012000
})
};
fetch('https://api.perpetuals.polymarket.com/v1/trade/leverage/batch', 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.perpetuals.polymarket.com/v1/trade/leverage/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'op' => [
'type' => 'updateLeverages',
'args' => [
[
'iid' => 1,
'lev' => 5,
'cross' => false
],
[
'iid' => 2,
'lev' => 10,
'cross' => true
]
]
],
'sig' => '0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c',
'salt' => 333333333,
'ts' => 1767000012000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.perpetuals.polymarket.com/v1/trade/leverage/batch"
payload := strings.NewReader("{\n \"op\": {\n \"type\": \"updateLeverages\",\n \"args\": [\n {\n \"iid\": 1,\n \"lev\": 5,\n \"cross\": false\n },\n {\n \"iid\": 2,\n \"lev\": 10,\n \"cross\": true\n }\n ]\n },\n \"sig\": \"0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c\",\n \"salt\": 333333333,\n \"ts\": 1767000012000\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://api.perpetuals.polymarket.com/v1/trade/leverage/batch")
.header("Content-Type", "application/json")
.body("{\n \"op\": {\n \"type\": \"updateLeverages\",\n \"args\": [\n {\n \"iid\": 1,\n \"lev\": 5,\n \"cross\": false\n },\n {\n \"iid\": 2,\n \"lev\": 10,\n \"cross\": true\n }\n ]\n },\n \"sig\": \"0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c\",\n \"salt\": 333333333,\n \"ts\": 1767000012000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.perpetuals.polymarket.com/v1/trade/leverage/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"op\": {\n \"type\": \"updateLeverages\",\n \"args\": [\n {\n \"iid\": 1,\n \"lev\": 5,\n \"cross\": false\n },\n {\n \"iid\": 2,\n \"lev\": 10,\n \"cross\": true\n }\n ]\n },\n \"sig\": \"0x59ed57f6dce8d15aa01e774ef53d9957c84801fb34ec655f6a2ea344af8a58843095314730a3f1bd8f0f4560f6dc6f8de69d3f2d0a6f3365fc877f7f4845d40b1c\",\n \"salt\": 333333333,\n \"ts\": 1767000012000\n}"
response = http.request(request)
puts response.read_body[
{
"status": "ok",
"instrument_id": 1,
"leverage": 5,
"cross": false
},
{
"status": "err",
"instrument_id": 2,
"error": "insufficient_margin"
}
][
{
"status": "err",
"error": "insufficient_margin"
}
][
{
"status": "err",
"error": "insufficient_margin"
}
][
{
"status": "err",
"error": "insufficient_margin"
}
]Request Weight: 1 + floor(n / 20)
Action Weight: 1 / instrument
Body
application/json
Batch leverage request.
Show child attributes
Show child attributes
Signature in hex format
Example:
"0x1234567890..."
Salt
Example:
1234567890
Request timestamp. Unix milliseconds for most operations; Unix seconds for withdrawals (must match the on-chain EIP-712 struct verified against block.timestamp).
Example:
1767225600000
Response
Ordered result for each requested instrument.
Was this page helpful?
⌘I