curl --request POST \
--url https://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"evmEoa": "0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f",
"side": "SELL",
"tokenID": "90234889617199443673709150877675264662915727532354468551650133547723659310093",
"orderType": "FAK",
"tickSize": "0.01",
"negRisk": true,
"amount": 2,
"slippage": 100,
"expiration": 1735689600,
"signatureByEvmEoa": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b"
}
'import requests
url = "https://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition"
payload = {
"evmEoa": "0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f",
"side": "SELL",
"tokenID": "90234889617199443673709150877675264662915727532354468551650133547723659310093",
"orderType": "FAK",
"tickSize": "0.01",
"negRisk": True,
"amount": 2,
"slippage": 100,
"expiration": 1735689600,
"signatureByEvmEoa": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b"
}
headers = {
"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: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
evmEoa: '0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f',
side: 'SELL',
tokenID: '90234889617199443673709150877675264662915727532354468551650133547723659310093',
orderType: 'FAK',
tickSize: '0.01',
negRisk: true,
amount: 2,
slippage: 100,
expiration: 1735689600,
signatureByEvmEoa: '0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b'
})
};
fetch('https://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition', 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-v2.swaps.xyz/api/workflows/polymarket/sellPosition",
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([
'evmEoa' => '0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f',
'side' => 'SELL',
'tokenID' => '90234889617199443673709150877675264662915727532354468551650133547723659310093',
'orderType' => 'FAK',
'tickSize' => '0.01',
'negRisk' => true,
'amount' => 2,
'slippage' => 100,
'expiration' => 1735689600,
'signatureByEvmEoa' => '0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b'
]),
CURLOPT_HTTPHEADER => [
"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://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition"
payload := strings.NewReader("{\n \"evmEoa\": \"0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f\",\n \"side\": \"SELL\",\n \"tokenID\": \"90234889617199443673709150877675264662915727532354468551650133547723659310093\",\n \"orderType\": \"FAK\",\n \"tickSize\": \"0.01\",\n \"negRisk\": true,\n \"amount\": 2,\n \"slippage\": 100,\n \"expiration\": 1735689600,\n \"signatureByEvmEoa\": \"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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-v2.swaps.xyz/api/workflows/polymarket/sellPosition")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"evmEoa\": \"0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f\",\n \"side\": \"SELL\",\n \"tokenID\": \"90234889617199443673709150877675264662915727532354468551650133547723659310093\",\n \"orderType\": \"FAK\",\n \"tickSize\": \"0.01\",\n \"negRisk\": true,\n \"amount\": 2,\n \"slippage\": 100,\n \"expiration\": 1735689600,\n \"signatureByEvmEoa\": \"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition")
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["Content-Type"] = 'application/json'
request.body = "{\n \"evmEoa\": \"0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f\",\n \"side\": \"SELL\",\n \"tokenID\": \"90234889617199443673709150877675264662915727532354468551650133547723659310093\",\n \"orderType\": \"FAK\",\n \"tickSize\": \"0.01\",\n \"negRisk\": true,\n \"amount\": 2,\n \"slippage\": 100,\n \"expiration\": 1735689600,\n \"signatureByEvmEoa\": \"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b\"\n}"
response = http.request(request)
puts response.read_body{
"txId": "0xa66c86a47f4f81caae5d767e2d8a5a7def1a191d24eba5bd49f8767297cfe2e5",
"orderResponse": {
"success": true,
"errorMsg": "",
"orderID": "0xb9826fe87ddf21261eceaf513977cb5ea1ae31ac173210857c879cef936dfa2b",
"transactionsHashes": [
"0x39ac6726cf2cfb7814bdb2e04aeeea1d3bde2d1ce7e357f79a404cacb6984f35"
],
"status": "matched",
"takingAmount": "1.376",
"makingAmount": "2"
}
}{
"success": false,
"error": {
"code": "<string>",
"name": "<string>",
"message": "<string>",
"title": "<string>",
"statusCode": 123,
"timestamp": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"name": "<string>",
"message": "<string>",
"title": "<string>",
"statusCode": 123,
"timestamp": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"name": "<string>",
"message": "<string>",
"title": "<string>",
"statusCode": 123,
"timestamp": "<string>",
"details": {}
}
}Sell Position
Sells an existing position in a Polymarket market. This endpoint allows users to exit their positions by selling their outcome tokens using market orders (FOK/FAK).
Every request must include expiration and an EIP-712 signatureByEvmEoa over the SellPosition typed data — see the Polymarket Signing Guide.
Proceeds default to the caller’s evmEoa. To deliver them to a different wallet or token, set dstWalletAddress and/or dstToken.
curl --request POST \
--url https://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"evmEoa": "0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f",
"side": "SELL",
"tokenID": "90234889617199443673709150877675264662915727532354468551650133547723659310093",
"orderType": "FAK",
"tickSize": "0.01",
"negRisk": true,
"amount": 2,
"slippage": 100,
"expiration": 1735689600,
"signatureByEvmEoa": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b"
}
'import requests
url = "https://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition"
payload = {
"evmEoa": "0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f",
"side": "SELL",
"tokenID": "90234889617199443673709150877675264662915727532354468551650133547723659310093",
"orderType": "FAK",
"tickSize": "0.01",
"negRisk": True,
"amount": 2,
"slippage": 100,
"expiration": 1735689600,
"signatureByEvmEoa": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b"
}
headers = {
"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: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
evmEoa: '0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f',
side: 'SELL',
tokenID: '90234889617199443673709150877675264662915727532354468551650133547723659310093',
orderType: 'FAK',
tickSize: '0.01',
negRisk: true,
amount: 2,
slippage: 100,
expiration: 1735689600,
signatureByEvmEoa: '0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b'
})
};
fetch('https://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition', 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-v2.swaps.xyz/api/workflows/polymarket/sellPosition",
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([
'evmEoa' => '0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f',
'side' => 'SELL',
'tokenID' => '90234889617199443673709150877675264662915727532354468551650133547723659310093',
'orderType' => 'FAK',
'tickSize' => '0.01',
'negRisk' => true,
'amount' => 2,
'slippage' => 100,
'expiration' => 1735689600,
'signatureByEvmEoa' => '0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b'
]),
CURLOPT_HTTPHEADER => [
"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://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition"
payload := strings.NewReader("{\n \"evmEoa\": \"0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f\",\n \"side\": \"SELL\",\n \"tokenID\": \"90234889617199443673709150877675264662915727532354468551650133547723659310093\",\n \"orderType\": \"FAK\",\n \"tickSize\": \"0.01\",\n \"negRisk\": true,\n \"amount\": 2,\n \"slippage\": 100,\n \"expiration\": 1735689600,\n \"signatureByEvmEoa\": \"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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-v2.swaps.xyz/api/workflows/polymarket/sellPosition")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"evmEoa\": \"0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f\",\n \"side\": \"SELL\",\n \"tokenID\": \"90234889617199443673709150877675264662915727532354468551650133547723659310093\",\n \"orderType\": \"FAK\",\n \"tickSize\": \"0.01\",\n \"negRisk\": true,\n \"amount\": 2,\n \"slippage\": 100,\n \"expiration\": 1735689600,\n \"signatureByEvmEoa\": \"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.swaps.xyz/api/workflows/polymarket/sellPosition")
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["Content-Type"] = 'application/json'
request.body = "{\n \"evmEoa\": \"0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f\",\n \"side\": \"SELL\",\n \"tokenID\": \"90234889617199443673709150877675264662915727532354468551650133547723659310093\",\n \"orderType\": \"FAK\",\n \"tickSize\": \"0.01\",\n \"negRisk\": true,\n \"amount\": 2,\n \"slippage\": 100,\n \"expiration\": 1735689600,\n \"signatureByEvmEoa\": \"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890001b\"\n}"
response = http.request(request)
puts response.read_body{
"txId": "0xa66c86a47f4f81caae5d767e2d8a5a7def1a191d24eba5bd49f8767297cfe2e5",
"orderResponse": {
"success": true,
"errorMsg": "",
"orderID": "0xb9826fe87ddf21261eceaf513977cb5ea1ae31ac173210857c879cef936dfa2b",
"transactionsHashes": [
"0x39ac6726cf2cfb7814bdb2e04aeeea1d3bde2d1ce7e357f79a404cacb6984f35"
],
"status": "matched",
"takingAmount": "1.376",
"makingAmount": "2"
}
}{
"success": false,
"error": {
"code": "<string>",
"name": "<string>",
"message": "<string>",
"title": "<string>",
"statusCode": 123,
"timestamp": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"name": "<string>",
"message": "<string>",
"title": "<string>",
"statusCode": 123,
"timestamp": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"name": "<string>",
"message": "<string>",
"title": "<string>",
"statusCode": 123,
"timestamp": "<string>",
"details": {}
}
}Authorizations
API key for authentication. Contact Swaps.xyz to obtain an API key.
Body
EVM address (wallet address)
^0x[a-fA-F0-9]{40}$Order side - must be SELL
SELL Polymarket CLOB token ID of the position to sell
Order type - Fill-Or-Kill (FOK) or Fill-And-Kill (FAK) for market orders
FOK, FAK Tick size from the market details (e.g., '0.01')
Negative risk flag from the market details
Amount of tokens to sell (must be a positive number)
Unix timestamp (seconds) when signatureByEvmEoa expires. Must be in the future and ≤ 300s ahead.
EIP-712 signature by the EOA over the SellPosition typed data. See the Polymarket Signing Guide.
^0x[a-fA-F0-9]*$Proxy wallet address (optional)
^0x[a-fA-F0-9]{40}$Slippage tolerance in basis points (optional, defaults to 0)
Optional destination token. When set, sale proceeds are swapped into this token (address + chainId) before delivery.
Show child attributes
Show child attributes
Optional wallet that receives the proceeds instead of the caller's evmEoa.
^0x[a-fA-F0-9]{40}$