Quickstart for eGain API
Get up and running with eGain's AI Knowledge Hub APIs in just a few steps. This guide walks you through setting up your account, ingesting content, and building your first application with eGain's powerful knowledge management capabilities.
Step 1: Set Up Your eGain Account
New to eGain?
If you don't have an existing eGain account, you can get started with a free trial of eGain's AI Knowledge Hub:
👉 Start your free trial here
The free trial gives you access to:
- Full AI Knowledge Hub capabilities
- Content ingestion and management
- Search and retrieval APIs
- Portal customization tools
Existing Users
If you already have an eGain account, sign in with your current account to proceed to the next step.
Step 2: Ingest Your Content
Once your content is correctly formatted and packaged, the next step is to ingest it into the eGain AI Knowledge Hub. There are three primary methods to accomplish this, each catering to different technical needs and data sources.
Method 1: Through the Knowledge Console UI (Connectors)
This is the most straightforward method for natively supported data sources. eGain provides built-in connectors that you can configure directly within the Knowledge Console UI, requiring no API calls.
For example, if your content resides in a source like SharePoint, you can set up a direct connection from the Knowledge Console. The system then handles the process of pulling, transforming, and ingesting the content based on your configuration.
- Access Apps & Integration from your eGain Knowledge Console.
- Use eGain’s prebuilt connectors to integrate with the desired data source. In this example, we'll use the SharePoint connector.
- Click on 'Add Sync' to connect to your SharePoint instance and eGain instance, then select the data source from SharePoint and the destination department.
- Start the ingestion job and monitor job status.
Method 2: Using the Ingestion API with Your Own Data Source
This method provides maximum flexibility and is ideal for automation and integration with your existing infrastructure. The Ingestion API allows you to pull content from a data source that you own and manage, such as an AWS S3 bucket or a secure SFTP server. To enable access to your content, you must provide the API with the correct path and any required credentials.
Sample Data
You may use our Sample Data Source, which is already formatted, or you may use your own content to be ingested. The sample is only available as a .zip file, which you must download and upload to your own data source location. The API does not accept a .zip file path; it requires the full extracted file structure.
Prerequisites
Before using the Ingestion API, ensure the following requirements are met:
-
A valid OAuth 2.0 access token with the
knowledge.contentmgr.manage
scope. - Content is correctly formatted into the required file structure. For more details, see the Data Import Format Guide .
- Access credentials and connection details for your data source (for example, S3 path and credentials or SFTP server details).
Important Note: It is highly recommended to validate your content before importing using the Validation API. This serves as a “dry run” that checks the entire content package for formatting issues, incorrect paths, and other potential errors without actually importing any data. Performing this step can save significant time and help prevent failed jobs.
To know more, see: Guide: Validating Content Before Import
API Endpoint
To start an ingestion job, make a POST
request to the following endpoint:
https://${API_DOMAIN}/knowledge/contentmgr/v4/import/content
Example Request (AWS S3)
The request body must be a JSON object specifying your data source details, the operation, and an optional schedule.
{
"dataSource": {
"type": "AWS S3 bucket",
"path": "s3://your-company-bucket/path/to/content",
"region": "us-east-1",
"credentials": {
"accessKeyId": "YOUR_AWS_ACCESS_KEY_ID",
"secretAccessKey": "YOUR_AWS_SECRET_ACCESS_KEY"
}
},
"operation": "import",
"scheduleTime": {
"date": "2024-03-01T10:00:00.000Z"
}
}
cURL Command (AWS S3)
curl --location --request POST 'https://<API_DOMAIN>/knowledge/contentmgr/v4/import/content' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"dataSource": {
"type": "AWS S3 bucket",
"path": "s3://your-bucket-name/your-folder/content",
"region": "your-aws-region",
"credentials": {
"accessKeyId": "YOUR_AWS_ACCESS_KEY_ID",
"secretAccessKey": "YOUR_AWS_SECRET_ACCESS_KEY"
}
},
"operation": "import"
}'
(For details on using a Shared File Path, see our Shared Path Ingestion Guide.)
Method 3: Using the Ingestion API with eGain's Sample Data Source
To help you get started or test the ingestion process, eGain provides a sample dataset hosted in a dedicated S3 bucket. This method allows you to run a full import using our pre-formatted sample data, giving you a practical, working example of the API and the required data structure in action.
Prerequisites
Before using the Ingestion API with the sample dataset, ensure you have the following:
- S3 bucket path and credentials for the eGain sample dataset (provided by your eGain representative).
-
A valid OAuth 2.0 access token with the
knowledge.contentmgr.manage
scope.
Example Request: eGain Sample S3 Data
Use the same request body structure as in Method 2, but populate it with the details of the sample data bucket provided by eGain.
{
"dataSource": {
"type": "AWS S3 bucket",
"path": "s3://egain-sample-data-bucket/retail-knowledge-pack",
"region": "us-west-2",
"credentials": {
"accessKeyId": "ACCESS_KEY_FOR_SAMPLE_DATA",
"secretAccessKey": "SECRET_KEY_FOR_SAMPLE_DATA"
}
},
"operation": "import"
}
The cURL command and API endpoint are the same as in Method 2.
cURL Command (AWS S3)
curl --location --request POST 'https://<API_DOMAIN>/knowledge/contentmgr/v4/import/content' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"dataSource": {
"type": "AWS S3 bucket",
"path": "s3://your-bucket-name/your-folder/content",
"region": "your-aws-region",
"credentials": {
"accessKeyId": "YOUR_AWS_ACCESS_KEY_ID",
"secretAccessKey": "YOUR_AWS_SECRET_ACCESS_KEY"
}
},
"operation": "import"
}'
Successful Response (for API Methods 2 and 3)
A successful API request queues the job and returns a 202 Accepted
status code. The Location
header in the response contains the URL used to check the status of the import job.
Example Response Header:
location: /knowledge/contentmgr/v4/import/content/7A84B875-6F75-4C7B-B137-0632B62DB0BD
After the import job has completed successfully, the content becomes available in eGain.
Step 3: View Your Imported Content in the Knowledge Console
Once your content import is complete, you can access and manage your imported content within the Knowledge Console.
Access Your Imported Content
- Log in to your AI Knowledge Hub instance using your credentials.
- In the Knowledge Console, navigate to Articles > Folders > Mirrored Content > SharePoint .
- The folder structure is automatically imported and organized to match your SharePoint hierarchy.
- Browse through the folders to view your articles.
Manage Your Imported Content
In the Knowledge Console, you can perform the following actions to manage your articles:
- Manage : Edit, update, or organize your knowledge articles.
- Search : Use the built-in global search functionality to find specific articles.
- Browse : Access automatically generated topics created through Topics from Folders. All mirrored articles are organized under these topics and displayed in 'Portal Zero' by default. You can also create a new portal and include selected topics from folders to view your content in a customized way.
- Preview : While editing an article, use the 'Preview in Portal' option to see how the content appears within a selected portal before publishing.
Customize Your Portal with Theme Studio
Personalize your knowledge portal to reflect your brand identity:
- Log in to your eGain AI Knowledge Hub instance as a Knowledge Manager.
- In the Knowledge Console, navigate to Publishing > Themes .
- Under the Default Themes section, click the Customize button to create a new theme.
- In the theme workspace, you can select the portal you want to modify and select the target audience.
- Use the Global and Page settings to customize colors, fonts, page layouts, and upload your logo or other brand assets to align with your brand guidelines.
- Preview your updates in real time as you make changes.
- Once satisfied, publish the theme to apply it to your portal and make it live for your users.
Portal Features
The knowledge portal provides the following features to help you consume and manage your knowledge more efficiently:
- Responsive Design: Optimized for both desktop and mobile devices.
- Advanced Search: Powerful search capabilities to quickly find relevant content.
- Content Organization: Supports categorization and tagging for easier navigation.
- Multi-Language Support: Provides content in multiple languages to serve diverse user bases.
Next steps
Now that your content is ingested and accessible, you are ready to build powerful applications leveraging eGain's Search, Retrieve, and Answer APIs. These APIs enable you to deliver intelligent search experiences and generate AI-powered answers for your users.
- Review the Authentication Guide to learn how to securely connect to the eGain APIs using OAuth 2.0 and manage access tokens.
- Explore the Guides , SDKs , APIs for detailed documentation.