First of all, go to the link here. Click on Select a project.
A popup window will appear. From the window, select ‘New Project’.
Provide the information and create a project.
Now click on Library to search for Custom Search API.
Search for Custom search API.
From the result, click on Custom Search API.
Enable Custom Search API.
Now click on Credentials. On the page, click Create Credentials. You will see a drop-down menu will appear. Select API key.
The next Window will show you the API key.