Status code 500 from market-status endpoint

With the following API call:

const getFyersMarketStatus = async () => {
  const url = "https://api.fyers.in/api/v2/market-status";
 
  try {
    const marketStatus = await axios.get(url, { headers: authHeaders }); //authHeaders is an environment variable
    const statusArray = marketStatus.data.marketStatus;
    return statusArray;
    } catch (error) {
    console.log("error from getMarketStatus", error.response.data);
    return false;
    }
};

Responds with status code 500:

{   
    "s": "error", 
    "code": -96, 
    "message": "An unexpected error occurred. Please contact support. 
}

Is anyone else getting this message?

Hi @shikhar_prasad,

As of now, please use this new endpoint for market status

Market status API url : [https://api-t1.fyers.in/data/marketStatus

Code:

def](https://api-t1.fyers.in/data/marketStatusCode:def) marketStatus(token):

try:

URL = “[https://api-t1.fyers.in/data/marketStatus”

response](https://api-t1.fyers.in/data/marketStatus"response) = requests.get(url = URL,headers={‘Authorization’:token})

return response.json()

except:

return response

token = ‘Add your token’

print(marketStatus(token))

Hope this helps.

Hi @shruthi_shetty, Thank you so much for this. Works perfectly.