> For the complete documentation index, see [llms.txt](https://wiki.simpler.grants.gov/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.simpler.grants.gov/product/api/simpler-grants-api-tutorial/lets-make-a-python-script-to-use-the-api/make-a-function-to-perform-the-search.md).

# Make a function to perform the search

Since we have the needed packages imported and the API configuration variables set, we can now start to do things with them. First let's define a function that will perform the search.

<pre class="language-python"><code class="lang-python">import requests
import json

# Your API configuration
API_KEY = "YOUR_API_KEY_HERE"  # Replace with your actual key
BASE_URL = "https://api.simpler.grants.gov"

# The function that will contain search logic
<strong>def search_opportunities(search_term=""):
</strong>    """Search for grant opportunities"""
</code></pre>

{% hint style="info" %}
The default `search_term=""` means “no keyword filter.”
{% endhint %}

{% hint style="warning" %}
Something not working as expected? Check out [common issues & solutions](/product/api/simpler-grants-api-tutorial/common-issues-and-solutions.md).
{% endhint %}
