Jump to content
bluehorseshoe

StatusCode 401 Unauthorized New Trade

Recommended Posts

When placing new trades, I keep getting the 401 Unauthorized error.

I can authenticate and I have confirmed marketId and marketName.

What is wrong with this body that I am passing?

{ IfDone = [], Type = null, Applicability = null, ExpiryDateTimeUTC = null, OcoOrder = null, Direction = BUY, isTrade = True, TriggerPrice = null, AuditId = null, Currency = null, MarketName = EUR/USD, BidPrice = 1.09417, ExpiryDateTimeUTCDate = null, PositionMethodId = 1, LastChangedDateTimeUTCDate = null, AutoRollover = False, Status = , MarketId = 401484347, OfferPrice = 1.09431, LastChangedDateTimeUTC = null, OrderId = 0, Quantity = 1000, QuoteId = null, TradingAccountId = xxxxxxx}

Share this post


Link to post

Hello,

Are you sending your User Name and Session token in the header of your calls? They are required as authentication in all calls made to the API. 

The HTTP 401 code indicates that the request has not been applied because it lacks valid authentication credentials.

Kind Regards, PM 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×