Learn how to open and close a short position with the Public API, including the rules and constraints specific to shorting at Public.
⚠️ You can’t flip from long to short in a single order
When shorting at Public, you must first have no position in the stock. You can’t go from long to short — or short to long — in a single order.
For example, if you own 100 shares of a stock, you can’t place one order to sell 200 shares and expect to end up short 100. Instead, flatten the position to 0 first (sell 100 shares), then place a second order to open the short (sell another 100). The same applies in reverse: to go long from a short position, cover the short first, then place a separate buy order.
Shorts require a margin account. Retrieve your accounts and pick the one with brokerageAccountType: MARGIN:
curl --request GET \
--url https://api.public.com/userapigateway/trading/account \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'A margin brokerage account in the response looks like this:
{
"accounts": [
{
"accountId": "YOUR_ACCOUNT_ID",
"accountType": "BROKERAGE",
"optionsLevel": "LEVEL_2",
"brokerageAccountType": "MARGIN",
"tradePermissions": "BUY_AND_SELL"
}
]
}Before placing a short, confirm the symbol is available to borrow using the instrument endpoint. The shortingAvailability field tells you whether the stock can be shorted and at what borrow difficulty:
curl --request GET \
--url https://api.public.com/userapigateway/marketdata/instruments/AAPL \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'A shortable instrument returns a non-null shortingAvailability value — for example, EASY_TO_BORROW. Hard-to-borrow names will surface a rate in hardToBorrowPercentageRate:
{
"instrument": {
"symbol": "AAPL",
"type": "EQUITY"
},
"trading": "BUY_AND_SELL",
"fractionalTrading": "BUY_AND_SELL",
"optionTrading": "BUY_AND_SELL",
"optionSpreadTrading": "BUY_AND_SELL",
"instrumentDetails": null,
"shortingAvailability": "EASY_TO_BORROW",
"hardToBorrowPercentageRate": null,
"optionContractPriceIncrements": {
"incrementBelow3": "0.01",
"incrementAbove3": "0.05"
}
}Once you’ve confirmed the stock is shortable, you have no existing long position, and you meet buying power and margin requirements, you can open the short. Use orderSide: SELL with openCloseIndicator: OPEN— this tells the API you’re selling with the intent to open a new short position.
Shorts can only be placed in whole shares (quantity). Notional (amount) shorting is not currently supported. If the uptick rule is active for the symbol, you must use a LIMIT order; market orders will be rejected.
curl --request POST \
--url https://api.public.com/userapigateway/trading/{YOUR_ACCOUNT_ID}/order \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"orderId": "a3f9b2c1-4d8e-4f7a-9b3c-1e2d3f4a5b6c",
"instrument": {
"symbol": "AAPL",
"type": "EQUITY"
},
"orderSide": "SELL",
"orderType": "LIMIT",
"limitPrice": "150.20",
"expiration": {
"timeInForce": "DAY"
},
"quantity": "10",
"openCloseIndicator": "OPEN"
}'The response returns the orderId you submitted, confirming the order was accepted:
{
"orderId": "a3f9b2c1-4d8e-4f7a-9b3c-1e2d3f4a5b6c"
}Use the returned orderId to poll the order status until the short fills:
curl --request GET \
--url https://api.public.com/userapigateway/trading/{YOUR_ACCOUNT_ID}/order/a3f9b2c1-4d8e-4f7a-9b3c-1e2d3f4a5b6c \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'Once filled, the response reflects the open short leg:
{
"orderId": "a3f9b2c1-4d8e-4f7a-9b3c-1e2d3f4a5b6c",
"instrument": {
"symbol": "AAPL",
"type": "EQUITY"
},
"createdAt": "2026-04-24T16:00:00Z",
"type": "LIMIT",
"side": "SELL",
"status": "FILLED",
"quantity": "10",
"filledQuantity": "10",
"averagePrice": "150.22",
"limitPrice": "150.20",
"openCloseIndicator": "OPEN",
"expiration": {
"timeInForce": "DAY"
}
}To exit the short, submit a buy order with openCloseIndicator: CLOSE— you’re buying the shares back to cover the borrow and close the position:
curl --request POST \
--url https://api.public.com/userapigateway/trading/{YOUR_ACCOUNT_ID}/order \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"orderId": "b4d9c3a2-5e7f-4a8b-8c4d-2f3e4d5b6c7d",
"instrument": {
"symbol": "AAPL",
"type": "EQUITY"
},
"orderSide": "BUY",
"orderType": "MARKET",
"expiration": {
"timeInForce": "DAY"
},
"quantity": "10",
"openCloseIndicator": "CLOSE"
}'📝 Important Notes
shortingAvailability on the instrument before submitting — unavailable names will be rejected, and hard-to-borrow names will surface a rate in hardToBorrowPercentageRate.