top of page
  • Writer's pictureshishir kushawaha

PowerShell to use Co-WIN Public APIs

Updated: Feb 17

An Indian digital platform for managing vaccine administration is called Co-WIN. The Co-WIN APIs give outside developers access to the platform's data and services, enabling them to find out things like vaccine doses, vaccination facilities, and vaccine recipients. Developers can create programs that facilitate the delivery of vaccinations and give citizens access to real-time information by utilizing these APIs.

Any third-party program can access some unrestricted information through Co-WIN Public APIs, which can then be shared with its users. Only read access is permitted in Co-WIN. Below is the link to access more details about these APIs.

Official Website: APIs | APISetu

Some of the public APIs listed below:

Picture 1

Here, we'll take a look at a situation in which you'd like to know if a particular district had any vaccines available. Here is how things will proceed:

Every state in India has unique ID defined in API. You can run below script to list the list of states and their unique id. API Address: /v2/admin/location/states

$sd=Invoke-RestMethod -Uri ""

Above code will result in below output. It will list state name with their ID.

Picture 2

As we know every state has multiple districts. Those districts have unique district ID defined. Once you know the state ID, using that you get the list of districts. For instance, using the state_id, which is "21" for Maharashtra, we can use the API /v2/admin/location/districts/{state_id}. to get the list of districts in Maharashtra. Replace the {state_id} of Maharashtra in request url with 21. (Refer Picture 1 for state_id list).

Code Snippet:

$di=Invoke-RestMethod -Uri ""


Picture 3

Once you get the district information, you can get the vaccine details in that district for a specific date. To get that we have API address as /v2/appointment/sessions/public/findByDistrict. You can pass district_id and date (in dd-mm-yyyy) format get the vaccine details.

Below is the code to get the vaccine detail of Mumbai city(District_id is 395) on specific date 18-02-2023.

$vaccinedetails=Invoke-RestMethod -Uri ""

Output (First record):


Picture 4

The output from the API request includes detailed information about the vaccine centers in the specified city, including the type of COVID-19 vaccines available, the available stock, and details about the hospital such as its name, address, and pin code. Additionally, the API also provides information about the available appointment slots for each center.

You can get the complete code from GitHub repository.

Video Output:

Learning from this GitHub code

  1. Calling API using invoke-restmethod

  2. Implementing powershell speak() function. You can find more details here PowerShell can 'SPEAK()' too!

  3. Using do-while loop

  4. Implementing Try-catch

  5. Integrate Beep sound

296 views2 comments
bottom of page