TypeScript SDK
import { createClient } from "@parlayx/sdk";
const client = createClient({ apiKey: process.env.PARLAYX_API_KEY! });
const { orderId } = await client.submitOrder({
marketOrders: [
{
marketInfo: {
venue: "polymarket",
outcomeId: "5161623255678193352839985156330393796378434470119114669671615782853260939535",
},
side: "buy",
amount: 5,
type: "market",
timeInForce: { type: "FOK" },
},
],
});
console.log("submitted order:", orderId);curl --request POST \
--url https://api.parlayx.com/v1/orders \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'x-api-key: <api-key>' \
--data '
{
"marketOrders": [
{
"marketInfo": {
"venue": "polymarket",
"outcomeId": "<string>"
},
"side": "buy",
"type": "market",
"timeInForce": {
"type": "FOK"
},
"amount": 20,
"shares": 100,
"maxFillPrice": 0.6,
"minFillPrice": 0.4,
"allowDustSell": true
}
]
}
'import requests
url = "https://api.parlayx.com/v1/orders"
payload = { "marketOrders": [
{
"marketInfo": {
"venue": "polymarket",
"outcomeId": "<string>"
},
"side": "buy",
"type": "market",
"timeInForce": { "type": "FOK" },
"amount": 20,
"shares": 100,
"maxFillPrice": 0.6,
"minFillPrice": 0.4,
"allowDustSell": True
}
] }
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({
marketOrders: [
{
marketInfo: {venue: 'polymarket', outcomeId: '<string>'},
side: 'buy',
type: 'market',
timeInForce: {type: 'FOK'},
amount: 20,
shares: 100,
maxFillPrice: 0.6,
minFillPrice: 0.4,
allowDustSell: true
}
]
})
};
fetch('https://api.parlayx.com/v1/orders', 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/orders",
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([
'marketOrders' => [
[
'marketInfo' => [
'venue' => 'polymarket',
'outcomeId' => '<string>'
],
'side' => 'buy',
'type' => 'market',
'timeInForce' => [
'type' => 'FOK'
],
'amount' => 20,
'shares' => 100,
'maxFillPrice' => 0.6,
'minFillPrice' => 0.4,
'allowDustSell' => true
]
]
]),
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/orders"
payload := strings.NewReader("{\n \"marketOrders\": [\n {\n \"marketInfo\": {\n \"venue\": \"polymarket\",\n \"outcomeId\": \"<string>\"\n },\n \"side\": \"buy\",\n \"type\": \"market\",\n \"timeInForce\": {\n \"type\": \"FOK\"\n },\n \"amount\": 20,\n \"shares\": 100,\n \"maxFillPrice\": 0.6,\n \"minFillPrice\": 0.4,\n \"allowDustSell\": true\n }\n ]\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/orders")
.header("Idempotency-Key", "<idempotency-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"marketOrders\": [\n {\n \"marketInfo\": {\n \"venue\": \"polymarket\",\n \"outcomeId\": \"<string>\"\n },\n \"side\": \"buy\",\n \"type\": \"market\",\n \"timeInForce\": {\n \"type\": \"FOK\"\n },\n \"amount\": 20,\n \"shares\": 100,\n \"maxFillPrice\": 0.6,\n \"minFillPrice\": 0.4,\n \"allowDustSell\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.parlayx.com/v1/orders")
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 \"marketOrders\": [\n {\n \"marketInfo\": {\n \"venue\": \"polymarket\",\n \"outcomeId\": \"<string>\"\n },\n \"side\": \"buy\",\n \"type\": \"market\",\n \"timeInForce\": {\n \"type\": \"FOK\"\n },\n \"amount\": 20,\n \"shares\": 100,\n \"maxFillPrice\": 0.6,\n \"minFillPrice\": 0.4,\n \"allowDustSell\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"orderId": "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>"
}
}Orders
Submit Order
Accepts one or more market orders and returns an issued orderId.
POST
/
v1
/
orders
TypeScript SDK
import { createClient } from "@parlayx/sdk";
const client = createClient({ apiKey: process.env.PARLAYX_API_KEY! });
const { orderId } = await client.submitOrder({
marketOrders: [
{
marketInfo: {
venue: "polymarket",
outcomeId: "5161623255678193352839985156330393796378434470119114669671615782853260939535",
},
side: "buy",
amount: 5,
type: "market",
timeInForce: { type: "FOK" },
},
],
});
console.log("submitted order:", orderId);curl --request POST \
--url https://api.parlayx.com/v1/orders \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'x-api-key: <api-key>' \
--data '
{
"marketOrders": [
{
"marketInfo": {
"venue": "polymarket",
"outcomeId": "<string>"
},
"side": "buy",
"type": "market",
"timeInForce": {
"type": "FOK"
},
"amount": 20,
"shares": 100,
"maxFillPrice": 0.6,
"minFillPrice": 0.4,
"allowDustSell": true
}
]
}
'import requests
url = "https://api.parlayx.com/v1/orders"
payload = { "marketOrders": [
{
"marketInfo": {
"venue": "polymarket",
"outcomeId": "<string>"
},
"side": "buy",
"type": "market",
"timeInForce": { "type": "FOK" },
"amount": 20,
"shares": 100,
"maxFillPrice": 0.6,
"minFillPrice": 0.4,
"allowDustSell": True
}
] }
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({
marketOrders: [
{
marketInfo: {venue: 'polymarket', outcomeId: '<string>'},
side: 'buy',
type: 'market',
timeInForce: {type: 'FOK'},
amount: 20,
shares: 100,
maxFillPrice: 0.6,
minFillPrice: 0.4,
allowDustSell: true
}
]
})
};
fetch('https://api.parlayx.com/v1/orders', 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/orders",
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([
'marketOrders' => [
[
'marketInfo' => [
'venue' => 'polymarket',
'outcomeId' => '<string>'
],
'side' => 'buy',
'type' => 'market',
'timeInForce' => [
'type' => 'FOK'
],
'amount' => 20,
'shares' => 100,
'maxFillPrice' => 0.6,
'minFillPrice' => 0.4,
'allowDustSell' => true
]
]
]),
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/orders"
payload := strings.NewReader("{\n \"marketOrders\": [\n {\n \"marketInfo\": {\n \"venue\": \"polymarket\",\n \"outcomeId\": \"<string>\"\n },\n \"side\": \"buy\",\n \"type\": \"market\",\n \"timeInForce\": {\n \"type\": \"FOK\"\n },\n \"amount\": 20,\n \"shares\": 100,\n \"maxFillPrice\": 0.6,\n \"minFillPrice\": 0.4,\n \"allowDustSell\": true\n }\n ]\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/orders")
.header("Idempotency-Key", "<idempotency-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"marketOrders\": [\n {\n \"marketInfo\": {\n \"venue\": \"polymarket\",\n \"outcomeId\": \"<string>\"\n },\n \"side\": \"buy\",\n \"type\": \"market\",\n \"timeInForce\": {\n \"type\": \"FOK\"\n },\n \"amount\": 20,\n \"shares\": 100,\n \"maxFillPrice\": 0.6,\n \"minFillPrice\": 0.4,\n \"allowDustSell\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.parlayx.com/v1/orders")
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 \"marketOrders\": [\n {\n \"marketInfo\": {\n \"venue\": \"polymarket\",\n \"outcomeId\": \"<string>\"\n },\n \"side\": \"buy\",\n \"type\": \"market\",\n \"timeInForce\": {\n \"type\": \"FOK\"\n },\n \"amount\": 20,\n \"shares\": 100,\n \"maxFillPrice\": 0.6,\n \"minFillPrice\": 0.4,\n \"allowDustSell\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"orderId": "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.
Minimum string length:
1Example:
"2f1a8c4e-0b3d-4a9c-8e7f-1a2b3c4d5e6f"
Body
application/json
marketOrders
(MarketOrder · object | LimitOrder · object | StopOrder · object | StopLimitOrder · object | IcebergOrder · object)[]
required
One or more market orders to submit.
Minimum array length:
1- MarketOrder
- LimitOrder
- StopOrder
- StopLimitOrder
- IcebergOrder
Show child attributes
Show child attributes
Response
Order accepted
Issued orderId. Stable handle for status lookups.
Minimum string length:
1Example:
"3f8b2c9a-2d18-4f7e-9c2a-1b6e1f0c8a4d"
⌘I