# (Superseded) Configure API Keys for Google Custom Search

**URL:** https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999
**Category:** Integrations
**Tags:** how-to, ai
**Created:** [November 9, 2023, 8:53pm UTC](https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999 "2023-11-09T20:53:32Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [November 9, 2023, 8:53pm UTC](https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999/1 "2023-11-09T20:53:32Z")

</div>

### Google Custom Search

In this example, we are using Google Custom Search to generate the keys.

> **Note** : You might need to pay based on usage. See here for up-to-date[details and pricing](https://developers.google.com/custom-search/docs/overview).

Platforms will always change so this guide may not reflect 100% process.

> ℹ In order to use certain AI modules, users must have an API Key from a 3rd party provider such as OpenAI (ChatGPT), Anthropic (Claude), Stability AI (Stable Diffusion), etc.
> 
> Please check each AI module to see which 3rd party providers can be used for it.

#### Generate the API key

1. Log in to Google Developers. Follow the instructions in [their documentation](https://developers.google.com/custom-search/v1/introduction) to get an API key and the CX parameter
2. Generate the API Key and [get the CX parameter](https://meta.discourse.org/t/configure-api-keys-for-google-custom-search/284999/2)
3. Once the key is generated, store it in a safe and secure place and copy it

#### Using API key for Discourse AI

1. Go to Admin settings from the sidebar or profile and then Plugins
2. Search or find `Discourse AI` and click settings
3. Search or find `ai_google_custom_search_api_key` and input your copied-over key
4. Search or find `ai_google_custom_search_cx` and input your copied-over CX parameter

 ![Googlesearch](https://global.discourse-cdn.com/meta/original/4X/0/7/8/07875b00680562acbcfc07bd03713f97f9b86626.png)

---

<div class="post-metadata">

### Author: ![Aizada\_M](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aizada_m/32/352050_2.png) [@Aizada\_M](https://meta.discourse.org/u/Aizada_M)
#### Post date: [November 29, 2023, 4:19pm UTC](https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999/2 "2023-11-29T16:19:27Z")

</div>

> [@Saif](#):
>
> the CX parameter

Hello, forgive me if my question seems stupid, I’m just not a programmer 🙏 I generated an API key, now how can I get the CX parameter?

EDIT:  
I guess I was a little hasty with the question, although finding the instructions I needed took a lot of time. But still I found [instructions in Russian](https://skine.ru/articles/706840/). Maybe someone will find this useful:

### Create your own custom search system

To get the CX parameter:

1. Visit [Programmable Search Engine by Google](https://programmablesearchengine.google.com/about/)  

2. Click “Get Started” and sign in to your Google account.

3. Click New Search Engine and follow the instructions to set up a custom search engine.  

- Enter search sites (eg [https://www.nytimes.com/](https://www.nytimes.com/) or [https://www.bbc.com/](https://www.bbc.com/)').  
\*Name your search engine.
- Click “Create”.

1. Customize your search engine by adjusting the settings in the General and Sites to Search tabs.

2. After saving the data, the Search engine created notification will appear. Go to the “Settings” tab to get the “cx” parameter, which will appear next to the `Search Engine ID`.

---

<div class="post-metadata">

### Author: ![Saif](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saif/32/318253_2.png) [@Saif](https://meta.discourse.org/u/Saif)
#### Post date: [November 29, 2023, 8:12pm UTC](https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999/3 "2023-11-29T20:12:49Z")

</div>

> [@Aizada\_M](#):
>
> Hello, forgive me if my question seems stupid, I’m just not a programmer 🙏 I generated an API key, now how can I get the CX parameter?

Thank you for writing up the guide! I will add it to the OP, I’m sure others will have the same question!

---

<div class="post-metadata">

### Author: ![Bathinda](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bathinda/32/135888_2.png) [@Bathinda](https://meta.discourse.org/u/Bathinda)
#### Post date: [April 23, 2024, 11:13am UTC](https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999/4 "2024-04-23T11:13:26Z")

</div>

Thank you but pls tell if this whole string is MX code or only the last part? And what is this ‘Get Code’? Thanks.

 ![image](https://global.discourse-cdn.com/meta/original/4X/7/6/8/768eaba40d53ee0c3faffe841ace5470bbbbcda0.png)

> [@Saif](#):
>
> Search or find `ai_google_custom_search_cx` and input your copied-over CX parameter

It’d be great if you’d shown a sample ‘CX’ code.

---

<div class="post-metadata">

### Author: ![Saif](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saif/32/318253_2.png) [@Saif](https://meta.discourse.org/u/Saif)
#### Post date: [April 25, 2024, 10:07pm UTC](https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999/6 "2024-04-25T22:07:24Z")

</div>

> [@Bathinda](#):
>
> It’d be great if you’d shown a sample ‘CX’ code.

It would be just the numbers after cx=

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [May 7, 2024, 4:18pm UTC](https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999/7 "2024-05-07T16:18:31Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 25, 2024, 5:07pm UTC](https://meta.discourse.org/t/superseded-configure-api-keys-for-google-custom-search/284999/10 "2024-05-25T17:07:16Z")

</div>

See [Google Search for Discourse AI - Programmable Search Engine and Custom Search API](https://meta.discourse.org/t/google-search-for-discourse-ai-programmable-search-engine-and-custom-search-api/307107)
