Getting Started
API keys
Every store has three keys: a Public browser key for your storefront, a Secret API key for your server, and a Test key for your playground link.
The three keys
You find them on your store's API Keys tab in the SearchX admin. Each card shows what the key can do.
| Key | Access | Where it goes |
|---|---|---|
| Public browser key | Read Access | Your storefront's pages: the SDK, a theme snippet, or your plugin's Public browser key field. |
| Secret API key | Read & Write Access | Your server only: your plugin's Secret API key field, or your own backend calling the SearchX APIs. |
| Test key | Read Access | Nothing to install. Your playground link runs on it, so anyone you share the link with can try your search. |
- The Public browser key can only search, and only from your store's website address (set on your store in SearchX). It is printed into your pages, and that is safe.
- The Secret API key can read and change your store: import products, read analytics, update settings and send orders. It stays on your server.
- The Test key can only search. Its searches are not counted in your analytics.
Never put the Secret API key in the browser
Anything in your pages, theme, templates or scripts is visible to every visitor. If the Secret API key ends up there, anyone can use it to change your store. Use the Public browser key for everything that runs in the browser, and regenerate the Secret API key if it was ever exposed.
Where each key goes
Pick your store's platform. Each tab says which key goes in which field.
In WooCommerce > Settings > SearchX:
| Field | Key | Notes |
|---|---|---|
| Secret API key | Secret API key | Stays on your server. Used for searches in Through WordPress mode and to send orders. |
| Public browser key | Public browser key | Needed for Direct to SearchX (recommended, and required for Agentic AI Search). The plugin refuses a Secret API key here. |
Or with constants in wp-config.php:
define('SEARCHX_APP_ID', 'YOUR_APP_ID');
define('SEARCHX_API_KEY', 'YOUR_SECRET_API_KEY');
define('SEARCHX_PUBLIC_KEY', 'YOUR_PUBLIC_BROWSER_KEY');
Full guide: WooCommerce integration.
In Modules > Module Manager > SearchX > Configure:
| Field | Key | Notes |
|---|---|---|
| Secret API key | Secret API key | Stays on your server; never sent to shoppers. |
| Public browser key | Public browser key | Needed for Direct to SearchX (required for Agentic AI Search). The module refuses a Secret API key here. |
Full guide: PrestaShop integration.
In Extensions > Extensions > Modules > SearchX > Edit:
| Field | Key | Notes |
|---|---|---|
| Public browser key | Public browser key | Required. Printed into your store's pages, so it must be the Public browser key. |
| Secret API key | Secret API key | Only for Send orders to SearchX. Used on your server; never printed into your pages. |
If you add SearchX with the Hosted Snippet or the Manual SDK instead of the extension, that code runs in the browser: use the Public browser key there.
Full guide: OpenCart integration.
In Stores > Configuration > SearchX > AI Search, under Connection (settings can differ per store view):
| Field | Key | Notes |
|---|---|---|
| Secret API key | Secret API key | Stored encrypted on your server; never sent to shoppers. |
| Public browser key | Public browser key | Needed for Direct to SearchX (required for the AI assistant). Saving refuses a Secret API key here. |
The Shopify setup is a snippet in your theme, so it runs in the browser. Use the Public browser key in the snippet's api_key:
api_key: 'YOUR_PUBLIC_BROWSER_KEY',
Shopify needs no Secret API key.
Full guide: Shopify integration.
The SDK runs in the shopper's browser. Initialize it with the Public browser key:
window.SearchXSDK.init({
app_id: 'YOUR_APP_ID',
api_key: 'YOUR_PUBLIC_BROWSER_KEY',
});
Never pass the Secret API key to the SDK, and never put it in a client component or a NEXT_PUBLIC_ environment variable. If your own server also calls SearchX, see the Server (API) tab.
Guides: Next.js, React, HTML / JavaScript.
Calls to the SearchX APIs from your own backend use the Secret API key in the Authorization header. Keep it in an environment variable or your secrets manager:
SEARCHX_APP_ID=YOUR_APP_ID
SEARCHX_SECRET_API_KEY=YOUR_SECRET_API_KEY
curl -X POST "https://admin.searchxengine.ai/api/v2/applications/$SEARCHX_APP_ID/import" \
-H "Authorization: Bearer $SEARCHX_SECRET_API_KEY" \
-H "Accept: application/json"
The v2 API and the Agent API refuse the Public browser key (error 4036) and the Test key (error 4092). Sending orders for Sales from search also uses the Secret API key.
Regenerating a key
Keys cannot be created by hand. If a key leaks, open the API Keys tab and click Regenerate on it. You confirm with a code sent to your email. The old token stops working at once, so paste the new one wherever the old one was used.
Older keys
Stores created before every store had its own three keys may also list Other keys. They keep working. Once nothing uses one, revoke it from the same tab.