Create position request
curl --request POST \
--url https://api.worm.wtf/margin/positions/requests/ \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"market_condition_id": "<string>",
"is_yes": true,
"leverage": 123,
"take_profit_price": "<string>",
"stop_loss_price": "<string>",
"funds": "<string>",
"price": "<string>",
"shares": "<string>"
}
'import requests
url = "https://api.worm.wtf/margin/positions/requests/"
payload = {
"type": "<string>",
"market_condition_id": "<string>",
"is_yes": True,
"leverage": 123,
"take_profit_price": "<string>",
"stop_loss_price": "<string>",
"funds": "<string>",
"price": "<string>",
"shares": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
market_condition_id: '<string>',
is_yes: true,
leverage: 123,
take_profit_price: '<string>',
stop_loss_price: '<string>',
funds: '<string>',
price: '<string>',
shares: '<string>'
})
};
fetch('https://api.worm.wtf/margin/positions/requests/', 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.worm.wtf/margin/positions/requests/",
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([
'type' => '<string>',
'market_condition_id' => '<string>',
'is_yes' => true,
'leverage' => 123,
'take_profit_price' => '<string>',
'stop_loss_price' => '<string>',
'funds' => '<string>',
'price' => '<string>',
'shares' => '<string>'
]),
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.worm.wtf/margin/positions/requests/"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"market_condition_id\": \"<string>\",\n \"is_yes\": true,\n \"leverage\": 123,\n \"take_profit_price\": \"<string>\",\n \"stop_loss_price\": \"<string>\",\n \"funds\": \"<string>\",\n \"price\": \"<string>\",\n \"shares\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.worm.wtf/margin/positions/requests/")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"market_condition_id\": \"<string>\",\n \"is_yes\": true,\n \"leverage\": 123,\n \"take_profit_price\": \"<string>\",\n \"stop_loss_price\": \"<string>\",\n \"funds\": \"<string>\",\n \"price\": \"<string>\",\n \"shares\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.worm.wtf/margin/positions/requests/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"market_condition_id\": \"<string>\",\n \"is_yes\": true,\n \"leverage\": 123,\n \"take_profit_price\": \"<string>\",\n \"stop_loss_price\": \"<string>\",\n \"funds\": \"<string>\",\n \"price\": \"<string>\",\n \"shares\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"pubkey": "4mD8rQ2xT7pL1vN6yB3kC9sW5uF0zJ4eR8nM2qP6tLy",
"type": "market",
"state": "created",
"message": "Program call payload to open leveraged position.",
"funding_txid": null,
"refund_txid": null,
"market": {
"title": "Will the Atlanta Hawks beat the New York Knicks in the NBA game on April 28, 2026?",
"condition_id": "7n9G9WfQ2V7d6hM3XK8pQ4LwR2eY6aT1uJ5cB8mN3qPz",
"logo": "https://cdn.worm.wtf/m/123.png",
"last_trade_price": "0.68",
"event": {
"title": "NBA Apr 28, 2026",
"condition_id": "9x4H2LdQ7sM1Kp6Wv3Tn8YfR5aC2uJ7mB4eQ9zN6dLp",
"logo": "https://cdn.worm.wtf/e/42.png"
}
},
"is_yes": true,
"leverage": "2.500000",
"funds": "100.000000",
"price": null,
"shares": null,
"take_profit_price": null,
"stop_loss_price": null,
"created": 1714300800
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -12,
"slug": "authentication_failed",
"message": "Invalid signature",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -14,
"slug": "permission_denied",
"message": "You do not have permission to perform this action.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}
Margin
Create position request
Create a margin position request draft that must be signed and submitted.
POST
/
margin
/
positions
/
requests
/
Create position request
curl --request POST \
--url https://api.worm.wtf/margin/positions/requests/ \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"market_condition_id": "<string>",
"is_yes": true,
"leverage": 123,
"take_profit_price": "<string>",
"stop_loss_price": "<string>",
"funds": "<string>",
"price": "<string>",
"shares": "<string>"
}
'import requests
url = "https://api.worm.wtf/margin/positions/requests/"
payload = {
"type": "<string>",
"market_condition_id": "<string>",
"is_yes": True,
"leverage": 123,
"take_profit_price": "<string>",
"stop_loss_price": "<string>",
"funds": "<string>",
"price": "<string>",
"shares": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
market_condition_id: '<string>',
is_yes: true,
leverage: 123,
take_profit_price: '<string>',
stop_loss_price: '<string>',
funds: '<string>',
price: '<string>',
shares: '<string>'
})
};
fetch('https://api.worm.wtf/margin/positions/requests/', 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.worm.wtf/margin/positions/requests/",
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([
'type' => '<string>',
'market_condition_id' => '<string>',
'is_yes' => true,
'leverage' => 123,
'take_profit_price' => '<string>',
'stop_loss_price' => '<string>',
'funds' => '<string>',
'price' => '<string>',
'shares' => '<string>'
]),
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.worm.wtf/margin/positions/requests/"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"market_condition_id\": \"<string>\",\n \"is_yes\": true,\n \"leverage\": 123,\n \"take_profit_price\": \"<string>\",\n \"stop_loss_price\": \"<string>\",\n \"funds\": \"<string>\",\n \"price\": \"<string>\",\n \"shares\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.worm.wtf/margin/positions/requests/")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"market_condition_id\": \"<string>\",\n \"is_yes\": true,\n \"leverage\": 123,\n \"take_profit_price\": \"<string>\",\n \"stop_loss_price\": \"<string>\",\n \"funds\": \"<string>\",\n \"price\": \"<string>\",\n \"shares\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.worm.wtf/margin/positions/requests/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"market_condition_id\": \"<string>\",\n \"is_yes\": true,\n \"leverage\": 123,\n \"take_profit_price\": \"<string>\",\n \"stop_loss_price\": \"<string>\",\n \"funds\": \"<string>\",\n \"price\": \"<string>\",\n \"shares\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"pubkey": "4mD8rQ2xT7pL1vN6yB3kC9sW5uF0zJ4eR8nM2qP6tLy",
"type": "market",
"state": "created",
"message": "Program call payload to open leveraged position.",
"funding_txid": null,
"refund_txid": null,
"market": {
"title": "Will the Atlanta Hawks beat the New York Knicks in the NBA game on April 28, 2026?",
"condition_id": "7n9G9WfQ2V7d6hM3XK8pQ4LwR2eY6aT1uJ5cB8mN3qPz",
"logo": "https://cdn.worm.wtf/m/123.png",
"last_trade_price": "0.68",
"event": {
"title": "NBA Apr 28, 2026",
"condition_id": "9x4H2LdQ7sM1Kp6Wv3Tn8YfR5aC2uJ7mB4eQ9zN6dLp",
"logo": "https://cdn.worm.wtf/e/42.png"
}
},
"is_yes": true,
"leverage": "2.500000",
"funds": "100.000000",
"price": null,
"shares": null,
"take_profit_price": null,
"stop_loss_price": null,
"created": 1714300800
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -12,
"slug": "authentication_failed",
"message": "Invalid signature",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -14,
"slug": "permission_denied",
"message": "You do not have permission to perform this action.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}
Body Parameters
Request style:
market (funds-based, executes at market) or limit (resting limit at price for shares).When type is market
Position collateral (decimal string). Do not send
price or shares. Minimum depends on the market backend: $1.00** for Hyperliquid-routed markets, **$5.00 for Polymarket-routed markets. Requests below the minimum return 400 with a field error on funds.When type is limit
After creation, sign the returned
message and call Submit position request with the hex signature. To abandon a draft, use Cancel position request.For type limit, the success response is the same envelope as market (201), but data includes non-null price and shares (and funds reflects margin computed from your limit rather than a direct funds input).On success the API returns 201 Created with a Location header pointing to GET /margin/positions/requests/{pubkey}/.Response
Show Data fields
Show Data fields
Position request state: (
created, funding_processing, processing, order_placed, completed, failed, cancelled, refund_processing) — same set as List position requests.{
"data": {
"pubkey": "4mD8rQ2xT7pL1vN6yB3kC9sW5uF0zJ4eR8nM2qP6tLy",
"type": "market",
"state": "created",
"message": "Program call payload to open leveraged position.",
"funding_txid": null,
"refund_txid": null,
"market": {
"title": "Will the Atlanta Hawks beat the New York Knicks in the NBA game on April 28, 2026?",
"condition_id": "7n9G9WfQ2V7d6hM3XK8pQ4LwR2eY6aT1uJ5cB8mN3qPz",
"logo": "https://cdn.worm.wtf/m/123.png",
"last_trade_price": "0.68",
"event": {
"title": "NBA Apr 28, 2026",
"condition_id": "9x4H2LdQ7sM1Kp6Wv3Tn8YfR5aC2uJ7mB4eQ9zN6dLp",
"logo": "https://cdn.worm.wtf/e/42.png"
}
},
"is_yes": true,
"leverage": "2.500000",
"funds": "100.000000",
"price": null,
"shares": null,
"take_profit_price": null,
"stop_loss_price": null,
"created": 1714300800
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -12,
"slug": "authentication_failed",
"message": "Invalid signature",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -14,
"slug": "permission_denied",
"message": "You do not have permission to perform this action.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}