APIError: trade denied due to pattern day trading protection

I have a program that buys a stock at market open and sells it at market close daily. When I ran it today, I get an error when I sell a stock with the API. It says

APIError: trade denied due to pattern day trading protection

Where can I get more detail of this error? Is there a reference doc?

I found that this is related to " Pattern Day Trader (PDT) Protection".

Alpaca Trading platform monitors the number of day trades for the account for the past 5 business days and rejects a newly submitted orders on exit of a position if it could potentially result in the account being flagged for PDT. This protection triggers only when the previous day’s closing account equity is less than $25,000 at the time of order submission.

More details here - https://docs.alpaca.markets/user-protections/


It’s a legal restriction that all brokers have to check for, though some seem to implement it differently. IB will still let you close positions if you’ve been flagged for PDT, even if your account balance is below $25k. If you’re funded above that, it’s a non-issue regardless.


I accidentally triggered the PDT rule and I can’t buy anything. I get the error: “Failed to submit order,
entry denied due to pattern day trading.” How long will this restriction last?

1 Like

Let us look into your case. Seems like there was invalid day trader call.

Could you look into my case as well please? I think I’ve also been hit with an invalid day trader call


Hello, I am receiving this error when trying to sell a stock. It still lets me buy stocks over the API but not sell any and getting the error APIError: trade denied due to pattern day trading protection. Could someone please take a look at my account and confirm? Thank you :slight_smile: