Creating Search API key
When configuring your Search widget, the important step is to add your API Key to it. This article aims to provide an easy guide on how to create this API Key and add it to your widget.
In this article
Creating API key
- 1
- To get your API key, first go to the Custom Search Introduction section and click Get a Key:
- 2
- A popup window will appear prompting you to input a new project name. Ensure that you click Yes to accept the Terms of Service, and then proceed by clicking Next:
- 3
-
All done! Click Show Key and copy it:
- 4
- Finally, paste the copied API Key into your widget:
Restricting your API key
To restrict your API Key, please go to the API Console:
Here, you can either limit websites (HTTP referrers), web servers (IP addresses), or mobile apps which can use it. You might want to make your API key accessible for your own domain and Elfsight apps only. In this case, simply add *.elfsight.com/* and your domain name, like illustrated on the below screenshots:
Please keep in mind that you need to change the way a referrer's inserted depending on the URLs which will use the key. Kindly adhere to the instructions provided on the left side of the page:
You can do the same thing for IP addresses and mobile apps as well.
Well done! Now you can continue configuring your Search widget.