Hi Team,
I request you to please help me to understand why the trades got rejected though I did request client code verification around 3 AM in the morning.
You can find trade & rejection details below -
NIFTY2480125000CE
Buy :106.25
Broker Name:Upstox
Quantity:50
Broker Order Date:2024-08-01 09:30:22
Broker Order No:
Order Type :MIS
AutoTrade :Yes
Response Message:“{\u0022status\u0022:\u0022error\u0022,\u0022errors\u0022:[{\u0022errorCode\u0022:\u0022UDAPI100050\u0022,\u0022message\u0022:\u0022Invalid token used to access API\u0022,\u0022propertyPath\u0022:null,\u0022invalidValue\u0022:null,\u0022error_code\u0022:\u0022UDAPI100050\u0022,\u0022property_path\u0022:null,\u0022invalid_value\u0022:null}]}”
Awaiting your response on this ASAP.
An access token generated at 3:00 AM will not be valid the same day as it expires at 3:30 AM. However, any token generated after 3:30 AM is valid for the entire day.
Please refer to the note on this page: Upstox API Documentation - Get Token.
The access_token
obtained through this API has a specific validity period that lasts until 3:30 AM
the following day, regardless of the time it was generated. For instance, if you generate a token at 8 PM on Tuesday, it will expire at 3:30 AM on Wednesday. This also means that a token created at 2:30 AM on Wednesday will still expire at 3:30 AM on the same Wednesday. Therefore, users are advised to plan their activities accordingly, ensuring they accommodate the token’s expiration schedule in their usage.
Understood Pradip. Thanks for the response. So ideally I should do it after 3.30 AM
Yes, you can do that. I recommend allowing some buffer time and scheduling it for 4:00 AM
Understood. Is there any automation available for this job to be done automatically
Upstox API does not support or recommend automating access token generation in light of SEBI and regulatory guidelines. Users must log in manually once daily by adhering to the specified login procedures.