403 Response code - Request Blocked when using Cowin setu APIs 403 Response code - Request Blocked when using Cowin setu APIs express express

403 Response code - Request Blocked when using Cowin setu APIs


I added a user-agent header to the request so that the API would recognize that my request is coming from a browser, rather than a script.

headers = {  'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',}url = "https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByDistrict?district_id=303&date="+dateresponse = requests.get(url, headers=headers)


Use following

var options = { url: URL,method: 'GET',    headers: {        Host: 'cdn-api.co-vin.in',        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36'    }};


Try These Headers They worked for me on local server (not production)

    let options = {    headers: {      "user-agent":        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36",    },  };

These will not work in production because Cowin APIs are geofenced and can't be accessed from IP address other than Indian. In most free hosting sites like Heroku, Indian IP is not an option. So alternative solution might be to use AWS, GCP, Azure with an Indian server (not tried yet).

Reference - https://github.com/cowinapi/developer.cowin/issues/228