Activate silently
Activate silently
In some circumstances, for example when creating many Sitecore servers, you’ll want to silently configure and activate Coveo for Sitecore.
This can be done using the REST API services that Coveo for Sitecore deploys to set the different configurations, instead of doing so via the Command Center activation page.
The interactive Swagger UI documentation for these services is available at https://<INSTANCE_HOSTNAME>/coveo/api/config/docs/index
.

Prerequisites
To perform the configuration and activation of Coveo for Sitecore via the REST API services, you need the following:
-
A running instance of Sitecore with the Coveo for Sitecore package installed, and on which you have administrator access.
-
You’ll need the
organizationId
which can be retrieved in the URL of your Coveo organization.If you don’t have access to an existing organization, create a trial organization using the Coveo Platform API Create organization Swagger UI page for your region: US | CA | EU | AU
In the organizationTemplate field, you need to specify a Coveo for Sitecore-specific template value. The options are:
-
SitecoreCloudProEditionTrial
for the Pro edition. -
SitecoreCloudTrialEdition
for the Enterprise edition.
-
-
Two API keys:
-
SearchApiKey
– for search activities. -
ApiKey
– for general organization configuration activities.To create the
SearchApiKey
-
Access the Coveo Platform API Create API key Swagger UI page for your region: US | CA | EU | AU
-
Authorize the Swagger UI to perform the upcoming request.
-
At the top-right of the screen, click Authorize.
-
Authenticate into the Coveo Platform as an administrator.
-
-
In the Parameters section of the Swagger UI:
-
In the organizationId field, enter your
organizationId
. -
In the apiKeyTemplateId field, enter
SitecoreCloudSearch
.NoteCreating the key based on the
SitecoreCloudSearch
template ensures adherence to the principle of minimum privileges and provides future-proofing by transparently applying any changes made to the template privileges to existing API keys.
-
-
Copy the following JSON and paste it in the request body:
{ "displayName": "SearchApiKey", "enabled": true }
-
Click Execute.
-
Retrieve the API key
value
from the response body and store it securely.
To create the
ApiKey
-
Access the Coveo Platform API Create API key Swagger UI page for your region: US | CA | EU | AU
-
If necessary, authorize the Swagger UI to perform the upcoming request.
-
At the top-right of the screen, click Authorize.
-
Authenticate into the Coveo Platform as an administrator.
-
-
In the Parameters section of the Swagger UI:
-
In the organizationId field, enter your
organizationId
.
-
-
In the apiKeyTemplateId field, enter
SitecoreCloudConfiguration
.NoteCreating the key based on the
SitecoreCloudConfiguration
template ensures adherence to the principle of minimum privileges and provides future-proofing by transparently applying any changes made to the template privileges to existing API keys. -
Copy the following JSON and paste it in the request body:
{ "displayName": "ApiKey", "enabled": true }
-
Click Execute.
-
Retrieve the API key
value
from the response body and store it securely.
Sitecore on Azure
Azure’s Web Application Firewall (WAF) may block Coveo query network requests that trigger OWASP rules. You might need to disable or customize Azure WAF rules to allow Coveo for Sitecore network requests (see Azure Web Application Firewall triggered rules block Coveo for Sitecore’s communication on Content Delivery servers).
-
-
Configure and activate Coveo for Sitecore
This process requires the following steps:
-
Retrieve the endpoints needed for configuration.
-
Configure Coveo for Sitecore application parameters and connections to the Coveo Platform APIs that Coveo for Sitecore uses.
Step 1 - Retrieve your organization endpoints
The request you’ll perform will retrieve the search, admin, and analytics organization endpoints you can use in step 2 to configure Coveo for Sitecore. You need the October 23, 2023 release (5.0.1277.4) or later to be able to configure Coveo for Sitecore with organization endpoints.
-
Access the Coveo Platform API Get organization global configuration Swagger UI page for your region: US | CA | EU | AU
-
If necessary, authorize the Swagger UI to perform the upcoming request.
-
At the top-right of the screen, click Authorize.
-
Authenticate into the Coveo Platform as an administrator.
-
-
Enter your
organizationId
and click Execute. -
Copy the response body so that you can specify these endpoints in the next step.
Step 2 - Configure
In this step, you’ll use the REST API bundled in Coveo for Sitecore to configure communication between Sitecore and the Coveo Platform, and to set application parameters. For example, you’ll tell Coveo for Sitecore which Coveo organization to index your items in, the Coveo Platform API endpoint URLs and keys to use for indexing and search activities.
-
Open the
https://<INSTANCE_HOSTNAME>/coveo/api/config/docs/index#!/ConfigureInstance/ConfigureInstanceV1_Update
Swagger UI page in your browser. -
In the Value field, set the JSON body parameter values for the PUT request. You can use the example below as a template, and replace the values with your own.
Example{ "Organization": { "OrganizationId": "mdteste72n3veh", "ApiKey": "xxe116ab99-6d42-41cc-95tr-7b25bb29ad87", "SearchApiKey": "xx62f4737a-c29p-4f9e-b2x5-6b19012ac8c1", "GeneralPlatformEndpointUrl": "https://platform-ca.cloud.coveo.com", "IndexingEndpointUrl": "https://api-ca.cloud.coveo.com/push", "PlatformEndpointUrl": "mdteste72n3veh.admin.org.coveo.com",
"SearchEndpointUrl": "mdteste72n3veh.org.coveo.com",
"UsageAnalyticsEndpointUrl": "mdteste72n3veh.analytics.org.coveo.com",
"DisableSourceCreation": false
}, "SitecoreCredentials": { "Username": "sitecore\\admin",
"Password": "a46WW!2d" }, "DocumentOptions": { "BodyIndexing": "Rich",
"IndexPermissions": true
}, "Farm": { "Name": "ABCproduction"
}, "Proxy": { "BypassCoveoForSitecoreProxy": false
} }
Use the adminDns
value from the response body of the Get organization global configuration request.Use the distributedDns
value from the response body of the Get organization global configuration request.Use the analyticsDns
value from the response body of the Get organization global configuration request.The value is optional. False
is the default value. See Basic configuration settings for more information on this parameter.Ensure you escape the domain-username backslash in the Username
field.The value is optional. The default value is Rich
, which means that the rendered HTML of your Sitecore items will be indexed.The value is optional. The default value is true
, which means that the permissions on your Sitecore items will be indexed.See the farmName
property in the Basic configuration settings table for more information on this parameter.The value is optional. False
is the default value. See restEndpointConfiguration section settings for more information on this parameter.
-
Specify the administrator’s user credentials in the
x-scUsername
andx-scPassword
headers to authenticate the request. -
Click Try it out. If the request is successful, you’ll see a
204
status code.
Step 3 - Activate
In this step, you’ll use the REST API bundled in Coveo for Sitecore to activate Coveo for Sitecore on the Sitecore instance.
This will rename the base .example
Coveo for Sitecore configuration files to enable them.
It will also validate that all values required in the configuration step have been set.
-
Open the
https://<INSTANCE_HOSTNAME>/coveo/api/config/docs/index#!/ActivateInstance/ActivateInstanceV1_Post
Swagger UI page in your browser. -
Specify the administrator’s user credentials in the
x-scUsername
andx-scPassword
headers to authenticate the request. -
Click Try it out. If the request is successful, you’ll see a
200
status code and a response body containing the list of enabled configuration files.